Skip to content

[CDX 339] Add support for "format" query parameter#251

Merged
esezen merged 9 commits intomasterfrom
cdx-339-node-sdk-support-for-format-query-parameter
Apr 8, 2026
Merged

[CDX 339] Add support for "format" query parameter#251
esezen merged 9 commits intomasterfrom
cdx-339-node-sdk-support-for-format-query-parameter

Conversation

@quiteeasy
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 3, 2026 18:10
@quiteeasy quiteeasy requested review from esezen and jjl014 as code owners April 3, 2026 18:10

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/modules/catalog.js:70

  • format is validated after potentially converting items/variations/itemGroups streams into buffers. If a caller passes an invalid format, this will still read the entire stream into memory before failing, which is unnecessary work and can be expensive for large uploads. Consider validating/normalizing format immediately after destructuring parameters (before any stream-to-buffer conversion) so invalid values fail fast.
    const { section, notification_email, notificationEmail = notification_email, force, item_groups, onMissing, format = 'csv' } = parameters;
    let { items, variations, itemGroups = item_groups } = parameters;

    try {
      // Convert items to buffer if passed as stream
      if (items instanceof fs.ReadStream || items instanceof Duplex) {
        items = await convertToBuffer(items);
      }


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@constructor-claude-bedrock constructor-claude-bedrock bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR adds a format query parameter (csv | jsonl) to all six catalog ingestion methods (replaceCatalog, updateCatalog, patchCatalog, and the three *UsingTarArchive variants), defaulting to csv for backwards compatibility, with comprehensive test coverage.

Inline comments: 5 discussions added

Overall Assessment: ⚠️ Needs Work

section: 'Products',
};

catalog.replaceCatalog(data).then((res) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important Issue: All new done-callback tests use .then() without a .catch(done) chain. If the promise rejects (e.g., a network error or unexpected server response), Mocha will silently time out instead of reporting the real failure. Add .catch(done) to each .then() block, or convert to async/await:

catalog.replaceCatalog(data).then((res) => {
  // assertions...
  done();
}).catch(done);

This applies to all eight new done-style tests across the four describe blocks.

@esezen esezen merged commit a7c20cc into master Apr 8, 2026
5 of 7 checks passed
@esezen esezen deleted the cdx-339-node-sdk-support-for-format-query-parameter branch April 8, 2026 12:13
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.

3 participants