Skip to content

feat(sdks): move catalog-search and cart-checkout-order to generator 0.99.0 - #648

Merged
field123 merged 7 commits into
mainfrom
sdks-catalog-search-cart-checkout-099
Oct 2, 2026
Merged

field123 merged 7 commits into
mainfrom
sdks-catalog-search-cart-checkout-099

Conversation

@field123

@field123 field123 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #646. Closes #647. Part of #629 and #626.

What this does

This repo publishes TypeScript SDKs (client libraries) generated from Elastic Path's API specs. Two of them were still built with an old version of the code generator, @hey-api/openapi-ts 0.61, and depended on a deprecated HTTP client. This PR rebuilds them with version 0.99, the same setup as the SDKs already migrated in #635, #637 and #642.

Package New client factory Version after
@epcc-sdk/sdks-catalog-search createCatalogSearchClient 0.2.0
@epcc-sdk/sdks-cart-checkout-order createCartCheckoutOrderClient 0.2.0

Each package now has:

  • a one-call client that fetches its own auth token and retries failed requests;
  • Zod validation schemas at <package>/zod;
  • tests, an updated README and a changeset.

What changes for people using these packages

Each changeset lists every type change. The main ones:

  • Timestamps are now string. They were typed Date, but the value was always a string.
  • num_tokens_dropped is now number (catalog-search). It was typed BigInt, but the value was always a number.
  • Small enum type aliases such as Status are removed. Each changeset shows how to derive them instead.
  • Two cart fields accept more value types, as the spec allows: a custom attribute's value and the error status.
  • Six cart response properties are now readonly.
  • The default region is EU West.

Where these two packages differ from the others

  • catalog-search uses the plain host as its base URL. The spec's server URLs end in /v2, but the API answers without it and returns 404 with it.
  • cart-checkout-order turns off one generator feature: splitting request and response types. With the feature on, the generator wrongly drops fields such as data and links from many response types. A test fails if the feature is turned back on.

Spec corrections

In four places the API spec doesn't match what the API accepts, so a call written to the types would fail. Each place is corrected when the package's spec is bundled, and the spec file itself is unchanged. Each correction was checked against the service code and has a test. The two custom discount corrections were also confirmed live:

  • catalog-search: a job's type had a default that isn't one of its allowed values, which broke the generated Zod schemas.
  • cart-checkout-order: bulk tax items can now carry meta.component_product_id, which targets a bundle component.
  • cart-checkout-order: custom discount updates send amount as an integer. The service rejected the object form the spec described.
  • cart-checkout-order: the cart item custom discount body is wrapped in { data }, which the service requires.

The spec problems are reported to the service owners.

Known issues (not fixed here)

How it was checked

  • Unit tests and the typecheck pass for every SDK package.
  • Two builds give identical output.
  • The packed packages compile in a fresh project under every TypeScript module-resolution mode.
  • sdks-shopper, which shares these specs, still generates identical output.
  • Live calls were made against a test store from the packed packages, and every response was validated with the package's own Zod schemas:
    • every read operation;
    • the changed write operations, on throwaway data that was deleted afterwards;
    • one test order.
    • The bundle-component tax could not be tested end to end, because the store has no bundle that can be added to a cart.
  • A fresh clone, built the way the release job builds, leaves no unexpected changes.

Regenerate @epcc-sdk/sdks-cart-checkout-order with @hey-api/openapi-ts
0.99.0 (previously 0.61.2), still from its cart-checkout-standalone@v1
bundle.

- Replace the generator config with the four-plugin one: client-fetch with
  an EU West baseUrl (the spec lists US East first), typescript, sdk and
  zod (compatibilityVersion 3). The transformers and generate-readme
  plugins are gone.
- Turn off the read/write split in this package's generator config. With
  it on, 0.99 drops a property it treats as free-form from any schema that
  has a readOnly property, which here removes data from 39 types and links
  from 28. With it off, no property the old types carried is missing and
  request bodies keep their 0.61 shape.
