Skip to content

PDF API IO - new components#19815

Merged
michelle0927 merged 2 commits intomasterfrom
issue-12172
Jan 27, 2026
Merged

PDF API IO - new components#19815
michelle0927 merged 2 commits intomasterfrom
issue-12172

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jan 22, 2026

Resolves #12172

Summary by CodeRabbit

  • New Features

    • Added Get Template action to retrieve templates by ID
    • Added List Templates action to view all available templates
    • Added Merge Templates action to combine multiple templates
    • Added Render Template action to generate PDFs with custom data
    • Added a Template ID selector in the component UI for easier template selection
  • Chores

    • Component version updated to 0.1.0

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jan 22, 2026 8:39pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Walkthrough

Adds a pdf_api_io integration: four new action modules (get, list, merge, render templates), a recursive parseObject utility, expanded app methods for API interaction (_baseUrl, _makeRequest, getTemplate, listTemplates, renderTemplate, mergeTemplates) with a templateId prop, and a package version/dependency update.

Changes

Cohort / File(s) Summary
Action modules
components/pdf_api_io/actions/get-template/get-template.mjs, components/pdf_api_io/actions/list-templates/list-templates.mjs, components/pdf_api_io/actions/merge-templates/merge-templates.mjs, components/pdf_api_io/actions/render-template/render-template.mjs
Four new actions exposing template operations (get, list, merge, render). Each exports a default action object with metadata, props, and an async run({ $ }) that calls corresponding pdfApiIo app methods and exports a summary.
Utility
components/pdf_api_io/common/utils.mjs
New parseObject(obj) exported function: recursively parses JSON strings, arrays, and object values, returning parsed structures or original values on parse failure.
Core app
components/pdf_api_io/pdf_api_io.app.mjs
Added _baseUrl, _makeRequest, getTemplate, listTemplates, renderTemplate, mergeTemplates methods; removed authKeys; added templateId propDefinition with async options; imports axios from @pipedream/platform.
Package metadata
components/pdf_api_io/package.json
Version bumped 0.0.10.1.0; added dependency "@pipedream/platform": "^3.1.1".

Sequence Diagram(s)

sequenceDiagram
    participant Action as Render Action
    participant App as pdfApiIo.app
    participant API as PDF-API.io

    Action->>App: renderTemplate({ templateId, data, $ })
    App->>App: _baseUrl() / prepare request
    App->>App: _makeRequest({ path, method: POST, body })
    App->>API: POST /api/templates/{templateId}/render (auth header, body)
    API-->>App: 200 { url, ... }
    App-->>Action: returns render response
    Action->>Action: exports summary "Successfully rendered template..."
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding new components for PDF API IO service integration.
Description check ✅ Passed The description is minimal but sufficient, containing the issue reference (#12172) that links to detailed requirements.
Linked Issues check ✅ Passed The PR implements multiple action modules (get-template, list-templates, merge-templates, render-template) and supporting utilities that fulfill the objective of adding pdf_api_io service components.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing pdf_api_io components; no unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@components/pdf_api_io/actions/list-templates/list-templates.mjs`:
- Around line 22-24: The pluralization uses the expression templates?.length ??
0 === 1 which misapplies operator precedence; change the comparison to evaluate
the nullish coalesced length first, e.g. wrap the coalesced value in parentheses
and compare: (templates?.length ?? 0) === 1, and use that result in the ternary
inside the $.export("$summary", ...) expression so counts >1 render the plural
form correctly.
- Line 7: The version field currently contains an invalid semver string with a
trailing comma ("version: \"0.0.1,\"); update the value to a valid semver string
(e.g., "0.0.1") in the template metadata so component validation succeeds —
locate the version property in list-templates.mjs and remove the extra
comma/character to produce a proper semver string.

In `@components/pdf_api_io/common/utils.mjs`:
- Around line 16-24: parseObject currently returns a new array via map but
mutates object properties in place using Object.entries; change it to be
immutable by creating a new object, iterating Object.entries(obj) and assigning
parsed values to the new object (e.g., newObj[key] = parseObject(value)), then
return newObj instead of mutating the original; update the branch that checks
typeof obj === "object" and the use of Object.entries(obj) so callers receive a
new object consistent with the array behavior.
- Around line 1-10: The top-level falsy guard in parseObject incorrectly returns
undefined for legitimate falsy values (0, "", false); change the early-return to
only bail for null or undefined (e.g., check obj === null || obj === undefined)
so parseObject still processes empty strings and false/0 values; keep the
existing typeof obj === "string" parsing logic and the try/catch fallback
behavior intact in the parseObject function.

In `@components/pdf_api_io/pdf_api_io.app.mjs`:
- Around line 11-17: options() currently assumes listTemplates() succeeds and
returns an array; wrap the call in a try-catch inside the options() method,
validate that the returned templates is an array before mapping (e.g.,
Array.isArray(templates)), and on error (or invalid shape) log the exception
(use existing logger or console.error) and return an empty array as a safe
fallback; keep the existing mapping logic for the successful path referencing
template.name and template.id.

Copy link
Collaborator

@lcaresia lcaresia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vunguyenhung
Copy link
Contributor

Hi everyone, all test cases are passed! Ready for release!

Test reports

@michelle0927 michelle0927 merged commit c73db4a into master Jan 27, 2026
9 checks passed
@michelle0927 michelle0927 deleted the issue-12172 branch January 27, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Components] pdf_api_io

3 participants