
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
sfcc-ocapi-documents
Advanced tools
TypeScript types based on the official OCAPI documentation
using npm:
npm install sfcc-ocapi-documents
using yarn:
yarn add sfcc-ocapi-documents
import OCAPI from 'sfcc-ocapi-documents'
const basket: OCAPI.Basket
import OCAPI from 'sfcc-ocapi-documents/20.10'
const basket: OCAPI.Basket = {...}
import OCAPI, {Util} from 'sfcc-ocapi-documents/20.10'
const basket: Util.Response<OCAPI.Basket> = {...}
latest
previous
20.2
20.3
20.4
20.8
20.9
20.10
21.2
21.6
21.8
// latest
import OCAPI from 'sfcc-ocapi-documents'
// equivalent to above
import OCAPI from 'sfcc-ocapi-documents/latest'
// specific version
import OCAPI from 'sfcc-ocapi-documents/21.2'
To add custom properties to the documents you can create a OCAPI.d.ts (example). If the keys of the interface are not prefixed with c_
- they will be automatically prefixed
declare namespace OCAPI {
namespace Custom {
interface ProductItem {
customAttribute: boolean
c_otherCustomAttribute: boolean
}
}
}
Dash separated numbers
import { Util } from 'sfcc-ocapi-documents'
const date: Util.Date = '2020-10-10';
the ISO 8601 standard: "2012-03-19T07:22:59Z".
import { Util } from 'sfcc-ocapi-documents'
export const dateTime: Util.DateTime = "2012-03-19T07:22:59Z";
Lowercase day of the week
import { Util } from 'sfcc-ocapi-documents'
const day: Util.DayOfWeek = "friday";
import { Util } from 'sfcc-ocapi-documents'
const time: Util.LocalTime = "23:59:59";
Placeholder indicating the value may be localized
import { Util } from 'sfcc-ocapi-documents'
const str: Util.Localized<string> = "супер кул";
Object indicating time interval
import { Util } from 'sfcc-ocapi-documents'
const timeOfDay: Util.TimeOfDay = {
time_from: "11:59:59",
time_to: "23:59:59"
};
Ensures the keys of the given object are prefixed with c_
import { Util } from 'sfcc-ocapi-documents'
type CustomData = {
c_attr1: "value 1",
attr2: boolean
}
const obj: Util.WithCustom<CustomData> = {
c_attr1: "value 1",
c_attr2: true
}
If given an object ensures it has optional _type
property with string
value and all of it's nested objects
import { Util } from 'sfcc-ocapi-documents'
type Data = {
prop1: string
prop2: {
nestedProp: boolean
},
prop3: {
nestedProp: boolean
}
}
const typedData: Util.Typed<Data> = {
_type: "data",
prop1: "val",
prop2: {
_type: "nested",
nestedProp: true
},
prop3: {
nestedProp: false
}
}
Adds _v: string
, _resource_state?: string;
and _flash?: Typed<Flash>[];
to the given object and ensures the rest of the properties are Typed
PRs are welcome for adding missing interfaces or versions
FAQs
SFCC Shop API documents
The npm package sfcc-ocapi-documents receives a total of 40 weekly downloads. As such, sfcc-ocapi-documents popularity was classified as not popular.
We found that sfcc-ocapi-documents demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.