/** * Granular Replications API client for B2C Commerce. * * Provides a fully typed client for Granular Replications API operations using * openapi-fetch with OAuth authentication middleware. Used for publishing individual * items (products, price tables, content assets) from staging to production. * * @module clients/granular-replications */ import { type Client } from 'openapi-fetch'; import type { AuthStrategy } from '../auth/types.js'; import type { paths, components } from './granular-replications.generated.js'; import { type MiddlewareRegistry } from './middleware-registry.js'; import { buildTenantScope, toOrganizationId, normalizeTenantId } from './custom-apis.js'; export { toOrganizationId, normalizeTenantId, buildTenantScope }; export type { paths, components }; export type GranularReplicationsClient = Client; export type GranularReplicationsResponse = T extends { content: { 'application/json': infer R; }; } ? R : never; export type GranularReplicationsError = components['schemas']['ErrorResponse']; export type ProductItem = components['schemas']['ProductItem']; export type PriceTableItem = components['schemas']['PriceTableItem']; export type ContentAssetItemPrivate = components['schemas']['ContentAssetItemPrivate']; export type ContentAssetItemShared = components['schemas']['ContentAssetItemShared']; export type PublishProcessResponse = components['schemas']['PublishProcessResponse']; export type PublishProcessListResponse = components['schemas']['PublishProcessListResponse']; export type PublishIdResponse = components['schemas']['PublishIdResponse']; /** * Configuration for creating a Granular Replications API client. * * @property shortCode - The instance short code (e.g., 'kv7kzm78') * @property tenantId - The tenant ID (e.g., 'zzxy_prd') * @property scopes - Optional custom OAuth scopes. Defaults to sfcc.granular-replications.rw and tenant-specific scope * @property middlewareRegistry - Optional custom middleware registry for request/response interceptors */ export interface GranularReplicationsClientConfig { shortCode: string; tenantId: string; scopes?: string[]; middlewareRegistry?: MiddlewareRegistry; } /** * Creates a Granular Replications API client for publishing individual items. * * The Granular Replications API enables programmatic publishing of individual items * (products, price tables, content assets) from staging to production environments. * * @param config - Client configuration with shortCode and tenantId * @param auth - OAuth authentication strategy * @returns Typed Granular Replications API client * * @example * ```typescript * import {createGranularReplicationsClient, OAuthStrategy} from '@salesforce/b2c-tooling-sdk'; * * const auth = new OAuthStrategy({ * clientId: 'your-client-id', * clientSecret: 'your-client-secret', * tokenEndpoint: 'https://account.demandware.com/dwsso/oauth2/access_token' * }); * * const client = createGranularReplicationsClient({ * shortCode: 'kv7kzm78', * tenantId: 'zzxy_prd' * }, auth); * * // Queue a product for publishing * const result = await client.POST('/organizations/{organizationId}/granular-processes', { * params: {path: {organizationId: 'f_ecom_zzxy_prd'}}, * body: {product: {productId: 'PROD-123'}} * }); * * // List all publish processes * const processes = await client.GET('/organizations/{organizationId}/granular-processes', { * params: { * path: {organizationId: 'f_ecom_zzxy_prd'}, * query: {limit: 20, offset: 0} * } * }); * ``` * * @see https://developer.salesforce.com/docs/commerce/commerce-api/references/replications */ export declare function createGranularReplicationsClient(config: GranularReplicationsClientConfig, auth: AuthStrategy): GranularReplicationsClient;