Add typed extend parameter support #30

Merged
chris-kreidl merged 9 commits from feat/extend-response-types into main 2026-03-21 22:40:30 +00:00
chris-kreidl commented 2026-03-21 21:56:41 +00:00 (Migrated from github.com)

Summary

  • Add WithExtend utility type and ExtendableFields map for conditional return typing based on extend parameter values
  • Add function overloads to list/get on Products, Materials, Variants, Inventory, Sales Order Rows, and Purchase Orders so extended fields are required in the return type when extend is specified
  • Add type-level tests verifying overload resolution and type narrowing
  • Create SPEC_GAPS.md documenting undocumented extend response fields in the Katana OpenAPI spec
  • Update README with typed extend parameter section and examples

Test plan

  • vp check passes (formatting, lint, type checks)
  • vp test passes (74 tests including 21 new type-level tests)
  • vp run build produces correct declarations with all new types exported
  • CI passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Typed extend parameter across client endpoints: using extend now narrows responses so extended fields are required.
  • Documentation

    • Added guide with examples and a table of supported extend values.
    • Added a SPEC_GAPS document listing undocumented response fields surfaced by extend.
  • Tests

    • Added compile-time type tests validating extend behavior and narrowed response shapes.
## Summary - Add `WithExtend` utility type and `ExtendableFields` map for conditional return typing based on `extend` parameter values - Add function overloads to `list`/`get` on Products, Materials, Variants, Inventory, Sales Order Rows, and Purchase Orders so extended fields are required in the return type when `extend` is specified - Add type-level tests verifying overload resolution and type narrowing - Create `SPEC_GAPS.md` documenting undocumented extend response fields in the Katana OpenAPI spec - Update README with typed `extend` parameter section and examples ## Test plan - [x] `vp check` passes (formatting, lint, type checks) - [x] `vp test` passes (74 tests including 21 new type-level tests) - [x] `vp run build` produces correct declarations with all new types exported - [ ] CI passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Typed extend parameter across client endpoints: using extend now narrows responses so extended fields are required. * **Documentation** * Added guide with examples and a table of supported extend values. * Added a SPEC_GAPS document listing undocumented response fields surfaced by extend. * **Tests** * Added compile-time type tests validating extend behavior and narrowed response shapes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2026-03-21 21:56:57 +00:00 (Migrated from github.com)

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 dae87e8739 and 25fc6f56ef.

📒 Files selected for processing (3)
  • packages/katana-client/src/resources/purchaseOrders.ts
  • packages/katana-client/src/resources/salesOrderRows.ts
  • packages/katana-client/src/types.ts

📝 Walkthrough

Walkthrough

Adds typed extend parameter 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

Cohort / File(s) Summary
Documentation & Release
\.changeset/extend-response-types.md, packages/katana-client/README.md, packages/katana-client/SPEC_GAPS.md
Changeset bump for a minor release; README documents typed extend usage and examples; SPEC_GAPS.md lists undocumented response fields returned by extend.
Types & Tests
packages/katana-client/src/types.ts, packages/katana-client/src/types.test.ts
Added ExtendableFields, WithExtend utility type and multiple *With* aliases; added product_or_material? to KatanaVariant; added compile-time type tests validating required-field narrowing and assignability.
Resource Methods (overloads & bindings)
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.ts
Converted arrow-function class members to async methods (bound in constructors) and added TypeScript overloads that narrow list/get return types when specific extend tuples 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

Poem

🐰 I nudged the types so fields stand tall,
When extend hops in, the optionals fall.
I bound the methods, wrote tests that gleam,
Nibbled a carrot, then dreamed a typed dream. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add typed extend parameter support' accurately and concisely summarizes the main change: introducing TypeScript-based type narrowing for the extend parameter across multiple API resource methods.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/extend-response-types

