-
Notifications
You must be signed in to change notification settings - Fork 5.5k
13409 components intelliprint #19216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Added methods for API interaction in intelliprint.app.mjs, including authentication and request handling. - Introduced create-a-print-job action with detailed properties for job configuration. - Updated package version to 0.1.0 and added dependency on @pipedream/platform. - Removed outdated README.md file and added utility function for camelCase to snake_case conversion.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds an Intelliprint create-print-job action, supporting app request helpers, option constants, and a camelCase-to-snake_case utility; removes README content and updates package version and dependencies. Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Create Print Job Action
participant Utils as camelCaseToSnakeCase
participant App as intelliprint.app
participant API as Intelliprint API
Action->>Action: resolve file via getFileStreamAndMetadata()
Action->>Action: create FormData and append file stream
loop for each prop
Action->>Utils: convert prop name to snake_case
Utils-->>Action: snake_case name
Action->>Action: append field to FormData
end
Action->>App: call createPrintJob(FormData, headers)
App->>App: _apiUrl() and _getAuth() prepare request
App->>API: POST /prints with FormData + auth
alt Success
API-->>App: 200 response
App-->>Action: return response
else Error
API-->>App: error response
App-->>Action: propagate as ConfigurationError
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (3 warnings, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
components/intelliprint/README.md(0 hunks)components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs(1 hunks)components/intelliprint/common/utils.mjs(1 hunks)components/intelliprint/intelliprint.app.mjs(1 hunks)components/intelliprint/package.json(2 hunks)
💤 Files with no reviewable changes (1)
- components/intelliprint/README.md
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/intelliprint/package.json
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/intelliprint/intelliprint.app.mjs
🧬 Code graph analysis (2)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (1)
components/intelliprint/common/utils.mjs (2)
camelCaseToSnakeCase(1-3)camelCaseToSnakeCase(1-3)
components/intelliprint/intelliprint.app.mjs (1)
components/gmail/gmail.app.mjs (1)
axios(415-423)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (3)
components/intelliprint/package.json (1)
3-3: LGTM! Dependency and version bump are appropriate.The version bump to 0.1.0 and addition of @pipedream/platform dependency align with the new action functionality introduced in this PR.
Also applies to: 15-16
components/intelliprint/intelliprint.app.mjs (1)
8-32: LGTM! API wrapper implementation is clean and correct.The authentication setup using basic auth with the API key as username and empty password is appropriate. The request abstraction with
_makeRequestprovides a good foundation for additional API methods.components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (1)
10-178: Review comment appears to be based on incorrect PR objectives.The commit message for this implementation states: "Implement Intelliprint API integration with new create print job action" — not a "send-letter" action. The directory structure confirms only a
create-a-print-jobaction exists in this PR, and the implemented properties (postage service, envelope size, mail date, backgrounds, double-sided options) align with print job creation for a mail-printing service, not letter composition.The review comment references PR objectives from issue #13409 calling for a "send-letter" action with
content,address, andsubjectprops, but this does not match the actual PR scope or implementation. ThefilePathprop (referencing a document to print) serves the analogous purpose tocontent, and the action supports postage/delivery configuration rather than recipient address in the traditional sense, as Intelliprint handles the physical delivery.Likely an incorrect or invalid review comment.
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
lcaresia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some few changes.
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Outdated
Show resolved
Hide resolved
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Outdated
Show resolved
Hide resolved
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Outdated
Show resolved
Hide resolved
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Outdated
Show resolved
Hide resolved
- Introduced a new constants file to define options for splitting methods, double-sided printing, postage services, and ideal envelope sizes. - Updated the create-a-print-job action to utilize these constants for improved maintainability and clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (4)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (4)
1-1: Remove the unnecessary eslint-disable comment.All imports are used:
ConfigurationError(line 200),getFileStreamAndMetadata(line 176),FormData(line 178), constants (lines 56, 75, 94, 101),camelCaseToSnakeCase(line 188), andintelliprint(line 191).
158-163: Remove unused required prop syncDir.The
syncDirprop is marked as required but is never used in therunmethod. It's destructured at line 170 but serves no purpose since the action usesgetFileStreamAndMetadatawith thefilePathstring prop.Apply this diff to remove the unused prop:
metadata: { type: "object", label: "Metadata", description: "A key-value object for storing any information you want to along with this Print Job.", optional: true, }, - syncDir: { - type: "dir", - accessMode: "read", - sync: true, - optional: false, - },And remove it from the destructuring:
const { intelliprint, filePath, - syncDir, ...data } = this;
184-189: Critical: String conversion breaks object and boolean values.Converting all values to strings with template literals will corrupt the
metadataobject (becomes"[object Object]") and misrepresent booleans as strings. The API likely expects proper JSON for objects and correct types for booleans.Apply this diff to handle different value types correctly:
for (const [ key, value, ] of Object.entries(data)) { - formData.append(camelCaseToSnakeCase(key), `${value}`); + if (value !== undefined && value !== null) { + const fieldValue = typeof value === "object" ? JSON.stringify(value) : value; + formData.append(camelCaseToSnakeCase(key), fieldValue); + } }
199-201: Unsafe error property access could cause runtime error.Line 200 assumes
error.response.data.error.messageexists. If any part of this chain is undefined, it will throw a TypeError instead of the intended ConfigurationError.Apply this diff to safely access the error message:
} catch (error) { - throw new ConfigurationError(`Error creating print job: ${error.response.data.error.message}`); + const errorMessage = error?.response?.data?.error?.message || error?.message || "Unknown error"; + throw new ConfigurationError(`Error creating print job: ${errorMessage}`); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs(1 hunks)components/intelliprint/common/constants.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-01-29T22:59:38.825Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 15436
File: components/printful/printful.app.mjs:55-63
Timestamp: 2025-01-29T22:59:38.825Z
Learning: Console.log statements should be removed before merging PRs to maintain code quality and prevent potential security risks from exposing sensitive information in logs.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-07-01T17:07:48.193Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 17375
File: components/zerobounce/actions/get-validation-results-file/get-validation-results-file.mjs:23-27
Timestamp: 2025-07-01T17:07:48.193Z
Learning: For "dir" props in Pipedream components, whether to mark them as optional depends on the action's file I/O behavior - if an action always writes files as output, the "dir" prop should not be marked as optional.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-07-01T17:01:46.327Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 17375
File: components/tinypng/actions/compress-image/compress-image.mjs:18-23
Timestamp: 2025-07-01T17:01:46.327Z
Learning: In TinyPNG compress-image action (components/tinypng/actions/compress-image/compress-image.mjs), the syncDir property uses accessMode: "read" because this action only reads input files and returns API responses without writing files to /tmp, unlike other TinyPNG actions that save processed files to disk.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
🧬 Code graph analysis (1)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (2)
components/intelliprint/common/constants.mjs (8)
SPLITTING_METHOD_OPTIONS(1-5)SPLITTING_METHOD_OPTIONS(1-5)DOUBLE_SIDED_OPTIONS(7-11)DOUBLE_SIDED_OPTIONS(7-11)POSTAGE_SERVICE_OPTIONS(13-20)POSTAGE_SERVICE_OPTIONS(13-20)IDEAL_ENVELOPE_OPTIONS(22-27)IDEAL_ENVELOPE_OPTIONS(22-27)components/intelliprint/common/utils.mjs (2)
camelCaseToSnakeCase(1-3)camelCaseToSnakeCase(1-3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/intelliprint/common/constants.mjs (1)
1-27: LGTM! Well-structured constants.The constant arrays are properly defined and use consistent snake_case naming that aligns with the API expectations. These will provide good validation options for the action props.
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (1)
16-26: Verify alignment with PR objectives.The PR objectives mention implementing a "send-letter" action with
content,address, andsubjectprops, but this implements "create-a-print-job" withfilePath, noaddressprop, andreferenceinstead ofsubject. While the implementation correctly follows the Intelliprint API documentation, please confirm this matches the intended requirements from issue #13409.
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
…int-job.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (5)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (5)
1-6: Remove globalno-unused-varsdisable and fix the underlying unused symbol instead.All imports are used, and the only unused symbol is
syncDir(see lines 158-163 and 167-172). Keeping/* eslint-disable no-unused-vars */at the top hides real issues going forward. Once you remove or usesyncDir, this disable should be dropped.
78-83: Resolve type/description mismatch fordoubleSidedSpecificPages.The prop is typed as
stringbut described as “The array of pages to print double sided” with an array example. This is ambiguous for users and also interacts poorly with the generic FormData serialization.Consider either:
- Keeping
type: "string"and updating the description to explicitly say it expects a JSON-encoded string (e.g.,"JSON-encoded array of page ranges, e.g. [[1,3],[6,7]]"), or- Changing the prop to an
array/objecttype and ensuring it’s JSON.stringified in the payload.
158-163: Remove unused requiredsyncDirprop and destructuring.
syncDiris defined as a requireddirprop but is never used in the action (it’s only destructured on line 170). This:
- Forces users to configure an irrelevant prop, and
- Is the root cause for the
no-unused-varssuppression at the top.Since you’re only using
getFileStreamAndMetadata(filePath)and not interacting with the directory directly, removesyncDirfrompropsand from the destructuring.Based on learnings, dir props should only be present (and required) when the action actually interacts with files in that directory.
Also applies to: 167-172
184-188: Fix FormData serialization: skip undefined and JSON-encode objects.The current loop unconditionally appends all entries as template-string values:
for (const [key, value] of Object.entries(data)) { formData.append(camelCaseToSnakeCase(key), `${value}`); }Problems:
- Optional props that are not set become
"undefined"in the payload.- Objects like
metadataare sent as"[object Object]"instead of JSON.- Potential future array/object props will be corrupted similarly.
Suggested fix:
- for (const [ - key, - value, - ] of Object.entries(data)) { - formData.append(camelCaseToSnakeCase(key), `${value}`); - } + for (const [key, value] of Object.entries(data)) { + if (value === undefined || value === null) continue; + + const fieldName = camelCaseToSnakeCase(key); + const fieldValue = typeof value === "object" + ? JSON.stringify(value) + : String(value); + + formData.append(fieldName, fieldValue); + }This preserves booleans / numbers as strings while correctly encoding objects and omitting unset values.
#!/bin/bash # Quick check: ensure no "undefined" values are appended to FormData rg -n 'Object\\.entries\\(data\\)' -n components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs -n -C3
199-201: Harden error handling to avoid secondary TypeErrors.
error.response.data.error.messageassumes every property in the chain exists. If any is missing, this throws a TypeError and masks the original API error.Use safe access with fallbacks, e.g.:
- } catch (error) { - throw new ConfigurationError(`Error creating print job: ${error.response.data.error.message}`); - } + } catch (error) { + const errorMessage = + error?.response?.data?.error?.message + || error?.response?.data?.message + || error?.message + || "Unknown error"; + + throw new ConfigurationError(`Error creating print job: ${errorMessage}`); + }#!/bin/bash # Grep for unsafe nested error access patterns for consistency rg -n 'error\\.response\\.data\\.error\\.message' -C2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-01-29T22:59:38.825Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 15436
File: components/printful/printful.app.mjs:55-63
Timestamp: 2025-01-29T22:59:38.825Z
Learning: Console.log statements should be removed before merging PRs to maintain code quality and prevent potential security risks from exposing sensitive information in logs.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-07-01T17:07:48.193Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 17375
File: components/zerobounce/actions/get-validation-results-file/get-validation-results-file.mjs:23-27
Timestamp: 2025-07-01T17:07:48.193Z
Learning: For "dir" props in Pipedream components, whether to mark them as optional depends on the action's file I/O behavior - if an action always writes files as output, the "dir" prop should not be marked as optional.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-07-01T17:01:46.327Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 17375
File: components/tinypng/actions/compress-image/compress-image.mjs:18-23
Timestamp: 2025-07-01T17:01:46.327Z
Learning: In TinyPNG compress-image action (components/tinypng/actions/compress-image/compress-image.mjs), the syncDir property uses accessMode: "read" because this action only reads input files and returns API responses without writing files to /tmp, unlike other TinyPNG actions that save processed files to disk.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2024-10-08T16:42:59.225Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14229
File: components/americommerce/actions/update-customer/update-customer.mjs:89-94
Timestamp: 2024-10-08T16:42:59.225Z
Learning: When defining boolean properties in AmeriCommerce components (e.g., in `update-customer.mjs`), ensure that the label and description are consistent and clearly indicate the intent, especially when using negations like "No Account", to avoid confusion.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
| confirmationEmail: { | ||
| type: "string", | ||
| label: "Confirmation Email", | ||
| description: "Whether a confirmation email should be sent to the user or account's email address when this letter is confirmed.", | ||
| optional: true, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's look at the full context of the file
cat -n components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs | head -160 | tail -30Repository: PipedreamHQ/pipedream
Length of output: 1411
🏁 Script executed:
# Search for other confirmationEmail usage in the codebase
rg -i "confirmationemail" --type=mjs -C 3Repository: PipedreamHQ/pipedream
Length of output: 92
🏁 Script executed:
# Look for the Intelliprint integration file to understand the app structure
fd -e mjs intelliprintRepository: PipedreamHQ/pipedream
Length of output: 109
🌐 Web query:
Intelliprint API documentation create print job confirmation email field type
💡 Result:
The Print Job parameter confirmation_email is a boolean (true/false). [1]
Fix confirmationEmail type from string to boolean.
The Intelliprint API expects confirmation_email as a boolean (true/false) per the API documentation, but the property is currently typed as string. The description correctly describes boolean behavior ("Whether a confirmation email should be sent..."), so the type should match. Change type: "string" to type: "boolean" on line 147.
🤖 Prompt for AI Agents
In components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
around lines 146 to 151, the confirmationEmail property is incorrectly typed as
"string"; update the property definition to use type: "boolean" (keeping label,
description and optional: true intact) so it matches the Intelliprint API
expectation for confirmation_email being a true/false value.
Resolves #13409
Summary by CodeRabbit
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.