-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
|
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... 📒 Files selected for processing (1)
Tip You can get early access to new features in CodeRabbit.Enable the WalkthroughAdds an Intelliprint create-print-job action, app HTTP helper methods, option constants, and two util functions; deletes README content; bumps package version and adds a dependency. The action builds multipart FormData (converting props to snake_case and parsing values), calls the app's createPrintJob, and surfaces the API response or errors. Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Create Print Job Action
participant Utils as common/utils
participant App as intelliprint.app
participant API as Intelliprint API
Action->>Action: getFileStreamAndMetadata(filePath)
Action->>Action: build FormData, append file stream
loop per prop
Action->>Utils: camelCaseToSnakeCase(propName)
Utils-->>Action: snake_case name
alt value may be JSON/string array
Action->>Utils: parseObject(value)
Utils-->>Action: parsed value
end
Action->>Action: append field to FormData
end
Action->>App: createPrintJob(FormData, headers)
App->>App: _apiUrl() and _getAuth()
App->>API: POST /prints (FormData + auth)
alt Success
API-->>App: 200 OK (response)
App-->>Action: return response
Action-->>Caller: summary + response
else Error
API-->>App: error response
App-->>Action: propagate error
Action-->>Caller: throw 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)
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.
…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
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.
LGTM!
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
- Added 'removeLettersSeries' and updated 'removeLettersWithPhrase' properties to the create-a-print-job action for improved letter management. - Introduced 'parseObject' utility function to handle parsing of letter series input. - Updated form data submission to include new properties for better API interaction.
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: 3
♻️ Duplicate comments (7)
components/intelliprint/common/utils.mjs (1)
26-28: Fix leading underscore and improve robustness incamelCaseToSnakeCase.Inputs starting with a capital produce a leading underscore (
"Foo"→"_foo"), which can break API field names.You can strip a single leading underscore after replacement:
export const camelCaseToSnakeCase = (str) => { - return str?.replace(/([A-Z])/g, "_$1").toLowerCase(); + return str + ?.replace(/([A-Z])/g, "_$1") + .replace(/^_/, "") + .toLowerCase(); };This keeps the existing behavior for internal capitals while avoiding a leading
_.components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (6)
1-1: Remove unnecessaryno-unused-varseslint disable.All imports are used, and after fixing the unused
syncDirprop (see below), there should be no unused variables. Keeping a file‑wideno-unused-varsdisable can hide real issues later; please remove it once the unused prop is cleaned up.
80-85: AligndoubleSidedSpecificPagestype/description with payload serialization.
doubleSidedSpecificPagesis typed asstring(Line 81) but described as an array (Line 83). In the payload (Line 209) you embed it directly inside a JSON-serialized object, so:
- If users pass a JSON string (e.g.
"[[1,3],[6,7]]"), the API sees a string instead of an array.- If they pass a non‑JSON string, JSON won’t match the documented example.
To avoid ambiguous behavior:
- Keep the prop as a string but document that it must be JSON, and
- Parse it before including it in the
printingobject:doubleSidedSpecificPages: { type: "string", label: "Double Sided Specific Pages", - description: "The array of pages to print double sided. Only used when **Double Sided** is set to `mixed`. Example: **[[1, 3], [6, 7]]**.", + description: "JSON-encoded array of pages to print double sided. Only used when **Double Sided** is set to `mixed`. Example: **[[1, 3], [6, 7]]**.", optional: true, }, @@ - formData.append("printing", JSON.stringify({ - double_sided: doubleSided, - double_sided_specific_pages: doubleSidedSpecificPages, - premium_quality: premiumQuality, - })); + formData.append("printing", JSON.stringify({ + double_sided: doubleSided, + double_sided_specific_pages: parseObject(doubleSidedSpecificPages), + premium_quality: premiumQuality, + }));This matches the documented example and ensures the API receives an actual array instead of a raw string.
Check the Intelliprint "create print job" API documentation to confirm the expected type/format of the `double_sided_specific_pages` parameter (array vs string, and JSON encoding requirements).Also applies to: 207-211
154-159: ChangeconfirmationEmailto boolean to match API semantics.
confirmationEmailis typed asstring(Line 155) but its description and the Intelliprint API both imply a boolean flag ("Whether a confirmation email should be sent..."). In the payload builder (Lines 234–239) it’s appended with other props and ends up as a string, which is misleading at the component level.Recommend:
confirmationEmail: { - type: "string", + type: "boolean", 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, },The FormData loop will then serialize
true/falseas strings, which is typical for boolean query/form parameters, while the component API exposes it correctly as a boolean.Verify in the Intelliprint API documentation that `confirmation_email` on the create print job endpoint is a boolean field and note any specific expectations about its serialization in requests.Also applies to: 234-239
166-171: Remove unused requiredsyncDirprop.
syncDiris defined as a requireddirprop (Lines 166–171) and destructured inrun(Lines 176–179) but never used. This:
- Forces users to configure an irrelevant directory.
- Necessitated the
no-unused-varseslint disable.- Conflicts with established patterns where
dirprops are reserved for actions that write files.Since this action only reads an input file (via
filePath) and doesn’t write to/tmp, you can safely removesyncDir:- syncDir: { - type: "dir", - accessMode: "read", - sync: true, - optional: false, - }, @@ const { intelliprint, filePath, - syncDir, splittingMethod,Once removed, you can also drop the
no-unused-varseslint disable.Also applies to: 176-179
160-165: Avoid blindly stringifying all remaining props (breaks objects likemetadata).The generic loop (Lines 234–239) appends every remaining prop as
`${value}`. For objects (e.g.,metadata, Line 160–165) this yields"[object Object]", and arrays would also be corrupted. Booleans and numbers become stringified without control.Handle complex types explicitly and skip nullish values:
- 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) + : value; + + formData.append(fieldName, fieldValue); + }This preserves objects/arrays as JSON and keeps primitives as-is while avoiding accidental
"undefined"/"null"strings.Also applies to: 234-239
249-251: Harden error handling to avoid crashing on unexpected error shapes.
error.response.data.error.messageassumes a fully populated error object. If any segment is missing, this will throw a newTypeErrorinstead of surfacing the original API error.Use optional chaining with sensible fallbacks:
- } catch (error) { - throw new ConfigurationError(`Error creating print job: ${error.response.data.error.message}`); - } + } catch (error) { + const errorMessage = + error?.response?.data?.error?.message + || error?.message + || "Unknown error"; + + throw new ConfigurationError(`Error creating print job: ${errorMessage}`); + }This ensures the action always throws a meaningful
ConfigurationErrorwithout risking an additional runtime exception.
📜 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/utils.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📚 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
📚 Learning: 2025-02-05T21:58:03.118Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 15479
File: packages/connect-react/src/components/ComponentForm.tsx:23-24
Timestamp: 2025-02-05T21:58:03.118Z
Learning: In the connect-react package, the `enableDebugging` property should be of type `boolean` as it's used for toggling debugging features and conditional rendering.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-09-11T01:53:51.070Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18334
File: components/buddee/actions/list-employees/list-employees.mjs:147-155
Timestamp: 2025-09-11T01:53:51.070Z
Learning: In Buddee list-employees action, the "manager" prop should be a boolean type to filter employees who have direct reports, not an employeeId propDefinition which would send an employee ID instead of the expected boolean value.
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 (4)
parseObject(1-24)parseObject(1-24)camelCaseToSnakeCase(26-28)camelCaseToSnakeCase(26-28)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (1)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (1)
173-248: Overall multipart payload construction looks solid (once field issues are fixed).Aside from the specific field/type issues noted in other comments, the general structure here—using
getFileStreamAndMetadata, attaching the file with metadata, grouping related settings intoprinting,splitting,postage,backgrounds,nudge, andremove_letters, and delegating tointelliprint.createPrintJob—is clear and consistent with typical Pipedream actions.
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
- Renamed 'removeLettersSeries' to 'nudgeX' with updated description for horizontal page adjustment. - Changed 'firstPageBackground' and 'otherPagesBackground' to 'backgroundFirstPage' and 'backgroundOtherPages' for consistency. - Updated form data handling to reflect new property names.
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 (6)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (6)
1-1: Remove the unnecessaryeslint-disablecomment.All imports are used in the code, so the
no-unused-varsdisable is unnecessary.
80-85: Clarify the type and format fordoubleSidedSpecificPages.The prop is typed as
stringbut the description says "array of pages" with example[[1, 3], [6, 7]]. This creates ambiguity. At line 209, it's passed directly toJSON.stringify, which will work if users provide a JSON string but expects users to know this format requirement.Consider either:
- Keep type as
stringand update description to: "JSON-encoded array of page ranges (e.g.,[[1, 3], [6, 7]])"- Change type to
objectand ensure proper serialization
154-159: FixconfirmationEmailtype toboolean.The prop is typed as
stringbut the description ("Whether a confirmation email should be sent...") describes boolean behavior. The Intelliprint API expects a boolean value forconfirmation_email.Apply this diff:
confirmationEmail: { - type: "string", + type: "boolean", 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, },
166-171: Remove unused requiredsyncDirprop.The
syncDirprop is marked as required (optional: false) but is destructured at line 178 and never used. Remove it entirely.
249-251: Add safe error property access.The error handler assumes
error.response.data.error.messageexists. If any part of this chain is undefined, it will throw aTypeErrorinstead of the intendedConfigurationError.Apply this diff:
} 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}`); }
234-239: String conversion still breaks object and boolean values.Despite a past review comment marked as "addressed in commit 2132ccb", line 238 still uses
${value}template literal, which converts all values to strings. This corrupts:
metadataobject →"[object Object]"- Boolean props (
confirmed,testmode,confidential) → string representationsApply this diff to handle 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); + } }
📜 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 (8)
📚 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
📚 Learning: 2025-02-05T21:58:03.118Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 15479
File: packages/connect-react/src/components/ComponentForm.tsx:23-24
Timestamp: 2025-02-05T21:58:03.118Z
Learning: In the connect-react package, the `enableDebugging` property should be of type `boolean` as it's used for toggling debugging features and conditional rendering.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-09-11T01:53:51.070Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18334
File: components/buddee/actions/list-employees/list-employees.mjs:147-155
Timestamp: 2025-09-11T01:53:51.070Z
Learning: In Buddee list-employees action, the "manager" prop should be a boolean type to filter employees who have direct reports, not an employeeId propDefinition which would send an employee ID instead of the expected boolean value.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
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 (4)
parseObject(1-24)parseObject(1-24)camelCaseToSnakeCase(26-28)camelCaseToSnakeCase(26-28)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (1)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (1)
207-233: No changes needed – JSON.stringify already omits undefined properties.Undefined values are not included in the JSON output. JavaScript's native
JSON.stringify()automatically omits properties with undefined values, so nested objects likeprinting,splitting, andpostagewill only include defined properties in the resulting JSON string. No additional filtering is required.
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
…ata handling - Changed 'removeLettersSeries' type from string to string[] for better input handling. - Updated 'confirmationEmail' type from string to boolean to reflect its true nature. - Adjusted form data submission to include the new 'confirmation_email' property for API compatibility.
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 (3)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (3)
154-165: Serialize complex props safely (especiallymetadata) and avoid sending"undefined"valuesTwo related issues in the generic FormData construction:
confirmationEmailis always appended via template literal:formData.append("confirmation_email", `${confirmationEmail}`);When
confirmationEmailis not provided, this sends the literal string"undefined".The generic loop converts all remaining props (including
metadata, which is an object) to strings via template literal:for (const [key, value] of Object.entries(data)) { formData.append(camelCaseToSnakeCase(key), `${value}`); }This turns
metadatainto"[object Object]"instead of JSON, and will similarly break any future object/array props.A safer approach is to skip null/undefined values, JSON-encode objects, and explicitly stringify primitives:
- formData.append("confirmation_email", `${confirmationEmail}`); - for (const [ - key, - value, - ] of Object.entries(data)) { - formData.append(camelCaseToSnakeCase(key), `${value}`); - } + if (confirmationEmail !== undefined && confirmationEmail !== null) { + formData.append("confirmation_email", String(confirmationEmail)); + } + + for (const [key, value] of Object.entries(data)) { + if (value === undefined || value === null) { + continue; + } + + const fieldName = camelCaseToSnakeCase(key); + if (typeof value === "object") { + formData.append(fieldName, JSON.stringify(value)); + } else { + formData.append(fieldName, String(value)); + } + }This preserves booleans / numbers as strings (as expected by multipart forms) while correctly serializing objects like
metadata.Also applies to: 235-241
251-253: Harden error handling to avoidTypeErroron unexpected error shapesThe catch block assumes
error.response.data.error.messagealways exists:throw new ConfigurationError(`Error creating print job: ${error.response.data.error.message}`);If any part of that chain is missing, this throws a
TypeErrorand hides the original error, making debugging harder and failing the step with the wrong exception.Use optional chaining and fallbacks instead:
- } catch (error) { - throw new ConfigurationError(`Error creating print job: ${error.response.data.error.message}`); - } + } catch (error) { + const errorMessage = error?.response?.data?.error?.message + ?? error?.message + ?? "Unknown error"; + + throw new ConfigurationError(`Error creating print job: ${errorMessage}`); + }This preserves the original context when available and avoids secondary crashes when the response structure is different than expected.
1-1: Avoid disablingno-unused-varsglobally; remove unusedsyncDirdestructuring insteadThe global
/* eslint-disable no-unused-vars */hides real issues and shouldn't be necessary here. The only unused variable issyncDirin therundestructuring, and thedirprop can still function for platform file-sync without being destructured.Recommend removing the global disable and the unused destructured variable:
-/* eslint-disable no-unused-vars */ -import { +import { ConfigurationError, getFileStreamAndMetadata, } from "@pipedream/platform"; @@ const { intelliprint, filePath, - syncDir, splittingMethod, splitOnPhrase, splitOnPage,This keeps the
syncDirprop available for platform behavior while preserving lint signal.Also applies to: 175-179
📜 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 (8)
📚 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
📚 Learning: 2025-02-05T21:58:03.118Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 15479
File: packages/connect-react/src/components/ComponentForm.tsx:23-24
Timestamp: 2025-02-05T21:58:03.118Z
Learning: In the connect-react package, the `enableDebugging` property should be of type `boolean` as it's used for toggling debugging features and conditional rendering.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-09-11T01:53:51.070Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18334
File: components/buddee/actions/list-employees/list-employees.mjs:147-155
Timestamp: 2025-09-11T01:53:51.070Z
Learning: In Buddee list-employees action, the "manager" prop should be a boolean type to filter employees who have direct reports, not an employeeId propDefinition which would send an employee ID instead of the expected boolean value.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
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: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Show resolved
Hide resolved
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
- Updated 'doubleSidedSpecificPages' type from string to string[] for better input handling. - Enhanced form data submission by restructuring how properties are appended, improving clarity and maintainability. - Ensured all relevant properties are conditionally appended to formData for better API interaction.
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
…andling - Changed 'doubleSidedSpecificPages' type from string[] to string for simplified input. - Updated example format in the description for clarity. - Adjusted form data submission for 'doubleSidedSpecificPages' to directly append the value. - Enhanced error logging for better debugging during print job creation.
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
- Added support for 'confirmed' and 'testmode' parameters in form data submission. - Updated handling of 'mailDate' to ensure proper timestamp conversion. - Included 'confidential' parameter for improved data handling during print job creation.
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-1: Remove the unnecessaryeslint-disablecomment.All imports are used in the code:
ConfigurationError(line 250),getFileStreamAndMetadata(line 204),FormData(line 206), constants (lines 58, 77, 96, 103),camelCaseToSnakeCase(line 236),parseObject(line 230), andintelliprint(line 177, 239). Theno-unused-varsdisable on line 1 should be removed.Apply this diff:
-/* eslint-disable no-unused-vars */ import { ConfigurationError, getFileStreamAndMetadata,
166-171: Remove unused required propsyncDir.The
syncDirprop is marked as required (optional: false) but is never used in the action logic. It's destructured at line 181 but serves no purpose.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, - }, },Also remove it from the destructuring at line 181:
const { intelliprint, confirmed, testmode, filePath, - syncDir, splittingMethod,
80-85: FixdoubleSidedSpecificPagesparsing and description.The prop description shows an example format
1-3,6-7(line 83), but this string is appended directly to FormData at line 216 without parsing. The API likely expects an array structure, not a raw string.Additionally, the example format is ambiguous—does
1-3,6-7mean a range notation or should users provide a JSON array like[[1,3],[6,7]]?Option 1: If users should provide JSON (recommended for consistency with
removeLettersSeries):Update the description and add parsing:
doubleSidedSpecificPages: { type: "string", label: "Double Sided Specific Pages", - description: "The array of pages to print double sided. Only used when **Double Sided** is set to `mixed`. Example: **1-3,6-7**.", + description: "JSON-encoded array of page ranges to print double sided (e.g., `[[1,3],[6,7]]`). Only used when **Double Sided** is set to `mixed`.", optional: true, },And at line 216:
- if (doubleSidedSpecificPages) formData.append("printing.double_sided_specific_pages", doubleSidedSpecificPages); + if (doubleSidedSpecificPages) formData.append("printing.double_sided_specific_pages", JSON.stringify(parseObject(doubleSidedSpecificPages)));Option 2: If the API accepts the
1-3,6-7string format as-is, update the description to clarify and keep the current implementation.
232-237: Critical: String conversion breaks object values.Converting all prop values to strings with template literals (line 236) will break the
metadataobject prop. Whenmetadatais passed, it will become"[object Object]"instead of being properly serialized.This issue was previously marked as addressed, but the template literal conversion is still present in the code.
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) : String(value); + formData.append(camelCaseToSnakeCase(key), fieldValue); + } }
250-250: Unsafe error property access could cause runtime error.The error handling assumes
error.response.data.error.messageexists. If any part of this chain is undefined (e.g., network errors, file reading errors fromgetFileStreamAndMetadata), it will throw a TypeError instead of the intended ConfigurationError, masking the original error.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 (1)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📚 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
📚 Learning: 2025-02-05T21:58:03.118Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 15479
File: packages/connect-react/src/components/ComponentForm.tsx:23-24
Timestamp: 2025-02-05T21:58:03.118Z
Learning: In the connect-react package, the `enableDebugging` property should be of type `boolean` as it's used for toggling debugging features and conditional rendering.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2025-09-11T01:53:51.070Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18334
File: components/buddee/actions/list-employees/list-employees.mjs:147-155
Timestamp: 2025-09-11T01:53:51.070Z
Learning: In Buddee list-employees action, the "manager" prop should be a boolean type to filter employees who have direct reports, not an employeeId propDefinition which would send an employee ID instead of the expected boolean value.
Applied to files:
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
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 (4)
parseObject(1-24)parseObject(1-24)camelCaseToSnakeCase(26-28)camelCaseToSnakeCase(26-28)
⏰ 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 (1)
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs (1)
112-123: Good improvements from previous feedback.Several issues from previous reviews have been successfully addressed:
backgroundFirstPageandbackgroundOtherPagesnaming is now consistent with destructuring and usage ✓nudgeXnow has the correct label and description ✓confirmationEmailis correctly typed as boolean ✓removeLettersSeriesis properly parsed withparseObjectbefore JSON serialization ✓- File handling with
getFileStreamAndMetadatais implemented correctly ✓mailDateis properly converted to Unix timestamp (line 223) ✓Also applies to: 142-153, 154-159, 202-211, 224-225, 230-230
components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs
Outdated
Show resolved
Hide resolved
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
…er error handling
Resolves #13409
Summary by CodeRabbit
New Features
Utilities
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.