@beyondwork/xlsx-substrate-bindings 0.0.0-stage → 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.
Files changed (47) hide show
  1. package/LICENSE.md +31 -0
  2. package/README.md +135 -2
  3. package/dist/ai/agent-metadata.d.ts +363 -0
  4. package/dist/ai/agent-metadata.js +227 -0
  5. package/dist/ai/index.d.ts +6 -0
  6. package/dist/ai/index.js +7 -0
  7. package/dist/ai/mutation-bridge.d.ts +82 -0
  8. package/dist/ai/mutation-bridge.js +179 -0
  9. package/dist/ai/types.d.ts +765 -0
  10. package/dist/ai/types.js +23 -0
  11. package/dist/index.d.ts +50 -0
  12. package/dist/index.js +90 -0
  13. package/dist/runtime/index.d.ts +2 -0
  14. package/dist/runtime/index.js +1 -0
  15. package/dist/runtime/types.d.ts +1435 -0
  16. package/dist/runtime/types.js +15 -0
  17. package/dist/shared.d.ts +69 -0
  18. package/dist/shared.js +1 -0
  19. package/dist/ui/index.d.ts +2 -0
  20. package/dist/ui/index.js +1 -0
  21. package/dist/ui/types.d.ts +765 -0
  22. package/dist/ui/types.js +12 -0
  23. package/dist/wasm/ai-session-bridge.d.ts +97 -0
  24. package/dist/wasm/ai-session-bridge.js +154 -0
  25. package/dist/wasm/bridge-contract.d.ts +643 -0
  26. package/dist/wasm/bridge-contract.js +1001 -0
  27. package/dist/wasm/index.d.ts +50 -0
  28. package/dist/wasm/index.js +297 -0
  29. package/dist/wasm/memory-budget.d.ts +77 -0
  30. package/dist/wasm/memory-budget.js +532 -0
  31. package/dist/wasm/runtime-guard.d.ts +141 -0
  32. package/dist/wasm/runtime-guard.js +373 -0
  33. package/dist/wasm/session-router.d.ts +98 -0
  34. package/dist/wasm/session-router.js +184 -0
  35. package/dist/wasm/sheet-window-binary-reference.d.ts +9 -0
  36. package/dist/wasm/sheet-window-binary-reference.js +308 -0
  37. package/dist/wasm/sheet-window-binary.d.ts +279 -0
  38. package/dist/wasm/sheet-window-binary.js +636 -0
  39. package/dist/wasm/web.d.ts +72 -0
  40. package/dist/wasm/web.js +142 -0
  41. package/generated/wasm-web/package.json +3 -0
  42. package/generated/wasm-web/snippets/ironcalc_base-89b4f49381e1e289/inline0.js +42 -0
  43. package/generated/wasm-web/xlsx_substrate_wasm.d.ts +532 -0
  44. package/generated/wasm-web/xlsx_substrate_wasm.js +2493 -0
  45. package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm +0 -0
  46. package/generated/wasm-web/xlsx_substrate_wasm_bg.wasm.d.ts +120 -0
  47. package/package.json +55 -3
