@intactfile/engines 0.1.0 → 0.2.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/dist/archive/index.d.ts +5 -13
- package/dist/archive/index.d.ts.map +1 -1
- package/dist/archive/index.js +4 -1
- package/dist/archive/index.js.map +1 -1
- package/dist/audio/index.d.ts +11 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +11 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/audio/mp3.d.ts +22 -0
- package/dist/audio/mp3.d.ts.map +1 -0
- package/dist/audio/mp3.js +141 -0
- package/dist/audio/mp3.js.map +1 -0
- package/dist/audio/wav.d.ts +23 -0
- package/dist/audio/wav.d.ts.map +1 -0
- package/dist/audio/wav.js +86 -0
- package/dist/audio/wav.js.map +1 -0
- package/dist/bytes-util.d.ts +17 -0
- package/dist/bytes-util.d.ts.map +1 -0
- package/dist/bytes-util.js +46 -0
- package/dist/bytes-util.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/jpeg/index.d.ts +2 -8
- package/dist/jpeg/index.d.ts.map +1 -1
- package/dist/jpeg/index.js +4 -1
- package/dist/jpeg/index.js.map +1 -1
- package/dist/license.d.ts +63 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +167 -0
- package/dist/license.js.map +1 -0
- package/dist/pdf/index.d.ts +5 -6
- package/dist/pdf/index.d.ts.map +1 -1
- package/dist/pdf/index.js +4 -1
- package/dist/pdf/index.js.map +1 -1
- package/dist/png/index.d.ts +1 -7
- package/dist/png/index.d.ts.map +1 -1
- package/dist/png/index.js +3 -1
- package/dist/png/index.js.map +1 -1
- package/dist/sqlite/index.d.ts +8 -1
- package/dist/sqlite/index.d.ts.map +1 -1
- package/dist/sqlite/index.js +4 -1
- package/dist/sqlite/index.js.map +1 -1
- package/dist/video/avi.d.ts +23 -0
- package/dist/video/avi.d.ts.map +1 -0
- package/dist/video/avi.js +122 -0
- package/dist/video/avi.js.map +1 -0
- package/dist/video/index.d.ts +15 -2
- package/dist/video/index.d.ts.map +1 -1
- package/dist/video/index.js +10 -2
- package/dist/video/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../src/license.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC;AAEhF,qBAAa,YAAa,SAAQ,KAAK;IAEnC,QAAQ,CAAC,IAAI,EAAE,gBAAgB;gBAAtB,IAAI,EAAE,gBAAgB,EAC/B,OAAO,EAAE,MAAM;CAKlB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAeD,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAG/D;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAEnD;AAyCD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,UAAU,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,OAAO,CAAC,aAAa,CAAC,CAsCxB;AAID,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAG9C;AAED,kCAAkC;AAClC,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAED,8EAA8E;AAC9E,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CAQ/D;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAYpD;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EACzC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7B,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAK5B"}
|
package/dist/license.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK/CLI license gate for the IntactFile repair engines.
|
|
3
|
+
*
|
|
4
|
+
* The repair engines are the paid product; diagnosis/detection stay free. On
|
|
5
|
+
* Node (CLI, MCP server, or the SDK imported directly) every repair entry
|
|
6
|
+
* point is gated behind a short-lived ES256 license minted by the API for
|
|
7
|
+
* ACTIVE Business subscribers and verified OFFLINE against the embedded PUBLIC
|
|
8
|
+
* key below — the API is the sole holder of the private key.
|
|
9
|
+
*
|
|
10
|
+
* In the BROWSER the gate is a no-op: the free in-browser widget calls these
|
|
11
|
+
* same functions and must stay free, so the gate only engages in a real Node
|
|
12
|
+
* runtime. DRM on a local library can't be unbreakable; this is a genuine,
|
|
13
|
+
* signed entitlement check plus the terms — not obfuscation. It never inspects
|
|
14
|
+
* file bytes and never phones home during a repair (verification is offline).
|
|
15
|
+
*/
|
|
16
|
+
/** Embedded PUBLIC verification key (P-256). The private key never ships. */
|
|
17
|
+
const PUBLIC_JWK = {
|
|
18
|
+
kty: "EC",
|
|
19
|
+
crv: "P-256",
|
|
20
|
+
x: "W2edR_v1SXRWdNPE6s5KUoCbFlThQ48h325OtSzr71A",
|
|
21
|
+
y: "4BzLYg5mju7wf6Y_DJ4Df1eWjX6wyUxd9X_5LHgSmC4",
|
|
22
|
+
};
|
|
23
|
+
export class LicenseError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
constructor(code, message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.name = "LicenseError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/* ------------------------------ module state ----------------------------- */
|
|
32
|
+
let currentToken;
|
|
33
|
+
/** Memoized claims for currentToken so repeated repairs don't re-verify. */
|
|
34
|
+
let verified;
|
|
35
|
+
/* ---------------------------- test-only hooks ---------------------------- */
|
|
36
|
+
// Undocumented, prefixed hooks used by the unit tests to drive the gate with
|
|
37
|
+
// an ephemeral keypair and to simulate a browser runtime. Not part of the API.
|
|
38
|
+
let testPublicJwk = null;
|
|
39
|
+
let testForceBrowser = false;
|
|
40
|
+
/** @internal test hook — override the embedded public key (null = restore). */
|
|
41
|
+
export function __setTestPublicKey(jwk) {
|
|
42
|
+
testPublicJwk = jwk;
|
|
43
|
+
verified = undefined;
|
|
44
|
+
}
|
|
45
|
+
/** @internal test hook — force the browser (no-op) code path. */
|
|
46
|
+
export function __setForceBrowser(on) {
|
|
47
|
+
testForceBrowser = on;
|
|
48
|
+
}
|
|
49
|
+
/* ------------------------------ runtime check ---------------------------- */
|
|
50
|
+
/** True only in a real Node runtime (never a browser tab or web worker). */
|
|
51
|
+
function isNodeRuntime() {
|
|
52
|
+
if (testForceBrowser)
|
|
53
|
+
return false;
|
|
54
|
+
return (typeof window === "undefined" &&
|
|
55
|
+
typeof globalThis.document === "undefined" &&
|
|
56
|
+
typeof process !== "undefined" &&
|
|
57
|
+
!!process.versions?.node);
|
|
58
|
+
}
|
|
59
|
+
/* ------------------------------ token decode ----------------------------- */
|
|
60
|
+
/** Decode a base64url segment to bytes (identical in Node and the browser). */
|
|
61
|
+
function b64urlToBytes(s) {
|
|
62
|
+
const b64 = s.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(s.length / 4) * 4, "=");
|
|
63
|
+
let bin;
|
|
64
|
+
try {
|
|
65
|
+
bin = atob(b64);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
throw new LicenseError("invalid", "Malformed license token.");
|
|
69
|
+
}
|
|
70
|
+
const out = new Uint8Array(bin.length);
|
|
71
|
+
for (let i = 0; i < bin.length; i++)
|
|
72
|
+
out[i] = bin.charCodeAt(i);
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function importVerifyKey(jwk) {
|
|
76
|
+
return globalThis.crypto.subtle.importKey("jwk", jwk, { name: "ECDSA", namedCurve: "P-256" }, false, ["verify"]);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Verify a compact ES256 license JWT offline and return its claims, or throw a
|
|
80
|
+
* LicenseError. Pure (no module state): the unit tests drive it with an
|
|
81
|
+
* ephemeral keypair via the `publicJwk` option.
|
|
82
|
+
*/
|
|
83
|
+
export async function verifyLicense(token, opts = {}) {
|
|
84
|
+
const parts = token.split(".");
|
|
85
|
+
if (parts.length !== 3)
|
|
86
|
+
throw new LicenseError("invalid", "Malformed license token.");
|
|
87
|
+
const [h, p, sig] = parts;
|
|
88
|
+
let claims;
|
|
89
|
+
try {
|
|
90
|
+
claims = JSON.parse(new TextDecoder().decode(b64urlToBytes(p)));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
throw new LicenseError("invalid", "Malformed license token.");
|
|
94
|
+
}
|
|
95
|
+
const key = await importVerifyKey(opts.publicJwk ?? testPublicJwk ?? PUBLIC_JWK);
|
|
96
|
+
// Re-wrap into plain ArrayBuffer-backed views so the WebCrypto BufferSource
|
|
97
|
+
// types line up (TextEncoder yields Uint8Array<ArrayBufferLike> under TS 5.7+).
|
|
98
|
+
const signature = b64urlToBytes(sig);
|
|
99
|
+
const data = new Uint8Array(new TextEncoder().encode(`${h}.${p}`));
|
|
100
|
+
let ok = false;
|
|
101
|
+
try {
|
|
102
|
+
ok = await globalThis.crypto.subtle.verify({ name: "ECDSA", hash: "SHA-256" }, key, signature, data);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
ok = false;
|
|
106
|
+
}
|
|
107
|
+
if (!ok)
|
|
108
|
+
throw new LicenseError("invalid", "License signature is not valid.");
|
|
109
|
+
const now = opts.now ?? Math.floor(Date.now() / 1000);
|
|
110
|
+
if (typeof claims.exp !== "number" || claims.exp <= now) {
|
|
111
|
+
throw new LicenseError("expired", "License has expired — run `intactfile license --refresh`.");
|
|
112
|
+
}
|
|
113
|
+
if (claims.tier !== "business") {
|
|
114
|
+
throw new LicenseError("wrong-tier", "This license is not for the Business plan.");
|
|
115
|
+
}
|
|
116
|
+
return claims;
|
|
117
|
+
}
|
|
118
|
+
/* ------------------------------- public API ------------------------------ */
|
|
119
|
+
/** Apply a license token so Node-side repairs can run. No-op-safe to re-call. */
|
|
120
|
+
export function setLicense(token) {
|
|
121
|
+
currentToken = token.trim();
|
|
122
|
+
verified = undefined;
|
|
123
|
+
}
|
|
124
|
+
/** Forget any applied license. */
|
|
125
|
+
export function clearLicense() {
|
|
126
|
+
currentToken = undefined;
|
|
127
|
+
verified = undefined;
|
|
128
|
+
}
|
|
129
|
+
/** Report whether a valid license is currently applied (verifies offline). */
|
|
130
|
+
export async function getLicenseStatus() {
|
|
131
|
+
if (!currentToken)
|
|
132
|
+
return { licensed: false, reason: "missing" };
|
|
133
|
+
try {
|
|
134
|
+
const c = await verifyLicense(currentToken);
|
|
135
|
+
return { licensed: true, tier: c.tier, expiresAt: new Date(c.exp * 1000).toISOString() };
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
return { licensed: false, reason: e instanceof LicenseError ? e.code : "invalid" };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The gate itself. In the browser it returns immediately (free widget). On
|
|
143
|
+
* Node it requires a valid, unexpired Business license, verified offline.
|
|
144
|
+
*/
|
|
145
|
+
export async function assertLicensed() {
|
|
146
|
+
if (!isNodeRuntime())
|
|
147
|
+
return;
|
|
148
|
+
if (!currentToken) {
|
|
149
|
+
throw new LicenseError("missing", "An active IntactFile Business license is required to run repairs here. " +
|
|
150
|
+
"Run `intactfile login`, or call setLicense() with a license token.");
|
|
151
|
+
}
|
|
152
|
+
const now = Math.floor(Date.now() / 1000);
|
|
153
|
+
if (verified && verified.exp > now)
|
|
154
|
+
return;
|
|
155
|
+
verified = await verifyLicense(currentToken, { now });
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Wrap a repair entry point so it is licensed on Node and free in the browser.
|
|
159
|
+
* Preserves the wrapped function's signature.
|
|
160
|
+
*/
|
|
161
|
+
export function gate(fn) {
|
|
162
|
+
return async (...args) => {
|
|
163
|
+
await assertLicensed();
|
|
164
|
+
return fn(...args);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=license.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.js","sourceRoot":"","sources":["../src/license.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,6EAA6E;AAC7E,MAAM,UAAU,GAAe;IAC7B,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,OAAO;IACZ,CAAC,EAAE,6CAA6C;IAChD,CAAC,EAAE,6CAA6C;CACjD,CAAC;AAIF,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE1B;IADX,YACW,IAAsB,EAC/B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,SAAI,GAAJ,IAAI,CAAkB;QAI/B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAiBD,+EAA+E;AAE/E,IAAI,YAAgC,CAAC;AACrC,4EAA4E;AAC5E,IAAI,QAAmC,CAAC;AAExC,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAE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
|
|
1
|
-
/**
|
|
2
|
-
* PDF engine subpath export (`@intactfile/engines/pdf`). Kept out of the root
|
|
3
|
-
* export so browser bundles that never repair PDFs never see the qpdf wasm
|
|
4
|
-
* dependency; even here, the wasm is only loaded on the first repairPdf call.
|
|
5
|
-
*/
|
|
6
1
|
export { diagnosePdf } from './diagnose.js';
|
|
7
2
|
export type { PdfDiagnosis, PdfDamageClass } from './diagnose.js';
|
|
8
|
-
export
|
|
3
|
+
export declare const repairPdf: (src: import("../byte-source.js").ByteSource) => Promise<{
|
|
4
|
+
pdf: Uint8Array;
|
|
5
|
+
report: import("./repair.js").PdfRepairReport;
|
|
6
|
+
}>;
|
|
7
|
+
export { qpdfArgLadder, buildRepairCandidates } from './repair.js';
|
|
9
8
|
export type { PdfRepairReport, PdfRepairAttempt, PdfRepairOutcome, PdfVerification, RepairCandidate, } from './repair.js';
|
|
10
9
|
export { rebuildXrefSkeleton } from './rebuild.js';
|
|
11
10
|
export type { XrefRebuildResult } from './rebuild.js';
|
package/dist/pdf/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pdf/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pdf/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClE,eAAO,MAAM,SAAS;;;EAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACnE,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/pdf/index.js
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* export so browser bundles that never repair PDFs never see the qpdf wasm
|
|
4
4
|
* dependency; even here, the wasm is only loaded on the first repairPdf call.
|
|
5
5
|
*/
|
|
6
|
+
import { gate } from '../license.js';
|
|
7
|
+
import { repairPdf as _repairPdf } from './repair.js';
|
|
6
8
|
export { diagnosePdf } from './diagnose.js';
|
|
7
|
-
export
|
|
9
|
+
export const repairPdf = gate(_repairPdf);
|
|
10
|
+
export { qpdfArgLadder, buildRepairCandidates } from './repair.js';
|
|
8
11
|
export { rebuildXrefSkeleton } from './rebuild.js';
|
|
9
12
|
export { runQpdf, setQpdfLoader, resetQpdfHost } from './qpdf-host.js';
|
|
10
13
|
export { createBrowserQpdfLoader, DEFAULT_QPDF_BASE_URL } from './browser-loader.js';
|
package/dist/pdf/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pdf/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pdf/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAQnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,UAAU,GACX,MAAM,aAAa,CAAC"}
|
package/dist/png/index.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PNG engine subpath export (`@intactfile/engines/png`). Pure TypeScript —
|
|
3
|
-
* pako (MIT) + fast-png (MIT), no wasm — so it is browser-safe. Kept on its own
|
|
4
|
-
* key (not the root barrel) purely to avoid touching src/index.ts; the parent
|
|
5
|
-
* integration can promote diagnosePng to the root if desired since it is pure.
|
|
6
|
-
*/
|
|
7
1
|
export { diagnosePng } from './diagnose.js';
|
|
8
2
|
export type { PngDiagnosis, PngDamageClass, PngChunkInfo } from './diagnose.js';
|
|
9
|
-
export
|
|
3
|
+
export declare const repairPng: (src: import("../byte-source.js").ByteSource, opts?: import("./repair.js").PngRepairOptions | undefined) => Promise<import("./repair.js").PngRepairResult>;
|
|
10
4
|
export type { PngRepairReport, PngRepairOutcome, PngRepairOptions, PngRepairResult, } from './repair.js';
|
|
11
5
|
export { PNG_SIGNATURE, DEFAULT_PNG_CAPS, walkChunksInMemory, factorizeDimensions, reconstructDimensions, channelsForColorType, isValidColorConfig, bytesPerRow, scanlineStride, unfilterScanlines8, unmangleNewlines, looksNewlineMangled, findSignature, hasSignatureAt, parseIhdr, serializeIhdr, ihdrCrc, } from './format.js';
|
|
12
6
|
export type { PngChunk, ChunkWalk, IhdrFields, PngSafetyCaps, DimensionCandidate, ReconstructedDimensions, } from './format.js';
|
package/dist/png/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChF,eAAO,MAAM,SAAS,4JAAmB,CAAC;AAC1C,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,SAAS,EACT,aAAa,EACb,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,aAAa,CAAC"}
|
package/dist/png/index.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* key (not the root barrel) purely to avoid touching src/index.ts; the parent
|
|
5
5
|
* integration can promote diagnosePng to the root if desired since it is pure.
|
|
6
6
|
*/
|
|
7
|
+
import { gate } from '../license.js';
|
|
8
|
+
import { repairPng as _repairPng } from './repair.js';
|
|
7
9
|
export { diagnosePng } from './diagnose.js';
|
|
8
|
-
export
|
|
10
|
+
export const repairPng = gate(_repairPng);
|
|
9
11
|
export { PNG_SIGNATURE, DEFAULT_PNG_CAPS, walkChunksInMemory, factorizeDimensions, reconstructDimensions, channelsForColorType, isValidColorConfig, bytesPerRow, scanlineStride, unfilterScanlines8, unmangleNewlines, looksNewlineMangled, findSignature, hasSignatureAt, parseIhdr, serializeIhdr, ihdrCrc, } from './format.js';
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/png/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;AAO1C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,SAAS,EACT,aAAa,EACb,OAAO,GACR,MAAM,aAAa,CAAC"}
|
package/dist/sqlite/index.d.ts
CHANGED
|
@@ -11,7 +11,14 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { diagnoseSqlite } from './diagnose.js';
|
|
13
13
|
export type { SqliteDiagnosis, SqliteDamageClass, DiagnoseSqliteOptions, } from './diagnose.js';
|
|
14
|
-
export
|
|
14
|
+
export declare const recoverSqlite: (src: import("../byte-source.js").ByteSource, opts?: import("./recover.js").RecoverSqliteOptions | undefined) => Promise<{
|
|
15
|
+
db?: Uint8Array;
|
|
16
|
+
report: import("./recover.js").SqliteRecoveryReport;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const recoverSqliteBytes: (bytes: Uint8Array<ArrayBufferLike>, opts?: import("./recover.js").RecoverSqliteOptions | undefined) => Promise<{
|
|
19
|
+
db?: Uint8Array;
|
|
20
|
+
report: import("./recover.js").SqliteRecoveryReport;
|
|
21
|
+
}>;
|
|
15
22
|
export type { SqliteRecoveryReport, SqliteRecoveryOutcome, SqliteRecoveryStrategy, RecoveredTableReport, RecoverSqliteOptions, } from './recover.js';
|
|
16
23
|
export { buildFreshDatabase, setSqliteBuilderLoader, resetSqliteHost, } from './sqlite-host.js';
|
|
17
24
|
export type { SqliteBuilder, SqliteBuilderLoader, SqliteBuildSpec, SqliteBuildStatement, SqliteBuildResult, } from './sqlite-host.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sqlite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sqlite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,aAAa;;;EAAuB,CAAC;AAClD,eAAO,MAAM,kBAAkB;;;EAA4B,CAAC;AAC5D,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1F,OAAO,EACL,UAAU,EACV,WAAW,EACX,uBAAuB,EACvB,cAAc,EACd,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
package/dist/sqlite/index.js
CHANGED
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
* it runs the same in Node and the browser.
|
|
11
11
|
*/
|
|
12
12
|
export { diagnoseSqlite } from './diagnose.js';
|
|
13
|
-
|
|
13
|
+
import { gate } from '../license.js';
|
|
14
|
+
import { recoverSqlite as _recoverSqlite, recoverSqliteBytes as _recoverSqliteBytes } from './recover.js';
|
|
15
|
+
export const recoverSqlite = gate(_recoverSqlite);
|
|
16
|
+
export const recoverSqliteBytes = gate(_recoverSqliteBytes);
|
|
14
17
|
export { buildFreshDatabase, setSqliteBuilderLoader, resetSqliteHost, } from './sqlite-host.js';
|
|
15
18
|
export { parseWal } from './wal.js';
|
|
16
19
|
// Low-level format + scan primitives (useful for tooling and tests).
|
package/dist/sqlite/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sqlite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sqlite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE1G,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC;AAS5D,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,qEAAqE;AACrE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,UAAU,EACV,WAAW,EACX,uBAAuB,EACvB,cAAc,EACd,gBAAgB,GACjB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AVI repair — pure TS, structural (RIFF). Rebuilds the idx1 index by scanning
|
|
3
|
+
* the 'movi' list, and fixes the RIFF/movi sizes. Container-level only (no
|
|
4
|
+
* libav): restores playback of index-broken or truncated AVIs. Honest: we do
|
|
5
|
+
* NOT claim keyframes for compressed streams, so seeking is limited (noted).
|
|
6
|
+
*/
|
|
7
|
+
import type { ByteSource } from "../byte-source.js";
|
|
8
|
+
export type AviOutcome = "success" | "partial" | "failed";
|
|
9
|
+
export interface AviRepairReport {
|
|
10
|
+
outcome: AviOutcome;
|
|
11
|
+
damageClass: string;
|
|
12
|
+
notes: string[];
|
|
13
|
+
bytesIn: number;
|
|
14
|
+
bytesOut: number;
|
|
15
|
+
streamsFound: number;
|
|
16
|
+
indexEntriesRebuilt: number;
|
|
17
|
+
truncated: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function repairAvi(src: ByteSource): Promise<{
|
|
20
|
+
video: Uint8Array;
|
|
21
|
+
report: AviRepairReport;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=avi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avi.d.ts","sourceRoot":"","sources":["../../src/video/avi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;CACpB;AAoBD,wBAAsB,SAAS,CAC7B,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CA8GzD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { indexOfAscii, matchAscii, readAll, u32le, writeAscii, writeU32le } from "../bytes-util.js";
|
|
2
|
+
const isHexDigit = (c) => (c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
|
|
3
|
+
/** A 'NNdc' / 'NNwb' style stream data chunk id. */
|
|
4
|
+
function isStreamCk(b, o) {
|
|
5
|
+
if (o + 4 > b.length)
|
|
6
|
+
return false;
|
|
7
|
+
if (!isHexDigit(b[o]) || !isHexDigit(b[o + 1]))
|
|
8
|
+
return false;
|
|
9
|
+
const t = String.fromCharCode(b[o + 2], b[o + 3]);
|
|
10
|
+
return t === "dc" || t === "db" || t === "wb" || t === "pc" || t === "tx";
|
|
11
|
+
}
|
|
12
|
+
export async function repairAvi(src) {
|
|
13
|
+
const buf = await readAll(src);
|
|
14
|
+
const notes = [];
|
|
15
|
+
const fail = (damageClass) => ({
|
|
16
|
+
video: new Uint8Array(0),
|
|
17
|
+
report: {
|
|
18
|
+
outcome: "failed",
|
|
19
|
+
damageClass,
|
|
20
|
+
notes,
|
|
21
|
+
bytesIn: buf.length,
|
|
22
|
+
bytesOut: 0,
|
|
23
|
+
streamsFound: 0,
|
|
24
|
+
indexEntriesRebuilt: 0,
|
|
25
|
+
truncated: false,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (buf.length < 32)
|
|
29
|
+
return fail("too-small");
|
|
30
|
+
const moviPos = indexOfAscii(buf, "movi", 8);
|
|
31
|
+
if (moviPos < 0)
|
|
32
|
+
return fail("no-movi");
|
|
33
|
+
const moviDataStart = moviPos + 4;
|
|
34
|
+
const entries = [];
|
|
35
|
+
const streams = new Set();
|
|
36
|
+
let truncated = false;
|
|
37
|
+
let anyCompressed = false;
|
|
38
|
+
let lastGoodEnd = moviDataStart;
|
|
39
|
+
let p = moviDataStart;
|
|
40
|
+
while (p + 8 <= buf.length) {
|
|
41
|
+
if (matchAscii(buf, p, "idx1"))
|
|
42
|
+
break;
|
|
43
|
+
if (matchAscii(buf, p, "LIST")) {
|
|
44
|
+
// 'rec ' groups wrap chunks; descend one level, otherwise stop.
|
|
45
|
+
const type = String.fromCharCode(buf[p + 8], buf[p + 9], buf[p + 10], buf[p + 11]);
|
|
46
|
+
if (type === "rec ") {
|
|
47
|
+
p += 12;
|
|
48
|
+
lastGoodEnd = p;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
if (!isStreamCk(buf, p))
|
|
54
|
+
break;
|
|
55
|
+
const size = u32le(buf, p + 4);
|
|
56
|
+
const dataEnd = p + 8 + size;
|
|
57
|
+
if (dataEnd > buf.length) {
|
|
58
|
+
truncated = true; // last chunk cut off
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
const ckid = buf.subarray(p, p + 4);
|
|
62
|
+
const t = String.fromCharCode(ckid[2], ckid[3]);
|
|
63
|
+
if (t === "dc")
|
|
64
|
+
anyCompressed = true;
|
|
65
|
+
// Don't claim keyframes for compressed video (we can't know without
|
|
66
|
+
// decoding); uncompressed frames and audio are safe to flag.
|
|
67
|
+
const flags = t === "db" || t === "wb" ? 0x10 : 0;
|
|
68
|
+
entries.push({ ckid, flags, offset: p - moviPos, size });
|
|
69
|
+
streams.add(String.fromCharCode(ckid[0], ckid[1]));
|
|
70
|
+
lastGoodEnd = dataEnd + (size & 1); // chunks are word-aligned
|
|
71
|
+
p = lastGoodEnd;
|
|
72
|
+
}
|
|
73
|
+
if (entries.length === 0)
|
|
74
|
+
return fail("no-chunks");
|
|
75
|
+
const idx = new Uint8Array(8 + entries.length * 16);
|
|
76
|
+
writeAscii(idx, 0, "idx1");
|
|
77
|
+
writeU32le(idx, 4, entries.length * 16);
|
|
78
|
+
let o = 8;
|
|
79
|
+
for (const e of entries) {
|
|
80
|
+
idx.set(e.ckid, o);
|
|
81
|
+
writeU32le(idx, o + 4, e.flags);
|
|
82
|
+
writeU32le(idx, o + 8, e.offset);
|
|
83
|
+
writeU32le(idx, o + 12, e.size);
|
|
84
|
+
o += 16;
|
|
85
|
+
}
|
|
86
|
+
const head = buf.subarray(0, lastGoodEnd);
|
|
87
|
+
const out = new Uint8Array(head.length + idx.length);
|
|
88
|
+
out.set(head, 0);
|
|
89
|
+
out.set(idx, head.length);
|
|
90
|
+
// Fix sizes + signatures.
|
|
91
|
+
writeU32le(out, 4, out.length - 8);
|
|
92
|
+
if (moviPos >= 8 && matchAscii(out, moviPos - 8, "LIST")) {
|
|
93
|
+
writeU32le(out, moviPos - 4, 4 + (lastGoodEnd - moviDataStart));
|
|
94
|
+
}
|
|
95
|
+
if (!matchAscii(out, 0, "RIFF")) {
|
|
96
|
+
writeAscii(out, 0, "RIFF");
|
|
97
|
+
notes.push("rebuilt RIFF signature");
|
|
98
|
+
}
|
|
99
|
+
if (!matchAscii(out, 8, "AVI ")) {
|
|
100
|
+
writeAscii(out, 8, "AVI ");
|
|
101
|
+
notes.push("rebuilt AVI signature");
|
|
102
|
+
}
|
|
103
|
+
notes.unshift(`rebuilt idx1 with ${entries.length} index entries across ${streams.size} stream(s)`);
|
|
104
|
+
if (truncated)
|
|
105
|
+
notes.push("file was truncated mid-chunk — recovered up to the last complete frame");
|
|
106
|
+
if (anyCompressed)
|
|
107
|
+
notes.push("seek points not reconstructed for compressed video (playback restored)");
|
|
108
|
+
return {
|
|
109
|
+
video: out,
|
|
110
|
+
report: {
|
|
111
|
+
outcome: truncated ? "partial" : "success",
|
|
112
|
+
damageClass: truncated ? "truncated" : "index",
|
|
113
|
+
notes,
|
|
114
|
+
bytesIn: buf.length,
|
|
115
|
+
bytesOut: out.length,
|
|
116
|
+
streamsFound: streams.size,
|
|
117
|
+
indexEntriesRebuilt: entries.length,
|
|
118
|
+
truncated,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=avi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avi.js","sourceRoot":"","sources":["../../src/video/avi.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,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, VideoContainer, VideoBoxInfo } from './diagnose.js';
|
|
10
|
-
export
|
|
10
|
+
export declare const remuxVideo: (src: import("../byte-source.js").ByteSource, opts?: import("./remux.js").RemuxOptions | undefined) => Promise<{
|
|
11
|
+
video: Uint8Array;
|
|
12
|
+
report: import("./remux.js").VideoRepairReport;
|
|
13
|
+
}>;
|
|
14
|
+
export { planRemux, outputContainerFor, REMUX_STRATEGIES, AVFMT_FLAG_GENPTS, AVFMT_FLAG_IGNIDX, } from './remux.js';
|
|
11
15
|
export type { RemuxPlan, RemuxOptions, RemuxStrategy, RemuxStrategyId, RemuxAttempt, OutputContainer, VideoRepairOutcome, VideoRepairReport, } from './remux.js';
|
|
12
16
|
export { setLibAVLoader, resetLibAVHost, getLibAV } from './libav-host.js';
|
|
13
17
|
export type { LibAVLoader, LibAVWrapper, LibAVInstance } from './libav-host.js';
|
|
14
18
|
export { scanMp4Boxes, scanMkv, scanAvi, checkMoovIntegrity } from './format.js';
|
|
15
19
|
export type { Mp4Scan, Mp4Box, MkvScan, AviScan } from './format.js';
|
|
16
|
-
export
|
|
20
|
+
export declare const reconstructMoov: (broken: import("../byte-source.js").ByteSource, reference: import("../byte-source.js").ByteSource, opts?: import("./reconstruct.js").ReconstructOptions | undefined) => Promise<{
|
|
21
|
+
video: Uint8Array;
|
|
22
|
+
report: import("./reconstruct.js").VideoReconstructReport;
|
|
23
|
+
}>;
|
|
24
|
+
export { chooseSampleSizes } from './reconstruct.js';
|
|
17
25
|
export type { VideoReconstructReport, VideoReconstructOutcome, ReconstructOptions, ReconstructStrategy, } from './reconstruct.js';
|
|
18
26
|
export { setMp4BoxLoader, resetMp4BoxHost, getMp4Box, parseReferenceMoov, ReferenceParseError, } from './mp4box-host.js';
|
|
19
27
|
export type { Mp4BoxLoader, Mp4BoxModule } from './mp4box-host.js';
|
|
20
28
|
export type { MoovTemplate, MoovTemplateTrack } from './mp4-rebuild.js';
|
|
29
|
+
export declare const repairAvi: (src: import("../byte-source.js").ByteSource) => Promise<{
|
|
30
|
+
video: Uint8Array;
|
|
31
|
+
report: import("./avi.js").AviRepairReport;
|
|
32
|
+
}>;
|
|
33
|
+
export type { AviRepairReport, AviOutcome } from './avi.js';
|
|
21
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/video/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/video/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAMpG,eAAO,MAAM,UAAU;;;EAAoB,CAAC;AAC5C,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,eAAe,EACf,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjF,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKrE,eAAO,MAAM,eAAe;;;EAAyB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGxE,eAAO,MAAM,SAAS;;;EAAmB,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/video/index.js
CHANGED
|
@@ -6,12 +6,20 @@
|
|
|
6
6
|
* the package root.
|
|
7
7
|
*/
|
|
8
8
|
export { diagnoseVideo } from './diagnose.js';
|
|
9
|
-
|
|
9
|
+
import { gate } from '../license.js';
|
|
10
|
+
import { remuxVideo as _remuxVideo } from './remux.js';
|
|
11
|
+
import { reconstructMoov as _reconstructMoov } from './reconstruct.js';
|
|
12
|
+
import { repairAvi as _repairAvi } from './avi.js';
|
|
13
|
+
export const remuxVideo = gate(_remuxVideo);
|
|
14
|
+
export { planRemux, outputContainerFor, REMUX_STRATEGIES, AVFMT_FLAG_GENPTS, AVFMT_FLAG_IGNIDX, } from './remux.js';
|
|
10
15
|
export { setLibAVLoader, resetLibAVHost, getLibAV } from './libav-host.js';
|
|
11
16
|
export { scanMp4Boxes, scanMkv, scanAvi, checkMoovIntegrity } from './format.js';
|
|
12
17
|
// Untrunc-class moov reconstruction (reference-file, clean-room TS). Kept out
|
|
13
18
|
// of the pure root diagnose path; it only pulls in mp4box.js (a parser) on the
|
|
14
19
|
// first reconstructMoov call, via the injectable mp4box host.
|
|
15
|
-
export
|
|
20
|
+
export const reconstructMoov = gate(_reconstructMoov);
|
|
21
|
+
export { chooseSampleSizes } from './reconstruct.js';
|
|
16
22
|
export { setMp4BoxLoader, resetMp4BoxHost, getMp4Box, parseReferenceMoov, ReferenceParseError, } from './mp4box-host.js';
|
|
23
|
+
// AVI container repair (rebuild idx1 + fix sizes; pure TS, no libav).
|
|
24
|
+
export const repairAvi = gate(_repairAvi);
|
|
17
25
|
//# sourceMappingURL=index.js.map
|
package/dist/video/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/video/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/video/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,eAAe,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;AAC5C,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjF,8EAA8E;AAC9E,+EAA+E;AAC/E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAOrD,OAAO,EACL,eAAe,EACf,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAI1B,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intactfile/engines",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "IntactFile repair engines (SDK): repair corrupted video, ZIP/Office, PDF, JPEG, PNG, SQLite and RAR/7z entirely in-process. Runs in the browser and in Node — files never leave the machine.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"./png": {
|
|
39
39
|
"types": "./dist/png/index.d.ts",
|
|
40
40
|
"default": "./dist/png/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./audio": {
|
|
43
|
+
"types": "./dist/audio/index.d.ts",
|
|
44
|
+
"default": "./dist/audio/index.js"
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
"files": [
|