@salesforce/b2c-cli 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dev.js +8 -8
- package/bin/run.js +5 -7
- package/content/guidance/b2c/b2c-business-manager-extensions/SKILL.md +361 -0
- package/content/guidance/b2c/b2c-business-manager-extensions/references/EXTENSIONS-XML.md +458 -0
- package/content/guidance/b2c/b2c-controllers/SKILL.md +301 -0
- package/content/guidance/b2c/b2c-controllers/references/CLASSIC-PATTERNS.md +335 -0
- package/content/guidance/b2c/b2c-controllers/references/SFRA-PATTERNS.md +400 -0
- package/content/guidance/b2c/b2c-custom-api-development/SKILL.md +281 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/CONTRACT.md +142 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/IMPLEMENTATION.md +153 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/TESTING.md +118 -0
- package/content/guidance/b2c/b2c-custom-caches/SKILL.md +279 -0
- package/content/guidance/b2c/b2c-custom-job-steps/SKILL.md +520 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/CHUNK-ORIENTED.md +377 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/JOBS-XML.md +212 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/STEPTYPES-JSON.md +373 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/TASK-ORIENTED.md +344 -0
- package/content/guidance/b2c/b2c-custom-objects/SKILL.md +327 -0
- package/content/guidance/b2c/b2c-custom-objects/references/OCAPI-SEARCH.md +298 -0
- package/content/guidance/b2c/b2c-forms/SKILL.md +242 -0
- package/content/guidance/b2c/b2c-forms/references/FORM-XML.md +409 -0
- package/content/guidance/b2c/b2c-hooks/SKILL.md +500 -0
- package/content/guidance/b2c/b2c-hooks/references/OCAPI-SCAPI-HOOKS.md +403 -0
- package/content/guidance/b2c/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +169 -0
- package/content/guidance/b2c/b2c-hooks/references/SYSTEM-HOOKS.md +433 -0
- package/content/guidance/b2c/b2c-isml/SKILL.md +320 -0
- package/content/guidance/b2c/b2c-isml/references/EXPRESSIONS.md +366 -0
- package/content/guidance/b2c/b2c-isml/references/TAGS.md +443 -0
- package/content/guidance/b2c/b2c-localization/SKILL.md +344 -0
- package/content/guidance/b2c/b2c-localization/references/PATTERNS.md +407 -0
- package/content/guidance/b2c/b2c-logging/SKILL.md +352 -0
- package/content/guidance/b2c/b2c-logging/references/LOG-FILES.md +282 -0
- package/content/guidance/b2c/b2c-metadata/SKILL.md +406 -0
- package/content/guidance/b2c/b2c-metadata/references/SYSTEM-OBJECTS.md +320 -0
- package/content/guidance/b2c/b2c-metadata/references/XML-EXAMPLES.md +366 -0
- package/content/guidance/b2c/b2c-onboarding/SKILL.md +154 -0
- package/content/guidance/b2c/b2c-ordering/SKILL.md +391 -0
- package/content/guidance/b2c/b2c-page-designer/SKILL.md +410 -0
- package/content/guidance/b2c/b2c-page-designer/references/ATTRIBUTE-TYPES.md +436 -0
- package/content/guidance/b2c/b2c-page-designer/references/META-DEFINITIONS.md +340 -0
- package/content/guidance/b2c/b2c-querying-data/SKILL.md +289 -0
- package/content/guidance/b2c/b2c-querying-data/references/PERFORMANCE-APIS.md +74 -0
- package/content/guidance/b2c/b2c-scapi-admin/SKILL.md +53 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +440 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/INTEGRATION-PATTERNS.md +518 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/OAUTH-SCOPES.md +337 -0
- package/content/guidance/b2c/b2c-scapi-shopper/SKILL.md +56 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/CHECKOUT-FLOW.md +466 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +351 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/COMMON-PATTERNS.md +390 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/SCOPES.md +290 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/SKILL.md +420 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/PASSKEYS.md +126 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/SESSION-BRIDGE.md +267 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/TOKEN-LIFECYCLE.md +367 -0
- package/content/guidance/b2c/b2c-webservices/SKILL.md +318 -0
- package/content/guidance/b2c/b2c-webservices/references/FTP-SERVICES.md +524 -0
- package/content/guidance/b2c/b2c-webservices/references/HTTP-SERVICES.md +578 -0
- package/content/guidance/b2c/b2c-webservices/references/SERVICES-XML.md +351 -0
- package/content/guidance/b2c/b2c-webservices/references/SOAP-SERVICES.md +587 -0
- package/content/guidance/b2c-cli/b2c-am/SKILL.md +277 -0
- package/content/guidance/b2c-cli/b2c-bm-users-roles/SKILL.md +210 -0
- package/content/guidance/b2c-cli/b2c-cap/SKILL.md +131 -0
- package/content/guidance/b2c-cli/b2c-cip/SKILL.md +116 -0
- package/content/guidance/b2c-cli/b2c-cip/references/KNOWN_TABLES.md +105 -0
- package/content/guidance/b2c-cli/b2c-cip/references/SALES_ANALYSIS.md +50 -0
- package/content/guidance/b2c-cli/b2c-cip/references/STARTER_QUERIES.md +147 -0
- package/content/guidance/b2c-cli/b2c-code/SKILL.md +146 -0
- package/content/guidance/b2c-cli/b2c-config/SKILL.md +462 -0
- package/content/guidance/b2c-cli/b2c-content/SKILL.md +176 -0
- package/content/guidance/b2c-cli/b2c-debug/SKILL.md +138 -0
- package/content/guidance/b2c-cli/b2c-docs/SKILL.md +301 -0
- package/content/guidance/b2c-cli/b2c-ecdn/SKILL.md +135 -0
- package/content/guidance/b2c-cli/b2c-ecdn/references/ADVANCED.md +97 -0
- package/content/guidance/b2c-cli/b2c-ecdn/references/SECURITY.md +75 -0
- package/content/guidance/b2c-cli/b2c-import-set-migrations/SKILL.md +265 -0
- package/content/guidance/b2c-cli/b2c-job/SKILL.md +64 -0
- package/content/guidance/b2c-cli/b2c-job/references/EXPORT.md +121 -0
- package/content/guidance/b2c-cli/b2c-job/references/IMPORT.md +55 -0
- package/content/guidance/b2c-cli/b2c-job/references/RUN-AND-MONITOR.md +119 -0
- package/content/guidance/b2c-cli/b2c-logs/SKILL.md +249 -0
- package/content/guidance/b2c-cli/b2c-metrics/SKILL.md +315 -0
- package/content/guidance/b2c-cli/b2c-mrt/SKILL.md +207 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/BUNDLE-COMMANDS.md +203 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/ENVIRONMENT-COMMANDS.md +218 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/PROJECT-COMMANDS.md +154 -0
- package/content/guidance/b2c-cli/b2c-sandbox/SKILL.md +112 -0
- package/content/guidance/b2c-cli/b2c-scapi-custom/SKILL.md +126 -0
- package/content/guidance/b2c-cli/b2c-scapi-schemas/SKILL.md +66 -0
- package/content/guidance/b2c-cli/b2c-scapi-schemas/references/CLI-EXAMPLES.md +108 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/SKILL.md +57 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/IMPORT-OPTIONS.md +118 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/METADATA-XML.md +381 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/WORKFLOWS.md +182 -0
- package/content/guidance/b2c-cli/b2c-sites/SKILL.md +112 -0
- package/content/guidance/b2c-cli/b2c-slas/SKILL.md +182 -0
- package/content/guidance/b2c-cli/b2c-webdav/SKILL.md +186 -0
- package/content/guidance/b2c-ops/b2c-checkout-triage/SKILL.md +68 -0
- package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +75 -0
- package/content/guidance/b2c-ops/b2c-job-health/references/job-logs.md +21 -0
- package/content/guidance/b2c-ops/b2c-order-failure-triage/SKILL.md +66 -0
- package/content/guidance/b2c-ops/b2c-order-failure-triage/references/order-evidence.md +87 -0
- package/content/guidance/b2c-ops/b2c-production-triage/SKILL.md +87 -0
- package/content/guidance/b2c-ops/b2c-production-triage/references/escalation.md +57 -0
- package/content/guidance/index.json +1949 -0
- package/content/guidance/storefront-next/sfnext-accessibility/SKILL.md +103 -0
- package/content/guidance/storefront-next/sfnext-accessibility/references/checklist.md +64 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/SKILL.md +91 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
- package/content/guidance/storefront-next/sfnext-authentication/SKILL.md +127 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/COOKIES.md +39 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/SKILL.md +67 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
- package/content/guidance/storefront-next/sfnext-components/SKILL.md +153 -0
- package/content/guidance/storefront-next/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
- package/content/guidance/storefront-next/sfnext-components/references/SHAPE-TOKENS.md +51 -0
- package/content/guidance/storefront-next/sfnext-components/references/STORYBOOK.md +54 -0
- package/content/guidance/storefront-next/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
- package/content/guidance/storefront-next/sfnext-components/references/TROUBLESHOOTING.md +19 -0
- package/content/guidance/storefront-next/sfnext-configuration/SKILL.md +163 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/SKILL.md +140 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/ACTIONS.md +53 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADERS.md +73 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/SCAPI-FETCHER.md +39 -0
- package/content/guidance/storefront-next/sfnext-deployment/SKILL.md +127 -0
- package/content/guidance/storefront-next/sfnext-deployment/references/MRT-DEPLOYMENT.md +59 -0
- package/content/guidance/storefront-next/sfnext-extensions/SKILL.md +118 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/BASE-AUDIT.md +68 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/EXTENSION-EXAMPLES.md +79 -0
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/SKILL.md +93 -0
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +86 -0
- package/content/guidance/storefront-next/sfnext-i18n/SKILL.md +152 -0
- package/content/guidance/storefront-next/sfnext-i18n/references/locale-config.md +35 -0
- package/content/guidance/storefront-next/sfnext-overview/SKILL.md +101 -0
- package/content/guidance/storefront-next/sfnext-page-designer/SKILL.md +202 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/COMPONENT-REGISTRY.md +111 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/DECORATOR-PATTERNS.md +168 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
- package/content/guidance/storefront-next/sfnext-performance/SKILL.md +102 -0
- package/content/guidance/storefront-next/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
- package/content/guidance/storefront-next/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
- package/content/guidance/storefront-next/sfnext-project-setup/SKILL.md +147 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SCRIPTS.md +47 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/SKILL.md +70 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
- package/content/guidance/storefront-next/sfnext-revalidation/SKILL.md +121 -0
- package/content/guidance/storefront-next/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
- package/content/guidance/storefront-next/sfnext-routing/SKILL.md +123 -0
- package/content/guidance/storefront-next/sfnext-routing/references/ROUTE-CONVENTIONS.md +65 -0
- package/content/guidance/storefront-next/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
- package/content/guidance/storefront-next/sfnext-scapi/SKILL.md +126 -0
- package/content/guidance/storefront-next/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/SKILL.md +129 -0
- package/content/guidance/storefront-next/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/references/TURNSTILE.md +43 -0
- package/content/guidance/storefront-next/sfnext-seo/SKILL.md +95 -0
- package/content/guidance/storefront-next/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
- package/content/guidance/storefront-next/sfnext-seo/references/SEO-ROUTES.md +31 -0
- package/content/guidance/storefront-next/sfnext-state-management/SKILL.md +114 -0
- package/content/guidance/storefront-next/sfnext-state-management/references/PATTERNS.md +45 -0
- package/content/guidance/storefront-next/sfnext-testing/SKILL.md +151 -0
- package/content/guidance/storefront-next/sfnext-testing/references/E2E.md +38 -0
- package/content/guidance/storefront-next/sfnext-testing/references/STORYBOOK-PATTERNS.md +97 -0
- package/content/guidance/storefront-next/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
- package/content/guidance/storefront-next/sfnext-theming/SKILL.md +104 -0
- package/content/guidance/storefront-next/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
- package/dist/commands/cap/install.d.ts +1 -0
- package/dist/commands/cap/list.d.ts +1 -0
- package/dist/commands/cap/pull.d.ts +1 -0
- package/dist/commands/cap/tasks.d.ts +1 -0
- package/dist/commands/cap/uninstall.d.ts +1 -0
- package/dist/commands/cip/describe.d.ts +1 -0
- package/dist/commands/cip/query.d.ts +1 -0
- package/dist/commands/cip/report/bot-traffic-share.d.ts +1 -0
- package/dist/commands/cip/report/checkout-funnel-dropoff.d.ts +1 -0
- package/dist/commands/cip/report/controller-error-rate-trend.d.ts +1 -0
- package/dist/commands/cip/report/controller-health-scorecard.d.ts +1 -0
- package/dist/commands/cip/report/customer-registration-trends.d.ts +1 -0
- package/dist/commands/cip/report/discount-depth-breakdown.d.ts +1 -0
- package/dist/commands/cip/report/inventory-stockout-by-location.d.ts +1 -0
- package/dist/commands/cip/report/new-vs-returning-buyer-revenue.d.ts +1 -0
- package/dist/commands/cip/report/ocapi-client-usage.d.ts +1 -0
- package/dist/commands/cip/report/ocapi-requests.d.ts +1 -0
- package/dist/commands/cip/report/payment-method-performance.d.ts +1 -0
- package/dist/commands/cip/report/product-co-purchase-analysis.d.ts +1 -0
- package/dist/commands/cip/report/promotion-discount-analysis.d.ts +1 -0
- package/dist/commands/cip/report/promotion-roi-leaderboard.d.ts +1 -0
- package/dist/commands/cip/report/recommender-effectiveness.d.ts +1 -0
- package/dist/commands/cip/report/remote-include-performance.d.ts +1 -0
- package/dist/commands/cip/report/revenue-by-channel.d.ts +1 -0
- package/dist/commands/cip/report/sales-analytics.d.ts +1 -0
- package/dist/commands/cip/report/sales-summary.d.ts +1 -0
- package/dist/commands/cip/report/scapi-cache-hit-ratio.d.ts +1 -0
- package/dist/commands/cip/report/scapi-error-rate-by-status.d.ts +1 -0
- package/dist/commands/cip/report/scapi-latency-distribution.d.ts +1 -0
- package/dist/commands/cip/report/scapi-traffic-latency.d.ts +1 -0
- package/dist/commands/cip/report/search-query-performance.d.ts +1 -0
- package/dist/commands/cip/report/top-referrers.d.ts +1 -0
- package/dist/commands/cip/report/top-selling-products.d.ts +1 -0
- package/dist/commands/cip/report/zero-result-searches.d.ts +1 -0
- package/dist/commands/cip/tables.d.ts +1 -0
- package/dist/commands/code/activate.d.ts +1 -0
- package/dist/commands/code/delete.d.ts +1 -0
- package/dist/commands/code/deploy.d.ts +1 -0
- package/dist/commands/code/download.d.ts +1 -0
- package/dist/commands/code/watch.d.ts +1 -0
- package/dist/commands/commands/search.d.ts +35 -0
- package/dist/commands/commands/search.js +85 -0
- package/dist/commands/commands/search.js.map +1 -0
- package/dist/commands/content/export.d.ts +1 -0
- package/dist/commands/content/list.d.ts +1 -0
- package/dist/commands/content/validate.d.ts +1 -0
- package/dist/commands/debug/cli.d.ts +1 -0
- package/dist/commands/debug/index.d.ts +1 -0
- package/dist/commands/docs/cache.d.ts +1 -0
- package/dist/commands/docs/download.d.ts +1 -0
- package/dist/commands/docs/read.d.ts +1 -0
- package/dist/commands/docs/schema.d.ts +1 -0
- package/dist/commands/docs/search.d.ts +1 -0
- package/dist/commands/docs/skill.d.ts +41 -0
- package/dist/commands/docs/skill.js +183 -0
- package/dist/commands/docs/skill.js.map +1 -0
- package/dist/commands/ecdn/cache/purge.d.ts +1 -0
- package/dist/commands/ecdn/certificates/add.d.ts +1 -0
- package/dist/commands/ecdn/certificates/delete.d.ts +1 -0
- package/dist/commands/ecdn/certificates/list.d.ts +1 -0
- package/dist/commands/ecdn/certificates/update.d.ts +1 -0
- package/dist/commands/ecdn/certificates/validate.d.ts +1 -0
- package/dist/commands/ecdn/cipher-suites/get.d.ts +1 -0
- package/dist/commands/ecdn/cipher-suites/update.d.ts +1 -0
- package/dist/commands/ecdn/firewall/create.d.ts +1 -0
- package/dist/commands/ecdn/firewall/delete.d.ts +1 -0
- package/dist/commands/ecdn/firewall/get.d.ts +1 -0
- package/dist/commands/ecdn/firewall/list.d.ts +1 -0
- package/dist/commands/ecdn/firewall/reorder.d.ts +1 -0
- package/dist/commands/ecdn/firewall/update.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/create.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/delete.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/get.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/list.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/update.d.ts +1 -0
- package/dist/commands/ecdn/logpush/ownership.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/create.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/delete.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/get.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/rules/delete.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/rules/update.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/update.d.ts +1 -0
- package/dist/commands/ecdn/mtls/create.d.ts +1 -0
- package/dist/commands/ecdn/mtls/delete.d.ts +1 -0
- package/dist/commands/ecdn/mtls/get.d.ts +1 -0
- package/dist/commands/ecdn/mtls/issue.d.ts +1 -0
- package/dist/commands/ecdn/mtls/list.d.ts +1 -0
- package/dist/commands/ecdn/mtls/setup.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/delete.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/get.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/set.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/create.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/delete.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/list.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/create.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/delete.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/get.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/list.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/update.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/scripts/get.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/scripts/list.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/create.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/delete.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/get.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/list.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/update.d.ts +1 -0
- package/dist/commands/ecdn/security/get.d.ts +1 -0
- package/dist/commands/ecdn/security/update.d.ts +1 -0
- package/dist/commands/ecdn/speed/get.d.ts +1 -0
- package/dist/commands/ecdn/speed/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/groups/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/groups/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/managed-rules/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/managed-rules/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/migrate.d.ts +1 -0
- package/dist/commands/ecdn/waf/owasp/get.d.ts +1 -0
- package/dist/commands/ecdn/waf/owasp/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/get.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/rulesets/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/rulesets/update.d.ts +1 -0
- package/dist/commands/ecdn/zones/create.d.ts +1 -0
- package/dist/commands/ecdn/zones/list.d.ts +1 -0
- package/dist/commands/job/execution/delete.d.ts +1 -0
- package/dist/commands/job/export.d.ts +1 -0
- package/dist/commands/job/import-set.d.ts +1 -0
- package/dist/commands/job/import.d.ts +1 -0
- package/dist/commands/job/log.d.ts +1 -0
- package/dist/commands/job/run.d.ts +1 -0
- package/dist/commands/job/search.d.ts +1 -0
- package/dist/commands/job/wait.d.ts +1 -0
- package/dist/commands/logs/get.d.ts +1 -0
- package/dist/commands/logs/list.d.ts +1 -0
- package/dist/commands/logs/tail.d.ts +1 -0
- package/dist/commands/metrics/controller.d.ts +1 -0
- package/dist/commands/metrics/ecdn.d.ts +1 -0
- package/dist/commands/metrics/mrt.d.ts +1 -0
- package/dist/commands/metrics/ocapi.d.ts +1 -0
- package/dist/commands/metrics/overall.d.ts +1 -0
- package/dist/commands/metrics/sales.d.ts +1 -0
- package/dist/commands/metrics/scapi-hooks.d.ts +1 -0
- package/dist/commands/metrics/scapi.d.ts +1 -0
- package/dist/commands/metrics/third-party.d.ts +1 -0
- package/dist/commands/mrt/bundle/delete.d.ts +1 -0
- package/dist/commands/mrt/bundle/deploy.d.ts +1 -0
- package/dist/commands/mrt/bundle/download.d.ts +1 -0
- package/dist/commands/mrt/bundle/history.d.ts +1 -0
- package/dist/commands/mrt/bundle/list.d.ts +1 -0
- package/dist/commands/mrt/bundle/save.d.ts +1 -0
- package/dist/commands/mrt/bundle/upload-v2.d.ts +1 -0
- package/dist/commands/mrt/env/access-control/list.d.ts +1 -0
- package/dist/commands/mrt/env/b2c.d.ts +1 -0
- package/dist/commands/mrt/env/clone.d.ts +1 -0
- package/dist/commands/mrt/env/create.d.ts +1 -0
- package/dist/commands/mrt/env/delete.d.ts +1 -0
- package/dist/commands/mrt/env/get.d.ts +1 -0
- package/dist/commands/mrt/env/invalidate.d.ts +1 -0
- package/dist/commands/mrt/env/list.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/clone.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/create.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/delete.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/list.d.ts +1 -0
- package/dist/commands/mrt/env/update.d.ts +1 -0
- package/dist/commands/mrt/env/var/delete.d.ts +1 -0
- package/dist/commands/mrt/env/var/list.d.ts +1 -0
- package/dist/commands/mrt/env/var/push.d.ts +1 -0
- package/dist/commands/mrt/env/var/set.d.ts +1 -0
- package/dist/commands/mrt/org/b2c.d.ts +1 -0
- package/dist/commands/mrt/org/cert/create.d.ts +1 -0
- package/dist/commands/mrt/org/cert/delete.d.ts +1 -0
- package/dist/commands/mrt/org/cert/get.d.ts +1 -0
- package/dist/commands/mrt/org/cert/list.d.ts +1 -0
- package/dist/commands/mrt/org/cert/restart-validation.d.ts +1 -0
- package/dist/commands/mrt/org/list.d.ts +1 -0
- package/dist/commands/mrt/org/member/add.d.ts +1 -0
- package/dist/commands/mrt/org/member/get.d.ts +1 -0
- package/dist/commands/mrt/org/member/list.d.ts +1 -0
- package/dist/commands/mrt/org/member/remove.d.ts +1 -0
- package/dist/commands/mrt/org/member/update.d.ts +1 -0
- package/dist/commands/mrt/project/create.d.ts +1 -0
- package/dist/commands/mrt/project/delete.d.ts +1 -0
- package/dist/commands/mrt/project/get.d.ts +1 -0
- package/dist/commands/mrt/project/list.d.ts +1 -0
- package/dist/commands/mrt/project/member/add.d.ts +1 -0
- package/dist/commands/mrt/project/member/get.d.ts +1 -0
- package/dist/commands/mrt/project/member/list.d.ts +1 -0
- package/dist/commands/mrt/project/member/remove.d.ts +1 -0
- package/dist/commands/mrt/project/member/update.d.ts +1 -0
- package/dist/commands/mrt/project/notification/delete.d.ts +1 -0
- package/dist/commands/mrt/project/notification/get.d.ts +1 -0
- package/dist/commands/mrt/project/update.d.ts +1 -0
- package/dist/commands/mrt/save-credentials.d.ts +1 -0
- package/dist/commands/mrt/tail-logs.d.ts +1 -0
- package/dist/commands/mrt/user/api-key.d.ts +1 -0
- package/dist/commands/mrt/user/email-prefs.d.ts +1 -0
- package/dist/commands/mrt/user/profile.d.ts +1 -0
- package/dist/commands/scaffold/init.js +2 -1
- package/dist/commands/scaffold/init.js.map +1 -1
- package/dist/commands/scapi/custom/status.d.ts +1 -0
- package/dist/commands/scapi/schemas/get.d.ts +1 -0
- package/dist/commands/scapi/schemas/list.d.ts +1 -0
- package/dist/commands/setup/ide/tsserver-plugin.d.ts +1 -0
- package/dist/commands/setup/ide/vscode-types.d.ts +1 -0
- package/dist/commands/setup/index.js +4 -3
- package/dist/commands/setup/index.js.map +1 -1
- package/dist/commands/setup/inspect.d.ts +1 -0
- package/dist/commands/setup/inspect.js +17 -2
- package/dist/commands/setup/inspect.js.map +1 -1
- package/dist/commands/setup/instance/create.d.ts +1 -0
- package/dist/commands/setup/instance/list.d.ts +1 -0
- package/dist/commands/setup/instance/remove.d.ts +1 -0
- package/dist/commands/setup/instance/set-active.d.ts +1 -0
- package/dist/commands/setup/openshell.d.ts +1 -0
- package/dist/commands/setup/skills.d.ts +1 -0
- package/dist/commands/slas/client/create.d.ts +1 -0
- package/dist/commands/slas/client/delete.d.ts +1 -0
- package/dist/commands/slas/client/get.d.ts +1 -0
- package/dist/commands/slas/client/list.d.ts +1 -0
- package/dist/commands/slas/client/open.d.ts +1 -0
- package/dist/commands/slas/client/update.d.ts +1 -0
- package/dist/commands/slas/token.d.ts +1 -0
- package/dist/commands/slas/token.js +2 -1
- package/dist/commands/slas/token.js.map +1 -1
- package/dist/commands/webdav/get.d.ts +1 -0
- package/dist/commands/webdav/mkdir.d.ts +2 -0
- package/dist/commands/webdav/mkdir.js +5 -3
- package/dist/commands/webdav/mkdir.js.map +1 -1
- package/dist/commands/webdav/put.d.ts +2 -0
- package/dist/commands/webdav/put.js +5 -3
- package/dist/commands/webdav/put.js.map +1 -1
- package/dist/commands/webdav/rm.d.ts +1 -0
- package/dist/help.d.ts +25 -0
- package/dist/help.js +96 -0
- package/dist/help.js.map +1 -0
- package/dist/lib/scaffold/generate-helper.js +3 -2
- package/dist/lib/scaffold/generate-helper.js.map +1 -1
- package/dist/lib/skills.d.ts +19 -0
- package/dist/lib/skills.js +75 -0
- package/dist/lib/skills.js.map +1 -0
- package/dist/utils/cip/command.d.ts +1 -0
- package/dist/utils/ecdn/zone-command.d.ts +1 -0
- package/dist/utils/slas/client.d.ts +1 -0
- package/oclif.manifest.json +10994 -7653
- package/package.json +11 -5
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# API Contract Reference (schema.yaml)
|
|
2
|
+
|
|
3
|
+
## Full Schema Example
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
openapi: 3.0.0
|
|
7
|
+
info:
|
|
8
|
+
version: 1.0.0 # API version (1.0.0 becomes v1 in URL)
|
|
9
|
+
title: My Custom API
|
|
10
|
+
components:
|
|
11
|
+
securitySchemes:
|
|
12
|
+
ShopperToken: # For Shopper APIs — always site-scoped (requires siteId)
|
|
13
|
+
type: oauth2
|
|
14
|
+
flows:
|
|
15
|
+
clientCredentials:
|
|
16
|
+
tokenUrl: https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/token
|
|
17
|
+
scopes:
|
|
18
|
+
c_my_scope: Description of my scope
|
|
19
|
+
AmOAuth2: # For Admin APIs — siteId optional (site or org context)
|
|
20
|
+
type: oauth2
|
|
21
|
+
flows:
|
|
22
|
+
clientCredentials:
|
|
23
|
+
tokenUrl: https://account.demandware.com/dwsso/oauth2/access_token
|
|
24
|
+
scopes:
|
|
25
|
+
c_my_admin_scope: Description of my admin scope
|
|
26
|
+
parameters:
|
|
27
|
+
siteId:
|
|
28
|
+
name: siteId
|
|
29
|
+
in: query
|
|
30
|
+
required: true
|
|
31
|
+
schema:
|
|
32
|
+
type: string
|
|
33
|
+
minLength: 1
|
|
34
|
+
locale:
|
|
35
|
+
name: locale
|
|
36
|
+
in: query
|
|
37
|
+
required: false
|
|
38
|
+
schema:
|
|
39
|
+
type: string
|
|
40
|
+
minLength: 1
|
|
41
|
+
paths:
|
|
42
|
+
/my-endpoint:
|
|
43
|
+
get:
|
|
44
|
+
summary: Get something
|
|
45
|
+
operationId: getMyData # Must match function name in script
|
|
46
|
+
parameters:
|
|
47
|
+
- $ref: '#/components/parameters/siteId'
|
|
48
|
+
- in: query
|
|
49
|
+
name: c_my_param # Custom params must start with c_
|
|
50
|
+
required: true
|
|
51
|
+
schema:
|
|
52
|
+
type: string
|
|
53
|
+
responses:
|
|
54
|
+
'200':
|
|
55
|
+
description: Success
|
|
56
|
+
content:
|
|
57
|
+
application/json:
|
|
58
|
+
schema:
|
|
59
|
+
type: object
|
|
60
|
+
security:
|
|
61
|
+
- ShopperToken: ['c_my_scope'] # Global security (or per-operation)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Contract Requirements
|
|
65
|
+
|
|
66
|
+
> Illustrative validation rules; confirm current OpenAPI contract requirements, scope naming constraints, and schema validation rules with `b2c docs read commerce-api/custom-api-components-references`.
|
|
67
|
+
|
|
68
|
+
- **Version:** Defined in `info.version`, transformed to URL version (e.g., `1.0.1` becomes `v1`)
|
|
69
|
+
- **Security Scheme:** Use `ShopperToken` for Shopper APIs or `AmOAuth2` for Admin APIs
|
|
70
|
+
- **Custom Scopes:** Must start with `c_`, contain only alphanumeric/hyphen/period/underscore, max 25 chars
|
|
71
|
+
- **Parameters:** All request parameters must be defined; custom params must have `c_` prefix
|
|
72
|
+
- **System Parameters:** `siteId` and `locale` must have `type: string` and `minLength: 1`
|
|
73
|
+
- **No additionalProperties:** The `additionalProperties` attribute is not allowed in request body schemas
|
|
74
|
+
|
|
75
|
+
## Shopper vs Admin APIs
|
|
76
|
+
|
|
77
|
+
> Illustrative operational limits and activity types; confirm current runtime quotas, max body sizes, and timeout values with `b2c docs read commerce-api/custom-apis`.
|
|
78
|
+
|
|
79
|
+
| Aspect | Shopper API | Admin API |
|
|
80
|
+
|--------|-------------|-----------|
|
|
81
|
+
| Security Scheme | `ShopperToken` | `AmOAuth2` |
|
|
82
|
+
| `siteId` Parameter | Required (always site-scoped) | Optional — see "Admin API call contexts" below |
|
|
83
|
+
| Max Runtime | 10 seconds | 60 seconds |
|
|
84
|
+
| Max Request Body | 5 MiB | 20 MB |
|
|
85
|
+
| Activity Type | STOREFRONT | BUSINESS_MANAGER |
|
|
86
|
+
|
|
87
|
+
### Admin API call contexts
|
|
88
|
+
|
|
89
|
+
Unlike Shopper APIs, Admin APIs (`AmOAuth2`) can be invoked in either a storefront site context or the Business Manager / organization context. The `siteId` parameter selects which:
|
|
90
|
+
|
|
91
|
+
| Context | `siteId` value | Cartridge path used to resolve `rest-apis/` |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| Storefront site context | A real site ID (e.g. `RefArch`) | That **site's** cartridge path |
|
|
94
|
+
| Organization / Business Manager context | The literal value `Sites-Site` | The **Business Manager** cartridge path |
|
|
95
|
+
| Organization / Business Manager context | `siteId` omitted | The **Business Manager** cartridge path |
|
|
96
|
+
|
|
97
|
+
`Sites-Site` is not a real storefront — it's the system-defined site identifier the platform uses for BM / org-level operations. Passing `siteId=Sites-Site` is the explicit way to invoke an Admin Custom API against the BM context; omitting `siteId` resolves the same way.
|
|
98
|
+
|
|
99
|
+
If you want the same Admin API to work in both contexts, declare `siteId` as an *optional* parameter (drop `required: true`). The cartridge containing your `rest-apis/` folder must be on whichever cartridge path corresponds to how the caller invokes it — the storefront site's path for storefront-`siteId` calls, and the BM cartridge path for `Sites-Site` / omitted-`siteId` calls.
|
|
100
|
+
|
|
101
|
+
## Path Parameter Example
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
paths:
|
|
105
|
+
/items/{itemId}:
|
|
106
|
+
get:
|
|
107
|
+
operationId: getItem
|
|
108
|
+
parameters:
|
|
109
|
+
- $ref: '#/components/parameters/siteId'
|
|
110
|
+
- in: path
|
|
111
|
+
name: itemId
|
|
112
|
+
required: true
|
|
113
|
+
schema:
|
|
114
|
+
type: string
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Request Body Example (POST/PUT/PATCH)
|
|
118
|
+
|
|
119
|
+
```yaml
|
|
120
|
+
paths:
|
|
121
|
+
/items:
|
|
122
|
+
post:
|
|
123
|
+
operationId: createItem
|
|
124
|
+
parameters:
|
|
125
|
+
- $ref: '#/components/parameters/siteId'
|
|
126
|
+
requestBody:
|
|
127
|
+
required: true
|
|
128
|
+
content:
|
|
129
|
+
application/json:
|
|
130
|
+
schema:
|
|
131
|
+
type: object
|
|
132
|
+
required:
|
|
133
|
+
- name
|
|
134
|
+
properties:
|
|
135
|
+
name:
|
|
136
|
+
type: string
|
|
137
|
+
c_customField:
|
|
138
|
+
type: string
|
|
139
|
+
responses:
|
|
140
|
+
'201':
|
|
141
|
+
description: Created
|
|
142
|
+
```
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Implementation Reference (script.js)
|
|
2
|
+
|
|
3
|
+
## Complete Implementation Example
|
|
4
|
+
|
|
5
|
+
> Illustrative Script API integration; confirm current Custom API request handling, path parameter access, and response patterns with `b2c docs read commerce-api/custom-api-components-references` and Script API docs for `dw.system.Request`.
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
var RESTResponseMgr = require('dw/system/RESTResponseMgr');
|
|
9
|
+
|
|
10
|
+
exports.getMyData = function() {
|
|
11
|
+
// Get query parameters
|
|
12
|
+
var myParam = request.getHttpParameterMap().get('c_my_param').getStringValue();
|
|
13
|
+
|
|
14
|
+
// Get path parameters (for paths like /items/{itemId})
|
|
15
|
+
var itemId = request.getSCAPIPathParameters().get('itemId');
|
|
16
|
+
|
|
17
|
+
// Get request body (for POST/PUT/PATCH)
|
|
18
|
+
var requestBody = JSON.parse(request.httpParameterMap.requestBodyAsString);
|
|
19
|
+
|
|
20
|
+
// Business logic here...
|
|
21
|
+
var result = {
|
|
22
|
+
data: 'my data',
|
|
23
|
+
param: myParam
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Return success response
|
|
27
|
+
RESTResponseMgr.createSuccess(result).render();
|
|
28
|
+
};
|
|
29
|
+
exports.getMyData.public = true; // Required: mark function as public
|
|
30
|
+
|
|
31
|
+
// Error response example
|
|
32
|
+
exports.getMyDataWithError = function() {
|
|
33
|
+
RESTResponseMgr
|
|
34
|
+
.createError(404, 'not-found', 'Resource Not Found', 'The requested resource was not found.')
|
|
35
|
+
.render();
|
|
36
|
+
};
|
|
37
|
+
exports.getMyDataWithError.public = true;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Best Practices
|
|
41
|
+
|
|
42
|
+
- Always return JSON format responses
|
|
43
|
+
- Use RFC 9457 error format with at least the `type` field
|
|
44
|
+
- Mark all exported functions with `.public = true`
|
|
45
|
+
- Handle errors gracefully to avoid circuit breaker activation
|
|
46
|
+
- GET requests cannot commit transactions
|
|
47
|
+
|
|
48
|
+
## Caching Responses
|
|
49
|
+
|
|
50
|
+
Enable Page Caching for the site, then use:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Cache for 60 seconds
|
|
54
|
+
response.setExpires(Date.now() + 60000);
|
|
55
|
+
|
|
56
|
+
// Personalized caching
|
|
57
|
+
response.setVaryBy('price_promotion');
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Remote Includes
|
|
61
|
+
|
|
62
|
+
Include responses from other SCAPI endpoints:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
var include = dw.system.RESTResponseMgr.createScapiRemoteInclude(
|
|
66
|
+
'custom', 'other-api', 'v1', 'endpointPath',
|
|
67
|
+
dw.web.URLParameter('siteId', 'MySite')
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
var response = {
|
|
71
|
+
data: 'my data',
|
|
72
|
+
included: [include]
|
|
73
|
+
};
|
|
74
|
+
RESTResponseMgr.createSuccess(response).render();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## External Service Calls
|
|
78
|
+
|
|
79
|
+
When calling external services via `LocalServiceRegistry.createService()`, configure the service in Business Manager or import via site archive:
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
var LocalServiceRegistry = require('dw/svc/LocalServiceRegistry');
|
|
83
|
+
|
|
84
|
+
var service = LocalServiceRegistry.createService('my.external.api', {
|
|
85
|
+
createRequest: function(svc, args) {
|
|
86
|
+
svc.setRequestMethod('GET');
|
|
87
|
+
svc.addHeader('Authorization', 'Bearer ' + args.token);
|
|
88
|
+
return null;
|
|
89
|
+
},
|
|
90
|
+
parseResponse: function(svc, client) {
|
|
91
|
+
return JSON.parse(client.text);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
var result = service.call({ token: 'my-token' });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See `b2c:b2c-webservices` skill for service configuration and services.xml format.
|
|
99
|
+
|
|
100
|
+
## services.xml Example
|
|
101
|
+
|
|
102
|
+
```xml
|
|
103
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
104
|
+
<services xmlns="http://www.demandware.com/xml/impex/services/2014-09-26">
|
|
105
|
+
|
|
106
|
+
<service-credential service-credential-id="my.external.api">
|
|
107
|
+
<url>https://api.example.com/v1</url>
|
|
108
|
+
</service-credential>
|
|
109
|
+
|
|
110
|
+
<service-profile service-profile-id="my.external.api.profile">
|
|
111
|
+
<timeout-millis>5000</timeout-millis>
|
|
112
|
+
<rate-limit-enabled>false</rate-limit-enabled>
|
|
113
|
+
<cb-enabled>true</cb-enabled>
|
|
114
|
+
<cb-calls>5</cb-calls>
|
|
115
|
+
<cb-millis>10000</cb-millis>
|
|
116
|
+
</service-profile>
|
|
117
|
+
|
|
118
|
+
<service service-id="my.external.api">
|
|
119
|
+
<service-type>HTTP</service-type>
|
|
120
|
+
<enabled>true</enabled>
|
|
121
|
+
<log-prefix>MYAPI</log-prefix>
|
|
122
|
+
<comm-log-enabled>true</comm-log-enabled>
|
|
123
|
+
<profile-id>my.external.api.profile</profile-id>
|
|
124
|
+
<credential-id>my.external.api</credential-id>
|
|
125
|
+
</service>
|
|
126
|
+
|
|
127
|
+
</services>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Import with: `b2c job import ./my-services-folder`
|
|
131
|
+
|
|
132
|
+
## HTTP Methods Supported
|
|
133
|
+
|
|
134
|
+
- GET (no transaction commits)
|
|
135
|
+
- POST
|
|
136
|
+
- PUT
|
|
137
|
+
- PATCH
|
|
138
|
+
- DELETE
|
|
139
|
+
- HEAD
|
|
140
|
+
- OPTIONS
|
|
141
|
+
|
|
142
|
+
## Circuit Breaker Protection
|
|
143
|
+
|
|
144
|
+
> Illustrative thresholds; confirm current circuit breaker behavior, error rate calculations, and timeout values with `b2c docs read commerce-api/custom-api-circuit-breaker`.
|
|
145
|
+
|
|
146
|
+
Custom APIs have a circuit breaker that blocks requests when error rate exceeds 50%:
|
|
147
|
+
|
|
148
|
+
1. Circuit opens after 50+ errors in 100 requests
|
|
149
|
+
2. Requests return 503 for 60 seconds
|
|
150
|
+
3. Circuit enters half-open state, testing next 10 requests
|
|
151
|
+
4. If >5 fail, circuit reopens; otherwise closes
|
|
152
|
+
|
|
153
|
+
**Prevention:** Write robust code with error handling and avoid long-running remote calls.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Testing Custom APIs
|
|
2
|
+
|
|
3
|
+
## Prerequisites for Testing
|
|
4
|
+
|
|
5
|
+
Before testing a Shopper API with custom scopes, ensure you have a SLAS client configured with those scopes:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Create a test client with your custom scope (replace c_my_scope with your scope)
|
|
9
|
+
b2c slas client create \
|
|
10
|
+
--tenant-id zzpq_013 \
|
|
11
|
+
--channels RefArch \
|
|
12
|
+
--default-scopes \
|
|
13
|
+
--scopes "c_my_scope" \
|
|
14
|
+
--redirect-uri http://localhost:3000/callback \
|
|
15
|
+
--json
|
|
16
|
+
|
|
17
|
+
# Save the client_id and client_secret from the output
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Warning:** Use `--scopes` (plural) for client scopes, NOT `--scope` (singular).
|
|
21
|
+
|
|
22
|
+
See `b2c-cli:b2c-slas` skill for more options.
|
|
23
|
+
|
|
24
|
+
## Get a Shopper Token (Private Client)
|
|
25
|
+
|
|
26
|
+
> Illustrative SLAS token endpoint and grant flow; confirm current SLAS endpoint URLs, grant types, and parameter requirements with `b2c docs read commerce-api/custom-api-authentication`.
|
|
27
|
+
|
|
28
|
+
Using a private SLAS client with client credentials grant:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Set your credentials
|
|
32
|
+
SHORTCODE="your-short-code" # see b2c-cli:b2c-config skill to find this value
|
|
33
|
+
ORG="f_ecom_xxxx_xxx"
|
|
34
|
+
SLAS_CLIENT_ID="your-client-id"
|
|
35
|
+
SLAS_CLIENT_SECRET="your-client-secret"
|
|
36
|
+
SITE="RefArch" # b2c-cli:b2c-sites skill to find site IDs
|
|
37
|
+
|
|
38
|
+
# Get access token
|
|
39
|
+
TOKEN=$(curl -s "https://$SHORTCODE.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/$ORG/oauth2/token" \
|
|
40
|
+
-u "$SLAS_CLIENT_ID:$SLAS_CLIENT_SECRET" \
|
|
41
|
+
-d "grant_type=client_credentials&channel_id=$SITE" | jq -r '.access_token')
|
|
42
|
+
|
|
43
|
+
echo $TOKEN
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Call Your Custom API
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Call the Custom API endpoint
|
|
50
|
+
curl -s "https://$SHORTCODE.api.commercecloud.salesforce.com/custom/my-api/v1/organizations/$ORG/my-endpoint?siteId=$SITE" \
|
|
51
|
+
-H "Authorization: Bearer $TOKEN" | jq
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Testing Admin APIs
|
|
55
|
+
|
|
56
|
+
> Illustrative Account Manager OAuth scope requirements; confirm current Admin API authorization model, tenant scope format, and scope combination rules with `b2c docs read commerce-api/custom-api-authentication`.
|
|
57
|
+
|
|
58
|
+
For Admin APIs (`AmOAuth2`), obtain a token from Account Manager with the **two required scope types**:
|
|
59
|
+
|
|
60
|
+
1. The **tenant scope** `SALESFORCE_COMMERCE_API:<tenant_id>` (grants access to the tenant), and
|
|
61
|
+
2. Your **custom Admin scope(s)** `c_my_admin_scope` (as declared in `schema.yaml`).
|
|
62
|
+
|
|
63
|
+
> **Important:** Unlike the SCAPI subcommands (`b2c scapi custom status`, `b2c scapi schemas list`), which inject the `SALESFORCE_COMMERCE_API:<tenant_id>` scope for you, a raw token request (`b2c auth token` or curl) sends **only** the scopes you pass. Omitting the tenant scope yields a token that 403s against the Admin API.
|
|
64
|
+
|
|
65
|
+
### Get an Admin Token via the CLI (recommended)
|
|
66
|
+
|
|
67
|
+
`b2c auth token` accepts multiple scopes — repeat `--auth-scope` or pass a comma-separated list. List the tenant scope **and** your custom scope(s):
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
TENANT_ID="zzpq_013"
|
|
71
|
+
|
|
72
|
+
# Repeatable flag form
|
|
73
|
+
TOKEN=$(b2c auth token \
|
|
74
|
+
--auth-scope "SALESFORCE_COMMERCE_API:$TENANT_ID" \
|
|
75
|
+
--auth-scope c_my_admin_scope)
|
|
76
|
+
|
|
77
|
+
# Comma-separated form (equivalent)
|
|
78
|
+
TOKEN=$(b2c auth token --auth-scope "SALESFORCE_COMMERCE_API:$TENANT_ID,c_my_admin_scope")
|
|
79
|
+
|
|
80
|
+
# Call Admin API (no siteId for org context)
|
|
81
|
+
curl -s "https://$SHORTCODE.api.commercecloud.salesforce.com/custom/my-admin-api/v1/organizations/$ORG/my-endpoint" \
|
|
82
|
+
-H "Authorization: Bearer $TOKEN" | jq
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Get an Admin Token via curl
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
AM_CLIENT_ID="your-am-client-id"
|
|
89
|
+
AM_CLIENT_SECRET="your-am-client-secret"
|
|
90
|
+
TENANT_ID="zzpq_013"
|
|
91
|
+
|
|
92
|
+
# The scope MUST include the tenant scope plus your custom Admin scope(s)
|
|
93
|
+
TOKEN=$(curl -s "https://account.demandware.com/dwsso/oauth2/access_token" \
|
|
94
|
+
-u "$AM_CLIENT_ID:$AM_CLIENT_SECRET" \
|
|
95
|
+
-d "grant_type=client_credentials" \
|
|
96
|
+
--data-urlencode "scope=SALESFORCE_COMMERCE_API:$TENANT_ID c_my_admin_scope" | jq -r '.access_token')
|
|
97
|
+
|
|
98
|
+
# Call Admin API (no siteId)
|
|
99
|
+
curl -s "https://$SHORTCODE.api.commercecloud.salesforce.com/custom/my-admin-api/v1/organizations/$ORG/my-endpoint" \
|
|
100
|
+
-H "Authorization: Bearer $TOKEN" | jq
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Testing Tips
|
|
104
|
+
|
|
105
|
+
- Use `b2c slas client list` to find existing SLAS clients
|
|
106
|
+
- Use `b2c slas client create --default-scopes --scopes "c_my_scope"` to create a test client
|
|
107
|
+
- Check logs with `b2c logs get` if requests fail
|
|
108
|
+
- Verify endpoint registration with `b2c scapi custom status --tenant-id <tenant>`
|
|
109
|
+
|
|
110
|
+
## Common Test Failures
|
|
111
|
+
|
|
112
|
+
| Error | Cause | Solution |
|
|
113
|
+
|-------|-------|----------|
|
|
114
|
+
| 400 Bad Request | Missing or invalid parameter | Check schema.yaml parameter definitions |
|
|
115
|
+
| 401 Unauthorized | Invalid/expired token | Get a fresh token |
|
|
116
|
+
| 403 Forbidden | Missing scope | Verify scope in token matches contract. For Admin APIs, confirm the token includes **both** `SALESFORCE_COMMERCE_API:<tenant_id>` and your custom scope(s) |
|
|
117
|
+
| 404 Not Found | Endpoint not registered | Run `b2c scapi custom status` |
|
|
118
|
+
| 500 Internal Error | Script error | Check `b2c logs get --level ERROR` |
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: b2c-custom-caches
|
|
3
|
+
description: Implement custom caching with CacheMgr, caches.json definitions, and cache region configuration. Use this skill whenever the user needs to cache expensive computations or API responses server-side, define cache regions with TTL and size limits, invalidate cache entries, or debug disappearing cache data. Also use when optimizing script performance with application-level caching -- even if they just say 'cache this data' or 'my cached values keep disappearing'.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# B2C Custom Caches
|
|
7
|
+
|
|
8
|
+
Custom caches improve code performance by storing data that is expensive to calculate, takes a long time to retrieve, or is accessed frequently. Caches are defined in JSON files within cartridges and accessed via the Script API.
|
|
9
|
+
|
|
10
|
+
## When to Use Custom Caches
|
|
11
|
+
|
|
12
|
+
| Use Case | Example |
|
|
13
|
+
|----------|---------|
|
|
14
|
+
| Expensive calculations | Check if any variation product is on sale for base product display |
|
|
15
|
+
| External system responses | Cache in-store availability or prices from external APIs |
|
|
16
|
+
| Configuration settings | Store configuration data from JSON files or external sources |
|
|
17
|
+
| Frequently accessed data | Product attributes, category data, site preferences |
|
|
18
|
+
|
|
19
|
+
## Limitations
|
|
20
|
+
|
|
21
|
+
| Constraint | Value |
|
|
22
|
+
|------------|-------|
|
|
23
|
+
| Total memory per app server | ~20 MB for all custom caches |
|
|
24
|
+
| Max caches per code version | 100 |
|
|
25
|
+
| Max entry size | 128 KB |
|
|
26
|
+
| Supported value types | Primitives, arrays, plain objects, `null` (not `undefined`) |
|
|
27
|
+
| Cross-server sync | None (caches are per-application-server) |
|
|
28
|
+
|
|
29
|
+
## Defining a Custom Cache
|
|
30
|
+
|
|
31
|
+
### File Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
my_cartridge/
|
|
35
|
+
├── package.json # References caches.json
|
|
36
|
+
└── caches.json # Cache definitions
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### package.json
|
|
40
|
+
|
|
41
|
+
Add a `caches` entry pointing to the cache definition file:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"name": "my_cartridge",
|
|
46
|
+
"caches": "./caches.json"
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### caches.json
|
|
51
|
+
|
|
52
|
+
Define caches with unique IDs and optional expiration:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"caches": [
|
|
57
|
+
{
|
|
58
|
+
"id": "ProductAttributeCache"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "ExternalPriceCache",
|
|
62
|
+
"expireAfterSeconds": 300
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "SiteConfigCache",
|
|
66
|
+
"expireAfterSeconds": 60
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Property | Required | Description |
|
|
73
|
+
|----------|----------|-------------|
|
|
74
|
+
| `id` | Yes | Unique ID across all cartridges in code version |
|
|
75
|
+
| `expireAfterSeconds` | No | Maximum seconds an entry is retained |
|
|
76
|
+
|
|
77
|
+
## Using Custom Caches
|
|
78
|
+
|
|
79
|
+
### Script API Classes
|
|
80
|
+
|
|
81
|
+
| Class | Description |
|
|
82
|
+
|-------|-------------|
|
|
83
|
+
| `dw.system.CacheMgr` | Entry point for accessing defined caches |
|
|
84
|
+
| `dw.system.Cache` | Cache instance for storing and retrieving entries |
|
|
85
|
+
|
|
86
|
+
### Basic Usage
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
var CacheMgr = require('dw/system/CacheMgr');
|
|
90
|
+
|
|
91
|
+
// Get a defined cache
|
|
92
|
+
var cache = CacheMgr.getCache('ProductAttributeCache');
|
|
93
|
+
|
|
94
|
+
// Get value (returns undefined if not found)
|
|
95
|
+
var value = cache.get('myKey');
|
|
96
|
+
|
|
97
|
+
// Store value directly
|
|
98
|
+
cache.put('myKey', { data: 'value' });
|
|
99
|
+
|
|
100
|
+
// Remove entry
|
|
101
|
+
cache.invalidate('myKey');
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Recommended Pattern: get with Loader
|
|
105
|
+
|
|
106
|
+
Use `get(key, loader)` to automatically populate the cache on miss:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
var CacheMgr = require('dw/system/CacheMgr');
|
|
110
|
+
var Site = require('dw/system/Site');
|
|
111
|
+
|
|
112
|
+
var cache = CacheMgr.getCache('SiteConfigCache');
|
|
113
|
+
|
|
114
|
+
// Loader function called only on cache miss
|
|
115
|
+
var config = cache.get(Site.current.ID + '_config', function() {
|
|
116
|
+
// Expensive operation - only runs if not cached
|
|
117
|
+
return loadConfigurationFromFile(Site.current);
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Scoped Cache Keys
|
|
122
|
+
|
|
123
|
+
Include scope identifiers in keys to separate entries by context:
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
var CacheMgr = require('dw/system/CacheMgr');
|
|
127
|
+
var Site = require('dw/system/Site');
|
|
128
|
+
|
|
129
|
+
var cache = CacheMgr.getCache('ProductCache');
|
|
130
|
+
|
|
131
|
+
// Site-scoped key
|
|
132
|
+
var siteKey = Site.current.ID + '_' + productID;
|
|
133
|
+
var productData = cache.get(siteKey, loadProductData);
|
|
134
|
+
|
|
135
|
+
// Catalog-scoped key
|
|
136
|
+
var catalogKey = 'catalog_' + catalogID + '_' + productID;
|
|
137
|
+
var catalogData = cache.get(catalogKey, loadCatalogData);
|
|
138
|
+
|
|
139
|
+
// Locale-scoped key
|
|
140
|
+
var localeKey = request.locale + '_' + contentID;
|
|
141
|
+
var content = cache.get(localeKey, loadLocalizedContent);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Cache Methods
|
|
145
|
+
|
|
146
|
+
| Method | Description |
|
|
147
|
+
|--------|-------------|
|
|
148
|
+
| `get(key)` | Returns cached value or `undefined` |
|
|
149
|
+
| `get(key, loader)` | Returns cached value or calls loader, stores result |
|
|
150
|
+
| `put(key, value)` | Stores value directly (overwrites existing) |
|
|
151
|
+
| `invalidate(key)` | Removes entry for key |
|
|
152
|
+
|
|
153
|
+
## Best Practices
|
|
154
|
+
|
|
155
|
+
### Do
|
|
156
|
+
|
|
157
|
+
- Use `get(key, loader)` pattern for automatic population
|
|
158
|
+
- Include scope (site, catalog, locale) in cache keys
|
|
159
|
+
- Set appropriate `expireAfterSeconds` for time-sensitive data
|
|
160
|
+
- Handle cache misses gracefully (data may be evicted anytime)
|
|
161
|
+
- Use descriptive cache IDs
|
|
162
|
+
|
|
163
|
+
### Don't
|
|
164
|
+
|
|
165
|
+
- Include personal user data in cache keys (keys may appear in logs)
|
|
166
|
+
- Store Script API objects (only primitives and plain objects)
|
|
167
|
+
- Rely on cache entries existing (no persistence guarantee)
|
|
168
|
+
- Expect cross-server cache synchronization
|
|
169
|
+
- Store `undefined` values (use `null` instead)
|
|
170
|
+
|
|
171
|
+
## Cache Invalidation
|
|
172
|
+
|
|
173
|
+
Caches are automatically cleared when:
|
|
174
|
+
- Any file in the active code version changes
|
|
175
|
+
- A new code version is activated
|
|
176
|
+
- Data replication completes
|
|
177
|
+
- Code replication completes
|
|
178
|
+
|
|
179
|
+
Manual invalidation only affects the current application server:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
var cache = CacheMgr.getCache('MyCache');
|
|
183
|
+
|
|
184
|
+
// Invalidate single entry (current app server only)
|
|
185
|
+
cache.invalidate('myKey');
|
|
186
|
+
|
|
187
|
+
// Storing undefined has same effect as invalidate
|
|
188
|
+
cache.put('myKey', undefined);
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Common Patterns
|
|
192
|
+
|
|
193
|
+
### Caching External API Responses
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
var CacheMgr = require('dw/system/CacheMgr');
|
|
197
|
+
var LocalServiceRegistry = require('dw/svc/LocalServiceRegistry');
|
|
198
|
+
|
|
199
|
+
var priceCache = CacheMgr.getCache('ExternalPriceCache');
|
|
200
|
+
|
|
201
|
+
function getExternalPrice(productID) {
|
|
202
|
+
return priceCache.get('price_' + productID, function() {
|
|
203
|
+
var service = LocalServiceRegistry.createService('PriceService', {
|
|
204
|
+
createRequest: function(svc, args) {
|
|
205
|
+
svc.setRequestMethod('GET');
|
|
206
|
+
svc.addParam('productId', args.productID);
|
|
207
|
+
return null;
|
|
208
|
+
},
|
|
209
|
+
parseResponse: function(svc, response) {
|
|
210
|
+
return JSON.parse(response.text);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
var result = service.call({ productID: productID });
|
|
215
|
+
return result.ok ? result.object : null;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Caching Expensive Calculations
|
|
221
|
+
|
|
222
|
+
```javascript
|
|
223
|
+
var CacheMgr = require('dw/system/CacheMgr');
|
|
224
|
+
|
|
225
|
+
var saleCache = CacheMgr.getCache('ProductSaleCache');
|
|
226
|
+
|
|
227
|
+
function isProductOnSale(masterProduct) {
|
|
228
|
+
return saleCache.get('sale_' + masterProduct.ID, function() {
|
|
229
|
+
var variants = masterProduct.variants.iterator();
|
|
230
|
+
while (variants.hasNext()) {
|
|
231
|
+
var variant = variants.next();
|
|
232
|
+
if (isInPromotion(variant)) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return false;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Configuration Cache with Site Scope
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
var CacheMgr = require('dw/system/CacheMgr');
|
|
245
|
+
var Site = require('dw/system/Site');
|
|
246
|
+
var File = require('dw/io/File');
|
|
247
|
+
var FileReader = require('dw/io/FileReader');
|
|
248
|
+
|
|
249
|
+
var configCache = CacheMgr.getCache('SiteConfigCache');
|
|
250
|
+
|
|
251
|
+
function getSiteConfig() {
|
|
252
|
+
var siteID = Site.current.ID;
|
|
253
|
+
|
|
254
|
+
return configCache.get(siteID + '_config', function() {
|
|
255
|
+
var configFile = new File(File.IMPEX + '/src/config/' + siteID + '.json');
|
|
256
|
+
if (!configFile.exists()) {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
var reader = new FileReader(configFile);
|
|
261
|
+
var content = reader.getString();
|
|
262
|
+
reader.close();
|
|
263
|
+
|
|
264
|
+
return JSON.parse(content);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Troubleshooting
|
|
270
|
+
|
|
271
|
+
| Issue | Cause | Solution |
|
|
272
|
+
|-------|-------|----------|
|
|
273
|
+
| Cache not found exception | Cache ID not defined in any caches.json | Add cache definition to caches.json |
|
|
274
|
+
| Duplicate cache ID error | Same ID used in multiple cartridges | Use unique IDs across all cartridges |
|
|
275
|
+
| Entry not stored | Value exceeds 128 KB limit | Reduce data size or cache subsets |
|
|
276
|
+
| Entry not stored | Value contains Script API objects | Use only primitives and plain objects |
|
|
277
|
+
| Unexpected cache misses | Different app server or cache cleared | Always handle misses gracefully |
|
|
278
|
+
|
|
279
|
+
Check the custom error log and custom warn log for cache-related messages.
|