Comment @coderabbitai help to get the list of available commands and usage tips.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: ASSERTIVE **Plan**: Pro **Run ID**: `a64bb838-82ee-4cca-a66a-ad0b5dff132c` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between dae87e87396fbe9d9091d698eed12fbd8c72c839 and 25fc6f56ef7b50296f66780a7dcc050edce22efc. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `packages/katana-client/src/resources/purchaseOrders.ts` * `packages/katana-client/src/resources/salesOrderRows.ts` * `packages/katana-client/src/types.ts` </details> </details> --- <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Adds typed `extend` parameter 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 |Cohort / File(s)|Summary| |---|---| |**Documentation & Release** <br> `\.changeset/extend-response-types.md`, `packages/katana-client/README.md`, `packages/katana-client/SPEC_GAPS.md`|Changeset bump for a minor release; README documents typed `extend` usage and examples; `SPEC_GAPS.md` lists undocumented response fields returned by `extend`.| |**Types & Tests** <br> `packages/katana-client/src/types.ts`, `packages/katana-client/src/types.test.ts`|Added `ExtendableFields`, `WithExtend` utility type and multiple `*With*` aliases; added `product_or_material?` to `KatanaVariant`; added compile-time type tests validating required-field narrowing and assignability.| |**Resource Methods (overloads & bindings)** <br> `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.ts`|Converted arrow-function class members to `async` methods (bound in constructors) and added TypeScript overloads that narrow `list`/`get` return types when specific `extend` tuples 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 - chris-kreidl/katanatools#25 — modifies `MaterialsResource` and introduces/adjusts `extend: ["supplier"]` handling similar to this PR. - chris-kreidl/katanatools#3 — related updates to product-related types and product response shapes touched by these changes. - chris-kreidl/katanatools#17 — earlier resource refactor that introduced the resource/class patterns extended by this PR. ## Poem > 🐰 I nudged the types so fields stand tall, > When `extend` hops in, the optionals fall. > I bound the methods, wrote tests that gleam, > Nibbled a carrot, then dreamed a typed dream. 🥕 </details> <!-- walkthrough_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 3</summary> <details> <summary>✅ Passed checks (3 passed)</summary> | Check name | Status | Explanation | | :----------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | ✅ Passed | The title 'Add typed extend parameter support' accurately and concisely summarizes the main change: introducing TypeScript-based type narrowing for the extend parameter across multiple API resource methods. | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. | </details> <sub>✏️ Tip: You can configure your own custom pre-merge checks in the settings.</sub> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> <details> <summary>📝 Generate docstrings</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> Create stacked PR - [ ] <!-- {"checkboxId": "3e1879ae-f29b-4d0d-8e06-d12b7ba33d98"} --> Commit on current branch </details> <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit unit tests in branch `feat/extend-response-types` </details> </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAgrXq4stx0kCQAHjQY9NzOaGw0fA7c3PgUuJAAFLaQZgDMAAwAlJCAKASQAKqIlFwMsBRIYADWFCTwtB6l9vjYFAzekABmJNQA9OGRtGAtiCkYVWCBwciASYSQzNpYZQDCLdR0XABM+QcAbGD5uWAHAIzQNxwArCccACzXAFqdAMq41NiIXHwwQwRi2sEwpABBigfloyAA6upYABRCJkeh4eAedTyRYkdBRSCoiYqLwAMXgJA8cLWaG4kAIoQwpPxTCi6ng+GZHRauB6WEW8AwREgAjQVXoXNCaMJMSo8UokAkaA82GkGmhkFhyAG2AwYk5WHwUgoHnwaBpA1SkGxiFwI1I6SlVgoimwYkQABpIABZPb1FVeyAANWc8EwuCDAEkMFIMAQX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aXZaAAYFMZeCj6xypR2wNvt91ZRRjDwErVlBOAFBw5jBU46dq6MnBhtAmwbS8BOAWgDtaAfIPUaygkBjgzm0Zd5sy09H+jAwEbOcamOHbpIRaQo61ogBdxftFAf7THvM2fawdcmxTfgAcgxB/gJAYHXsExOg6ZNPZbY3aBZLonaAPgXABQV/x0AEdT22WBCVR35BwTSJvACibRNVBMTNAD7YSH0BAA= --> <!-- internal state end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2026-03-21 22:01:49 +00:00
coderabbitai[bot] (Migrated from github.com) left a comment

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
packages/katana-client/src/resources/materials.ts (1)

101-135: 🧹 Nitpick | 🔵 Trivial

Consider converting remaining methods to standard method syntax for consistency.

