@telorun/pdf 0.2.1 → 0.7.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/README.md
CHANGED
|
@@ -23,9 +23,9 @@ Built to be language-agnostic and infinitely extensible.
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
# Reconcile your manifest into a running backend
|
|
26
|
-
$ telo ./examples/
|
|
26
|
+
$ telo ./examples/todo-app
|
|
27
27
|
|
|
28
|
-
{"level":30,"time":1771610393008,"pid":1310178,"hostname":"dev","msg":"Server listening at http://127.0.0.1:
|
|
28
|
+
{"level":30,"time":1771610393008,"pid":1310178,"hostname":"dev","msg":"Server listening at http://127.0.0.1:8077"}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Why use Telo?
|
|
@@ -48,7 +48,9 @@ See [examples/](./examples/) for a list of working applications.
|
|
|
48
48
|
|
|
49
49
|
## Status
|
|
50
50
|
|
|
51
|
-
Telo is under
|
|
51
|
+
Telo is under heavy development. While it is pre-1.0, breaking changes ship in **minor** releases — manifest shapes, kind schemas, and APIs can change between versions. Pin your imports and expect to update manifests when you upgrade. The core runtime, module system, and standard library are functional, but Telo is not yet recommended for production use.
|
|
52
|
+
|
|
53
|
+
**1.0 lands when the Rust kernel reaches feature parity with the Node.js implementation** — that is the milestone that freezes the manifest contract across runtimes.
|
|
52
54
|
|
|
53
55
|
## The Meaning of Telo
|
|
54
56
|
|
|
@@ -14,10 +14,10 @@ class PdfFormFields {
|
|
|
14
14
|
}
|
|
15
15
|
async invoke(inputs) {
|
|
16
16
|
const label = `Pdf.FormFields "${this.resource.metadata.name}"`;
|
|
17
|
+
// An `inputs.scale` is declared on `inputType` with `exclusiveMinimum: 0` and
|
|
18
|
+
// enforced by the kernel's contract binding; the resource-level fallback is
|
|
19
|
+
// checked by the config schema. Neither needs re-checking here.
|
|
17
20
|
const scale = inputs?.scale ?? this.resource.scale ?? 1;
|
|
18
|
-
if (typeof scale !== "number" || !(scale > 0)) {
|
|
19
|
-
throw new InvokeError("ERR_INVALID_INPUT", `${label}: 'scale' must be a positive number; got ${scale}.`);
|
|
20
|
-
}
|
|
21
21
|
const data = inputs?.data;
|
|
22
22
|
if (!(data instanceof Uint8Array)) {
|
|
23
23
|
throw new InvokeError("ERR_INVALID_INPUT", `${label}: 'data' must be a Uint8Array of PDF bytes; got ${typeof data}.`);
|
|
@@ -32,10 +32,11 @@ class PdfRasterizer {
|
|
|
32
32
|
if (!(data instanceof Uint8Array)) {
|
|
33
33
|
throw new InvokeError("ERR_INVALID_INPUT", `Pdf.Rasterizer "${name}": 'data' must be a Uint8Array of PDF bytes; got ${typeof data}.`);
|
|
34
34
|
}
|
|
35
|
+
// `page` is declared on `inputType` as an integer with `minimum: 1` and
|
|
36
|
+
// enforced by the kernel's contract binding, so only the range check the
|
|
37
|
+
// schema cannot express — page vs. the document's actual page count — is
|
|
38
|
+
// still this controller's to make (below).
|
|
35
39
|
const pageNumber = inputs.page ?? 1;
|
|
36
|
-
if (!Number.isInteger(pageNumber) || pageNumber < 1) {
|
|
37
|
-
throw new InvokeError("ERR_INVALID_INPUT", `Pdf.Rasterizer "${name}": 'page' must be a positive integer; got ${pageNumber}.`);
|
|
38
|
-
}
|
|
39
40
|
const task = loadPdf(data);
|
|
40
41
|
try {
|
|
41
42
|
const doc = await task.promise.catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "PDF primitives — rasterize pages to PNG images and author editable AcroForm fields.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^20.0.0",
|
|
49
49
|
"typescript": "^5.0.0",
|
|
50
|
-
"@telorun/sdk": "0.
|
|
50
|
+
"@telorun/sdk": "0.75.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@telorun/sdk": "*"
|
|
@@ -41,13 +41,10 @@ class PdfFormFields implements ResourceInstance<FormFieldsInputs, FormFieldsOutp
|
|
|
41
41
|
|
|
42
42
|
async invoke(inputs: FormFieldsInputs): Promise<FormFieldsOutputs> {
|
|
43
43
|
const label = `Pdf.FormFields "${this.resource.metadata.name}"`;
|
|
44
|
+
// An `inputs.scale` is declared on `inputType` with `exclusiveMinimum: 0` and
|
|
45
|
+
// enforced by the kernel's contract binding; the resource-level fallback is
|
|
46
|
+
// checked by the config schema. Neither needs re-checking here.
|
|
44
47
|
const scale = inputs?.scale ?? this.resource.scale ?? 1;
|
|
45
|
-
if (typeof scale !== "number" || !(scale > 0)) {
|
|
46
|
-
throw new InvokeError(
|
|
47
|
-
"ERR_INVALID_INPUT",
|
|
48
|
-
`${label}: 'scale' must be a positive number; got ${scale}.`,
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
48
|
const data = inputs?.data;
|
|
52
49
|
if (!(data instanceof Uint8Array)) {
|
|
53
50
|
throw new InvokeError(
|
|
@@ -59,13 +59,11 @@ class PdfRasterizer implements ResourceInstance<RasterizerInputs, RasterizerOutp
|
|
|
59
59
|
`Pdf.Rasterizer "${name}": 'data' must be a Uint8Array of PDF bytes; got ${typeof data}.`,
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
+
// `page` is declared on `inputType` as an integer with `minimum: 1` and
|
|
63
|
+
// enforced by the kernel's contract binding, so only the range check the
|
|
64
|
+
// schema cannot express — page vs. the document's actual page count — is
|
|
65
|
+
// still this controller's to make (below).
|
|
62
66
|
const pageNumber = inputs.page ?? 1;
|
|
63
|
-
if (!Number.isInteger(pageNumber) || pageNumber < 1) {
|
|
64
|
-
throw new InvokeError(
|
|
65
|
-
"ERR_INVALID_INPUT",
|
|
66
|
-
`Pdf.Rasterizer "${name}": 'page' must be a positive integer; got ${pageNumber}.`,
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
67
|
|
|
70
68
|
const task = loadPdf(data);
|
|
71
69
|
try {
|