sfcc-dev-mcp
Version:
MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools
123 lines • 4.36 kB
TypeScript
/**
* OCAPI Client for Salesforce Commerce Cloud
*
* This module provides a unified interface for making authenticated requests to SFCC's Open Commerce API (OCAPI).
* It orchestrates specialized client modules for different domain areas while maintaining backward compatibility.
*/
import { OCAPIConfig } from '../types/types.js';
import { OCAPISystemObjectsClient } from './ocapi/system-objects-client.js';
import { OCAPISitePreferencesClient } from './ocapi/site-preferences-client.js';
import { OCAPICodeVersionsClient } from './ocapi/code-versions-client.js';
/**
* Interface for common query parameters used across multiple endpoints
*/
interface BaseQueryParams {
start?: number;
count?: number;
select?: string;
}
/**
* Interface for search request structure used in multiple search endpoints
*/
interface SearchRequest {
query?: {
text_query?: {
fields: string[];
search_phrase: string;
};
term_query?: {
fields: string[];
operator: string;
values: any[];
};
filtered_query?: {
filter: any;
query: any;
};
bool_query?: {
must?: any[];
must_not?: any[];
should?: any[];
};
match_all_query?: {};
};
sorts?: Array<{
field: string;
sort_order?: 'asc' | 'desc';
}>;
start?: number;
count?: number;
select?: string;
}
/**
* OCAPI Client - Unified interface for SFCC OCAPI operations
*
* This class serves as a facade that orchestrates specialized client modules:
* - SystemObjectsClient: Handles system object definitions and attributes
* - SitePreferencesClient: Manages site preference operations
* - CodeVersionsClient: Manages code version operations
* - AuthClient: Manages OAuth authentication and token lifecycle
*/
export declare class OCAPIClient {
readonly systemObjects: OCAPISystemObjectsClient;
readonly sitePreferences: OCAPISitePreferencesClient;
readonly codeVersions: OCAPICodeVersionsClient;
private readonly authClient;
private logger;
constructor(config: OCAPIConfig);
/**
* Get all system object definitions
*/
getSystemObjectDefinitions(params?: BaseQueryParams): Promise<any>;
/**
* Get a specific system object definition by object type
*/
getSystemObjectDefinition(objectType: string): Promise<any>;
/**
* Search for system object definitions using complex queries
*/
searchSystemObjectDefinitions(searchRequest: SearchRequest): Promise<any>;
/**
* Search attribute definitions for a specific system object type using complex queries
*/
searchSystemObjectAttributeDefinitions(objectType: string, searchRequest: SearchRequest): Promise<any>;
/**
* Search attribute groups for a specific system object type
*/
searchSystemObjectAttributeGroups(objectType: string, searchRequest: SearchRequest): Promise<any>;
/**
* Search attribute definitions for a specific custom object type using complex queries
*/
searchCustomObjectAttributeDefinitions(objectType: string, searchRequest: SearchRequest): Promise<any>;
/**
* Search site preferences across sites in the specified preference group and instance
*/
searchSitePreferences(groupId: string, instanceType: string, searchRequest: SearchRequest, options?: {
maskPasswords?: boolean;
expand?: string;
}): Promise<any>;
/**
* Get all code versions from the SFCC instance
*
* @returns {Promise<any>} Code version result with data array containing version information
*/
getCodeVersions(): Promise<any>;
/**
* Activate a specific code version on the SFCC instance
*
* @param {string} codeVersionId - The ID of the code version to activate
* @param {string} codeVersionId - The ID of the code version to activate
* @returns {Promise<any>} Updated code version object
*/
activateCodeVersion(codeVersionId: string): Promise<any>;
/**
* Get current token expiration for debugging
*/
getTokenExpiration(): Date | null;
/**
* Force refresh the token (useful for testing)
*/
refreshToken(): Promise<void>;
}
export {};
//# sourceMappingURL=ocapi-client.d.ts.map