Skip to content

CEXT-6420: Adopt aio-commerce-sdk (bundle size, response & webhook helpers)#165

Merged
iivvaannxx merged 6 commits into
mainfrom
CEXT-6420/aio-commerce-sdk
Jul 17, 2026
Merged

CEXT-6420: Adopt aio-commerce-sdk (bundle size, response & webhook helpers)#165
iivvaannxx merged 6 commits into
mainfrom
CEXT-6420/aio-commerce-sdk

Conversation

@iivvaannxx

@iivvaannxx iivvaannxx commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adopts @adobe/aio-commerce-sdk across the starter kit, removing bespoke local helpers in favor of the SDK's shared building blocks. Three logical changes:

1. Reduce bundle size by removing aio-sdk

  • Drop the heavyweight @adobe/aio-sdk dependency; loggers now come from @adobe/aio-lib-core-logging directly.

2. Adopt the SDK response & webhook helpers

  • Replace the local constants.js / responses.js helpers with @adobe/aio-commerce-sdk/core/responses and @adobe/aio-commerce-sdk/webhooks/responses.
  • Every action now uses the SDK response builders (ok, badRequest, internalServerError, buildErrorResponse) and its type-discriminated response shape; the telemetry success predicate switches to isSuccessResponse.
  • The check-stock webhook uses ok(successOperation()) / ok(exceptionOperation(message)) — the SDK's Commerce op protocol helpers.
  • Removed the now-unused src/lib/constants.js, src/lib/responses.js, and responses.test.js; HTTP status codes come from the SDK.

3. Docs & cleanup

  • Documented the sendData return contract (success / failure variants) on every sender's @returns.
  • Removed a stale doc.

Testing

  • npx vitest run204 passing (57 files).
  • biome ci clean on changed files.

Replace the local constants/responses helpers with the SDK equivalents from
@adobe/aio-commerce-sdk/core/responses and @adobe/aio-commerce-sdk/webhooks/responses.

- Migrate every action to the SDK response builders (ok, badRequest,
  internalServerError, buildErrorResponse) and its type-discriminated response
  shape; switch the telemetry success predicate to isSuccessResponse.
- Migrate the check-stock webhook to ok(successOperation()) /
  ok(exceptionOperation(message)).
- Remove the now-unused src/lib/constants.js and src/lib/responses.js (and
  responses.test.js); HTTP_* status codes now come from the SDK.
- Document the sendData return contract (success / failure variants) on every
  sender's @returns.
- Update tests to assert the new SDK response shapes.
@iivvaannxx
iivvaannxx requested a review from a team as a code owner July 17, 2026 09:06
Event descriptions duplicated their labels verbatim, unlike the webhook
entries which already describe behavior separately from the label.
Event labels were just the raw event name title-cased, adding no
information beyond the name field itself.
The event description field only allows letters, numbers, spaces,
underscores, hyphens, dots, colons, parentheses, commas, @, and /.
@iivvaannxx
iivvaannxx merged commit c1c1d25 into main Jul 17, 2026
3 checks passed
@iivvaannxx
iivvaannxx deleted the CEXT-6420/aio-commerce-sdk branch July 17, 2026 09:58
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