CEXT-6420: Adopt aio-commerce-sdk (bundle size, response & webhook helpers)#165
Merged
Conversation
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.
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 /.
obarcelonap
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adopts
@adobe/aio-commerce-sdkacross 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@adobe/aio-sdkdependency; loggers now come from@adobe/aio-lib-core-loggingdirectly.2. Adopt the SDK response & webhook helpers
constants.js/responses.jshelpers with@adobe/aio-commerce-sdk/core/responsesand@adobe/aio-commerce-sdk/webhooks/responses.ok,badRequest,internalServerError,buildErrorResponse) and itstype-discriminated response shape; the telemetry success predicate switches toisSuccessResponse.check-stockwebhook usesok(successOperation())/ok(exceptionOperation(message))— the SDK's Commerceopprotocol helpers.src/lib/constants.js,src/lib/responses.js, andresponses.test.js; HTTP status codes come from the SDK.3. Docs & cleanup
sendDatareturn contract (success / failure variants) on every sender's@returns.Testing
npx vitest run→ 204 passing (57 files).biome ciclean on changed files.