@freedome/client 0.0.0-stage → 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/CHANGELOG.md +5 -0
- package/LICENSE +289 -0
- package/README.md +20 -2
- package/dist/chunk-CAEBM4AN.js +180 -0
- package/dist/chunk-HYGH4JIY.js +30 -0
- package/dist/chunk-J7A5LF32.js +180 -0
- package/dist/chunk-K3G5AG65.js +211 -0
- package/dist/chunk-YB5V2MMF.js +81 -0
- package/dist/codecs.cjs +1608 -0
- package/dist/codecs.d.cts +204 -0
- package/dist/codecs.d.ts +204 -0
- package/dist/codecs.js +1364 -0
- package/dist/discovery-BsEQfHam.d.cts +419 -0
- package/dist/discovery-DTV9yp9S.d.ts +419 -0
- package/dist/errors-L_bIF-OR.d.cts +108 -0
- package/dist/errors-L_bIF-OR.d.ts +108 -0
- package/dist/index.cjs +4753 -0
- package/dist/index.d.cts +1124 -0
- package/dist/index.d.ts +1124 -0
- package/dist/index.js +4084 -0
- package/dist/input-CxW5zgc-.d.cts +27 -0
- package/dist/input-CxW5zgc-.d.ts +27 -0
- package/dist/node.cjs +465 -0
- package/dist/node.d.cts +31 -0
- package/dist/node.d.ts +31 -0
- package/dist/node.js +136 -0
- package/dist/testing.cjs +1622 -0
- package/dist/testing.d.cts +184 -0
- package/dist/testing.d.ts +184 -0
- package/dist/testing.js +1251 -0
- package/dist/transport-dvmDQyvB.d.cts +130 -0
- package/dist/transport-dvmDQyvB.d.ts +130 -0
- package/package.json +78 -3
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { F as FormatInput } from './input-CxW5zgc-.cjs';
|
|
2
|
+
export { D as DirectoryInput, a as FileInput, b as bytesInput, d as directoryInput } from './input-CxW5zgc-.cjs';
|
|
3
|
+
import { F as FreedomeError } from './errors-L_bIF-OR.cjs';
|
|
4
|
+
import '@freedome/protocol';
|
|
5
|
+
|
|
6
|
+
declare const u16: (b: Uint8Array, o: number) => number;
|
|
7
|
+
declare const u32: (b: Uint8Array, o: number) => number;
|
|
8
|
+
declare const u64big: (b: Uint8Array, o: number) => bigint;
|
|
9
|
+
declare const f64: (b: Uint8Array, o: number) => number;
|
|
10
|
+
declare const f32: (b: Uint8Array, o: number) => number;
|
|
11
|
+
declare const latin1: (b: Uint8Array) => string;
|
|
12
|
+
declare const fromLatin1: (s: string) => Uint8Array;
|
|
13
|
+
declare const utf8: (s: string) => Uint8Array;
|
|
14
|
+
declare const fromUtf8: (b: Uint8Array) => string;
|
|
15
|
+
declare function equalBytes(a: Uint8Array, b: Uint8Array): boolean;
|
|
16
|
+
/** Byte order of UTF-8 encodings (writer entry order). */
|
|
17
|
+
declare function byteOrder(a: string, b: string): number;
|
|
18
|
+
declare function concat(parts: Uint8Array[]): Uint8Array;
|
|
19
|
+
/** CRC-32 (IEEE). */
|
|
20
|
+
declare function crc32(b: Uint8Array): number;
|
|
21
|
+
/** Writable little-endian buffer. */
|
|
22
|
+
declare class LeWriter {
|
|
23
|
+
readonly bytes: Uint8Array;
|
|
24
|
+
private readonly dv;
|
|
25
|
+
constructor(n: number);
|
|
26
|
+
u16(o: number, v: number): this;
|
|
27
|
+
u32(o: number, v: number): this;
|
|
28
|
+
u64(o: number, v: number | bigint): this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const DOS_DATE_1980_01_01 = 33;
|
|
32
|
+
/** Reader limits (01b §2.1). */
|
|
33
|
+
interface ZipLimits {
|
|
34
|
+
maxEntries: number;
|
|
35
|
+
maxManifestBytes: number;
|
|
36
|
+
maxTotalBytes: number;
|
|
37
|
+
maxRatio: number;
|
|
38
|
+
ratioMinBytes: number;
|
|
39
|
+
}
|
|
40
|
+
declare const DEFAULT_ZIP_LIMITS: ZipLimits;
|
|
41
|
+
/** One entry of the central directory. */
|
|
42
|
+
interface ZipEntryInfo {
|
|
43
|
+
name: string;
|
|
44
|
+
method: number;
|
|
45
|
+
flags: number;
|
|
46
|
+
crc: number;
|
|
47
|
+
compressedSize: number;
|
|
48
|
+
size: number;
|
|
49
|
+
localOffset: number;
|
|
50
|
+
dataOffset: number;
|
|
51
|
+
localExtraLength: number;
|
|
52
|
+
centralExtraLength: number;
|
|
53
|
+
zip64: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** An opened archive. */
|
|
56
|
+
interface ZipArchive {
|
|
57
|
+
entries: ZipEntryInfo[];
|
|
58
|
+
zip64: boolean;
|
|
59
|
+
read(name: string): Uint8Array;
|
|
60
|
+
}
|
|
61
|
+
/** Entry-name rule (01b §2.1); returns the reason or null. */
|
|
62
|
+
declare function badEntryName(name: string): string | null;
|
|
63
|
+
/** Whether [b] starts with a ZIP local header. */
|
|
64
|
+
declare const isZip: (b: Uint8Array) => boolean;
|
|
65
|
+
/** Parses a ZIP held in memory. */
|
|
66
|
+
declare function openZip(buf: Uint8Array, limits?: ZipLimits): ZipArchive;
|
|
67
|
+
/** One entry to write. */
|
|
68
|
+
interface WriteEntry {
|
|
69
|
+
name: string;
|
|
70
|
+
data: Uint8Array;
|
|
71
|
+
store: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Deterministic ZIP (fixed DOS date, no timestamps / attributes; ZIP64 when needed or forced). */
|
|
74
|
+
declare function writeZip(entries: WriteEntry[], opts?: {
|
|
75
|
+
forceZip64?: boolean;
|
|
76
|
+
}): Uint8Array;
|
|
77
|
+
|
|
78
|
+
declare const DOME_MIME = "application/vnd.nativemind.freedome.dome+zip";
|
|
79
|
+
declare const DOME_WRITER_VERSION = "1.1.0";
|
|
80
|
+
type Json$1 = any;
|
|
81
|
+
/** A decoded `.dome`. */
|
|
82
|
+
interface DomeDoc {
|
|
83
|
+
manifest: Json$1;
|
|
84
|
+
/** Every container entry except `mimetype` and `dome.json`. */
|
|
85
|
+
entries: Map<string, Uint8Array>;
|
|
86
|
+
form: 'zip' | 'dir';
|
|
87
|
+
warnings: string[];
|
|
88
|
+
/** The reader rewrote interim x-* keys. */
|
|
89
|
+
normalised: boolean;
|
|
90
|
+
raw?: Uint8Array;
|
|
91
|
+
rawCanon?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Verifies an Ed25519 signature (default: WebCrypto). */
|
|
94
|
+
type Ed25519Verify = (publicKeySpki: Uint8Array, message: Uint8Array, signature: Uint8Array) => Promise<boolean>;
|
|
95
|
+
/** Read options. */
|
|
96
|
+
interface DomeReadOptions {
|
|
97
|
+
limits?: Partial<ZipLimits>;
|
|
98
|
+
/** Public keys (SPKI DER or PEM) by signature keyId. */
|
|
99
|
+
keys?: Record<string, Uint8Array | string>;
|
|
100
|
+
requireSignature?: boolean;
|
|
101
|
+
verify?: Ed25519Verify;
|
|
102
|
+
}
|
|
103
|
+
/** SPKI DER of a PEM public key. */
|
|
104
|
+
declare function pemToDer(pem: string): Uint8Array;
|
|
105
|
+
/** WebCrypto Ed25519 verification (Node ≥ 20, current browsers). */
|
|
106
|
+
declare const webCryptoVerify: Ed25519Verify;
|
|
107
|
+
/** Manifest bytes: as read when unchanged, else canonical 2-space JSON + LF. */
|
|
108
|
+
declare function manifestBytesFor(doc: DomeDoc): Uint8Array;
|
|
109
|
+
/** Entries a signature must list (01b §2.2), writer order. */
|
|
110
|
+
declare function signedEntryNames(doc: DomeDoc): string[];
|
|
111
|
+
/** (Re)writes checksums.sha256. */
|
|
112
|
+
declare function addChecksums(doc: DomeDoc): void;
|
|
113
|
+
/** Signs (01b §2.2) with an Ed25519 private key (WebCrypto CryptoKey). */
|
|
114
|
+
declare function signDome(doc: DomeDoc, privateKey: CryptoKey, keyId: string, created: string): Promise<void>;
|
|
115
|
+
/** The `.dome` codec. */
|
|
116
|
+
declare const DomeCodec: {
|
|
117
|
+
/** Reads a packed `.dome` (bytes) or an unpacked directory. */
|
|
118
|
+
read(input: FormatInput | Uint8Array, opts?: DomeReadOptions): Promise<DomeDoc>;
|
|
119
|
+
/** Deterministic zip: mimetype, dome.json, then byte order; media stored, the rest deflated. */
|
|
120
|
+
write(doc: DomeDoc, opts?: {
|
|
121
|
+
forceZip64?: boolean;
|
|
122
|
+
}): Uint8Array;
|
|
123
|
+
/** Unpacked form as a path → bytes map. */
|
|
124
|
+
toDirectory(doc: DomeDoc): Map<string, Uint8Array>;
|
|
125
|
+
/** New document from a manifest object and entries. */
|
|
126
|
+
create(manifest: Json$1, entries?: Map<string, Uint8Array>): DomeDoc;
|
|
127
|
+
};
|
|
128
|
+
/** Whether two docs carry the same manifest and entry bytes. */
|
|
129
|
+
declare function sameDome(a: DomeDoc, b: DomeDoc): boolean;
|
|
130
|
+
|
|
131
|
+
/** Codec problem codes. */
|
|
132
|
+
type CodecProblemCode = 'validation-failed' | 'unsupported-format' | 'payload-too-large';
|
|
133
|
+
/** One problem detail. */
|
|
134
|
+
interface CodecIssue {
|
|
135
|
+
pointer: string;
|
|
136
|
+
detail: string;
|
|
137
|
+
}
|
|
138
|
+
/** Error of the format codecs. */
|
|
139
|
+
declare class CodecError extends FreedomeError {
|
|
140
|
+
readonly codecCode: CodecProblemCode;
|
|
141
|
+
readonly status: number;
|
|
142
|
+
readonly errors: CodecIssue[];
|
|
143
|
+
constructor(codecCode: CodecProblemCode, detail: string, errors?: CodecIssue[]);
|
|
144
|
+
/** RFC 9457 problem object. */
|
|
145
|
+
toProblem(): Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
declare const unsupported: (detail: string) => CodecError;
|
|
148
|
+
declare const invalid: (detail: string, pointer?: string) => CodecError;
|
|
149
|
+
declare const tooLarge: (detail: string) => CodecError;
|
|
150
|
+
|
|
151
|
+
/** FDMESH header. */
|
|
152
|
+
interface FdmeshHeader {
|
|
153
|
+
version: number;
|
|
154
|
+
flags: number;
|
|
155
|
+
cols: number;
|
|
156
|
+
rows: number;
|
|
157
|
+
channels: number;
|
|
158
|
+
}
|
|
159
|
+
/** The header, or the reason the bytes are not a valid FDMESH v1 file. */
|
|
160
|
+
declare function checkFdmesh(b: Uint8Array): FdmeshHeader | string;
|
|
161
|
+
|
|
162
|
+
type Json = any;
|
|
163
|
+
/** Media types. */
|
|
164
|
+
declare const FORMAT_MIME: {
|
|
165
|
+
readonly domeZip: "application/vnd.nativemind.freedome.dome+zip";
|
|
166
|
+
readonly zelimJson: "application/vnd.nativemind.zelim+json";
|
|
167
|
+
readonly zelimBinary: "application/vnd.nativemind.zelim";
|
|
168
|
+
readonly borankoJson: "application/vnd.nativemind.boranko+json";
|
|
169
|
+
readonly borankoZip: "application/vnd.nativemind.boranko+zip";
|
|
170
|
+
readonly comicsZip: "application/vnd.nativemind.comics+zip";
|
|
171
|
+
};
|
|
172
|
+
/** Result of `sniff`. */
|
|
173
|
+
interface SniffResult {
|
|
174
|
+
format: 'dome' | 'zelim' | 'boranko' | 'comics';
|
|
175
|
+
variant: string;
|
|
176
|
+
mime: string;
|
|
177
|
+
warnings: string[];
|
|
178
|
+
}
|
|
179
|
+
/** A decoded document with reader warnings (`<code>` or `<code>:<pointer>`). */
|
|
180
|
+
interface Decoded<T = Json> {
|
|
181
|
+
result: T;
|
|
182
|
+
warnings: string[];
|
|
183
|
+
}
|
|
184
|
+
/** UTF-8 (fatal) decode with BOM strip. */
|
|
185
|
+
declare function decodeText(buf: Uint8Array, what: string): string;
|
|
186
|
+
declare function parseJson(buf: Uint8Array, what: string): Json;
|
|
187
|
+
/** Detects the format by content (the extension is never consulted). */
|
|
188
|
+
declare function sniff(input: FormatInput | Uint8Array): SniffResult;
|
|
189
|
+
/** Binary `.zelim` → v2-normalised scene (every length checked before reading). */
|
|
190
|
+
declare function decodeZelimBinary(buf: Uint8Array): Json;
|
|
191
|
+
/** JSON `.zelim` project (BOM strip, major check, schema of the newest known minor ≤ the file's, quantum.scene check). */
|
|
192
|
+
declare function decodeZelimJson(buf: Uint8Array, sibling?: (rel: string) => Promise<Uint8Array | undefined>): Promise<Decoded>;
|
|
193
|
+
/** `.zelim` of either variant. */
|
|
194
|
+
declare function decodeZelim(input: FormatInput | Uint8Array): Promise<Decoded>;
|
|
195
|
+
/** `.boranko` (directory, single JSON or zip). */
|
|
196
|
+
declare function decodeBoranko(input: FormatInput | Uint8Array): Promise<Decoded>;
|
|
197
|
+
/** Animation kind from a .NET `$type` name. */
|
|
198
|
+
declare function animKind(type: string): string;
|
|
199
|
+
/** Comics.Editor `data.json` → normalised comics. */
|
|
200
|
+
declare function decodeComicsData(buf: Uint8Array, entryNames?: string[] | null): Promise<Decoded>;
|
|
201
|
+
/** `.comics` (Comics.Editor zip or legacy image zip). */
|
|
202
|
+
declare function decodeComics(input: FormatInput | Uint8Array): Promise<Decoded>;
|
|
203
|
+
|
|
204
|
+
export { CodecError, type CodecIssue, type CodecProblemCode, DEFAULT_ZIP_LIMITS, DOME_MIME, DOME_WRITER_VERSION, DOS_DATE_1980_01_01, type Decoded, DomeCodec, type DomeDoc, type DomeReadOptions, type Ed25519Verify, FORMAT_MIME, type FdmeshHeader, FormatInput, LeWriter, type SniffResult, type WriteEntry, type ZipArchive, type ZipEntryInfo, type ZipLimits, addChecksums, animKind, badEntryName, byteOrder, checkFdmesh, concat, crc32, decodeBoranko, decodeComics, decodeComicsData, decodeText, decodeZelim, decodeZelimBinary, decodeZelimJson, equalBytes, f32, f64, fromLatin1, fromUtf8, invalid, isZip, latin1, manifestBytesFor, openZip, parseJson, pemToDer, sameDome, signDome, signedEntryNames, sniff, tooLarge, u16, u32, u64big, unsupported, utf8, webCryptoVerify, writeZip };
|
package/dist/codecs.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { F as FormatInput } from './input-CxW5zgc-.js';
|
|
2
|
+
export { D as DirectoryInput, a as FileInput, b as bytesInput, d as directoryInput } from './input-CxW5zgc-.js';
|
|
3
|
+
import { F as FreedomeError } from './errors-L_bIF-OR.js';
|
|
4
|
+
import '@freedome/protocol';
|
|
5
|
+
|
|
6
|
+
declare const u16: (b: Uint8Array, o: number) => number;
|
|
7
|
+
declare const u32: (b: Uint8Array, o: number) => number;
|
|
8
|
+
declare const u64big: (b: Uint8Array, o: number) => bigint;
|
|
9
|
+
declare const f64: (b: Uint8Array, o: number) => number;
|
|
10
|
+
declare const f32: (b: Uint8Array, o: number) => number;
|
|
11
|
+
declare const latin1: (b: Uint8Array) => string;
|
|
12
|
+
declare const fromLatin1: (s: string) => Uint8Array;
|
|
13
|
+
declare const utf8: (s: string) => Uint8Array;
|
|
14
|
+
declare const fromUtf8: (b: Uint8Array) => string;
|
|
15
|
+
declare function equalBytes(a: Uint8Array, b: Uint8Array): boolean;
|
|
16
|
+
/** Byte order of UTF-8 encodings (writer entry order). */
|
|
17
|
+
declare function byteOrder(a: string, b: string): number;
|
|
18
|
+
declare function concat(parts: Uint8Array[]): Uint8Array;
|
|
19
|
+
/** CRC-32 (IEEE). */
|
|
20
|
+
declare function crc32(b: Uint8Array): number;
|
|
21
|
+
/** Writable little-endian buffer. */
|
|
22
|
+
declare class LeWriter {
|
|
23
|
+
readonly bytes: Uint8Array;
|
|
24
|
+
private readonly dv;
|
|
25
|
+
constructor(n: number);
|
|
26
|
+
u16(o: number, v: number): this;
|
|
27
|
+
u32(o: number, v: number): this;
|
|
28
|
+
u64(o: number, v: number | bigint): this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const DOS_DATE_1980_01_01 = 33;
|
|
32
|
+
/** Reader limits (01b §2.1). */
|
|
33
|
+
interface ZipLimits {
|
|
34
|
+
maxEntries: number;
|
|
35
|
+
maxManifestBytes: number;
|
|
36
|
+
maxTotalBytes: number;
|
|
37
|
+
maxRatio: number;
|
|
38
|
+
ratioMinBytes: number;
|
|
39
|
+
}
|
|
40
|
+
declare const DEFAULT_ZIP_LIMITS: ZipLimits;
|
|
41
|
+
/** One entry of the central directory. */
|
|
42
|
+
interface ZipEntryInfo {
|
|
43
|
+
name: string;
|
|
44
|
+
method: number;
|
|
45
|
+
flags: number;
|
|
46
|
+
crc: number;
|
|
47
|
+
compressedSize: number;
|
|
48
|
+
size: number;
|
|
49
|
+
localOffset: number;
|
|
50
|
+
dataOffset: number;
|
|
51
|
+
localExtraLength: number;
|
|
52
|
+
centralExtraLength: number;
|
|
53
|
+
zip64: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** An opened archive. */
|
|
56
|
+
interface ZipArchive {
|
|
57
|
+
entries: ZipEntryInfo[];
|
|
58
|
+
zip64: boolean;
|
|
59
|
+
read(name: string): Uint8Array;
|
|
60
|
+
}
|
|
61
|
+
/** Entry-name rule (01b §2.1); returns the reason or null. */
|
|
62
|
+
declare function badEntryName(name: string): string | null;
|
|
63
|
+
/** Whether [b] starts with a ZIP local header. */
|
|
64
|
+
declare const isZip: (b: Uint8Array) => boolean;
|
|
65
|
+
/** Parses a ZIP held in memory. */
|
|
66
|
+
declare function openZip(buf: Uint8Array, limits?: ZipLimits): ZipArchive;
|
|
67
|
+
/** One entry to write. */
|
|
68
|
+
interface WriteEntry {
|
|
69
|
+
name: string;
|
|
70
|
+
data: Uint8Array;
|
|
71
|
+
store: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Deterministic ZIP (fixed DOS date, no timestamps / attributes; ZIP64 when needed or forced). */
|
|
74
|
+
declare function writeZip(entries: WriteEntry[], opts?: {
|
|
75
|
+
forceZip64?: boolean;
|
|
76
|
+
}): Uint8Array;
|
|
77
|
+
|
|
78
|
+
declare const DOME_MIME = "application/vnd.nativemind.freedome.dome+zip";
|
|
79
|
+
declare const DOME_WRITER_VERSION = "1.1.0";
|
|
80
|
+
type Json$1 = any;
|
|
81
|
+
/** A decoded `.dome`. */
|
|
82
|
+
interface DomeDoc {
|
|
83
|
+
manifest: Json$1;
|
|
84
|
+
/** Every container entry except `mimetype` and `dome.json`. */
|
|
85
|
+
entries: Map<string, Uint8Array>;
|
|
86
|
+
form: 'zip' | 'dir';
|
|
87
|
+
warnings: string[];
|
|
88
|
+
/** The reader rewrote interim x-* keys. */
|
|
89
|
+
normalised: boolean;
|
|
90
|
+
raw?: Uint8Array;
|
|
91
|
+
rawCanon?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Verifies an Ed25519 signature (default: WebCrypto). */
|
|
94
|
+
type Ed25519Verify = (publicKeySpki: Uint8Array, message: Uint8Array, signature: Uint8Array) => Promise<boolean>;
|
|
95
|
+
/** Read options. */
|
|
96
|
+
interface DomeReadOptions {
|
|
97
|
+
limits?: Partial<ZipLimits>;
|
|
98
|
+
/** Public keys (SPKI DER or PEM) by signature keyId. */
|
|
99
|
+
keys?: Record<string, Uint8Array | string>;
|
|
100
|
+
requireSignature?: boolean;
|
|
101
|
+
verify?: Ed25519Verify;
|
|
102
|
+
}
|
|
103
|
+
/** SPKI DER of a PEM public key. */
|
|
104
|
+
declare function pemToDer(pem: string): Uint8Array;
|
|
105
|
+
/** WebCrypto Ed25519 verification (Node ≥ 20, current browsers). */
|
|
106
|
+
declare const webCryptoVerify: Ed25519Verify;
|
|
107
|
+
/** Manifest bytes: as read when unchanged, else canonical 2-space JSON + LF. */
|
|
108
|
+
declare function manifestBytesFor(doc: DomeDoc): Uint8Array;
|
|
109
|
+
/** Entries a signature must list (01b §2.2), writer order. */
|
|
110
|
+
declare function signedEntryNames(doc: DomeDoc): string[];
|
|
111
|
+
/** (Re)writes checksums.sha256. */
|
|
112
|
+
declare function addChecksums(doc: DomeDoc): void;
|
|
113
|
+
/** Signs (01b §2.2) with an Ed25519 private key (WebCrypto CryptoKey). */
|
|
114
|
+
declare function signDome(doc: DomeDoc, privateKey: CryptoKey, keyId: string, created: string): Promise<void>;
|
|
115
|
+
/** The `.dome` codec. */
|
|
116
|
+
declare const DomeCodec: {
|
|
117
|
+
/** Reads a packed `.dome` (bytes) or an unpacked directory. */
|
|
118
|
+
read(input: FormatInput | Uint8Array, opts?: DomeReadOptions): Promise<DomeDoc>;
|
|
119
|
+
/** Deterministic zip: mimetype, dome.json, then byte order; media stored, the rest deflated. */
|
|
120
|
+
write(doc: DomeDoc, opts?: {
|
|
121
|
+
forceZip64?: boolean;
|
|
122
|
+
}): Uint8Array;
|
|
123
|
+
/** Unpacked form as a path → bytes map. */
|
|
124
|
+
toDirectory(doc: DomeDoc): Map<string, Uint8Array>;
|
|
125
|
+
/** New document from a manifest object and entries. */
|
|
126
|
+
create(manifest: Json$1, entries?: Map<string, Uint8Array>): DomeDoc;
|
|
127
|
+
};
|
|
128
|
+
/** Whether two docs carry the same manifest and entry bytes. */
|
|
129
|
+
declare function sameDome(a: DomeDoc, b: DomeDoc): boolean;
|
|
130
|
+
|
|
131
|
+
/** Codec problem codes. */
|
|
132
|
+
type CodecProblemCode = 'validation-failed' | 'unsupported-format' | 'payload-too-large';
|
|
133
|
+
/** One problem detail. */
|
|
134
|
+
interface CodecIssue {
|
|
135
|
+
pointer: string;
|
|
136
|
+
detail: string;
|
|
137
|
+
}
|
|
138
|
+
/** Error of the format codecs. */
|
|
139
|
+
declare class CodecError extends FreedomeError {
|
|
140
|
+
readonly codecCode: CodecProblemCode;
|
|
141
|
+
readonly status: number;
|
|
142
|
+
readonly errors: CodecIssue[];
|
|
143
|
+
constructor(codecCode: CodecProblemCode, detail: string, errors?: CodecIssue[]);
|
|
144
|
+
/** RFC 9457 problem object. */
|
|
145
|
+
toProblem(): Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
declare const unsupported: (detail: string) => CodecError;
|
|
148
|
+
declare const invalid: (detail: string, pointer?: string) => CodecError;
|
|
149
|
+
declare const tooLarge: (detail: string) => CodecError;
|
|
150
|
+
|
|
151
|
+
/** FDMESH header. */
|
|
152
|
+
interface FdmeshHeader {
|
|
153
|
+
version: number;
|
|
154
|
+
flags: number;
|
|
155
|
+
cols: number;
|
|
156
|
+
rows: number;
|
|
157
|
+
channels: number;
|
|
158
|
+
}
|
|
159
|
+
/** The header, or the reason the bytes are not a valid FDMESH v1 file. */
|
|
160
|
+
declare function checkFdmesh(b: Uint8Array): FdmeshHeader | string;
|
|
161
|
+
|
|
162
|
+
type Json = any;
|
|
163
|
+
/** Media types. */
|
|
164
|
+
declare const FORMAT_MIME: {
|
|
165
|
+
readonly domeZip: "application/vnd.nativemind.freedome.dome+zip";
|
|
166
|
+
readonly zelimJson: "application/vnd.nativemind.zelim+json";
|
|
167
|
+
readonly zelimBinary: "application/vnd.nativemind.zelim";
|
|
168
|
+
readonly borankoJson: "application/vnd.nativemind.boranko+json";
|
|
169
|
+
readonly borankoZip: "application/vnd.nativemind.boranko+zip";
|
|
170
|
+
readonly comicsZip: "application/vnd.nativemind.comics+zip";
|
|
171
|
+
};
|
|
172
|
+
/** Result of `sniff`. */
|
|
173
|
+
interface SniffResult {
|
|
174
|
+
format: 'dome' | 'zelim' | 'boranko' | 'comics';
|
|
175
|
+
variant: string;
|
|
176
|
+
mime: string;
|
|
177
|
+
warnings: string[];
|
|
178
|
+
}
|
|
179
|
+
/** A decoded document with reader warnings (`<code>` or `<code>:<pointer>`). */
|
|
180
|
+
interface Decoded<T = Json> {
|
|
181
|
+
result: T;
|
|
182
|
+
warnings: string[];
|
|
183
|
+
}
|
|
184
|
+
/** UTF-8 (fatal) decode with BOM strip. */
|
|
185
|
+
declare function decodeText(buf: Uint8Array, what: string): string;
|
|
186
|
+
declare function parseJson(buf: Uint8Array, what: string): Json;
|
|
187
|
+
/** Detects the format by content (the extension is never consulted). */
|
|
188
|
+
declare function sniff(input: FormatInput | Uint8Array): SniffResult;
|
|
189
|
+
/** Binary `.zelim` → v2-normalised scene (every length checked before reading). */
|
|
190
|
+
declare function decodeZelimBinary(buf: Uint8Array): Json;
|
|
191
|
+
/** JSON `.zelim` project (BOM strip, major check, schema of the newest known minor ≤ the file's, quantum.scene check). */
|
|
192
|
+
declare function decodeZelimJson(buf: Uint8Array, sibling?: (rel: string) => Promise<Uint8Array | undefined>): Promise<Decoded>;
|
|
193
|
+
/** `.zelim` of either variant. */
|
|
194
|
+
declare function decodeZelim(input: FormatInput | Uint8Array): Promise<Decoded>;
|
|
195
|
+
/** `.boranko` (directory, single JSON or zip). */
|
|
196
|
+
declare function decodeBoranko(input: FormatInput | Uint8Array): Promise<Decoded>;
|
|
197
|
+
/** Animation kind from a .NET `$type` name. */
|
|
198
|
+
declare function animKind(type: string): string;
|
|
199
|
+
/** Comics.Editor `data.json` → normalised comics. */
|
|
200
|
+
declare function decodeComicsData(buf: Uint8Array, entryNames?: string[] | null): Promise<Decoded>;
|
|
201
|
+
/** `.comics` (Comics.Editor zip or legacy image zip). */
|
|
202
|
+
declare function decodeComics(input: FormatInput | Uint8Array): Promise<Decoded>;
|
|
203
|
+
|
|
204
|
+
export { CodecError, type CodecIssue, type CodecProblemCode, DEFAULT_ZIP_LIMITS, DOME_MIME, DOME_WRITER_VERSION, DOS_DATE_1980_01_01, type Decoded, DomeCodec, type DomeDoc, type DomeReadOptions, type Ed25519Verify, FORMAT_MIME, type FdmeshHeader, FormatInput, LeWriter, type SniffResult, type WriteEntry, type ZipArchive, type ZipEntryInfo, type ZipLimits, addChecksums, animKind, badEntryName, byteOrder, checkFdmesh, concat, crc32, decodeBoranko, decodeComics, decodeComicsData, decodeText, decodeZelim, decodeZelimBinary, decodeZelimJson, equalBytes, f32, f64, fromLatin1, fromUtf8, invalid, isZip, latin1, manifestBytesFor, openZip, parseJson, pemToDer, sameDome, signDome, signedEntryNames, sniff, tooLarge, u16, u32, u64big, unsupported, utf8, webCryptoVerify, writeZip };
|