Similar to purchaseOrders.ts, the create, update, and delete methods remain as arrow function properties while list and get were converted to standard method syntax. Consider converting all methods to match for consistency within the class.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/katana-client/src/resources/materials.ts` around lines 101 - 135,
The create, update, and delete members are declared as arrow properties; convert
them to standard async method declarations for consistency with list and get:
change "create = async (payload: createMaterialSchemaType):
Promise<KatanaCreateMaterialResponse> => { ... }" to "async create(payload:
createMaterialSchemaType): Promise<KatanaCreateMaterialResponse> { ... }",
similarly change "update = async (payload: updateMaterialSchemaType):
Promise<KatanaMaterial> => { ... }" and "delete = async (params:
deleteMaterialSchemaType): Promise<void> => { ... }" to "async update(...){...}"
and "async delete(...){...}" respectively, keeping the same bodies, return
types, and use of this.client.request and named symbols (create, update, delete,
createMaterialSchemaType, updateMaterialSchemaType, deleteMaterialSchemaType,
KatanaCreateMaterialResponse, KatanaMaterial) so behavior and typings remain
unchanged.
packages/katana-client/src/resources/purchaseOrders.ts (1)

77-83: 🧹 Nitpick | 🔵 Trivial

Consider converting create to standard method syntax for consistency.

The list method was converted from arrow function property to standard method syntax, but create remains as an arrow function. For consistency within the class and with other resource files in this PR, consider converting create to match.

♻️ Suggested refactor
-  create = async (
-    payload: createPurchaseOrderSchemaType,
-  ): Promise<KatanaCreatePurchaseOrderResponse> => {
+  async create(
+    payload: createPurchaseOrderSchemaType,
+  ): Promise<KatanaCreatePurchaseOrderResponse> {
     return this.client.request<KatanaCreatePurchaseOrderResponse>("POST", "purchase_orders", {
       body: JSON.stringify(payload),
     });
-  };
+  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/katana-client/src/resources/purchaseOrders.ts` around lines 77 - 83,
The create method is defined as an arrow function property while list was
converted to a standard class method; change create from an arrow property to a
standard async method to keep style consistent: replace the "create = async
(payload: createPurchaseOrderSchemaType):
Promise<KatanaCreatePurchaseOrderResponse> => { ... }" property with "async
create(payload: createPurchaseOrderSchemaType):
Promise<KatanaCreatePurchaseOrderResponse> { ... }", preserving the body that
calls this.client.request and the return type; no other behavior changes or
bindings are required.
packages/katana-client/src/resources/variants.ts (1)

69-72: ⚠️ Potential issue | 🟡 Minor

JSDoc example uses incorrect extend value.

The example shows extend: ["product"] but the overload only narrows types for extend: ["product_or_material"]. This could confuse users expecting type narrowing when using the documented example.

📝 Suggested fix
   * `@example`
   * ```ts
-  * const variant = await client.variants.get({ id: 100, extend: ["product"] });
+  * const variant = await client.variants.get({ id: 100, extend: ["product_or_material"] });
   * ```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/katana-client/src/resources/variants.ts` around lines 69 - 72,
Update the JSDoc example in packages/katana-client/src/resources/variants.ts to
use the correct extend value that matches the overload type-narrowing: change
the example call to client.variants.get({ id: 100, extend:
["product_or_material"] }) so it aligns with the overload that narrows types for
extend: ["product_or_material"] (look for the get method in the variants
resource or the JSDoc block containing the current example).
packages/katana-client/src/resources/products.ts (1)

69-77: 🧹 Nitpick | 🔵 Trivial

Consider updating example to demonstrate typed extend.

The JSDoc example shows extend: ["variants"], but the new overload only provides type narrowing for extend: ["supplier"]. While the example is valid, it doesn't demonstrate the typed extend feature. Consider updating the example or adding a second example showing the supplier extend with its type benefit.

📝 Suggested example update
   * `@example`
   * ```ts
-  * const product = await client.products.get({ id: 42, extend: ["variants"] });
+  * // Typed extend: supplier field is guaranteed to be present
+  * const product = await client.products.get({ id: 42, extend: ["supplier"] });
+  * console.log(product.supplier.name); // No undefined check needed
   * ```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/katana-client/src/resources/products.ts` around lines 69 - 77,
