Skip to content

chore: support [affected]#232

Merged
sjvans merged 3 commits into
mainfrom
affected
May 21, 2026
Merged

chore: support [affected]#232
sjvans merged 3 commits into
mainfrom
affected

Conversation

@sjvans
Copy link
Copy Markdown
Contributor

@sjvans sjvans commented May 21, 2026

Chore: Support [affected] Array Format in CRUD Resolvers

Refactor

♻️ Updated the CRUD resolvers (create, update, delete) to handle the new [affected] array format returned by CDS, replacing the previous affectedRows-based result structure.

Changes

  • lib/resolvers/crud/create.js: Extracted a helper function _only_keys to check if result data contains only entity key fields (including IsActiveEntity). Updated result handling to check Array.isArray(result) && 'affected' in result instead of typeof result === 'object' && 'affectedRows' in result. Simplified the conditional logic for determining whether to use the request data or the result directly.

  • lib/resolvers/crud/delete.js: Updated result handling to extract result.affected instead of result.affectedRows when the result is an array with an affected property.

  • lib/resolvers/crud/update.js: Updated result handling to use the new [affected] array check, and replaced result.data ?? cdsReq.data with result.length ? result : cdsReq.data to determine the correct return value.

  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.20.51

  • File Content Strategy: Full file content
  • Output Template: Default Template
  • Correlation ID: 7af88f27-a399-4d8f-9cb1-231d7fb77074
  • Summary Prompt: Default Prompt
  • Event Trigger: pull_request.edited
  • LLM: anthropic--claude-4.6-sonnet

@sjvans sjvans requested a review from a team as a code owner May 21, 2026 08:40
@sjvans sjvans requested review from johannes-vogel and schwma May 21, 2026 08:40
Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights Bot left a comment

Choose a reason for hiding this comment

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

The PR introduces two significant bugs in create.js: a shared-state mutation via Object.assign on entity.keys, and an inverted ternary condition that causes the wrong result to be returned after an insert. The delete.js and update.js changes look correct for the new affected API shape.

PR Bot Information

Version: 1.20.51

  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.opened
  • Correlation ID: 0172d97f-8c62-4113-b7c6-3c082286da77
  • File Content Strategy: Full file content

Comment thread lib/resolvers/crud/create.js Outdated
Comment thread lib/resolvers/crud/create.js
sjvans and others added 2 commits May 21, 2026 11:14
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.com>
@sjvans sjvans merged commit 802ea71 into main May 21, 2026
6 checks passed
@sjvans sjvans deleted the affected branch May 21, 2026 10:08
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.

2 participants