@laminapdf/sdk 0.0.0-stage → 0.2.0-alpha.2
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/README.md +208 -2
- package/dist/api.d.ts +23 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +11 -0
- package/dist/api.js.map +1 -0
- package/dist/builder.d.ts +319 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +540 -0
- package/dist/builder.js.map +1 -0
- package/dist/defined.d.ts +5 -0
- package/dist/defined.d.ts.map +1 -0
- package/dist/defined.js +7 -0
- package/dist/defined.js.map +1 -0
- package/dist/document.d.ts +241 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +427 -0
- package/dist/document.js.map +1 -0
- package/dist/entry/node.d.ts +30 -0
- package/dist/entry/node.d.ts.map +1 -0
- package/dist/entry/node.js +37 -0
- package/dist/entry/node.js.map +1 -0
- package/dist/entry/workerd.d.ts +30 -0
- package/dist/entry/workerd.d.ts.map +1 -0
- package/dist/entry/workerd.js +37 -0
- package/dist/entry/workerd.js.map +1 -0
- package/dist/errors.d.ts +102 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +137 -0
- package/dist/errors.js.map +1 -0
- package/dist/explain.d.ts +20 -0
- package/dist/explain.d.ts.map +1 -0
- package/dist/explain.js +14 -0
- package/dist/explain.js.map +1 -0
- package/dist/font.d.ts +66 -0
- package/dist/font.d.ts.map +1 -0
- package/dist/font.js +103 -0
- package/dist/font.js.map +1 -0
- package/dist/generated/builder-enums.d.ts +29 -0
- package/dist/generated/builder-enums.d.ts.map +1 -0
- package/dist/generated/builder-enums.js +80 -0
- package/dist/generated/builder-enums.js.map +1 -0
- package/dist/generated/codes.d.ts +97 -0
- package/dist/generated/codes.d.ts.map +1 -0
- package/dist/generated/codes.js +453 -0
- package/dist/generated/codes.js.map +1 -0
- package/dist/generated/explain.d.ts +6 -0
- package/dist/generated/explain.d.ts.map +1 -0
- package/dist/generated/explain.js +138 -0
- package/dist/generated/explain.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +80 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +127 -0
- package/dist/init.js.map +1 -0
- package/dist/loader/fetch.d.ts +3 -0
- package/dist/loader/fetch.d.ts.map +1 -0
- package/dist/loader/fetch.js +2 -0
- package/dist/loader/fetch.js.map +1 -0
- package/dist/loader/node.d.ts +3 -0
- package/dist/loader/node.d.ts.map +1 -0
- package/dist/loader/node.js +9 -0
- package/dist/loader/node.js.map +1 -0
- package/dist/loader/workerd.d.ts +3 -0
- package/dist/loader/workerd.d.ts.map +1 -0
- package/dist/loader/workerd.js +15 -0
- package/dist/loader/workerd.js.map +1 -0
- package/dist/matrix.d.ts +16 -0
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +36 -0
- package/dist/matrix.js.map +1 -0
- package/dist/path.d.ts +34 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +49 -0
- package/dist/path.js.map +1 -0
- package/dist/source/http.d.ts +36 -0
- package/dist/source/http.d.ts.map +1 -0
- package/dist/source/http.js +211 -0
- package/dist/source/http.js.map +1 -0
- package/dist/source/range.d.ts +70 -0
- package/dist/source/range.d.ts.map +1 -0
- package/dist/source/range.js +96 -0
- package/dist/source/range.js.map +1 -0
- package/dist/text.d.ts +90 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +127 -0
- package/dist/text.js.map +1 -0
- package/dist/transaction.d.ts +36 -0
- package/dist/transaction.d.ts.map +1 -0
- package/dist/transaction.js +47 -0
- package/dist/transaction.js.map +1 -0
- package/dist/types.d.ts +79 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/worker/client.d.ts +87 -0
- package/dist/worker/client.d.ts.map +1 -0
- package/dist/worker/client.js +405 -0
- package/dist/worker/client.js.map +1 -0
- package/dist/worker/emitter.d.ts +12 -0
- package/dist/worker/emitter.d.ts.map +1 -0
- package/dist/worker/emitter.js +34 -0
- package/dist/worker/emitter.js.map +1 -0
- package/dist/worker/entry.d.ts +2 -0
- package/dist/worker/entry.d.ts.map +1 -0
- package/dist/worker/entry.js +4 -0
- package/dist/worker/entry.js.map +1 -0
- package/dist/worker/index.d.ts +7 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +4 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/protocol.d.ts +82 -0
- package/dist/worker/protocol.d.ts.map +1 -0
- package/dist/worker/protocol.js +11 -0
- package/dist/worker/protocol.js.map +1 -0
- package/dist/worker/server.d.ts +51 -0
- package/dist/worker/server.d.ts.map +1 -0
- package/dist/worker/server.js +460 -0
- package/dist/worker/server.js.map +1 -0
- package/dist/worker/support.d.ts +39 -0
- package/dist/worker/support.d.ts.map +1 -0
- package/dist/worker/support.js +25 -0
- package/dist/worker/support.js.map +1 -0
- package/dist/worker/transfer.d.ts +3 -0
- package/dist/worker/transfer.d.ts.map +1 -0
- package/dist/worker/transfer.js +13 -0
- package/dist/worker/transfer.js.map +1 -0
- package/dist/worker/types.d.ts +43 -0
- package/dist/worker/types.d.ts.map +1 -0
- package/dist/worker/types.js +2 -0
- package/dist/worker/types.js.map +1 -0
- package/package.json +91 -3
- package/schemas/error.schema.json +288 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Document, PageRef } from "../document.js";
|
|
2
|
+
/**
|
|
3
|
+
* Document members with no remote twin:
|
|
4
|
+
* - `transact` takes a callback, which can't cross to a worker: use `apply` with ops;
|
|
5
|
+
* - `saveJob` returns a job the caller steps: the remote `save`/`saveWithReport` are stepped
|
|
6
|
+
* jobs already, cancelled through `signal`;
|
|
7
|
+
* - `ensure` fetches a range document's bytes: the worker does that for every call;
|
|
8
|
+
* - `free` and `Symbol.dispose`: the remote handle's `close()` and `Symbol.asyncDispose`.
|
|
9
|
+
*/
|
|
10
|
+
export type ExcludedDocumentMembers = "transact" | "saveJob" | "ensure" | "free" | typeof Symbol.dispose;
|
|
11
|
+
/** PageRef members with no remote twin: none. */
|
|
12
|
+
export type ExcludedPageMembers = never;
|
|
13
|
+
export type RemotableDocumentMember = Exclude<keyof Document, ExcludedDocumentMembers>;
|
|
14
|
+
export type RemotablePageMember = Exclude<keyof PageRef, ExcludedPageMembers>;
|
|
15
|
+
export declare const DOCUMENT_METHODS: {
|
|
16
|
+
readonly apply: 1;
|
|
17
|
+
readonly applyLog: 1;
|
|
18
|
+
readonly canExtractText: 0;
|
|
19
|
+
readonly hasUnsavedChanges: 0;
|
|
20
|
+
readonly info: 0;
|
|
21
|
+
readonly page: 1;
|
|
22
|
+
readonly pageById: 1;
|
|
23
|
+
readonly pageCount: 0;
|
|
24
|
+
readonly pageInfo: 1;
|
|
25
|
+
readonly pages: 0;
|
|
26
|
+
readonly rebase: 1;
|
|
27
|
+
readonly redo: 0;
|
|
28
|
+
readonly save: 1;
|
|
29
|
+
readonly saveWithReport: 1;
|
|
30
|
+
readonly undo: 0;
|
|
31
|
+
readonly warnings: 0;
|
|
32
|
+
};
|
|
33
|
+
export declare const PAGE_METHODS: {
|
|
34
|
+
readonly id: 0;
|
|
35
|
+
readonly index: 0;
|
|
36
|
+
readonly info: 0;
|
|
37
|
+
readonly text: 1;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../../src/worker/support.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,MAAM,CAAC,OAAO,CAAC;AAEzG,iDAAiD;AACjD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,QAAQ,EAAE,uBAAuB,CAAC,CAAC;AACvF,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,OAAO,EAAE,mBAAmB,CAAC,CAAC;AAE9E,eAAO,MAAM,gBAAgB;oBACpB,CAAC;uBACE,CAAC;6BACK,CAAC;gCACE,CAAC;mBACd,CAAC;mBACD,CAAC;uBACG,CAAC;wBACA,CAAC;uBACF,CAAC;oBACJ,CAAC;qBACA,CAAC;mBACH,CAAC;mBACD,CAAC;6BACS,CAAC;mBACX,CAAC;uBACG,CAAC;CAC+C,CAAC;AAE7D,eAAO,MAAM,YAAY;iBACnB,CAAC;oBACE,CAAC;mBACF,CAAC;mBACD,CAAC;CAC+C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const DOCUMENT_METHODS = {
|
|
2
|
+
apply: 1,
|
|
3
|
+
applyLog: 1,
|
|
4
|
+
canExtractText: 0,
|
|
5
|
+
hasUnsavedChanges: 0,
|
|
6
|
+
info: 0,
|
|
7
|
+
page: 1,
|
|
8
|
+
pageById: 1,
|
|
9
|
+
pageCount: 0,
|
|
10
|
+
pageInfo: 1,
|
|
11
|
+
pages: 0,
|
|
12
|
+
rebase: 1,
|
|
13
|
+
redo: 0,
|
|
14
|
+
save: 1,
|
|
15
|
+
saveWithReport: 1,
|
|
16
|
+
undo: 0,
|
|
17
|
+
warnings: 0,
|
|
18
|
+
};
|
|
19
|
+
export const PAGE_METHODS = {
|
|
20
|
+
id: 0,
|
|
21
|
+
index: 0,
|
|
22
|
+
info: 0,
|
|
23
|
+
text: 1,
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/worker/support.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,cAAc,EAAE,CAAC;IACjB,iBAAiB,EAAE,CAAC;IACpB,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,cAAc,EAAE,CAAC;IACjB,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;CAC+C,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,CAAC;IACL,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;CAC+C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/worker/transfer.ts"],"names":[],"mappings":"AAEA,sGAAsG;AACtG,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,EAAE,CAOnD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Which buffers a message between the page and the worker can move instead of copying.
|
|
2
|
+
/** The buffer of `value` if transferring it moves exactly `value` (not a larger or shared buffer). */
|
|
3
|
+
export function whole(value) {
|
|
4
|
+
if (value instanceof ArrayBuffer)
|
|
5
|
+
return [value];
|
|
6
|
+
if (!ArrayBuffer.isView(value))
|
|
7
|
+
return [];
|
|
8
|
+
const { buffer } = value;
|
|
9
|
+
return buffer instanceof ArrayBuffer && value.byteOffset === 0 && value.byteLength === buffer.byteLength
|
|
10
|
+
? [buffer]
|
|
11
|
+
: [];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=transfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../src/worker/transfer.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,sGAAsG;AACtG,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,WAAW;QAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1C,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,OAAO,MAAM,YAAY,WAAW,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU;QACtG,CAAC,CAAC,CAAC,MAAM,CAAC;QACV,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Document, PageRef } from "../document.js";
|
|
2
|
+
import type { Progress } from "../types.js";
|
|
3
|
+
import type { RemotableDocumentMember, RemotablePageMember } from "./support.js";
|
|
4
|
+
/** Per-call options of the worker client. */
|
|
5
|
+
export interface CallOptions {
|
|
6
|
+
/** Aborting it rejects the call (`cancelled`) and stops it in the worker (see the README). */
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
/** Progress of a stepped call (`save`), sent as events, at most every 50 ms. */
|
|
9
|
+
readonly onProgress?: (progress: Progress) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Transfer the input buffer to the worker instead of copying it: faster for large files, but
|
|
12
|
+
* the caller's buffer is detached (empty) afterwards. Default `false` (copy). Only a buffer
|
|
13
|
+
* the input covers whole moves: a subarray or a `SharedArrayBuffer` view is copied.
|
|
14
|
+
*/
|
|
15
|
+
readonly transfer?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Options of an extension call (`client.request`, for packages that extend the worker, such as
|
|
19
|
+
* `@laminapdf/viewer`): the worker runs the highest `priority` first, and runs calls with the same
|
|
20
|
+
* `key` once (each caller still gets its own answer).
|
|
21
|
+
*/
|
|
22
|
+
export interface RequestOptions extends CallOptions {
|
|
23
|
+
readonly priority?: number;
|
|
24
|
+
readonly key?: string;
|
|
25
|
+
}
|
|
26
|
+
/** `R` as the page receives it. */
|
|
27
|
+
export type RemoteResult<R> = R extends PageRef ? RemotePage : R;
|
|
28
|
+
/** A member of `T` as a remote method. */
|
|
29
|
+
export type RemoteMember<T> = T extends (...args: infer A) => infer R ? (...args: [...A, options?: CallOptions]) => Promise<RemoteResult<R>> : (options?: CallOptions) => Promise<RemoteResult<T>>;
|
|
30
|
+
/** A document in the worker. Close it (or `await using`) to free it there. */
|
|
31
|
+
export type RemoteDocument = {
|
|
32
|
+
readonly [K in RemotableDocumentMember]: RemoteMember<Document[K]>;
|
|
33
|
+
} & {
|
|
34
|
+
/** Frees the document in the worker; a second call, or one after the worker stopped, does nothing. */
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
/** `close()`, for `await using`. */
|
|
37
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
/** A page of a document in the worker (freed with its document). */
|
|
40
|
+
export type RemotePage = {
|
|
41
|
+
readonly [K in RemotablePageMember]: RemoteMember<PageRef[K]>;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEjF,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,mCAAmC;AACnC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,UAAU,GAAG,CAAC,CAAC;AAEjE,0CAA0C;AAC1C,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACjE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACpE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAExD,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,uBAAuB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG;IACpG,sGAAsG;IACtG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,oCAAoC;IACpC,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,mBAAmB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laminapdf/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
|
+
"description": "Create, read, edit and save PDFs from TypeScript: Lamina PDF's Rust core as WebAssembly, synchronous after init(), in browsers, Node, Deno, Bun and Cloudflare Workers.",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"homepage": "https://laminapdf.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/laudebugs/laminapdf.git",
|
|
10
|
+
"directory": "packages/sdk"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"pdf",
|
|
14
|
+
"pdf-generation",
|
|
15
|
+
"pdf-editing",
|
|
16
|
+
"wasm",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"schemas"
|
|
27
|
+
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"workerd": {
|
|
31
|
+
"types": "./dist/entry/workerd.d.ts",
|
|
32
|
+
"default": "./dist/entry/workerd.js"
|
|
33
|
+
},
|
|
34
|
+
"deno": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"browser": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"node": {
|
|
43
|
+
"types": "./dist/entry/node.d.ts",
|
|
44
|
+
"default": "./dist/entry/node.js"
|
|
45
|
+
},
|
|
46
|
+
"default": {
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
48
|
+
"default": "./dist/index.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./explain": {
|
|
52
|
+
"types": "./dist/explain.d.ts",
|
|
53
|
+
"default": "./dist/explain.js"
|
|
54
|
+
},
|
|
55
|
+
"./worker": {
|
|
56
|
+
"types": "./dist/worker/index.d.ts",
|
|
57
|
+
"default": "./dist/worker/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./worker/server": {
|
|
60
|
+
"types": "./dist/worker/server.d.ts",
|
|
61
|
+
"default": "./dist/worker/server.js"
|
|
62
|
+
},
|
|
63
|
+
"./schemas/error.schema.json": "./schemas/error.schema.json",
|
|
64
|
+
"./package.json": "./package.json"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@laminapdf/wasm": "0.2.0-alpha.2"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
71
|
+
"@types/node": "26.6.5",
|
|
72
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
73
|
+
"ajv": "8.20.0",
|
|
74
|
+
"bun": "1.4.4",
|
|
75
|
+
"deno": "2.9.6",
|
|
76
|
+
"esbuild": "0.28.2",
|
|
77
|
+
"playwright": "1.64.1",
|
|
78
|
+
"publint": "0.3.25",
|
|
79
|
+
"typescript": "7.0.2",
|
|
80
|
+
"vite": "8.3.5",
|
|
81
|
+
"vitest": "5.0.5",
|
|
82
|
+
"wrangler": "4.152.0",
|
|
83
|
+
"@laminapdf/test-utils": "0.0.0"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public"
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"build:wasm": "tsc -p tsconfig.build.json",
|
|
90
|
+
"typecheck:wasm": "tsc --noEmit -p tsconfig.json",
|
|
91
|
+
"test:wasm": "pnpm run build:wasm && tsc --noEmit -p tsconfig.json && vitest run -c vitest.node.config.ts --project node",
|
|
92
|
+
"lint:package": "publint --strict && attw --pack . --profile esm-only"
|
|
93
|
+
}
|
|
6
94
|
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$defs": {
|
|
3
|
+
"error": {
|
|
4
|
+
"properties": {
|
|
5
|
+
"code": {
|
|
6
|
+
"description": "The stable kebab-case code (fixtures/codes.json).",
|
|
7
|
+
"enum": [
|
|
8
|
+
"not-pdf",
|
|
9
|
+
"missing-root",
|
|
10
|
+
"reference-cycle",
|
|
11
|
+
"limit-exceeded",
|
|
12
|
+
"strict",
|
|
13
|
+
"data-pending",
|
|
14
|
+
"source",
|
|
15
|
+
"type",
|
|
16
|
+
"invalid-structure",
|
|
17
|
+
"unset-object",
|
|
18
|
+
"repaired-base",
|
|
19
|
+
"encrypted-base",
|
|
20
|
+
"password-required",
|
|
21
|
+
"wrong-password",
|
|
22
|
+
"unsupported-security-handler",
|
|
23
|
+
"unexpected-eof",
|
|
24
|
+
"syntax",
|
|
25
|
+
"unsupported-filter",
|
|
26
|
+
"decompress",
|
|
27
|
+
"nested-transaction",
|
|
28
|
+
"no-transaction",
|
|
29
|
+
"unknown-page",
|
|
30
|
+
"direct-page",
|
|
31
|
+
"unsupported-version",
|
|
32
|
+
"invalid-op-log",
|
|
33
|
+
"saved-not-rebased",
|
|
34
|
+
"no-pending-save",
|
|
35
|
+
"sink",
|
|
36
|
+
"not-rebased",
|
|
37
|
+
"sink-not-empty",
|
|
38
|
+
"would-invalidate-signatures",
|
|
39
|
+
"requires-rewrite",
|
|
40
|
+
"invalid-font",
|
|
41
|
+
"collection-index",
|
|
42
|
+
"unknown-axis",
|
|
43
|
+
"font-not-embeddable",
|
|
44
|
+
"missing-glyph",
|
|
45
|
+
"glyph-out-of-range",
|
|
46
|
+
"unknown-font",
|
|
47
|
+
"subset-failed",
|
|
48
|
+
"invalid-axis-value",
|
|
49
|
+
"wrong-document",
|
|
50
|
+
"invalid-feature",
|
|
51
|
+
"invalid-text-range",
|
|
52
|
+
"unsupported-layout-option",
|
|
53
|
+
"font-mismatch",
|
|
54
|
+
"encoding-full",
|
|
55
|
+
"font-not-shapable",
|
|
56
|
+
"invalid-image",
|
|
57
|
+
"unsupported-image",
|
|
58
|
+
"image-too-large",
|
|
59
|
+
"image-data-length",
|
|
60
|
+
"invalid-icc-profile",
|
|
61
|
+
"color-components",
|
|
62
|
+
"invalid-color",
|
|
63
|
+
"invalid-geometry",
|
|
64
|
+
"text-overflow",
|
|
65
|
+
"page-index-out-of-range",
|
|
66
|
+
"unknown-destination",
|
|
67
|
+
"invalid-page-labels",
|
|
68
|
+
"profile-version-conflict",
|
|
69
|
+
"missing-title",
|
|
70
|
+
"missing-lang",
|
|
71
|
+
"missing-alt-text",
|
|
72
|
+
"untagged-content",
|
|
73
|
+
"heading-level-skipped",
|
|
74
|
+
"unnumbered-heading-misused",
|
|
75
|
+
"invalid-structure-nesting",
|
|
76
|
+
"link-without-structure",
|
|
77
|
+
"link-without-contents",
|
|
78
|
+
"font-not-embedded",
|
|
79
|
+
"glyph-without-unicode",
|
|
80
|
+
"device-color-without-output-intent",
|
|
81
|
+
"embedded-file-forbidden",
|
|
82
|
+
"embedded-file-without-mime-type",
|
|
83
|
+
"render-too-large",
|
|
84
|
+
"render-failed",
|
|
85
|
+
"render-backend-unavailable",
|
|
86
|
+
"cancelled",
|
|
87
|
+
"job-finished",
|
|
88
|
+
"document-changed",
|
|
89
|
+
"builder-finished",
|
|
90
|
+
"invalid-argument",
|
|
91
|
+
"source-budget-exceeded",
|
|
92
|
+
"unknown-option",
|
|
93
|
+
"already-initialized",
|
|
94
|
+
"extract-module-not-loaded",
|
|
95
|
+
"fetch-failed",
|
|
96
|
+
"not-initialized",
|
|
97
|
+
"source-changed",
|
|
98
|
+
"text-module-not-loaded",
|
|
99
|
+
"disposed",
|
|
100
|
+
"worker-version-mismatch",
|
|
101
|
+
"worker-crashed",
|
|
102
|
+
"worker-failed"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"data": {
|
|
106
|
+
"description": "Code-specific fields, listed on the code's page; the only place document-derived strings appear (untrusted).",
|
|
107
|
+
"type": "object"
|
|
108
|
+
},
|
|
109
|
+
"didYouMean": {
|
|
110
|
+
"description": "For usage errors: the closest names from lamina's own vocabulary.",
|
|
111
|
+
"items": {
|
|
112
|
+
"type": "string"
|
|
113
|
+
},
|
|
114
|
+
"minItems": 1,
|
|
115
|
+
"type": "array"
|
|
116
|
+
},
|
|
117
|
+
"docsUrl": {
|
|
118
|
+
"description": "The code's explain page: base + code + suffix (ADR 0026 §6).",
|
|
119
|
+
"pattern": "^https:\\/\\/github\\.com\\/laudebugs\\/laminapdf\\/blob\\/main\\/docs\\/errors\\/[a-z0-9-]+\\.md$",
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"hint": {
|
|
123
|
+
"description": "One actionable sentence for this code. Never document text.",
|
|
124
|
+
"minLength": 1,
|
|
125
|
+
"type": "string"
|
|
126
|
+
},
|
|
127
|
+
"kind": {
|
|
128
|
+
"$ref": "#/$defs/kind"
|
|
129
|
+
},
|
|
130
|
+
"location": {
|
|
131
|
+
"$ref": "#/$defs/location"
|
|
132
|
+
},
|
|
133
|
+
"message": {
|
|
134
|
+
"description": "One lowercase sentence. Never document text (ADR 0026 §4).",
|
|
135
|
+
"minLength": 1,
|
|
136
|
+
"type": "string"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"required": [
|
|
140
|
+
"code",
|
|
141
|
+
"kind",
|
|
142
|
+
"message",
|
|
143
|
+
"docsUrl"
|
|
144
|
+
],
|
|
145
|
+
"type": "object"
|
|
146
|
+
},
|
|
147
|
+
"kind": {
|
|
148
|
+
"description": "The nine kinds of ADR 0026 §2.",
|
|
149
|
+
"enum": [
|
|
150
|
+
"input",
|
|
151
|
+
"io",
|
|
152
|
+
"unsupported",
|
|
153
|
+
"limit",
|
|
154
|
+
"security",
|
|
155
|
+
"usage",
|
|
156
|
+
"state",
|
|
157
|
+
"cancelled",
|
|
158
|
+
"internal"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"location": {
|
|
162
|
+
"additionalProperties": false,
|
|
163
|
+
"dependentRequired": {
|
|
164
|
+
"streamOffset": [
|
|
165
|
+
"object"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"description": "Where the problem is (ADR 0026 §1.1); every value is lamina-made.",
|
|
169
|
+
"properties": {
|
|
170
|
+
"id": {
|
|
171
|
+
"description": "A LaminaPdfId (p12.0).",
|
|
172
|
+
"type": "string"
|
|
173
|
+
},
|
|
174
|
+
"object": {
|
|
175
|
+
"description": "Object number of the indirect object the problem is in or at.",
|
|
176
|
+
"minimum": 0,
|
|
177
|
+
"type": "integer"
|
|
178
|
+
},
|
|
179
|
+
"offset": {
|
|
180
|
+
"description": "Byte offset in the input file.",
|
|
181
|
+
"minimum": 0,
|
|
182
|
+
"type": "integer"
|
|
183
|
+
},
|
|
184
|
+
"pageIndex": {
|
|
185
|
+
"description": "0-based page index (ADR 0027 §6).",
|
|
186
|
+
"minimum": 0,
|
|
187
|
+
"type": "integer"
|
|
188
|
+
},
|
|
189
|
+
"streamOffset": {
|
|
190
|
+
"description": "Byte offset in the decoded data of `object`.",
|
|
191
|
+
"minimum": 0,
|
|
192
|
+
"type": "integer"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"type": "object"
|
|
196
|
+
},
|
|
197
|
+
"warning": {
|
|
198
|
+
"properties": {
|
|
199
|
+
"code": {
|
|
200
|
+
"description": "The stable kebab-case code (fixtures/codes.json).",
|
|
201
|
+
"enum": [
|
|
202
|
+
"missing-header",
|
|
203
|
+
"xref-repaired",
|
|
204
|
+
"xrefstm-ignored",
|
|
205
|
+
"stream-length-recovered",
|
|
206
|
+
"stale-generation",
|
|
207
|
+
"page-tree-node-skipped",
|
|
208
|
+
"page-count-mismatch",
|
|
209
|
+
"flate-truncated",
|
|
210
|
+
"objstm-index-mismatch",
|
|
211
|
+
"object-number-out-of-range",
|
|
212
|
+
"aes-padding-invalid",
|
|
213
|
+
"perms-mismatch",
|
|
214
|
+
"warnings-truncated",
|
|
215
|
+
"invalid-box",
|
|
216
|
+
"invalid-rotate",
|
|
217
|
+
"name-tree-node-skipped",
|
|
218
|
+
"outline-cycle",
|
|
219
|
+
"outline-item-skipped",
|
|
220
|
+
"invalid-date",
|
|
221
|
+
"invalid-page-label",
|
|
222
|
+
"invalid-entry",
|
|
223
|
+
"content-unknown-operator",
|
|
224
|
+
"content-bad-operands",
|
|
225
|
+
"content-unbalanced-q",
|
|
226
|
+
"content-unbalanced-bt",
|
|
227
|
+
"content-unbalanced-marked",
|
|
228
|
+
"content-syntax",
|
|
229
|
+
"content-resource-missing",
|
|
230
|
+
"inline-image-unterminated",
|
|
231
|
+
"xobject-cycle",
|
|
232
|
+
"content-path-unpainted",
|
|
233
|
+
"font-invalid",
|
|
234
|
+
"cmap-invalid",
|
|
235
|
+
"unmapped-glyph",
|
|
236
|
+
"tounicode-conflict",
|
|
237
|
+
"whole-font-rebuilt"
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"data": {
|
|
241
|
+
"description": "Code-specific fields, listed on the code's page; the only place document-derived strings appear (untrusted).",
|
|
242
|
+
"type": "object"
|
|
243
|
+
},
|
|
244
|
+
"didYouMean": false,
|
|
245
|
+
"docsUrl": {
|
|
246
|
+
"description": "The code's explain page: base + code + suffix (ADR 0026 §6).",
|
|
247
|
+
"pattern": "^https:\\/\\/github\\.com\\/laudebugs\\/laminapdf\\/blob\\/main\\/docs\\/errors\\/[a-z0-9-]+\\.md$",
|
|
248
|
+
"type": "string"
|
|
249
|
+
},
|
|
250
|
+
"hint": {
|
|
251
|
+
"description": "One actionable sentence for this code. Never document text.",
|
|
252
|
+
"minLength": 1,
|
|
253
|
+
"type": "string"
|
|
254
|
+
},
|
|
255
|
+
"kind": {
|
|
256
|
+
"$ref": "#/$defs/kind"
|
|
257
|
+
},
|
|
258
|
+
"location": {
|
|
259
|
+
"$ref": "#/$defs/location"
|
|
260
|
+
},
|
|
261
|
+
"message": {
|
|
262
|
+
"description": "One lowercase sentence. Never document text (ADR 0026 §4).",
|
|
263
|
+
"minLength": 1,
|
|
264
|
+
"type": "string"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"required": [
|
|
268
|
+
"code",
|
|
269
|
+
"kind",
|
|
270
|
+
"message",
|
|
271
|
+
"docsUrl"
|
|
272
|
+
],
|
|
273
|
+
"type": "object"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"$id": "https://github.com/laudebugs/laminapdf/blob/main/packages/sdk/schemas/error.schema.json",
|
|
277
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
278
|
+
"description": "An error or warning of every lamina surface (ADR 0026 §1): camelCase keys, optional keys omitted (never null). Generated from fixtures/codes.json by `cargo xtask gen codes`; do not edit. New optional keys may appear within version 1; consumers ignore unknown keys.",
|
|
279
|
+
"oneOf": [
|
|
280
|
+
{
|
|
281
|
+
"$ref": "#/$defs/error"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"$ref": "#/$defs/warning"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"title": "laminapdf.error/1"
|
|
288
|
+
}
|