Update the JSDoc examples for products.get to demonstrate the typed `extend`
overload: replace or add an example that calls client.products.get with extend:
["supplier"] (showing that the returned product has a typed supplier field,
e.g., accessing product.supplier.name without undefined checks). Locate the
comment block around the products.get JSDoc (referencing the products.get
method/overload) and modify the example text to use the typed supplier extend or
include a second example illustrating both variants.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/katana-client/src/resources/materials.ts`:
- Around line 101-135: The create, update, and delete members are declared as
arrow properties; convert them to standard async method declarations for
consistency with list and get: change "create = async (payload:
createMaterialSchemaType): Promise<KatanaCreateMaterialResponse> => { ... }" to
"async create(payload: createMaterialSchemaType):
Promise<KatanaCreateMaterialResponse> { ... }", similarly change "update = async
(payload: updateMaterialSchemaType): Promise<KatanaMaterial> => { ... }" and
"delete = async (params: deleteMaterialSchemaType): Promise<void> => { ... }" to
"async update(...){...}" and "async delete(...){...}" respectively, keeping the
same bodies, return types, and use of this.client.request and named symbols
(create, update, delete, createMaterialSchemaType, updateMaterialSchemaType,
deleteMaterialSchemaType, KatanaCreateMaterialResponse, KatanaMaterial) so
behavior and typings remain unchanged.

In `@packages/katana-client/src/resources/products.ts`:
- Around line 69-77: Update the JSDoc examples for products.get to demonstrate
the typed `extend` overload: replace or add an example that calls
client.products.get with extend: ["supplier"] (showing that the returned product
has a typed supplier field, e.g., accessing product.supplier.name without
undefined checks). Locate the comment block around the products.get JSDoc
(referencing the products.get method/overload) and modify the example text to
use the typed supplier extend or include a second example illustrating both
variants.

In `@packages/katana-client/src/resources/purchaseOrders.ts`:
- Around line 77-83: The create method is defined as an arrow function property
while list was converted to a standard class method; change create from an arrow
property to a standard async method to keep style consistent: replace the
"create = async (payload: createPurchaseOrderSchemaType):
Promise<KatanaCreatePurchaseOrderResponse> => { ... }" property with "async
create(payload: createPurchaseOrderSchemaType):
Promise<KatanaCreatePurchaseOrderResponse> { ... }", preserving the body that
calls this.client.request and the return type; no other behavior changes or
bindings are required.

In `@packages/katana-client/src/resources/variants.ts`:
- Around line 69-72: Update the JSDoc example in
packages/katana-client/src/resources/variants.ts to use the correct extend value
that matches the overload type-narrowing: change the example call to
client.variants.get({ id: 100, extend: ["product_or_material"] }) so it aligns
with the overload that narrows types for extend: ["product_or_material"] (look
for the get method in the variants resource or the JSDoc block containing the
current example).

ℹ️ 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 01eeaac445 and 3d0cfbacca.

📒 Files selected for processing (11)
  • .changeset/extend-response-types.md
  • packages/katana-client/README.md
  • packages/katana-client/SPEC_GAPS.md
  • packages/katana-client/src/resources/inventory.ts
  • packages/katana-client/src/resources/materials.ts
  • packages/katana-client/src/resources/products.ts
  • packages/katana-client/src/resources/purchaseOrders.ts
  • packages/katana-client/src/resources/salesOrderRows.ts
  • packages/katana-client/src/resources/variants.ts
  • packages/katana-client/src/types.test.ts
  • packages/katana-client/src/types.ts
> [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to platform limitations. > > > > <details> > <summary>⚠️ Outside diff range comments (4)</summary><blockquote> > > <details> > <summary>packages/katana-client/src/resources/materials.ts (1)</summary><blockquote> > > `101-135`: _🧹 Nitpick_ | _🔵 Trivial_ > > **Consider converting remaining methods to standard method syntax for consistency.** > > Similar to `purchaseOrders.ts`, the `create`, `update`, and `delete` methods remain as arrow function properties while `list` and `get` were converted to standard method syntax. Consider converting all methods to match for consistency within the class. > > <details> > <summary>🤖 Prompt for AI Agents</summary> > > ``` > Verify each finding against the current code and only fix it if needed. > > In `@packages/katana-client/src/resources/materials.ts` around lines 101 - 135, > The create, update, and delete members are declared as arrow properties; convert > them to standard async method declarations for consistency with list and get: > change "create = async (payload: createMaterialSchemaType): > Promise<KatanaCreateMaterialResponse> => { ... }" to "async create(payload: > createMaterialSchemaType): Promise<KatanaCreateMaterialResponse> { ... }", > similarly change "update = async (payload: updateMaterialSchemaType): > Promise<KatanaMaterial> => { ... }" and "delete = async (params: > deleteMaterialSchemaType): Promise<void> => { ... }" to "async update(...){...}" > and "async delete(...){...}" respectively, keeping the same bodies, return > types, and use of this.client.request and named symbols (create, update, delete, > createMaterialSchemaType, updateMaterialSchemaType, deleteMaterialSchemaType, > KatanaCreateMaterialResponse, KatanaMaterial) so behavior and typings remain > unchanged. > ``` > > </details> > > </blockquote></details> > <details> > <summary>packages/katana-client/src/resources/purchaseOrders.ts (1)</summary><blockquote> > > `77-83`: _🧹 Nitpick_ | _🔵 Trivial_ > > **Consider converting `create` to standard method syntax for consistency.** > > The `list` method was converted from arrow function property to standard method syntax, but `create` remains as an arrow function. For consistency within the class and with other resource files in this PR, consider converting `create` to match. > > > > <details> > <summary>♻️ Suggested refactor</summary> > > ```diff > - create = async ( > - payload: createPurchaseOrderSchemaType, > - ): Promise<KatanaCreatePurchaseOrderResponse> => { > + async create( > + payload: createPurchaseOrderSchemaType, > + ): Promise<KatanaCreatePurchaseOrderResponse> { > return this.client.request<KatanaCreatePurchaseOrderResponse>("POST", "purchase_orders", { > body: JSON.stringify(payload), > }); > - }; > + } > ``` > </details> > > <details> > <summary>🤖 Prompt for AI Agents</summary> > > ``` > Verify each finding against the current code and only fix it if needed. > > In `@packages/katana-client/src/resources/purchaseOrders.ts` around lines 77 - 83, > The create method is defined as an arrow function property while list was > converted to a standard class method; change create from an arrow property to a > standard async method to keep style consistent: replace the "create = async > (payload: createPurchaseOrderSchemaType): > Promise<KatanaCreatePurchaseOrderResponse> => { ... }" property with "async > create(payload: createPurchaseOrderSchemaType): > Promise<KatanaCreatePurchaseOrderResponse> { ... }", preserving the body that > calls this.client.request and the return type; no other behavior changes or > bindings are required. > ``` > > </details> > > </blockquote></details> > <details> > <summary>packages/katana-client/src/resources/variants.ts (1)</summary><blockquote> > > `69-72`: _⚠️ Potential issue_ | _🟡 Minor_ > > **JSDoc example uses incorrect extend value.** > > The example shows `extend: ["product"]` but the overload only narrows types for `extend: ["product_or_material"]`. This could confuse users expecting type narrowing when using the documented example. > > > <details> > <summary>📝 Suggested fix</summary> > > ```diff > * `@example` > * ```ts > - * const variant = await client.variants.get({ id: 100, extend: ["product"] }); > + * const variant = await client.variants.get({ id: 100, extend: ["product_or_material"] }); > * ``` > ``` > </details> > > <details> > <summary>🤖 Prompt for AI Agents</summary> > > ``` > Verify each finding against the current code and only fix it if needed. > > In `@packages/katana-client/src/resources/variants.ts` around lines 69 - 72, > Update the JSDoc example in packages/katana-client/src/resources/variants.ts to > use the correct extend value that matches the overload type-narrowing: change > the example call to client.variants.get({ id: 100, extend: > ["product_or_material"] }) so it aligns with the overload that narrows types for > extend: ["product_or_material"] (look for the get method in the variants > resource or the JSDoc block containing the current example). > ``` > > </details> > > </blockquote></details> > <details> > <summary>packages/katana-client/src/resources/products.ts (1)</summary><blockquote> > > `69-77`: _🧹 Nitpick_ | _🔵 Trivial_ > > **Consider updating example to demonstrate typed extend.** > > The JSDoc example shows `extend: ["variants"]`, but the new overload only provides type narrowing for `extend: ["supplier"]`. While the example is valid, it doesn't demonstrate the typed extend feature. Consider updating the example or adding a second example showing the supplier extend with its type benefit. > > > <details> > <summary>📝 Suggested example update</summary> > > ```diff > * `@example` > * ```ts > - * const product = await client.products.get({ id: 42, extend: ["variants"] }); > + * // Typed extend: supplier field is guaranteed to be present > + * const product = await client.products.get({ id: 42, extend: ["supplier"] }); > + * console.log(product.supplier.name); // No undefined check needed > * ``` > ``` > </details> > > <details> > <summary>🤖 Prompt for AI Agents</summary> > > ``` > Verify each finding against the current code and only fix it if needed. > > In `@packages/katana-client/src/resources/products.ts` around lines 69 - 77, > Update the JSDoc examples for products.get to demonstrate the typed `extend` > overload: replace or add an example that calls client.products.get with extend: > ["supplier"] (showing that the returned product has a typed supplier field, > e.g., accessing product.supplier.name without undefined checks). Locate the > comment block around the products.get JSDoc (referencing the products.get > method/overload) and modify the example text to use the typed supplier extend or > include a second example illustrating both variants. > ``` > > </details> > > </blockquote></details> > > </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary> ``` Verify each finding against the current code and only fix it if needed. Outside diff comments: In `@packages/katana-client/src/resources/materials.ts`: - Around line 101-135: The create, update, and delete members are declared as arrow properties; convert them to standard async method declarations for consistency with list and get: change "create = async (payload: createMaterialSchemaType): Promise<KatanaCreateMaterialResponse> => { ... }" to "async create(payload: createMaterialSchemaType): Promise<KatanaCreateMaterialResponse> { ... }", similarly change "update = async (payload: updateMaterialSchemaType): Promise<KatanaMaterial> => { ... }" and "delete = async (params: deleteMaterialSchemaType): Promise<void> => { ... }" to "async update(...){...}" and "async delete(...){...}" respectively, keeping the same bodies, return types, and use of this.client.request and named symbols (create, update, delete, createMaterialSchemaType, updateMaterialSchemaType, deleteMaterialSchemaType, KatanaCreateMaterialResponse, KatanaMaterial) so behavior and typings remain unchanged. In `@packages/katana-client/src/resources/products.ts`: - Around line 69-77: Update the JSDoc examples for products.get to demonstrate the typed `extend` overload: replace or add an example that calls client.products.get with extend: ["supplier"] (showing that the returned product has a typed supplier field, e.g., accessing product.supplier.name without undefined checks). Locate the comment block around the products.get JSDoc (referencing the products.get method/overload) and modify the example text to use the typed supplier extend or include a second example illustrating both variants. In `@packages/katana-client/src/resources/purchaseOrders.ts`: - Around line 77-83: The create method is defined as an arrow function property while list was converted to a standard class method; change create from an arrow property to a standard async method to keep style consistent: replace the "create = async (payload: createPurchaseOrderSchemaType): Promise<KatanaCreatePurchaseOrderResponse> => { ... }" property with "async create(payload: createPurchaseOrderSchemaType): Promise<KatanaCreatePurchaseOrderResponse> { ... }", preserving the body that calls this.client.request and the return type; no other behavior changes or bindings are required. In `@packages/katana-client/src/resources/variants.ts`: - Around line 69-72: Update the JSDoc example in packages/katana-client/src/resources/variants.ts to use the correct extend value that matches the overload type-narrowing: change the example call to client.variants.get({ id: 100, extend: ["product_or_material"] }) so it aligns with the overload that narrows types for extend: ["product_or_material"] (look for the get method in the variants resource or the JSDoc block containing the current example). ``` </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: ASSERTIVE **Plan**: Pro **Run ID**: `49b0b257-61a6-4881-9844-69d8ed92f060` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 01eeaac44582c549cce770699c4237418ca01ee9 and 3d0cfbaccaa6520de7a95cd64aa729db5d4d7f5f. </details> <details> <summary>📒 Files selected for processing (11)</summary> * `.changeset/extend-response-types.md` * `packages/katana-client/README.md` * `packages/katana-client/SPEC_GAPS.md` * `packages/katana-client/src/resources/inventory.ts` * `packages/katana-client/src/resources/materials.ts` * `packages/katana-client/src/resources/products.ts` * `packages/katana-client/src/resources/purchaseOrders.ts` * `packages/katana-client/src/resources/salesOrderRows.ts` * `packages/katana-client/src/resources/variants.ts` * `packages/katana-client/src/types.test.ts` * `packages/katana-client/src/types.ts` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
coderabbitai[bot] (Migrated from github.com) reviewed 2026-03-21 22:14:36 +00:00
coderabbitai[bot] (Migrated from github.com) left a comment

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/katana-client/src/resources/materials.ts (1)

37-64: ⚠️ Potential issue | 🔴 Critical

Confirmed: This is a breaking change for the public API.

When methods are passed as callbacks to paginate() or listAllPages() (documented usage patterns like client.paginate(client.products.list, ...)), prototype methods without binding will lose their this context and fail at runtime. The methods are invoked directly without .bind() or wrapping.

This affects any existing code or external consumers relying on the documented callback patterns. The suggested fix of binding methods in the constructor is valid and necessary.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/katana-client/src/resources/materials.ts` around lines 37 - 64, The
Materials class's prototype method list (and other resource methods) lose their
this context when passed as callbacks (e.g.,
client.paginate(client.products.list, ...)), causing runtime failures; fix by
binding the instance methods to this in the resource constructor (bind methods
like list on the Materials class instance) so that calls preserve the client
context, or alternatively wrap callbacks when passing to paginate/listAllPages;
ensure you bind every public method used as a standalone callback (e.g., list)
in the constructor of the Materials resource (or the shared base resource) so
paginate/listAllPages work without consumers changing their usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/katana-client/src/resources/materials.ts`:
- Around line 37-64: The Materials class's prototype method list (and other
resource methods) lose their this context when passed as callbacks (e.g.,
client.paginate(client.products.list, ...)), causing runtime failures; fix by
binding the instance methods to this in the resource constructor (bind methods
like list on the Materials class instance) so that calls preserve the client
context, or alternatively wrap callbacks when passing to paginate/listAllPages;
ensure you bind every public method used as a standalone callback (e.g., list)
in the constructor of the Materials resource (or the shared base resource) so
paginate/listAllPages work without consumers changing their usage.

ℹ️ 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 3d0cfbacca and 4c87da91ee.

📒 Files selected for processing (4)
  • packages/katana-client/src/resources/materials.ts
  • packages/katana-client/src/resources/products.ts
  • packages/katana-client/src/resources/purchaseOrders.ts
  • packages/katana-client/src/resources/variants.ts
> [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to platform limitations. > > > > <details> > <summary>⚠️ Outside diff range comments (1)</summary><blockquote> > > <details> > <summary>packages/katana-client/src/resources/materials.ts (1)</summary><blockquote> > > `37-64`: _⚠️ Potential issue_ | _🔴 Critical_ > > **Confirmed: This is a breaking change for the public API.** > > When methods are passed as callbacks to `paginate()` or `listAllPages()` (documented usage patterns like `client.paginate(client.products.list, ...)`), prototype methods without binding will lose their `this` context and fail at runtime. The methods are invoked directly without `.bind()` or wrapping. > > This affects any existing code or external consumers relying on the documented callback patterns. The suggested fix of binding methods in the constructor is valid and necessary. > > <details> > <summary>🤖 Prompt for AI Agents</summary> > > ``` > Verify each finding against the current code and only fix it if needed. > > In `@packages/katana-client/src/resources/materials.ts` around lines 37 - 64, The > Materials class's prototype method list (and other resource methods) lose their > this context when passed as callbacks (e.g., > client.paginate(client.products.list, ...)), causing runtime failures; fix by > binding the instance methods to this in the resource constructor (bind methods > like list on the Materials class instance) so that calls preserve the client > context, or alternatively wrap callbacks when passing to paginate/listAllPages; > ensure you bind every public method used as a standalone callback (e.g., list) > in the constructor of the Materials resource (or the shared base resource) so > paginate/listAllPages work without consumers changing their usage. > ``` > > </details> > > </blockquote></details> > > </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary> ``` Verify each finding against the current code and only fix it if needed. Outside diff comments: In `@packages/katana-client/src/resources/materials.ts`: - Around line 37-64: The Materials class's prototype method list (and other resource methods) lose their this context when passed as callbacks (e.g., client.paginate(client.products.list, ...)), causing runtime failures; fix by binding the instance methods to this in the resource constructor (bind methods like list on the Materials class instance) so that calls preserve the client context, or alternatively wrap callbacks when passing to paginate/listAllPages; ensure you bind every public method used as a standalone callback (e.g., list) in the constructor of the Materials resource (or the shared base resource) so paginate/listAllPages work without consumers changing their usage. ``` </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: ASSERTIVE **Plan**: Pro **Run ID**: `5c65efec-d7d7-4103-b460-a5c0782b6a06` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 3d0cfbaccaa6520de7a95cd64aa729db5d4d7f5f and 4c87da91ee6e7be2e50e6bb9226dffaa329264a6. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `packages/katana-client/src/resources/materials.ts` * `packages/katana-client/src/resources/products.ts` * `packages/katana-client/src/resources/purchaseOrders.ts` * `packages/katana-client/src/resources/variants.ts` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
coderabbitai[bot] (Migrated from github.com) reviewed 2026-03-21 22:28:38 +00:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/katana-client/src/resources/purchaseOrders.ts`:
- Around line 33-39: Add a named type alias instead of inlining WithExtend<...>
to keep style consistent: define KatanaPurchaseOrderWithSupplier =
WithExtend<KatanaPurchaseOrder, ["supplier"]> in types.ts and then update the
overloaded list signatures to use KatanaPurchaseOrderWithSupplier (refer to the
list method and the existing WithExtend<KatanaPurchaseOrder, ["supplier"]>
usage) so the promise return becomes Promise<{ data:
KatanaPurchaseOrderWithSupplier[] }>.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ 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 4c87da91ee and dae87e8739.

