@salesforce/b2c-tooling-sdk / operations/content
operations/content ​
Content library operations for B2C Commerce.
This module provides functions for exporting, manipulating, and validating Page Designer content libraries and metadefinitions.
Core Classes ​
- Library - Parse and manipulate content library trees
- LibraryNode - Individual nodes in the library tree
Operations ​
- fetchContentLibrary - Fetch and parse a content library
- exportContent - Export filtered pages with assets to disk
Validation ​
- validateMetaDefinition - Validate a parsed JSON object against a metadefinition schema
- validateMetaDefinitionFile - Validate a JSON file against a metadefinition schema
- detectMetaDefinitionType - Auto-detect the schema type from file path or data
Utilities ​
- extractAssetPaths - Extract asset paths from component JSON data
Usage ​
typescript
import {
Library,
fetchContentLibrary,
exportContent,
validateMetaDefinitionFile,
} from '@salesforce/b2c-tooling-sdk/operations/content';
// Fetch and filter a library
const { library } = await fetchContentLibrary(instance, 'SharedLibrary');
library.filter(n => n.id === 'homepage');
// Or use the high-level export
const result = await exportContent(instance, ['homepage'], 'SharedLibrary', './export');
// Validate a metadefinition file
const validation = validateMetaDefinitionFile('experience/pages/home.json');
console.log(validation.valid, validation.errors);Classes ​
Interfaces ​
- ContentExportOptions
- ContentExportResult
- FetchContentLibraryOptions
- FetchContentLibraryResult
- LibraryParseOptions
- MetaDefinitionValidationError
- MetaDefinitionValidationResult
- TraverseOptions
- TreeStringOptions
- ValidateMetaDefinitionOptions
Type Aliases ​
Variables ​
Functions ​
- detectMetaDefinitionType
- detectTypeFromData
- detectTypeFromPath
- exportContent
- extractAssetPaths
- fetchContentLibrary
- validateMetaDefinition
- validateMetaDefinitionFile
References ​
MetaDefinitionDetectionError ​
Re-exports MetaDefinitionDetectionError