Summary
Add support for the SKU resource in the @commercelayer/core and @commercelayer/hooks packages, following the same pattern established by the prices resource.
Motivation
The prices resource is already implemented across both packages (core/src/prices/ and hooks/src/prices/). SKUs are a fundamental resource in Commerce Layer and should be available with the same level of abstraction for consumers of the v5 packages.
Tasks
packages/core
packages/hooks
Reference
- Existing implementation to follow:
packages/core/src/prices/ and packages/hooks/src/prices/
- SDK resource:
CommerceLayerClient.skus
Summary
Add support for the SKU resource in the
@commercelayer/coreand@commercelayer/hookspackages, following the same pattern established by thepricesresource.Motivation
The
pricesresource is already implemented across both packages (core/src/prices/andhooks/src/prices/). SKUs are a fundamental resource in Commerce Layer and should be available with the same level of abstraction for consumers of the v5 packages.Tasks
packages/coresrc/skus/getSku.ts— fetch a single SKU by IDsrc/skus/getSkus.ts— fetch a list of SKUs (with optional filters)src/skus/index.ts— re-export SKU functionssrc/skus/getSku.spec.ts/getSkus.spec.ts— integration tests usingcoreTestfixturesrc/index.tspackages/hookssrc/skus/useSkus.ts— React hook wrapping the coregetSkusfunction (using SWR, mirroringusePrices)src/skus/useSku.ts— React hook for fetching a single SKUsrc/skus/index.ts— re-export SKU hookssrc/skus/useSkus.test.ts— unit testssrc/index.tsReference
packages/core/src/prices/andpackages/hooks/src/prices/CommerceLayerClient.skus