@reportwright/engine 0.12.1 → 0.13.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 +78 -0
- package/README.md +79 -0
- package/THIRD-PARTY-NOTICES.md +52 -0
- package/dist/index.js +5727 -4524
- package/dist/pdfstreamworker.js +2 -2
- package/dist/types/packages/engine/entry.d.ts +70 -2
- package/dist/types/src/engine/data/index.d.ts +14 -1
- package/dist/types/src/engine/expr/evaluate.d.ts +1 -0
- package/dist/types/src/engine/index.d.ts +11 -3
- package/dist/types/src/engine/lazylibs.d.ts +46 -0
- package/dist/types/src/engine/notices.d.ts +1 -0
- package/dist/types/src/engine/options.d.ts +10 -0
- package/dist/types/src/engine/schema/report.schema.d.ts +3 -0
- package/dist/types/src/engine/stream.d.ts +30 -35
- package/dist/types/src/engine/text/fonts.d.ts +30 -5
- package/dist/types/src/engine/text/measure.d.ts +4 -0
- package/dist/types/src/engine/text/standard.d.ts +42 -0
- package/dist/types/src/exporters/docx.d.ts +14 -0
- package/dist/types/src/exporters/officestream.d.ts +27 -0
- package/dist/types/src/exporters/pdf.d.ts +5 -3
- package/dist/types/src/exporters/pdfstandard.d.ts +23 -0
- package/dist/types/src/exporters/pdfstream.d.ts +13 -6
- package/dist/types/src/exporters/subset.d.ts +14 -0
- package/dist/types/src/exporters/xlsxstream.d.ts +22 -0
- package/package.json +5 -3
- package/report.d.ts +1 -0
- package/schema.json +3 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @typedef {{ title: string, page: number, top?: number, level?: number }} OutlineEntry
|
|
5
|
-
* page: 1-based; top: the destination's y in PDF space (from the bottom), else the page fits the window.
|
|
2
|
+
* p, or signal's reason as soon as it aborts (p goes on, unwatched).
|
|
3
|
+
* @template T @param {Promise<T>} p @param {AbortSignal} [signal] @returns {Promise<T>}
|
|
6
4
|
*/
|
|
5
|
+
export function raced<T>(p: Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
7
6
|
/**
|
|
8
7
|
* @param {Sink} sink
|
|
9
8
|
* @param {{ fontStore: import('../engine/text/fonts.js').FontStore, fonts?: string[],
|
|
10
9
|
* subset?: (font: Uint8Array, codePoints: Iterable<number>, opt?: { glyphs?: Iterable<number> }) => Promise<Uint8Array>,
|
|
11
|
-
* id?: string }} opt
|
|
10
|
+
* id?: string, signal?: AbortSignal }} opt
|
|
12
11
|
* fonts: font keys to name now (F1, F2… in this order); any other font is named on first use.
|
|
13
12
|
* subset: subset.js's subsetter; without it fonts embed in full. id: the file ID (32 hex digits), else random.
|
|
13
|
+
* signal: stops a wait for the sink (back-pressure) when it aborts.
|
|
14
14
|
*/
|
|
15
15
|
export function createPdfStream(sink: Sink, opt: {
|
|
16
16
|
fontStore: import("../engine/text/fonts.js").FontStore;
|
|
@@ -19,6 +19,7 @@ export function createPdfStream(sink: Sink, opt: {
|
|
|
19
19
|
glyphs?: Iterable<number>;
|
|
20
20
|
}) => Promise<Uint8Array>;
|
|
21
21
|
id?: string;
|
|
22
|
+
signal?: AbortSignal;
|
|
22
23
|
}): {
|
|
23
24
|
/** @param {string} key @returns {string} the font's resource name (F1…) */
|
|
24
25
|
fontName: (key: string) => string;
|
|
@@ -127,6 +128,9 @@ export function createPdfStream(sink: Sink, opt: {
|
|
|
127
128
|
* opts: render()'s options and exportPdf's (fontStore, subset, title, author, creationDate, drillBase…). Tagged
|
|
128
129
|
* (PDF/UA-1) and PDF/A files stream too; encrypted and signed files, save options and PDF/A without a colour profile
|
|
129
130
|
* take the whole-model path (the result's why says which).
|
|
131
|
+
* timeoutMs (or deadline) bounds the whole export, waits for the sink included; signal (an AbortSignal) stops it at its
|
|
132
|
+
* next wait (a row batch, the sink, a sort, a page). Stopped or failed: it rejects (the signal's reason, an AbortError;
|
|
133
|
+
* a timeout: status 504, code 'ETIMEDOUT'), the rows' cursors are closed, a sort's temporary files removed.
|
|
130
134
|
* @param {any} def @param {any} opts @param {Sink} sink
|
|
131
135
|
* @returns {Promise<{ streamed: boolean, pages: number, warnings: string[], why?: string }>}
|
|
132
136
|
*/
|
|
@@ -158,12 +162,13 @@ export function paintPage(pg: any, H: number, env: any): {
|
|
|
158
162
|
};
|
|
159
163
|
/**
|
|
160
164
|
* What paintPage draws with: a writer's resource names and glyph records (w), the fonts, shaped glyphs' texts.
|
|
161
|
-
* @param {any} w @param {any} fontStore @param {{ drillBase?: string, pageRef?: (i: number) => any, tags?: any }} [o]
|
|
165
|
+
* @param {any} w @param {any} fontStore @param {{ drillBase?: string, pageRef?: (i: number) => any, tags?: any, embedAll?: boolean }} [o]
|
|
162
166
|
*/
|
|
163
167
|
export function paintEnv(w: any, fontStore: any, o?: {
|
|
164
168
|
drillBase?: string;
|
|
165
169
|
pageRef?: (i: number) => any;
|
|
166
170
|
tags?: any;
|
|
171
|
+
embedAll?: boolean;
|
|
167
172
|
}): {
|
|
168
173
|
shared: {
|
|
169
174
|
font: (f: any) => any;
|
|
@@ -180,6 +185,8 @@ export function paintEnv(w: any, fontStore: any, o?: {
|
|
|
180
185
|
reserve: () => any;
|
|
181
186
|
drillBase: string;
|
|
182
187
|
tags: any;
|
|
188
|
+
/** PDF/A, PDF/UA: standard fonts drawn in embedded stand-ins; the families that were @type {Set<string>|null} */
|
|
189
|
+
embedded: Set<string> | null;
|
|
183
190
|
};
|
|
184
191
|
/**
|
|
185
192
|
* write may return a promise (awaited: back-pressure), or false with a 'drain' event to wait for (a Node Writable).
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tables of a single-face sfnt (TrueType or CFF) as a Map of tag to bytes. A collection (ttcf) gives an empty map.
|
|
3
|
+
* @param {Uint8Array} bytes
|
|
4
|
+
*/
|
|
5
|
+
export function sfntTables(bytes: Uint8Array): Map<any, any>;
|
|
6
|
+
/** A sfnt from its tables: directory, 4-byte padding, table checksums and the head checkSumAdjustment. */
|
|
7
|
+
export function buildSfnt(version: any, tables: any): Uint8Array<ArrayBuffer>;
|
|
8
|
+
/**
|
|
9
|
+
* The name table with the given strings replaced (nameID to text). Each replaced string is written in its record's own
|
|
10
|
+
* encoding: UTF-16BE for Windows and Unicode, one byte per character for Macintosh.
|
|
11
|
+
* @param {Uint8Array} name
|
|
12
|
+
* @param {Map<number, string>} strings
|
|
13
|
+
*/
|
|
14
|
+
export function setNameStrings(name: Uint8Array, strings: Map<number, string>): Uint8Array<ArrayBuffer>;
|
|
1
15
|
/** @param {() => Promise<ArrayBuffer|Uint8Array>} loadWasm */
|
|
2
16
|
export function createSubsetter(loadWasm: () => Promise<ArrayBuffer | Uint8Array>): (font: Uint8Array, codePoints: Iterable<number>, opt?: {
|
|
3
17
|
glyphs?: Iterable<number>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {{ name: string, title: string, columns: number[], timeZone: string|null, locale: string|null, currency: string|null, rows: () => AsyncGenerator<any> }} plan
|
|
3
|
+
* @param {(bytes: Uint8Array) => any} put the zip's bytes as they come (awaited: back-pressure)
|
|
4
|
+
* @param {{ currency?: string, title?: string, formulas?: boolean, maxRows?: number, timeZone?: string }} [opt]
|
|
5
|
+
*/
|
|
6
|
+
export function writeXlsxStream(plan: {
|
|
7
|
+
name: string;
|
|
8
|
+
title: string;
|
|
9
|
+
columns: number[];
|
|
10
|
+
timeZone: string | null;
|
|
11
|
+
locale: string | null;
|
|
12
|
+
currency: string | null;
|
|
13
|
+
rows: () => AsyncGenerator<any>;
|
|
14
|
+
}, put: (bytes: Uint8Array) => any, opt?: {
|
|
15
|
+
currency?: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
formulas?: boolean;
|
|
18
|
+
maxRows?: number;
|
|
19
|
+
timeZone?: string;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
export const EXCEL_ROWS: 1048576;
|
|
22
|
+
export const EXCEL_COLS: 16384;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reportwright/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"schema.json",
|
|
58
58
|
"README.md",
|
|
59
59
|
"CHANGELOG.md",
|
|
60
|
-
"LICENSE"
|
|
60
|
+
"LICENSE",
|
|
61
|
+
"THIRD-PARTY-NOTICES.md"
|
|
61
62
|
],
|
|
62
63
|
"engines": {
|
|
63
64
|
"node": ">=20.9"
|
|
@@ -66,12 +67,13 @@
|
|
|
66
67
|
"dependencies": {
|
|
67
68
|
"pdf-lib": "1.17.1",
|
|
68
69
|
"@pdf-lib/fontkit": "1.1.1",
|
|
70
|
+
"@pdf-lib/standard-fonts": "1.0.0",
|
|
69
71
|
"bwip-js": "4.11.4",
|
|
70
72
|
"fflate": "0.8.3",
|
|
71
73
|
"bidi-js": "1.0.3"
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|
|
74
|
-
"@reportwright/fonts": "0.
|
|
76
|
+
"@reportwright/fonts": "0.13.0"
|
|
75
77
|
},
|
|
76
78
|
"peerDependenciesMeta": {
|
|
77
79
|
"@reportwright/fonts": {
|
package/report.d.ts
CHANGED