@@ -0,0 +1,50 @@
1
+ import { type XlsxWasmAdmissionOptions, type XlsxWasmBridgeLoadResult } from "./bridge-contract.ts";
2
+ export * from "./bridge-contract.ts";
3
+ export { AI_SESSION_AGENT_CAPABILITY, AI_SESSION_METHODS, AI_SESSION_OPS, AI_SESSION_POOL_METHODS, AI_SESSION_RAW_METHOD, AI_SESSION_RAW_METHODS, aiSessionOpClass, attachAiSessionMethods, isXlsxAiUnknownOpRefusal, XlsxAiUnknownOpRefusalError, type RawXlsxAiSessionModule, type XlsxAiSessionBridgeMethods, type AiSessionCallOp, type AiSessionCommitMethod, type AiSessionMethod, type AiSessionOp } from "./ai-session-bridge.ts";
4
+ /**
5
+ * R3: compile the package's wasm binary once, asynchronously, into a
6
+ * `WebAssembly.Module` a host can share: pass it to `loadXlsxWasmBridge`
7
+ * here, or post it to worker_threads, each of which instantiates its own
8
+ * instance from it without compiling again. The Module is compiled from the
9
+ * exact bytes `generatedWasmModuleSha256()` hashes.
10
+ */
11
+ export declare function compileXlsxWasmModule(): Promise<WebAssembly.Module>;
12
+ /**
13
+ * The SHA-256 this realm recorded for the bytes it compiled `module` from
14
+ * (`compileXlsxWasmModule`, or the default instance's Module). It is a
15
+ * lookup, not a hash of the Module: a `WebAssembly.Module` exposes no bytes.
16
+ * A Module received from another thread is a clone and answers undefined.
17
+ */
18
+ export declare function xlsxWasmModuleSha256(module: WebAssembly.Module): string | undefined;
19
+ export interface XlsxWasmBridgeLoadOptions extends XlsxWasmAdmissionOptions {
20
+ /**
21
+ * A Module from `compileXlsxWasmModule()` (possibly in another thread).
22
+ * Given: the bridge runs on a NEW instance of its own. Absent: the bridge
23
+ * runs on the process's shared default instance, as every
24
+ * `loadGeneratedXlsxWasmBridge()` bridge does.
25
+ *
26
+ * `memoryBudgetBytes` and `admission` apply to the returned bridge only.
27
+ * On the shared default instance each bridge keeps its own setting, and
28
+ * every bridge's live sessions count against the one maximum.
29
+ */
30
+ readonly module?: WebAssembly.Module;
31
+ /** Throw instead of returning not-mounted. Defaults to XLSX_WASM_REQUIRED=1. */
32
+ readonly required?: boolean;
33
+ }
34
+ /**
35
+ * R3: mount the bridge on a wasm instance. Synchronous: with a Module the
36
+ * instantiation is cheap; without one the default instance is created (and
37
+ * the binary compiled) once per process.
38
+ */
39
+ export declare function loadXlsxWasmBridge(options?: XlsxWasmBridgeLoadOptions): XlsxWasmBridgeLoadResult;
40
+ /**
41
+ * The process's shared default bridge (unchanged entry point). `options`
42
+ * sets this bridge's own admission (see `XlsxWasmBridgeLoadOptions`).
43
+ */
44
+ export declare function loadGeneratedXlsxWasmBridge(options?: XlsxWasmAdmissionOptions): XlsxWasmBridgeLoadResult;
45
+ /**
46
+ * SHA-256 of the WebAssembly binary this loader instantiates. Hosts report it
47
+ * with the bridge version so a deployed runtime is identifiable without
48
+ * reading the package's directory layout.
49
+ */
50
+ export declare function generatedWasmModuleSha256(): string;
@@ -0,0 +1,297 @@
1
+ // Node.js loader over the ONE wasm binary (runtime 0.2.0, R2): the
2
+ // wasm-bindgen web-target ESM glue in `generated/wasm-web/`, instantiated
3
+ // with initSync({ module }). The target-independent bridge contract (types,
4
+ // required-capability / required-method lists, `validateRawXlsxWasmModule`,
5
+ // `createXlsxWasmBridge`, result normalizers, the memory contract and the
6
+ // sheet-window binary decoder re-exports) lives in `bridge-contract.ts` so
7
+ // the browser loader (`web.ts`) shares it verbatim without `node:` imports.
8
+ import { createHash } from "node:crypto";
9
+ import { existsSync, readFileSync } from "node:fs";
10
+ import { createRequire } from "node:module";
11
+ import { dirname, resolve } from "node:path";
12
+ import { fileURLToPath } from "node:url";
13
+ import { createXlsxWasmBridge, createXlsxWasmRuntime, readWasmMemoryLimits, validateRawXlsxWasmModule, XLSX_WASM_LINEAR_MEMORY_MAXIMUM_BYTES } from "./bridge-contract.js";
14
+ export * from "./bridge-contract.js";
15
+ // XB5 (Q8 "Bindings package surface"): the pool, the worker's twin and the
16
+ // packed consumer read the AI constants through this entry.
17
+ export { AI_SESSION_AGENT_CAPABILITY, AI_SESSION_METHODS, AI_SESSION_OPS, AI_SESSION_POOL_METHODS, AI_SESSION_RAW_METHOD, AI_SESSION_RAW_METHODS, aiSessionOpClass, attachAiSessionMethods, isXlsxAiUnknownOpRefusal, XlsxAiUnknownOpRefusalError } from "./ai-session-bridge.js";
18
+ function nativeRequire(path) {
19
+ const load = typeof __non_webpack_require__ === "function"
20
+ ? __non_webpack_require__
21
+ : createRequire(import.meta.url);
22
+ return load(path);
23
+ }
24
+ const SHIM_INSTANCE_KEY = Symbol.for("@beyondwork/xlsx-substrate-bindings/wasm-instance");
25
+ function packageRoot() {
26
+ // src/wasm/index.ts and dist/wasm/index.js both sit two levels below it.
27
+ return resolve(dirname(fileURLToPath(import.meta.url)), "../..");
28
+ }
29
+ function generatedGluePath() {
30
+ return resolve(packageRoot(), "generated/wasm-web/xlsx_substrate_wasm.js");
31
+ }
32
+ function generatedBinaryPath() {
33
+ return resolve(packageRoot(), "generated/wasm-web/xlsx_substrate_wasm_bg.wasm");
34
+ }
35
+ /** The in-repo CommonJS shim; absent from the published package. */
36
+ function generatedShimPath() {
37
+ return resolve(packageRoot(), "generated/wasm/xlsx_substrate_wasm.js");
38
+ }
39
+ const moduleSha256 = new WeakMap();
40
+ let compiledModule;
41
+ let defaultRuntime;
42
+ function sha256(bytes) {
43
+ return createHash("sha256").update(bytes).digest("hex");
44
+ }
45
+ function maximumMemoryBytes(bytes) {
46
+ return readWasmMemoryLimits(bytes)?.maximumBytes ?? XLSX_WASM_LINEAR_MEMORY_MAXIMUM_BYTES;
47
+ }
48
+ /**
49
+ * R3: compile the package's wasm binary once, asynchronously, into a
50
+ * `WebAssembly.Module` a host can share: pass it to `loadXlsxWasmBridge`
51
+ * here, or post it to worker_threads, each of which instantiates its own
52
+ * instance from it without compiling again. The Module is compiled from the
53
+ * exact bytes `generatedWasmModuleSha256()` hashes.
54
+ */
55
+ export function compileXlsxWasmModule() {
56
+ compiledModule ??= (async () => {
57
+ const bytes = readFileSync(generatedBinaryPath());
58
+ const module = await WebAssembly.compile(bytes);
59
+ moduleSha256.set(module, sha256(bytes));
60
+ return module;
61
+ })();
62
+ compiledModule.catch(() => {
63
+ compiledModule = undefined;
64
+ });
65
+ return compiledModule;
66
+ }
67
+ /**
68
+ * The SHA-256 this realm recorded for the bytes it compiled `module` from
69
+ * (`compileXlsxWasmModule`, or the default instance's Module). It is a
70
+ * lookup, not a hash of the Module: a `WebAssembly.Module` exposes no bytes.
71
+ * A Module received from another thread is a clone and answers undefined.
72
+ */
73
+ export function xlsxWasmModuleSha256(module) {
74
+ return moduleSha256.get(module);
75
+ }
76
+ /**
77
+ * R3: mount the bridge on a wasm instance. Synchronous: with a Module the
78
+ * instantiation is cheap; without one the default instance is created (and
79
+ * the binary compiled) once per process.
80
+ */
81
+ export function loadXlsxWasmBridge(options = {}) {
82
+ const required = options.required ?? process.env.XLSX_WASM_REQUIRED === "1";
83
+ if (!existsSync(generatedGluePath()) || !existsSync(generatedBinaryPath())) {
84
+ // Absent artifacts stay a soft result even in required mode, as before:
85
+ // the tests that require the runtime fail on the missing bridge.
86
+ return {
87
+ wasmBinding: "not-mounted",
88
+ reason: "generated WASM module is absent; run build:wasm"
89
+ };
90
+ }
91
+ try {
92
+ const mounted = options.module ? instantiateOwnRuntime(options.module, options) : sharedDefaultView(options);
93
+ const validation = validateRawXlsxWasmModule(mounted.raw);
94
+ if (!validation.ok) {
95
+ if (required) {
96
+ throw new Error(validation.requiredModeMessage);
97
+ }
98
+ return {
99
+ wasmBinding: "not-mounted",
100
+ reason: validation.reason
101
+ };
102
+ }
103
+ return {
104
+ wasmBinding: "mounted",
105
+ bridge: createXlsxWasmBridge(mounted.raw, validation.status, mounted.runtime)
106
+ };
107
+ }
108
+ catch (error) {
109
+ if (required) {
110
+ throw error;
111
+ }
112
+ return {
113
+ wasmBinding: "not-mounted",
114
+ reason: error instanceof Error ? error.message : String(error)
115
+ };
116
+ }
117
+ }
118
+ /**
119
+ * The process's shared default bridge (unchanged entry point). `options`
120
+ * sets this bridge's own admission (see `XlsxWasmBridgeLoadOptions`).
121
+ */
122
+ export function loadGeneratedXlsxWasmBridge(options = {}) {
123
+ return loadXlsxWasmBridge(admissionOptions(options));
124
+ }
125
+ function admissionOptions(options) {
126
+ return {
127
+ ...(options.memoryBudgetBytes !== undefined ? { memoryBudgetBytes: options.memoryBudgetBytes } : {}),
128
+ ...(options.admission !== undefined ? { admission: options.admission } : {})
129
+ };
130
+ }
131
+ function loadGlue() {
132
+ // require(esm) (Node >= 22.12): the glue is ESM without top-level await.
133
+ const glue = nativeRequire(generatedGluePath());
134
+ if (typeof glue.createXlsxSubstrateGlue !== "function") {
135
+ throw new Error("generated WASM glue has no createXlsxSubstrateGlue; run build:wasm");
136
+ }
137
+ return glue;
138
+ }
139
+ function freshInstance(glue, module) {
140
+ const instance = glue.createXlsxSubstrateGlue();
141
+ const wasmExports = instance.initSync({ module });
142
+ return { instance, ...(wasmExports.memory ? { memory: wasmExports.memory } : {}) };
143
+ }
144
+ /**
145
+ * A runtime over a holder object. Recovery after a trap copies a fresh
146
+ * instance's functions onto the same holder, so a caller that required the
147
+ * holder by path (the in-repo shim) also lands on the fresh instance.
148
+ */
149
+ function runtimeOverHolder(holder, memory, glue, module, maximumBytes, options) {
150
+ const instance = memory ? { raw: holder, memory } : { raw: holder };
151
+ const runtime = createXlsxWasmRuntime({
152
+ instance,
153
+ maximumMemoryBytes: maximumBytes,
154
+ ...admissionOptions(options),
155
+ reinstantiate() {
156
+ const fresh = freshInstance(glue, module);
157
+ Object.assign(holder, fresh.instance);
158
+ return fresh.memory ? { raw: holder, memory: fresh.memory } : { raw: holder };
159
+ }
160
+ });
161
+ return { runtime, raw: runtime.raw };
162
+ }
163
+ /** Glue fields that are not bridge calls: wasm-bindgen's init entry points. */
164
+ const UNGUARDED_GLUE_FIELDS = new Set(["default", "initSync"]);
165
+ function isPlainFunction(value) {
166
+ return typeof value === "function" && !/^class\b/u.test(Function.prototype.toString.call(value));
167
+ }
168
+ /**
169
+ * The runtime over the in-repo CommonJS shim. The shim is an object other
170
+ * in-repo code requires by path and calls directly, so it must never route a
171
+ * call around the guard. This puts a guarded function on the shim for every
172
+ * bridge call and keeps the instance's own functions private:
173
+ *
174
+ * - a direct shim call goes through the runtime: its handle ids are checked
175
+ * and translated, a trap is contained, and after a recovery an id from the
176
+ * lost instance is refused instead of reaching a new session that reused
177
+ * its native number;
178
+ * - the runtime calls back through the shim's current property, so a test
179
+ * or tally that wraps a shim export still sees every bridge call. Those
180
+ * inner calls reach the instance's own function directly;
181
+ * - a recovery swaps the private functions for the fresh instance's and
182
+ * updates the carried memory. The shim keeps its guarded functions.
183
+ */
184
+ function runtimeOverShim(shim, carried, maximumBytes) {
185
+ const holder = shim;
186
+ let instanceFunctions = { ...holder };
187
+ let insideRuntime = false;
188
+ let guarded;
189
+ for (const [name, value] of Object.entries(instanceFunctions)) {
190
+ if (UNGUARDED_GLUE_FIELDS.has(name) || !isPlainFunction(value))
191
+ continue;
192
+ holder[name] = function guardedShimCall(...args) {
193
+ if (insideRuntime) {
194
+ const own = instanceFunctions[name];
195
+ if (typeof own !== "function") {
196
+ throw new TypeError(`wasm bridge method ${name} is not a function`);
197
+ }
198
+ return own.apply(instanceFunctions, args);
199
+ }
200
+ return guarded[name](...args);
201
+ };
202
+ }
203
+ const dispatchers = new Map();
204
+ // What the runtime calls: the shim's current property, marked as an inner call.
205
+ const inner = new Proxy({}, {
206
+ get(_target, property) {
207
+ const value = holder[property];
208
+ if (typeof property !== "string" || typeof value !== "function")
209
+ return value;
210
+ let dispatch = dispatchers.get(property);
211
+ if (!dispatch) {
212
+ dispatch = (...args) => {
213
+ const outer = insideRuntime;
214
+ insideRuntime = true;
215
+ try {
216
+ return holder[property].apply(holder, args);
217
+ }
218
+ finally {
219
+ insideRuntime = outer;
220
+ }
221
+ };
222
+ dispatchers.set(property, dispatch);
223
+ }
224
+ return dispatch;
225
+ },
226
+ has(_target, property) {
227
+ return property in holder;
228
+ }
229
+ });
230
+ const runtime = createXlsxWasmRuntime({
231
+ instance: carried.memory ? { raw: inner, memory: carried.memory } : { raw: inner },
232
+ maximumMemoryBytes: maximumBytes,
233
+ reinstantiate() {
234
+ const fresh = freshInstance(carried.glue, carried.module);
235
+ instanceFunctions = { ...fresh.instance };
236
+ if (fresh.memory)
237
+ carried.memory = fresh.memory;
238
+ else
239
+ delete carried.memory;
240
+ return fresh.memory ? { raw: inner, memory: fresh.memory } : { raw: inner };
241
+ }
242
+ });
243
+ guarded = runtime.raw;
244
+ return { runtime, raw: runtime.raw };
245
+ }
246
+ function instantiateOwnRuntime(module, options) {
247
+ const glue = loadGlue();
248
+ const fresh = freshInstance(glue, module);
249
+ const holder = { ...fresh.instance };
250
+ // The build checks the binary against this constant, so a Module compiled
251
+ // from the package's binary carries exactly this maximum.
252
+ return runtimeOverHolder(holder, fresh.memory, glue, module, XLSX_WASM_LINEAR_MEMORY_MAXIMUM_BYTES, options);
253
+ }
254
+ /** A view of the shared default instance with this bridge's own admission. */
255
+ function sharedDefaultView(options) {
256
+ const shared = sharedDefaultRuntime();
257
+ if (options.memoryBudgetBytes === undefined && options.admission === undefined) {
258
+ return shared;
259
+ }
260
+ const runtime = shared.runtime.withAdmission(options);
261
+ return { runtime, raw: runtime.raw };
262
+ }
263
+ function sharedDefaultRuntime() {
264
+ if (defaultRuntime) {
265
+ return defaultRuntime;
266
+ }
267
+ // In the repository the CommonJS shim exists and is the default instance,
268
+ // so in-process code that requires the glue by path shares sessions with
269
+ // this loader, as it did with the CommonJS glue.
270
+ const shimPath = generatedShimPath();
271
+ if (existsSync(shimPath)) {
272
+ const shim = nativeRequire(shimPath);
273
+ const carried = shim[SHIM_INSTANCE_KEY];
274
+ if (carried) {
275
+ const bytes = readFileSync(generatedBinaryPath());
276
+ moduleSha256.set(carried.module, sha256(bytes));
277
+ defaultRuntime = runtimeOverShim(shim, carried, maximumMemoryBytes(bytes));
278
+ return defaultRuntime;
279
+ }
280
+ }
281
+ const bytes = readFileSync(generatedBinaryPath());
282
+ const module = new WebAssembly.Module(bytes);
283
+ moduleSha256.set(module, sha256(bytes));
284
+ const glue = loadGlue();
285
+ const fresh = freshInstance(glue, module);
286
+ const holder = { ...fresh.instance };
287
+ defaultRuntime = runtimeOverHolder(holder, fresh.memory, glue, module, maximumMemoryBytes(bytes), {});
288
+ return defaultRuntime;
289
+ }
290
+ /**
291
+ * SHA-256 of the WebAssembly binary this loader instantiates. Hosts report it
292
+ * with the bridge version so a deployed runtime is identifiable without
293
+ * reading the package's directory layout.
294
+ */
295
+ export function generatedWasmModuleSha256() {
296
+ return sha256(readFileSync(generatedBinaryPath()));
297
+ }
@@ -0,0 +1,77 @@
1
+ /** The 64 KiB wasm page. */
2
+ export declare const XLSX_WASM_PAGE_BYTES: number;
3
+ /**
4
+ * The linear-memory maximum `scripts/build-wasm.mjs` sets at link time
5
+ * (`-C link-arg=--max-memory`). 2 GiB is the value the S34 runtime policy
6
+ * ruling sets: half the wasm32 address space, so a runaway allocation traps
7
+ * well before the engine's 4 GiB ceiling, with room above the 1 GiB point
8
+ * where xlsx-api recycles a worker. The build checks the emitted module
9
+ * against this number.
10
+ */
11
+ export declare const XLSX_WASM_LINEAR_MEMORY_MAXIMUM_BYTES: number;
12
+ /**
13
+ * Pre-admission estimate weights. They are coarse and they are NOT upper
14
+ * bounds. One measurement so far (gate job d950f2f82b9948d8b4ae62b28d0a80d0,
15
+ * the memory-contract test's 5,000 x 21 workbook with one SUM per row): the
16
+ * estimate was 26.7 MB for open plus recalculation, and linear memory grew
17
+ * 244 MB. So admission refuses packages whose declared size or shape is far
18
+ * over budget, and a workbook it admits can still exhaust memory; trap
19
+ * containment is the backstop. Calibrating these needs retained and peak
20
+ * figures per workbook shape.
21
+ *
22
+ * A part's declared uncompressed bytes count twice (the inflated XML plus
23
+ * the model built from it), and each cell a sheet can hold counts
24
+ * `ESTIMATE_BYTES_PER_CELL` (cell record, layout and calc-graph entries). A
25
+ * sheet's cell count is the smaller of its `<dimension>` area and what its XML
26
+ * size can carry at `ESTIMATE_MIN_CELL_XML_BYTES` per cell, so a sparse sheet
27
+ * with a whole-grid dimension is not refused for its declared shape.
28
+ */
29
+ export declare const ESTIMATE_PART_EXPANSION = 2;
30
+ export declare const ESTIMATE_BYTES_PER_CELL = 128;
31
+ export declare const ESTIMATE_MIN_CELL_XML_BYTES = 10;
32
+ /** Recalculation working set per cell the session holds. */
33
+ export declare const ESTIMATE_RECALC_BYTES_PER_CELL = 64;
34
+ /**
35
+ * How much compressed input one `<dimension>` read may consume. Output alone
36
+ * does not bound the work: an empty stored block is 5 input bytes and no
37
+ * output, so a part made of them would keep the decoder looping through its
38
+ * whole declared size. 64 KiB is four times the output prefix, which covers
39
+ * a stored (uncompressible) prefix with room to spare.
40
+ */
41
+ export declare const DIMENSION_INPUT_BYTES: number;
42
+ export interface XlsxWasmMemoryLimits {
43
+ readonly minimumBytes: number;
44
+ /** Undefined when the module declares no maximum. */
45
+ readonly maximumBytes: number | undefined;
46
+ }
47
+ /**
48
+ * The linear-memory limits of a wasm binary's first defined memory (memory
49
+ * section, id 5), or undefined when the binary defines none or is not wasm.
50
+ */
51
+ export declare function readWasmMemoryLimits(bytes: Uint8Array): XlsxWasmMemoryLimits | undefined;
52
+ export interface XlsxPackageMemoryEstimate {
53
+ /** Bytes handed to the bridge (copied into linear memory as is). */
54
+ readonly packageBytes: number;
55
+ /** False when no ZIP central directory was found; the estimate is then the package size. */
56
+ readonly zipReadable: boolean;
57
+ readonly partCount: number;
58
+ /** Sum of the parts' declared uncompressed sizes. */
59
+ readonly declaredUncompressedBytes: number;
60
+ readonly worksheetCount: number;
61
+ /** Cells the worksheets can hold (dimension area, bounded by XML size). */
62
+ readonly cellBound: number;
63
+ /** Worksheets whose `<dimension>` was read. */
64
+ readonly dimensionsRead: number;
65
+ /** The open estimate: package + expanded parts + cells. */
66
+ readonly estimatedBytes: number;
67
+ /** The recalculation working-set estimate for the same workbook. */
68
+ readonly recalcEstimatedBytes: number;
69
+ }
70
+ /**
71
+ * Estimate the linear memory opening `bytes` needs, from the package's
72
+ * declared part sizes and sheet dimensions, without calling into wasm. Never
73
+ * throws: a malformed package gets the package-size estimate and the native
74
+ * open reports its own typed error.
75
+ */
76
+ export declare function estimateXlsxPackageMemory(bytes: Uint8Array): XlsxPackageMemoryEstimate;
77
+ export declare function inflateRawPrefix(input: Uint8Array, maxOutput: number, maxInput?: number): Uint8Array;