@adobe-commerce/aio-services-kit
Overview
A comprehensive TypeScript services kit for Adobe App Builder applications providing REST endpoint services implementation for Adobe Commerce APIs, standardized service patterns, and robust backend development tools with 100% test coverage.
Installation
npm install @adobe-commerce/aio-services-kit
Usage
The services kit is organized into framework utilities and Adobe Commerce service modules:
🛠️ Framework Components
Core infrastructure for building and consuming Adobe Commerce REST APIs
ApiResponse
Standardized success/error response handling with Adobe Commerce error format support.
import { ApiResponse } from '@adobe-commerce/aio-services-kit';
const success = ApiResponse.success(data);
const error = ApiResponse.error(errorResponse);
const fallback = ApiResponse.fallbackError('Something went wrong', 500);
if (ApiResponse.isError(response.body)) {
}
SearchCriteriaBuilder
Fluent API for building complex search queries with filters, sorting, and pagination.
import { SearchCriteriaBuilder } from '@adobe-commerce/aio-services-kit';
const criteria = new SearchCriteriaBuilder()
.addFilter('status', 1, 'eq')
.addFilter('price', 100, 'gt')
.addFilter('category_id', [1, 2, 3], 'in')
.addSortOrder('created_at', 'DESC')
.addSortOrder('name', 'ASC')
.setPageSize(20)
.setCurrentPage(1)
.addField('id')
.addField('sku')
.addField('name')
.create();
Supported Condition Types:
eq, neq - Equal / Not equal
gt, gteq - Greater than / Greater than or equal
lt, lteq - Less than / Less than or equal
in, nin - In array / Not in array
null, notnull - Is null / Is not null
like - Like pattern matching
🏪 Commerce Services
Complete Adobe Commerce API integration with chainable services
AdobeCommerceService
Top-level service orchestrator providing access to all Adobe Commerce operations.
import { AdobeCommerceService } from '@adobe-commerce/aio-services-kit';
const commerce = new AdobeCommerceService(adobeCommerceClient);
const catalogService = commerce.catalog();
const eventService = commerce.event();
const checkoutService = commerce.checkout();
const configService = commerce.configuration();
Catalog Services
ProductService - Complete product management:
const productService = commerce.catalog().product();
const products = await productService.list(
new SearchCriteriaBuilder()
.addFilter('status', 1, 'eq')
.addFilter('visibility', 4, 'eq')
.setPageSize(20)
.create()
);
const product = await productService.get('PRODUCT-SKU-001');
const result = await productService.create({
sku: 'NEW-PRODUCT',
name: 'New Product',
price: 99.99,
type_id: 'simple',
attribute_set_id: 4,
status: 1,
visibility: 4
});
const updated = await productService.update('PRODUCT-SKU-001', {
price: 89.99,
name: 'Updated Product Name'
});
const deleted = await productService.delete('PRODUCT-SKU-001');
ProductAttributeService - Manage product attributes:
const attributeService = commerce.catalog().product().attribute();
const attributes = await attributeService.list();
const filtered = await attributeService.list(
new SearchCriteriaBuilder()
.addFilter('is_user_defined', 1, 'eq')
.create()
);
const attribute = await attributeService.get('color');
const created = await attributeService.create({
attribute_code: 'custom_attr',
frontend_label: 'Custom Attribute',
frontend_input: 'text',
is_required: false
});
const updated = await attributeService.update('custom_attr', {
frontend_label: 'Updated Label'
});
const deleted = await attributeService.delete('custom_attr');
ConfigurableProductService - Manage configurable products:
const configurableService = commerce.catalog().product().configurable();
const optionsService = configurableService.options();
const options = await optionsService.list('CONF-PRODUCT-001');
const option = await optionsService.get('CONF-PRODUCT-001', 123);
await optionsService.create('CONF-PRODUCT-001', {
attribute_id: 93,
label: 'Color',
position: 0,
values: [
{ value_index: 0 },
{ value_index: 1 }
]
});
await optionsService.update('CONF-PRODUCT-001', 123, {
label: 'Updated Color'
});
await optionsService.delete('CONF-PRODUCT-001', 123);
const childrenService = configurableService.children();
const children = await childrenService.list('CONF-PRODUCT-001');
await childrenService.add('CONF-PRODUCT-001', 'CHILD-SKU-001');
await childrenService.remove('CONF-PRODUCT-001', 'CHILD-SKU-001');
Event Services
EventService - Comprehensive event management:
const eventService = commerce.event();
await eventService.configuration().update({
enabled: true,
merchant_id: 'merchant123',
environment_id: 'env456'
});
const subscriptionService = eventService.subscription();
const subscriptions = await subscriptionService.list();
await subscriptionService.create({
name: 'observer.catalog_product_save_after',
destination: 'commerce.catalog.product.updated',
fields: [
{ name: 'sku', converter: 'string' }
]
});
await subscriptionService.create(subscriptionData, true);
await subscriptionService.update('subscription-name', {
enabled: false
});
await subscriptionService.delete('subscription-name');
const providerService = eventService.provider();
const providers = await providerService.list();
const provider = await providerService.get('provider-id');
await providerService.create({
provider_id: 'adobe_io',
instance_id: 'instance_123',
label: 'Adobe I/O Events',
description: 'Adobe I/O Events provider'
});
await providerService.delete('provider-id');
const supportedEvents = await eventService.supportedList();
Configuration Services
StoreService - Store configuration management:
const storeService = commerce.configuration().store();
const websites = await storeService.websites();
const storeViews = await storeService.storeViews();
const storeGroups = await storeService.storeGroups();
const allConfigs = await storeService.storeConfigs();
const configs = await storeService.storeConfigs(['default', 'en', 'fr']);
Checkout Services
OopeShippingCarrierService - Out-of-process shipping carrier management:
const carrierService = commerce.checkout().outOfProcess().shippingCarrier();
const carriers = await carrierService.list();
const carrier = await carrierService.getByCode('custom_carrier');
await carrierService.create({
carrier_code: 'custom_carrier',
carrier_title: 'Custom Carrier',
active: true
});
await carrierService.update({
carrier_code: 'custom_carrier',
carrier_title: 'Updated Carrier'
});
await carrierService.deleteByCode('custom_carrier');
📦 Type Safety
Full TypeScript support with comprehensive type definitions:
import type {
Product,
ProductResponse,
ProductAttribute,
ProductAttributeResponse,
Website,
WebsiteResponse,
StoreView,
StoreViewResponse,
EventSubscription,
EventSubscriptionResponse,
OopeShippingCarrier,
OopeShippingCarrierResponse
} from '@adobe-commerce/aio-services-kit';
const result: ProductResponse = await productService.get('SKU-001');
if (result.success && result.data) {
const product: Product = result.data;
console.log(product.name, product.price);
}
License
See the LICENSE file for license rights and limitations.