@docmentis/udoc-node 0.0.1 → 0.8.1

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/worker.js ADDED
@@ -0,0 +1,246 @@
1
+ // The worker thread that holds one document's session.
2
+ //
3
+ // One document, one worker, one wasm instance. The session's calls are
4
+ // synchronous and CPU-bound — composing and rasterizing a page holds the thread
5
+ // for as long as it takes — so they run here, off the embedder's event loop.
6
+ // And since a trap leaves an instance unusable, an instance per document means
7
+ // a document that brings the engine down takes nothing else with it.
8
+ import { readFile } from "node:fs/promises";
9
+ import { parentPort, workerData } from "node:worker_threads";
10
+ import { UDocError, createFontFetchMemory, fetchFontBinaries, initSync, officeCompatibleFontsAt, startSession, } from "@docmentis/udoc-wasm";
11
+ import { bundledFontUrls } from "@docmentis/udoc-wasm/meta-url";
12
+ import { blockingFetch } from "./blocking-fetch.js";
13
+ const init = workerData;
14
+ initSync({ module: init.module });
15
+ const port = parentPort;
16
+ /** The document's session, once `open` has started one. */
17
+ let session = null;
18
+ /** The page limit that composes every page: the largest wasm32 `usize`. */
19
+ const WHOLE_DOCUMENT = 2 ** 32 - 1;
20
+ /** What the fulfiller remembers across this document's font orders: the css2
21
+ * responses it has read, and the files it has handed over. */
22
+ const fontMemory = createFontFetchMemory();
23
+ /** Where a font file is asked for, once the open has carried it: the session's
24
+ * side, which keeps the files for every document of its `UDocNode`. */
25
+ let fontFiles = null;
26
+ /** The font files asked for and not answered yet, by their request's id. */
27
+ const fontFilesPending = new Map();
28
+ let nextFontFileId = 1;
29
+ /** The request being handled, which the next one waits behind. */
30
+ let handling = Promise.resolve();
31
+ port.on("message", (request) => {
32
+ // One at a time. A call that composes waits for its fonts partway through,
33
+ // and nothing else may touch the session while it does.
34
+ handling = handling.then(async () => {
35
+ const reply = await handle(request);
36
+ // Saved or exported bytes are a fresh copy out of wasm memory, so their
37
+ // buffer is this reply's alone to hand over.
38
+ const transfer = reply.ok && reply.result instanceof Uint8Array ? [reply.result.buffer] : [];
39
+ port.postMessage(reply, transfer);
40
+ });
41
+ });
42
+ async function handle(request) {
43
+ const { id } = request;
44
+ try {
45
+ switch (request.type) {
46
+ case "open":
47
+ case "openRemote":
48
+ fontFiles = request.fontFiles;
49
+ fontFiles.on("message", settleFontFile);
50
+ // Permitted first, then the permit is spent on this document
51
+ // whether or not it parses: one session, one permit, one document.
52
+ session = await startSession(init.config, bundledFontUrls, init.googleFontFamilies);
53
+ // The host's own fonts first: of two faces on one descriptor,
54
+ // the first registered answers, so a host's face outranks the
55
+ // package's — as in a browser, where the package's go in by URL
56
+ // and every face given as bytes outranks those.
57
+ registerHostFonts(session);
58
+ // The office-compatible fonts are files beside the engine, not
59
+ // inside it. By URL, nearly every office document would compose
60
+ // once in a stand-in and again when they landed, so they go in
61
+ // as bytes, before the document opens.
62
+ for (const bytes of await officeCompatibleFonts())
63
+ session.registerLocalFont(bytes);
64
+ if (request.type === "open")
65
+ session.open(request.bytes, request.format, request.delimiter);
66
+ // The session keeps the fetch: a page composed later may need a
67
+ // part not fetched yet.
68
+ else
69
+ session.openRemote(request.url, blockingFetch(request.fetches));
70
+ return { id, ok: true, result: openedAs(session) };
71
+ case "authenticate":
72
+ // Not a second open: the permit was spent on this document by
73
+ // the open that found it needs a password.
74
+ if (!session)
75
+ throw new UDocError("invalidRequest", "no document is open");
76
+ return { id, ok: true, result: session.authenticate(request.password) };
77
+ case "pageCount": {
78
+ const s = opened();
79
+ // Nothing is known about a page until it is composed, so the
80
+ // count is known only once every page is: compose the whole
81
+ // primary plane. A pass that falls short had a page fail, and
82
+ // then the count is not known at all.
83
+ if (!(await updateLayoutSettled(s, WHOLE_DOCUMENT))) {
84
+ throw new UDocError("malformed", `the page count is unknown: a page failed to compose after ${s.composedPageCount()} page(s)`);
85
+ }
86
+ return { id, ok: true, result: s.composedPageCount() };
87
+ }
88
+ case "saveToBytes":
89
+ return {
90
+ id,
91
+ ok: true,
92
+ result: opened().saveToBytes(request.format, request.strategy, request.delimiter),
93
+ };
94
+ case "saveToPackage":
95
+ return { id, ok: true, result: opened().saveToPackage(request.version) };
96
+ case "exportToBytes":
97
+ return { id, ok: true, result: opened().exportToBytes(request.format) };
98
+ case "exportPageToBytes": {
99
+ const s = opened();
100
+ // A page is known only once composed, so compose through the
101
+ // one asked for — not the whole document. If the pass finishes
102
+ // the document short of it, the page doesn't exist.
103
+ const complete = await updateLayoutSettled(s, request.index);
104
+ const count = s.composedPageCount();
105
+ if (request.index >= count) {
106
+ if (complete) {
107
+ // Says what the document has, not which page was asked
108
+ // for: a host numbers pages its own way (the CLI from
109
+ // 1) and words the address itself.
110
+ const message = `the document has ${count} page(s)`;
111
+ return { id, ok: false, failure: { code: "notFound", message } };
112
+ }
113
+ throw new UDocError("malformed", `page index ${request.index} is not composed: the document composed ${count} page(s)`);
114
+ }
115
+ // Plane 0 — the document's primary plane (the deck for a
116
+ // presentation).
117
+ return { id, ok: true, result: s.exportPageToBytes(0, request.index, request.format) };
118
+ }
119
+ case "snapshot":
120
+ return { id, ok: true, result: opened().snapshot() };
121
+ case "versionVector":
122
+ return { id, ok: true, result: opened().versionVector() };
123
+ case "patchSince":
124
+ return { id, ok: true, result: opened().patchSince(request.peer) };
125
+ case "merge":
126
+ opened().mergePatch(request.patch);
127
+ return { id, ok: true, result: undefined };
128
+ case "presence":
129
+ return { id, ok: true, result: opened().presence() };
130
+ case "mergePresence":
131
+ opened().mergePresence(request.presence);
132
+ return { id, ok: true, result: undefined };
133
+ }
134
+ }
135
+ catch (error) {
136
+ return { id, ok: false, failure: failureOf(error) };
137
+ }
138
+ }
139
+ function opened() {
140
+ if (!session)
141
+ throw new UDocError("invalidRequest", "no document is open");
142
+ // Said here, for every call, rather than as whichever call it was failing
143
+ // for want of a document.
144
+ if (session.needsPassword()) {
145
+ throw new UDocError("passwordRequired", "the document needs a password: authenticate it first");
146
+ }
147
+ return session;
148
+ }
149
+ /** The office-compatible fonts `@docmentis/udoc-wasm` ships, read from its
150
+ * `dist/fonts/` — `file:` URLs under Node. */
151
+ function officeCompatibleFonts() {
152
+ return Promise.all(officeCompatibleFontsAt(bundledFontUrls).map((font) => readFile(new URL(font.url))));
153
+ }
154
+ /** Offer `s` the host's own fonts: bytes as they are, the rest by URL. */
155
+ function registerHostFonts(s) {
156
+ const urlFonts = [];
157
+ for (const font of init.fonts) {
158
+ if (font instanceof Uint8Array)
159
+ s.registerLocalFont(font);
160
+ else
161
+ urlFonts.push(font);
162
+ }
163
+ s.registerUrlFonts(urlFonts);
164
+ }
165
+ /**
166
+ * Compose through page `index`, then fill every font order the composing
167
+ * placed and compose again, until none is left — so what a call answers with
168
+ * is drawn in the document's fonts, never in the stand-in a font still on order
169
+ * is drawn in. Whether the document composed to its end, as `updateLayout`
170
+ * says it.
171
+ *
172
+ * It ends: each settled order installs its font or retires its characters from
173
+ * that vendor — putting the next one on order — and a family's chain of vendors
174
+ * is finite.
175
+ */
176
+ async function updateLayoutSettled(s, index) {
177
+ let complete = s.updateLayout({ pages: { start: 0, limit: index } });
178
+ for (let orders = s.takeFontRequests(); orders.length > 0; orders = s.takeFontRequests()) {
179
+ const settled = await Promise.all(orders.map(async (order) => [order.id, await fetchFontBinaries(order, fetchFont, fontMemory, init.googleFontEndpoint)]));
180
+ for (const [id, binaries] of settled)
181
+ s.completeFontRequest(BigInt(id), binaries);
182
+ // A round of nothing but refusals installed nothing, so there is nothing
183
+ // to re-shape; the next vendors are already on order.
184
+ if (settled.every(([, binaries]) => binaries.length === 0))
185
+ continue;
186
+ s.refreshFonts();
187
+ // Re-shaping can move page breaks, so the page asked for may sit
188
+ // beyond what is composed now.
189
+ complete = s.updateLayout({ pages: { start: 0, limit: index } });
190
+ }
191
+ return complete;
192
+ }
193
+ /** How the fulfiller fetches under Node: a `file:` URL — the package's fonts,
194
+ * or a host's — read from disk, which Node's `fetch` can't; a css2 stylesheet
195
+ * by `fetch`, each time; any other file from the cache every session of this
196
+ * document's `UDocNode` shares. */
197
+ async function fetchFont(url, requestInit) {
198
+ if (url.startsWith("file:"))
199
+ return new Response(await readFile(new URL(url)));
200
+ if (url.startsWith(`${init.googleFontEndpoint}?`))
201
+ return fetch(url, requestInit);
202
+ return new Response(await fetchCachedFont(url));
203
+ }
204
+ /** The font file at `url`, asked of the session's side, which keeps it. */
205
+ function fetchCachedFont(url) {
206
+ const files = fontFiles;
207
+ if (!files)
208
+ return Promise.reject(new Error("no document is open"));
209
+ const id = nextFontFileId++;
210
+ return new Promise((resolve, reject) => {
211
+ fontFilesPending.set(id, { resolve, reject });
212
+ files.postMessage({ id, url });
213
+ });
214
+ }
215
+ /** Settle the font file `answer` is for. */
216
+ function settleFontFile(answer) {
217
+ const pending = fontFilesPending.get(answer.id);
218
+ if (!pending)
219
+ return;
220
+ fontFilesPending.delete(answer.id);
221
+ if (answer.ok)
222
+ pending.resolve(answer.body);
223
+ else
224
+ pending.reject(new Error(answer.message));
225
+ }
226
+ /** What `s`, just opened, opened as. */
227
+ function openedAs(s) {
228
+ const docType = s.docType();
229
+ if (docType === undefined)
230
+ throw new UDocError("internal", "the document opened, but its doc type is unknown");
231
+ const sourceFormat = s.sourceFormat();
232
+ return {
233
+ docType,
234
+ ...(sourceFormat !== undefined ? { sourceFormat } : {}),
235
+ fromPackage: s.fromPackage(),
236
+ needsPassword: s.needsPassword(),
237
+ entitlements: s.entitlements(),
238
+ };
239
+ }
240
+ /** `error` as it crosses to the session's side. A panic aborts, and an abort
241
+ * in wasm is a trap, which `UDocError.from` reads as `crashed`. */
242
+ function failureOf(error) {
243
+ const { code, message, detail } = UDocError.from(error);
244
+ return { code, message, ...(detail && { detail }) };
245
+ }
246
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,uEAAuE;AACvE,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAC/E,qEAAqE;AAErE,OAAO,EAAE,QAA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M,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,63 @@
1
1
  {
2
- "name": "@docmentis/udoc-node",
3
- "version": "0.0.1",
4
- "description": "Placeholder: the first release is on its way.",
5
- "license": "MIT OR Apache-2.0",
6
- "repository": { "type": "git", "url": "git+https://github.com/docMentis/docmentis-udoc.git", "directory": "packages/udoc-node" }
2
+ "name": "@docmentis/udoc-node",
3
+ "version": "0.8.1",
4
+ "description": "Read, render, and process documents programmatically in Node.js.",
5
+ "keywords": [
6
+ "document",
7
+ "pdf",
8
+ "docx",
9
+ "pptx",
10
+ "xlsx",
11
+ "word",
12
+ "powerpoint",
13
+ "excel",
14
+ "office",
15
+ "csv",
16
+ "render",
17
+ "png",
18
+ "nodejs",
19
+ "worker-threads",
20
+ "docmentis",
21
+ "udoc",
22
+ "webassembly",
23
+ "wasm"
24
+ ],
25
+ "homepage": "https://www.docmentis.com",
26
+ "license": "MIT OR Apache-2.0",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/docMentis/docmentis-udoc.git",
30
+ "directory": "packages/udoc-node"
31
+ },
32
+ "type": "module",
33
+ "sideEffects": false,
34
+ "files": [
35
+ "dist",
36
+ "LICENSE-MIT",
37
+ "LICENSE-APACHE"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "main": "./dist/index.js",
43
+ "types": "./dist/index.d.ts",
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist/index.d.ts",
47
+ "import": "./dist/index.js"
48
+ }
49
+ },
50
+ "engines": {
51
+ "node": ">=22.18"
52
+ },
53
+ "scripts": {
54
+ "dev": "tsc -p tsconfig.json --watch",
55
+ "build": "npm run clean && node scripts/check-version.mjs && tsc -p tsconfig.json",
56
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
57
+ "test": "node --test",
58
+ "clean": "rm -rf dist"
59
+ },
60
+ "dependencies": {
61
+ "@docmentis/udoc-wasm": "0.8.3"
62
+ }
7
63
  }