@salesforce/b2c-tooling-sdk / project-index
project-index
A model of a B2C Commerce project's server-side entry points, built from cartridges on disk using SFRA and SiteGenesis idioms.
The index lists storefront endpoints (Controller-Action) with their accepted methods, HTTPS, login, and CSRF requirements and, for SFRA, the middleware chain composed along the cartridge path (server.extend, append, prepend, replace). It also lists hook registrations, Custom API endpoints, and custom job step types. The result is plain JSON, so it can be cached, sent to tools, or passed to lint rules as settings.
Example
typescript
import {buildProjectIndex} from '@salesforce/b2c-tooling-sdk/project-index';
const index = buildProjectIndex({root: '.'});
const addProduct = index.endpoints.find((e) => e.id === 'Cart-AddProduct');
console.log(addProduct?.methods, addProduct?.csrf, addProduct?.chain?.map((m) => m.id));Interfaces
- BuildProjectIndexOptions
- CartridgeOrder
- CustomApiGroup
- EndpointSummary
- EndpointSummaryFilter
- HookCaller
- HookChain
- IndexedCartridge
- IndexedCustomApiEndpoint
- IndexedEndpoint
- IndexedHook
- IndexedJobStep
- IndexedJobStepParameter
- IndexedMiddleware
- ProjectIndex
- RouteEventListener
- RouteStep