@cosmicdrift/kumiko-renderer-puppeteer-client 0.378.0 → 0.379.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.
@@ -289,7 +289,7 @@ async function findOwnPdfTemplate(tplApi, ctx, slug, locale, scope) {
289
289
  }
290
290
  async function assembleDocument(input, ctx, markers, recordImages = "placeholder") {
291
291
  const { slug, locale, variables } = input;
292
- const tplApi = createTemplateResolverApi(ctx.db);
292
+ const tplApi = createTemplateResolverApi(ctx.db, ctx.registry);
293
293
  const template = input.draft === undefined
294
294
  ? await resolvePdfTemplate(tplApi, ctx, slug, locale)
295
295
  : applyPdfDraft(await findStoredPdfTemplate(tplApi, ctx, slug, locale), await findOwnPdfTemplate(tplApi, ctx, slug, locale, input.draftScope ?? "tenant"), input.draft, slug, locale);
package/dist/feature.js CHANGED
@@ -14,11 +14,12 @@ import { puppeteerStatusQuery } from "./status.query.js";
14
14
  // - PUPPETEER_CLIENT_TIMEOUT_MS default 60000
15
15
  // - PUPPETEER_CLIENT_MAX_RETRIES default 3
16
16
  //
17
- // **Retry strategy:** 5xx + network errors → exponential backoff (200ms,
17
+ // **Retry strategy:** 502/503 + network errors → exponential backoff (200ms,
18
18
  // 400ms, 800ms) + jitter. 4xx → NO retry (config bug, fail immediately).
19
+ // Other 5xx and client timeouts → NO retry (the render already ran).
19
20
  export function createRendererPuppeteerClientFeature() {
20
21
  return defineFeature("renderer-puppeteer-client", (r) => {
21
- r.describe("A `renderer-foundation` plugin that prints documents to PDF through a separately deployed `puppeteer-service`. A `document-pdf` request names a stored template (`{ slug, locale, variables }`): the plugin resolves the template and its `pdf-layout` (header, signature and footer regions), embeds every image as a data URI, turns repeating table header rows into a real table head and sends the finished HTML to the service, which performs no network fetches itself. The page format, margins, file name pattern and title come from the template meta. A write handler renders with `renderPdfBeforeTransaction(ctx, { slug, locale, variables })` as its `beforeTransaction` phase, so the print service call holds no database connection, and stores the result with `storeRenderedPdf(ctx, event.prepared)` in the handler: a file plus a `rendered-pdf` record that keeps the template and layout version, so a stored document can always be traced to the text it was created from. The `puppeteer-status` query tells a TenantAdmin whether the service answers; while it does not, rendering fails with a `puppeteer_unavailable` error (HTTP 503) and no PDF is created. `image-snapshot` requests still take ready HTML in `payload.content`, which must embed all resources as data: URIs because the service fetches no http(s) resources. Configure the endpoint and token with `PUPPETEER_SERVICE_URL` and `PUPPETEER_AUTH_TOKEN`; the client retries 5xx and network errors with exponential backoff (default 3 retries), 4xx fails at once. The feature adds the `rendered_pdfs` table, so apps that mount it need a schema migration.");
22
+ r.describe("A `renderer-foundation` plugin that prints documents to PDF through a separately deployed `puppeteer-service`. A `document-pdf` request names a stored template (`{ slug, locale, variables }`): the plugin resolves the template and its `pdf-layout` (header, signature and footer regions), embeds every image as a data URI, turns repeating table header rows into a real table head and sends the finished HTML to the service, which performs no network fetches itself. The page format, margins, file name pattern and title come from the template meta. A write handler renders with `renderPdfBeforeTransaction(ctx, { slug, locale, variables })` as its `beforeTransaction` phase, so the print service call holds no database connection, and stores the result with `storeRenderedPdf(ctx, event.prepared)` in the handler: a file plus a `rendered-pdf` record that keeps the template and layout version, so a stored document can always be traced to the text it was created from. The `puppeteer-status` query tells a TenantAdmin whether the service answers; while it does not, rendering fails with a `puppeteer_unavailable` error (HTTP 503) and no PDF is created. `image-snapshot` requests still take ready HTML in `payload.content`, which must embed all resources as data: URIs because the service fetches no http(s) resources. Configure the endpoint and token with `PUPPETEER_SERVICE_URL` and `PUPPETEER_AUTH_TOKEN`; the client retries 502, 503 and network errors with exponential backoff (default 3 retries); 4xx, other 5xx and client timeouts fail at once, because the render has already run. The feature adds the `rendered_pdfs` table, so apps that mount it need a schema migration.");
22
23
  r.requires({ features: ["renderer-foundation"] });
23
24
  r.useExtension("renderer", "puppeteer", {
24
25
  kinds: ["document-pdf", "image-snapshot"],
@@ -0,0 +1,6 @@
1
+ [
2
+ {
3
+ "module": "entity",
4
+ "export": "renderedPdfsTable"
5
+ }
6
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-renderer-puppeteer-client",
3
- "version": "0.378.0",
3
+ "version": "0.379.0",
4
4
  "description": "Renderer-Foundation plugin: HTTP client for puppeteer-service (PDF + image snapshot via remote browser).",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -19,13 +19,13 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@cosmicdrift/kumiko-bundled-features": "0.378.0",
23
- "@cosmicdrift/kumiko-framework": "0.378.0",
24
- "@cosmicdrift/kumiko-renderer-mail-html": "0.378.0",
25
- "@cosmicdrift/kumiko-types": "0.378.0"
22
+ "@cosmicdrift/kumiko-bundled-features": "0.379.0",
23
+ "@cosmicdrift/kumiko-framework": "0.379.0",
24
+ "@cosmicdrift/kumiko-renderer-mail-html": "0.379.0",
25
+ "@cosmicdrift/kumiko-types": "0.379.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@cosmicdrift/kumiko-testing": "0.378.0"
28
+ "@cosmicdrift/kumiko-testing": "0.379.0"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -52,6 +52,7 @@
52
52
  },
53
53
  "files": [
54
54
  "dist",
55
+ "kumiko-es-tables.json",
55
56
  "src/changes.json",
56
57
  "README.md",
57
58
  "LICENSE"
package/src/changes.json CHANGED
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "version": "0.379.0",
4
+ "type": "improvement",
5
+ "title": "Retry documentation matches the client",
6
+ "detail": "The client retries 502, 503 and network errors; other 5xx and client timeouts fail at once because the render already ran. The feature description no longer promises a retry for every 5xx."
7
+ },
8
+ {
9
+ "version": "0.379.0",
10
+ "type": "improvement",
11
+ "title": "Package ships its event-store table catalog",
12
+ "detail": "kumiko-es-tables.json is included in the published files; no runtime change."
13
+ },
2
14
  {
3
15
  "version": "0.365.0",
4
16
  "type": "improvement",