- Vendor the fetch client and drop @hey-api/client-fetch. Add
  createCartCheckoutOrderClient over @epcc-sdk/sdks-runtime, re-export the
  runtime helpers from the root, and publish Zod schemas on ./zod with a
  typesVersions map and zod as an optional peer.
- Add a vitest suite beside the runtime entry: the bearer token, the
  replay after a 401, the EU West default, the shipping group response in
  /zod, and pins for the read/write switch and the bulk tax meta.
- Replace the README's Authentication section by hand and add a
  Validation schemas section.
- Add cart_checkout_service_corrections.yaml to the standalone entry only:
  a bulk tax item takes an optional meta.component_product_id, which the
  service reads to tax a bundle component and the spec's own example
  sends, but its schema left out.
- Add a minor changeset listing every type change the old-against-new
  diff found: 11 date-time fields from Date to string, the two OpenAPI 3.1
  widenings, six newly readonly property declarations, ten dropped inline enums with
  derive examples, and the bulk tax meta.

Refs #647
Regenerate @epcc-sdk/sdks-catalog-search with @hey-api/openapi-ts 0.99.0
(previously 0.61.2), file for file after #642. It still generates from the
catalog_search-standalone@v1 bundle.

- Replace the generator config with the four-plugin one: client-fetch with an
  EU West baseUrl, typescript, sdk and zod (compatibilityVersion 3). The
  transformers and generate-readme plugins are gone.
- Vendor the fetch client and drop @hey-api/client-fetch. Add
  createCatalogSearchClient over @epcc-sdk/sdks-runtime, re-export the runtime
  helpers from the root, and publish Zod schemas on ./zod with a typesVersions
  map and zod as an optional peer.
- Add a vitest suite beside the runtime entry; tsup leaves it out of dist.
- Replace the README's Authentication section by hand and add a Validation
  schemas section.
- Add a minor changeset listing every type change found by diffing each named
  type old against new: ten date-time fields from Date to string,
  num_tokens_dropped from BigInt to number, and six dropped inline enums with
  derive examples. All 40 operations keep their names and types.

The standalone bundle gains two preprocessors; the spec and the shopper join's
catalog_search@v1 entry are unchanged:

- remove-v2-server: the spec's servers end in /v2, but the service answers at
  <host>/pcm/... and returns 404 under /v2, so the base URL is the host.
- remove-invalid-enum-defaults (new): deletes a default that is not one of its
  schema's enum values. JobAttributes.type declares default: index, which made
  the generated zod declarations fail to compile.

specs/patches/README.md describes both.

Refs #629
Closes #646
… the integer the service takes

The specification points both custom discount update bodies at the response shape, so
amount was typed as an object the service rejects with a 400. A correction in the
cart-checkout-standalone bundle points them at a request schema with an integer amount,
pinned by a test.
…y in data

The specification declares the bare discount object as the body of the cart item custom
discount create, and the service rejects it with a 422 because it requires the data
wrapper. A correction in the cart-checkout-standalone bundle adds the wrapper, pinned by a
test.
@field123 field123 added this to the SDKs on generator 0.99.0 milestone Oct 2, 2026
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Actions Updated
commerce-essentials Ignored Ignored Preview Oct 2, 2026 1:35pm UTC
composable-frontend-algolia Ignored Ignored Oct 2, 2026 1:35pm UTC
composable-frontend-core Ignored Ignored Preview Oct 2, 2026 1:35pm UTC
composable-frontend-docs Ignored Ignored Preview Oct 2, 2026 1:35pm UTC
composable-frontend-simple Ignored Ignored Preview Oct 2, 2026 1:35pm UTC
composable-frontend-subscriptions Ignored Ignored Preview Oct 2, 2026 1:35pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b482e48

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@epcc-sdk/sdks-cart-checkout-order Minor
@epcc-sdk/sdks-catalog-search Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@field123
field123 merged commit c8863c1 into main Oct 2, 2026
7 checks passed
@field123
field123 deleted the sdks-catalog-search-cart-checkout-099 branch October 2, 2026 14:43
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.

Migrate sdks-cart-checkout-order to generator 0.99.0 Migrate sdks-catalog-search to generator 0.99.0

1 participant