Add typed extend parameter support #30
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
javascript
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ckreidl/katanatools!30
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/extend-response-types"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
WithExtendutility type andExtendableFieldsmap for conditional return typing based onextendparameter valueslist/geton Products, Materials, Variants, Inventory, Sales Order Rows, and Purchase Orders so extended fields are required in the return type whenextendis specifiedSPEC_GAPS.mddocumenting undocumented extend response fields in the Katana OpenAPI specextendparameter section and examplesTest plan
vp checkpasses (formatting, lint, type checks)vp testpasses (74 tests including 21 new type-level tests)vp run buildproduces correct declarations with all new types exported🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID:
a64bb838-82ee-4cca-a66a-ad0b5dff132c📥 Commits
Reviewing files that changed from the base of the PR and between
dae87e8739and25fc6f56ef.📒 Files selected for processing (3)
packages/katana-client/src/resources/purchaseOrders.tspackages/katana-client/src/resources/salesOrderRows.tspackages/katana-client/src/types.ts📝 Walkthrough
Walkthrough
Adds typed
extendparameter support across Katana client resource methods via TypeScript overloads and new utility types, making extended response fields required when requested. Includes README and SPEC_GAPS documentation and type-level tests verifying the narrowing behavior.Changes
\.changeset/extend-response-types.md,packages/katana-client/README.md,packages/katana-client/SPEC_GAPS.mdextendusage and examples;SPEC_GAPS.mdlists undocumented response fields returned byextend.packages/katana-client/src/types.ts,packages/katana-client/src/types.test.tsExtendableFields,WithExtendutility type and multiple*With*aliases; addedproduct_or_material?toKatanaVariant; added compile-time type tests validating required-field narrowing and assignability.packages/katana-client/src/resources/products.ts,packages/katana-client/src/resources/materials.ts,packages/katana-client/src/resources/variants.ts,packages/katana-client/src/resources/inventory.ts,packages/katana-client/src/resources/purchaseOrders.ts,packages/katana-client/src/resources/salesOrderRows.tsasyncmethods (bound in constructors) and added TypeScript overloads that narrowlist/getreturn types when specificextendtuples are provided (e.g.,["supplier"],["variant"],["location"],["product_or_material"]). Runtime request construction unchanged.Sequence Diagram(s)
(none — changes are primarily type-level overloads and small method form changes, not new multi-component runtime flows.)
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~35 minutes
Possibly related PRs
MaterialsResourceand introduces/adjustsextend: ["supplier"]handling similar to this PR.Poem
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
feat/extend-response-typesComment
@coderabbitai helpto get the list of available commands and usage tips.🤖 Prompt for all review comments with AI agents
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID:
49b0b257-61a6-4881-9844-69d8ed92f060📥 Commits
Reviewing files that changed from the base of the PR and between
01eeaac445and3d0cfbacca.📒 Files selected for processing (11)
.changeset/extend-response-types.mdpackages/katana-client/README.mdpackages/katana-client/SPEC_GAPS.mdpackages/katana-client/src/resources/inventory.tspackages/katana-client/src/resources/materials.tspackages/katana-client/src/resources/products.tspackages/katana-client/src/resources/purchaseOrders.tspackages/katana-client/src/resources/salesOrderRows.tspackages/katana-client/src/resources/variants.tspackages/katana-client/src/types.test.tspackages/katana-client/src/types.ts🤖 Prompt for all review comments with AI agents
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID:
5c65efec-d7d7-4103-b460-a5c0782b6a06📥 Commits
Reviewing files that changed from the base of the PR and between
3d0cfbaccaand4c87da91ee.📒 Files selected for processing (4)
packages/katana-client/src/resources/materials.tspackages/katana-client/src/resources/products.tspackages/katana-client/src/resources/purchaseOrders.tspackages/katana-client/src/resources/variants.tsActionable comments posted: 1
🤖 Prompt for all review comments with AI agents
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID:
a052d2ca-56ea-4d39-af87-5da294fcdf27📥 Commits
Reviewing files that changed from the base of the PR and between
4c87da91eeanddae87e8739.📒 Files selected for processing (6)
packages/katana-client/src/resources/inventory.tspackages/katana-client/src/resources/materials.tspackages/katana-client/src/resources/products.tspackages/katana-client/src/resources/purchaseOrders.tspackages/katana-client/src/resources/salesOrderRows.tspackages/katana-client/src/resources/variants.ts@ -54,3 +64,4 @@}/*** Creates a new purchase order. Requires at minimum a `supplier_id` and🧹 Nitpick | 🔵 Trivial
Consider using a type alias for consistency.
Other resources (e.g.,
materials.ts) use a pre-defined type alias likeKatanaMaterialWithSupplierrather than inliningWithExtend<..., ["supplier"]>. For consistency, consider addingKatanaPurchaseOrderWithSuppliertotypes.tsand using it here.That said, the current implementation is functionally correct.
🤖 Prompt for AI Agents