UNPKG

sfcc-dev-mcp

Version:

MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools

43 lines 1.57 kB
/** * OCAPI Code Versions Client * * This module handles all SFCC code version related operations including * retrieving code versions and activating specific versions for deployment management. */ import { OCAPIAuthClient } from '../base/ocapi-auth-client.js'; import { Validator } from '../../utils/validator.js'; /** * OCAPI Code Versions Client * Handles code version management operations for SFCC instances */ export class OCAPICodeVersionsClient extends OCAPIAuthClient { constructor(config) { const version = config.version ?? 'v21_3'; const baseUrl = `https://${config.hostname}/s/-/dw/data/${version}`; super(config); // Override the baseUrl for this specialized client this.baseUrl = baseUrl; } /** * Get all code versions from the SFCC instance * * @returns {Promise<any>} Code version result with data array containing version information */ async getCodeVersions() { return this.get('/code_versions'); } /** * Activate a specific code version by setting its active flag to true * * @param {string} codeVersionId - The ID of the code version to activate * @returns {Promise<any>} Updated code version object */ async activateCodeVersion(codeVersionId) { Validator.validateRequired({ codeVersionId }, ['codeVersionId']); const requestBody = { active: true, }; return this.patch(`/code_versions/${codeVersionId}`, requestBody); } } //# sourceMappingURL=code-versions-client.js.map