📒 Files selected for processing (6)
  • packages/katana-client/src/resources/inventory.ts
  • packages/katana-client/src/resources/materials.ts
  • packages/katana-client/src/resources/products.ts
  • packages/katana-client/src/resources/purchaseOrders.ts
  • packages/katana-client/src/resources/salesOrderRows.ts
  • packages/katana-client/src/resources/variants.ts
**Actionable comments posted: 1** <details> <summary>🤖 Prompt for all review comments with AI agents</summary> ``` Verify each finding against the current code and only fix it if needed. Inline comments: In `@packages/katana-client/src/resources/purchaseOrders.ts`: - Around line 33-39: Add a named type alias instead of inlining WithExtend<...> to keep style consistent: define KatanaPurchaseOrderWithSupplier = WithExtend<KatanaPurchaseOrder, ["supplier"]> in types.ts and then update the overloaded list signatures to use KatanaPurchaseOrderWithSupplier (refer to the list method and the existing WithExtend<KatanaPurchaseOrder, ["supplier"]> usage) so the promise return becomes Promise<{ data: KatanaPurchaseOrderWithSupplier[] }>. ``` </details> <details> <summary>🪄 Autofix (Beta)</summary> Fix all unresolved CodeRabbit comments on this PR: - [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended) - [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: ASSERTIVE **Plan**: Pro **Run ID**: `a052d2ca-56ea-4d39-af87-5da294fcdf27` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4c87da91ee6e7be2e50e6bb9226dffaa329264a6 and dae87e87396fbe9d9091d698eed12fbd8c72c839. </details> <details> <summary>📒 Files selected for processing (6)</summary> * `packages/katana-client/src/resources/inventory.ts` * `packages/katana-client/src/resources/materials.ts` * `packages/katana-client/src/resources/products.ts` * `packages/katana-client/src/resources/purchaseOrders.ts` * `packages/katana-client/src/resources/salesOrderRows.ts` * `packages/katana-client/src/resources/variants.ts` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -54,3 +64,4 @@
}
/**
* Creates a new purchase order. Requires at minimum a `supplier_id` and
coderabbitai[bot] (Migrated from github.com) commented 2026-03-21 22:28:37 +00:00

🧹 Nitpick | 🔵 Trivial

Consider using a type alias for consistency.

Other resources (e.g., materials.ts) use a pre-defined type alias like KatanaMaterialWithSupplier rather than inlining WithExtend<..., ["supplier"]>. For consistency, consider adding KatanaPurchaseOrderWithSupplier to types.ts and using it here.

That said, the current implementation is functionally correct.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/katana-client/src/resources/purchaseOrders.ts` around lines 33 - 39,
Add a named type alias instead of inlining WithExtend<...> to keep style
consistent: define KatanaPurchaseOrderWithSupplier =
WithExtend<KatanaPurchaseOrder, ["supplier"]> in types.ts and then update the
overloaded list signatures to use KatanaPurchaseOrderWithSupplier (refer to the
list method and the existing WithExtend<KatanaPurchaseOrder, ["supplier"]>
usage) so the promise return becomes Promise<{ data:
KatanaPurchaseOrderWithSupplier[] }>.
_🧹 Nitpick_ | _🔵 Trivial_ **Consider using a type alias for consistency.** Other resources (e.g., `materials.ts`) use a pre-defined type alias like `KatanaMaterialWithSupplier` rather than inlining `WithExtend<..., ["supplier"]>`. For consistency, consider adding `KatanaPurchaseOrderWithSupplier` to `types.ts` and using it here. That said, the current implementation is functionally correct. <details> <summary>🤖 Prompt for AI Agents</summary> ``` Verify each finding against the current code and only fix it if needed. In `@packages/katana-client/src/resources/purchaseOrders.ts` around lines 33 - 39, Add a named type alias instead of inlining WithExtend<...> to keep style consistent: define KatanaPurchaseOrderWithSupplier = WithExtend<KatanaPurchaseOrder, ["supplier"]> in types.ts and then update the overloaded list signatures to use KatanaPurchaseOrderWithSupplier (refer to the list method and the existing WithExtend<KatanaPurchaseOrder, ["supplier"]> usage) so the promise return becomes Promise<{ data: KatanaPurchaseOrderWithSupplier[] }>. ``` </details> <!-- fingerprinting:phantom:poseidon:ocelot --> <!-- This is an auto-generated comment by CodeRabbit -->
Sign in to join this conversation.
No description provided.