@salesforce/b2c-cli 2.3.1 → 2.5.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 +481 -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 +137 -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 +70 -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 +148 -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 +70 -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-edge-traffic-triage/SKILL.md +69 -0
- package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +80 -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 +88 -0
- package/content/guidance/b2c-ops/b2c-production-triage/references/escalation.md +57 -0
- package/content/guidance/index.json +1969 -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/run.js +1 -1
- package/dist/commands/job/run.js.map +1 -1
- 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 +9 -0
- package/dist/commands/scapi/schemas/get.js +51 -19
- package/dist/commands/scapi/schemas/get.js.map +1 -1
- package/dist/commands/scapi/schemas/list.d.ts +6 -0
- package/dist/commands/scapi/schemas/list.js +28 -18
- package/dist/commands/scapi/schemas/list.js.map +1 -1
- package/dist/commands/setup/get.d.ts +36 -0
- package/dist/commands/setup/get.js +67 -0
- package/dist/commands/setup/get.js.map +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 +15 -4
- package/dist/commands/setup/inspect.js.map +1 -1
- package/dist/commands/setup/instance/create.d.ts +9 -0
- package/dist/commands/setup/instance/create.js +22 -6
- package/dist/commands/setup/instance/create.js.map +1 -1
- package/dist/commands/setup/instance/list.d.ts +1 -0
- package/dist/commands/setup/instance/list.js +3 -4
- package/dist/commands/setup/instance/list.js.map +1 -1
- package/dist/commands/setup/instance/remove.d.ts +1 -0
- package/dist/commands/setup/instance/remove.js +5 -5
- package/dist/commands/setup/instance/remove.js.map +1 -1
- package/dist/commands/setup/instance/set-active.d.ts +6 -0
- package/dist/commands/setup/instance/set-active.js +20 -5
- package/dist/commands/setup/instance/set-active.js.map +1 -1
- package/dist/commands/setup/openshell.d.ts +1 -0
- package/dist/commands/setup/set.d.ts +37 -0
- package/dist/commands/setup/set.js +87 -0
- package/dist/commands/setup/set.js.map +1 -0
- package/dist/commands/setup/skills.d.ts +1 -0
- package/dist/commands/setup/unset.d.ts +37 -0
- package/dist/commands/setup/unset.js +55 -0
- package/dist/commands/setup/unset.js.map +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/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/setup/config-field-command.d.ts +25 -0
- package/dist/utils/setup/config-field-command.js +41 -0
- package/dist/utils/setup/config-field-command.js.map +1 -0
- package/dist/utils/slas/client.d.ts +1 -0
- package/oclif.manifest.json +20802 -16968
- package/package.json +11 -5
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: b2c-custom-job-steps
|
|
3
|
+
description: Create custom job steps for B2C Commerce batch processing. Use this skill whenever the user needs to write a batch job, data export script, scheduled cleanup task, or any server-side processing that runs on a schedule. Also use when they ask about steptypes.json, chunk-oriented vs task-oriented job steps, read/process/write patterns, how to get a custom job to appear in Business Manager, or how to author and import a jobs.xml job definition (job/flow/step structure, step type, the required triggers element) so a step type becomes a runnable, schedulable job — even if they just say "I need a script that runs nightly" or "batch process orders".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Custom Job Steps Skill
|
|
7
|
+
|
|
8
|
+
This skill guides you through **creating new custom job steps** for Salesforce B2C Commerce batch processing.
|
|
9
|
+
|
|
10
|
+
> **Running an existing job?** If you need to execute jobs or import site archives via CLI, use the `b2c-cli:b2c-job` skill instead.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Creating a **new scheduled job** for batch processing
|
|
15
|
+
- Building a **data import job** (customers, products, orders)
|
|
16
|
+
- Building a **data export job** (reports, feeds, sync)
|
|
17
|
+
- Implementing **data sync** between systems
|
|
18
|
+
- Creating **cleanup or maintenance tasks**
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
Custom job steps allow you to execute custom business logic as part of B2C Commerce jobs. There are two execution models:
|
|
23
|
+
|
|
24
|
+
| Model | Use Case | Progress Tracking |
|
|
25
|
+
|-------|----------|-------------------|
|
|
26
|
+
| **Task-oriented** | Single operations (FTP, import/export) | Limited |
|
|
27
|
+
| **Chunk-oriented** | Bulk data processing | Fine-grained |
|
|
28
|
+
|
|
29
|
+
## File Structure
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
my_cartridge/
|
|
33
|
+
├── cartridge/
|
|
34
|
+
│ ├── scripts/
|
|
35
|
+
│ │ └── steps/
|
|
36
|
+
│ │ ├── myTaskStep.js # Task-oriented script
|
|
37
|
+
│ │ └── myChunkStep.js # Chunk-oriented script
|
|
38
|
+
│ └── my_cartridge.properties
|
|
39
|
+
└── steptypes.json # Step type definitions (at cartridge ROOT)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Important:** The `steptypes.json` file must be placed in the **root** folder of the cartridge, not inside the `cartridge/` directory. Only one `steptypes.json` file per cartridge.
|
|
43
|
+
|
|
44
|
+
## Step Type Definition (steptypes.json)
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"step-types": {
|
|
49
|
+
"script-module-step": [
|
|
50
|
+
{
|
|
51
|
+
"@type-id": "custom.MyTaskStep",
|
|
52
|
+
"@supports-parallel-execution": "false",
|
|
53
|
+
"@supports-site-context": "true",
|
|
54
|
+
"@supports-organization-context": "false",
|
|
55
|
+
"description": "My custom task step",
|
|
56
|
+
"module": "my_cartridge/cartridge/scripts/steps/myTaskStep.js",
|
|
57
|
+
"function": "execute",
|
|
58
|
+
"timeout-in-seconds": 900,
|
|
59
|
+
"parameters": {
|
|
60
|
+
"parameter": [
|
|
61
|
+
{
|
|
62
|
+
"@name": "InputFile",
|
|
63
|
+
"@type": "string",
|
|
64
|
+
"@required": "true",
|
|
65
|
+
"description": "Path to input file"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"@name": "Enabled",
|
|
69
|
+
"@type": "boolean",
|
|
70
|
+
"@required": "false",
|
|
71
|
+
"default-value": "true",
|
|
72
|
+
"description": "Enable processing"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"status-codes": {
|
|
77
|
+
"status": [
|
|
78
|
+
{
|
|
79
|
+
"@code": "OK",
|
|
80
|
+
"description": "Step completed successfully"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"@code": "ERROR",
|
|
84
|
+
"description": "Step failed"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"@code": "NO_DATA",
|
|
88
|
+
"description": "No data to process"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"chunk-script-module-step": [
|
|
95
|
+
{
|
|
96
|
+
"@type-id": "custom.MyChunkStep",
|
|
97
|
+
"@supports-parallel-execution": "true",
|
|
98
|
+
"@supports-site-context": "true",
|
|
99
|
+
"@supports-organization-context": "false",
|
|
100
|
+
"description": "Bulk data processing step",
|
|
101
|
+
"module": "my_cartridge/cartridge/scripts/steps/myChunkStep.js",
|
|
102
|
+
"before-step-function": "beforeStep",
|
|
103
|
+
"read-function": "read",
|
|
104
|
+
"process-function": "process",
|
|
105
|
+
"write-function": "write",
|
|
106
|
+
"after-step-function": "afterStep",
|
|
107
|
+
"total-count-function": "getTotalCount",
|
|
108
|
+
"chunk-size": 100,
|
|
109
|
+
"transactional": "false",
|
|
110
|
+
"timeout-in-seconds": 1800,
|
|
111
|
+
"parameters": {
|
|
112
|
+
"parameter": [
|
|
113
|
+
{
|
|
114
|
+
"@name": "CategoryId",
|
|
115
|
+
"@type": "string",
|
|
116
|
+
"@required": "true"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## From Step Type to Runnable Job (jobs.xml)
|
|
127
|
+
|
|
128
|
+
`steptypes.json` only *declares* a step type — it does not create a job. To get a job that `b2c job run` can execute and Business Manager can schedule, author a **job definition** (`jobs.xml`) that references your step type, then import it:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
b2c job import ./my-job-archive # jobs.xml at the archive root
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
A minimal valid definition wires one step into a flow and includes the **required `<triggers>`** element:
|
|
135
|
+
|
|
136
|
+
```xml
|
|
137
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
138
|
+
<jobs xmlns="http://www.demandware.com/xml/impex/jobs/2015-07-01">
|
|
139
|
+
<job job-id="MyNightlyExport">
|
|
140
|
+
<flow>
|
|
141
|
+
<context site-id="RefArch"/>
|
|
142
|
+
<!-- type="..." matches the @type-id declared in steptypes.json -->
|
|
143
|
+
<step step-id="ExportStep" type="custom.ProductExport">
|
|
144
|
+
<parameters>
|
|
145
|
+
<parameter name="OutputFile">/export/products.csv</parameter>
|
|
146
|
+
</parameters>
|
|
147
|
+
</step>
|
|
148
|
+
</flow>
|
|
149
|
+
<triggers>
|
|
150
|
+
<run-once enabled="false">
|
|
151
|
+
<date>2025-01-01</date>
|
|
152
|
+
<time>00:00:00.000Z</time>
|
|
153
|
+
</run-once>
|
|
154
|
+
</triggers>
|
|
155
|
+
</job>
|
|
156
|
+
</jobs>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Key rules (full details in the [jobs.xml Reference](references/JOBS-XML.md)):
|
|
160
|
+
|
|
161
|
+
- **`<triggers>` is required** by the schema — a `jobs.xml` without it fails import validation. Use `<run-once enabled="false">` for an on-demand/manually-run job, or `<run-recurring>` to schedule it.
|
|
162
|
+
- The `<step>` **`type`** attribute references the step type; its value must match the **`@type-id`** you declared in `steptypes.json` (don't confuse the two — `steptypes.json` uses `@type-id`, `jobs.xml` uses `type`).
|
|
163
|
+
- `<job>` children must appear in order: `description → parameters → flow/split → rules → triggers`.
|
|
164
|
+
- The cartridge carrying the step's `steptypes.json` + module must be deployed and on the cartridge path before the job can resolve the step type.
|
|
165
|
+
|
|
166
|
+
After import, run it with `b2c job run MyNightlyExport --wait` (see the `b2c-cli:b2c-job` skill).
|
|
167
|
+
|
|
168
|
+
## Task-Oriented Steps
|
|
169
|
+
|
|
170
|
+
Use for single operations like FTP transfers, file generation, or import/export.
|
|
171
|
+
|
|
172
|
+
### Script (scripts/steps/myTaskStep.js)
|
|
173
|
+
|
|
174
|
+
```javascript
|
|
175
|
+
'use strict';
|
|
176
|
+
|
|
177
|
+
var Status = require('dw/system/Status');
|
|
178
|
+
var Logger = require('dw/system/Logger');
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Execute the task step
|
|
182
|
+
* @param {Object} parameters - Job step parameters
|
|
183
|
+
* @param {dw.job.JobStepExecution} stepExecution - Step execution context
|
|
184
|
+
* @returns {dw.system.Status} Execution status
|
|
185
|
+
*/
|
|
186
|
+
exports.execute = function (parameters, stepExecution) {
|
|
187
|
+
var log = Logger.getLogger('job', 'MyTaskStep');
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
var inputFile = parameters.InputFile;
|
|
191
|
+
var enabled = parameters.Enabled;
|
|
192
|
+
|
|
193
|
+
if (!enabled) {
|
|
194
|
+
log.info('Step disabled, skipping');
|
|
195
|
+
return new Status(Status.OK, 'SKIP', 'Step disabled');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Your business logic here
|
|
199
|
+
log.info('Processing file: ' + inputFile);
|
|
200
|
+
|
|
201
|
+
// Return success
|
|
202
|
+
return new Status(Status.OK);
|
|
203
|
+
|
|
204
|
+
} catch (e) {
|
|
205
|
+
log.error('Step failed: ' + e.message);
|
|
206
|
+
return new Status(Status.ERROR, 'ERROR', e.message);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Status Codes
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
// Success
|
|
215
|
+
return new Status(Status.OK);
|
|
216
|
+
return new Status(Status.OK, 'CUSTOM_CODE', 'Custom message');
|
|
217
|
+
|
|
218
|
+
// Error
|
|
219
|
+
return new Status(Status.ERROR);
|
|
220
|
+
return new Status(Status.ERROR, null, 'Error message');
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Important:** Custom status codes work **only** with OK status. If you use a custom code with ERROR status, it is replaced with ERROR. Custom status codes cannot contain commas, wildcards, leading/trailing whitespace, or exceed 100 characters.
|
|
224
|
+
|
|
225
|
+
## Chunk-Oriented Steps
|
|
226
|
+
|
|
227
|
+
Use for bulk processing of countable data (products, orders, customers).
|
|
228
|
+
|
|
229
|
+
**Important:** You cannot define custom exit status for chunk-oriented steps. Chunk modules always finish with either **OK** or **ERROR**.
|
|
230
|
+
|
|
231
|
+
### Required Functions
|
|
232
|
+
|
|
233
|
+
| Function | Purpose | Returns |
|
|
234
|
+
|----------|---------|---------|
|
|
235
|
+
| `read()` | Get next item | Item or nothing |
|
|
236
|
+
| `process(item)` | Transform item | Processed item or nothing (filters) |
|
|
237
|
+
| `write(items)` | Save chunk of items | Nothing |
|
|
238
|
+
|
|
239
|
+
### Optional Functions
|
|
240
|
+
|
|
241
|
+
| Function | Purpose | Returns |
|
|
242
|
+
|----------|---------|---------|
|
|
243
|
+
| `beforeStep()` | Initialize (open files, queries) | Nothing |
|
|
244
|
+
| `afterStep(success)` | Cleanup (close files) | Nothing |
|
|
245
|
+
| `getTotalCount()` | Return total items for progress | Number |
|
|
246
|
+
| `beforeChunk()` | Before each chunk | Nothing |
|
|
247
|
+
| `afterChunk()` | After each chunk | Nothing |
|
|
248
|
+
|
|
249
|
+
### Script (scripts/steps/myChunkStep.js)
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
'use strict';
|
|
253
|
+
|
|
254
|
+
var ProductMgr = require('dw/catalog/ProductMgr');
|
|
255
|
+
var Transaction = require('dw/system/Transaction');
|
|
256
|
+
var Logger = require('dw/system/Logger');
|
|
257
|
+
var File = require('dw/io/File');
|
|
258
|
+
var FileWriter = require('dw/io/FileWriter');
|
|
259
|
+
|
|
260
|
+
var log = Logger.getLogger('job', 'MyChunkStep');
|
|
261
|
+
var products;
|
|
262
|
+
var fileWriter;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Initialize before processing
|
|
266
|
+
*/
|
|
267
|
+
exports.beforeStep = function (parameters, stepExecution) {
|
|
268
|
+
log.info('Starting chunk processing');
|
|
269
|
+
|
|
270
|
+
// Open resources
|
|
271
|
+
var outputFile = new File(File.IMPEX + '/export/products.csv');
|
|
272
|
+
fileWriter = new FileWriter(outputFile);
|
|
273
|
+
fileWriter.writeLine('ID,Name,Price');
|
|
274
|
+
|
|
275
|
+
// Query products
|
|
276
|
+
products = ProductMgr.queryAllSiteProducts();
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Get total count for progress tracking
|
|
281
|
+
*/
|
|
282
|
+
exports.getTotalCount = function (parameters, stepExecution) {
|
|
283
|
+
return products.count;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Read next item
|
|
288
|
+
* Return nothing to signal end of data
|
|
289
|
+
*/
|
|
290
|
+
exports.read = function (parameters, stepExecution) {
|
|
291
|
+
if (products.hasNext()) {
|
|
292
|
+
return products.next();
|
|
293
|
+
}
|
|
294
|
+
// Return nothing = end of data
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Process single item
|
|
299
|
+
* Return nothing to filter out item
|
|
300
|
+
*/
|
|
301
|
+
exports.process = function (product, parameters, stepExecution) {
|
|
302
|
+
// Filter: skip offline products
|
|
303
|
+
if (!product.online) {
|
|
304
|
+
return; // Filtered out
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Transform
|
|
308
|
+
return {
|
|
309
|
+
id: product.ID,
|
|
310
|
+
name: product.name,
|
|
311
|
+
price: product.priceModel.price.value
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Write chunk of processed items
|
|
317
|
+
*/
|
|
318
|
+
exports.write = function (items, parameters, stepExecution) {
|
|
319
|
+
for (var i = 0; i < items.size(); i++) {
|
|
320
|
+
var item = items.get(i);
|
|
321
|
+
fileWriter.writeLine(item.id + ',' + item.name + ',' + item.price);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Cleanup after all chunks
|
|
327
|
+
*/
|
|
328
|
+
exports.afterStep = function (success, parameters, stepExecution) {
|
|
329
|
+
// Close resources
|
|
330
|
+
if (fileWriter) {
|
|
331
|
+
fileWriter.close();
|
|
332
|
+
}
|
|
333
|
+
if (products) {
|
|
334
|
+
products.close();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (success) {
|
|
338
|
+
log.info('Chunk processing completed successfully');
|
|
339
|
+
} else {
|
|
340
|
+
log.error('Chunk processing failed');
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Parameter Types
|
|
346
|
+
|
|
347
|
+
| Type | Description | Example Value |
|
|
348
|
+
|------|-------------|---------------|
|
|
349
|
+
| `string` | Text value | `"my-value"` |
|
|
350
|
+
| `boolean` | true/false | `true` |
|
|
351
|
+
| `long` | Integer | `12345` |
|
|
352
|
+
| `double` | Decimal | `123.45` |
|
|
353
|
+
| `datetime-string` | ISO datetime | `"2024-01-15T10:30:00Z"` |
|
|
354
|
+
| `date-string` | ISO date | `"2024-01-15"` |
|
|
355
|
+
| `time-string` | ISO time | `"10:30:00"` |
|
|
356
|
+
|
|
357
|
+
### Parameter Validation Attributes
|
|
358
|
+
|
|
359
|
+
| Attribute | Applies To | Description |
|
|
360
|
+
|-----------|------------|-------------|
|
|
361
|
+
| `@trim` | All | Trim whitespace before validation (default: `true`) |
|
|
362
|
+
| `@required` | All | Mark as required (default: `true`) |
|
|
363
|
+
| `@target-type` | datetime-string, date-string, time-string | Convert to `long` or `date` (default: `date`) |
|
|
364
|
+
| `pattern` | string | Regex pattern for validation |
|
|
365
|
+
| `min-length` | string | Minimum string length (must be ≥1) |
|
|
366
|
+
| `max-length` | string | Maximum string length (max 1000 chars total) |
|
|
367
|
+
| `min-value` | long, double, datetime-string, time-string | Minimum numeric value |
|
|
368
|
+
| `max-value` | long, double, datetime-string, time-string | Maximum numeric value |
|
|
369
|
+
| `enum-values` | All | Restrict to allowed values (dropdown in BM) |
|
|
370
|
+
|
|
371
|
+
## Configuration Options
|
|
372
|
+
|
|
373
|
+
### steptypes.json Attributes
|
|
374
|
+
|
|
375
|
+
| Attribute | Required | Description |
|
|
376
|
+
|-----------|----------|-------------|
|
|
377
|
+
| `@type-id` | Yes | Unique ID (must start with `custom.`, max 100 chars) |
|
|
378
|
+
| `@supports-parallel-execution` | No | Allow parallel execution (default: `true`) |
|
|
379
|
+
| `@supports-site-context` | No | Available in site-scoped jobs (default: `true`) |
|
|
380
|
+
| `@supports-organization-context` | No | Available in org-scoped jobs (default: `true`) |
|
|
381
|
+
| `module` | Yes | Path to script module |
|
|
382
|
+
| `function` | Yes | Function name to execute (task-oriented) |
|
|
383
|
+
| `timeout-in-seconds` | No | Step timeout (recommended to set) |
|
|
384
|
+
| `transactional` | No | Wrap in single transaction (default: `false`) |
|
|
385
|
+
| `chunk-size` | Yes* | Items per chunk (*required for chunk steps) |
|
|
386
|
+
|
|
387
|
+
**Context Constraints:** `@supports-site-context` and `@supports-organization-context` cannot both be `true` or both be `false` - one must be `true` and the other `false`.
|
|
388
|
+
|
|
389
|
+
## Standard (System) Job Steps
|
|
390
|
+
|
|
391
|
+
Custom steps are only half of a job flow. B2C Commerce also ships **standard (system) job steps** — built-in step **type IDs** you add to a flow in **Business Manager → Administration → Operations → Jobs**, or reference by type ID in a `jobs.xml` flow inside a site-import archive. Unlike custom steps, you do **not** declare these in `steptypes.json`; they are always available. Use them for catalog/inventory/price/content/coupon/custom-object import & export, order export, and similar platform operations — and chain them with your custom steps.
|
|
392
|
+
|
|
393
|
+
**Do not guess standard step type IDs or their parameters.** The full catalog — every step's purpose plus its configuration parameters (required, defaults, allowed values) — is bundled with the CLI and searchable through the `b2c-cli:b2c-docs` skill:
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
# Browse the catalog of standard step type IDs
|
|
397
|
+
b2c docs read job-steps
|
|
398
|
+
|
|
399
|
+
# Look up a specific step's purpose + configuration parameters
|
|
400
|
+
b2c docs read ImportCatalog
|
|
401
|
+
b2c docs read ExportInventoryLists
|
|
402
|
+
|
|
403
|
+
# Fuzzy-search for a step
|
|
404
|
+
b2c docs search "import price"
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Commonly used standard steps
|
|
408
|
+
|
|
409
|
+
The bundled catalog covers the full set of standard step type IDs shown in the Business Manager job-step picker (import, export, and processing steps). Below is a representative subset — run `b2c docs read job-steps` for the complete list, and `b2c docs read <TypeID>` for any step's full parameters and defaults. **Scope** is the execution scope (Organization, Site, or both).
|
|
410
|
+
|
|
411
|
+
| Type ID | Scope | Key required params |
|
|
412
|
+
| --- | --- | --- |
|
|
413
|
+
| `ImportCatalog` | Organization | `NoFilesFoundHandling`, `ImportMode`, `ImportFailedHandling` |
|
|
414
|
+
| `ImportInventoryLists` | Organization | `NoFilesFoundHandling`, `ImportMode`, `ImportFailedHandling` |
|
|
415
|
+
| `ImportPriceBook` | Organization | `NoFilesFoundHandling`, `ImportMode`, `ImportFailedHandling` |
|
|
416
|
+
| `ImportContent` | Site | `NoFilesFoundHandling`, `ImportMode`, `ImportFailedHandling` |
|
|
417
|
+
| `ImportCustomObjects` | Organization & Sites | `NoFilesFoundHandling`, `ImportFailedHandling` |
|
|
418
|
+
| `ExportCatalog` | Organization | `CatalogID` |
|
|
419
|
+
| `ExportInventoryLists` | Site | (none) |
|
|
420
|
+
| `ExportPriceBook` | Organization | `PriceBookID` |
|
|
421
|
+
| `ExportContent` | Organization & Sites | `LibraryID` |
|
|
422
|
+
| `ExportOrders` | Site | `Confirmation Status`, `Shipment Status`, `Payment Status` |
|
|
423
|
+
| `ExecutePreconfiguredDataReplicationProcess` | Organization | `ReplicationProcessID` |
|
|
424
|
+
| `SearchReindex` | Site | `Indexer Type` |
|
|
425
|
+
| `ExecuteScriptModule` | Organization & Sites | `ExecuteScriptModule.Module` |
|
|
426
|
+
|
|
427
|
+
Import steps share a common set of file-handling parameters (`WorkingFolder`, `FileNamePattern`, `ImportMode`, `NoFilesFoundHandling`, `ImportFailedHandling`, `AfterImportFileHandling`, `ArchiveFolder`); export steps share `ExportFile` / `FileNamePrefix` / `OverwriteExportFile`. Processing steps (replication, reindex, cache invalidation, `ExecutePipeline`/`ExecuteScriptModule`/`IncludeStepsFromJob`) have their own parameters. Read any step's doc for the exact list.
|
|
428
|
+
|
|
429
|
+
### Referencing an IMPEX-staged file from a prior step
|
|
430
|
+
|
|
431
|
+
Standard import steps read from the instance **IMPEX** area. The `WorkingFolder` parameter is resolved relative to `IMPEX/src/` (and defaults to `IMPEX/src/`); `FileNamePattern` is a regex that selects which file(s) in that folder to import. This is the hand-off contract: **a step that writes a file under `IMPEX/src/...` can be followed by a standard import step that reads it** — no download/upload round-trip.
|
|
432
|
+
|
|
433
|
+
In a custom step, write to that location with `dw.io.File` using the `IMPEX` constant:
|
|
434
|
+
|
|
435
|
+
```javascript
|
|
436
|
+
var File = require('dw/io/File');
|
|
437
|
+
|
|
438
|
+
// Custom step writes a catalog import file into IMPEX/src/jobdata/
|
|
439
|
+
exports.beforeStep = function () {
|
|
440
|
+
var dir = new File(File.IMPEX + '/src/jobdata');
|
|
441
|
+
dir.mkdirs();
|
|
442
|
+
outputFile = new File(dir, 'catalog-' + Date.now() + '.xml');
|
|
443
|
+
fileWriter = new dw.io.FileWriter(outputFile);
|
|
444
|
+
// ... write valid catalog XML (validate against the `catalog` XSD:
|
|
445
|
+
// b2c docs schema catalog) ...
|
|
446
|
+
};
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
Then the standard `ImportCatalog` step in the next stage of the flow reads it by pointing `WorkingFolder` at `src/jobdata` (relative to `IMPEX/src/` → use `jobdata`) with a `FileNamePattern` of `catalog-.*\.xml`.
|
|
450
|
+
|
|
451
|
+
### Chaining custom + standard steps in one flow
|
|
452
|
+
|
|
453
|
+
A flow can interleave your custom steps with standard ones. Example: a custom step pulls data from an external system and generates a catalog XML in IMPEX; a standard `ImportCatalog` step then applies it; finally a standard replication step publishes the change to production.
|
|
454
|
+
|
|
455
|
+
```xml
|
|
456
|
+
<!-- jobs.xml — a flow chaining a custom step with standard steps -->
|
|
457
|
+
<job job-id="NightlyCatalogSync">
|
|
458
|
+
<flow>
|
|
459
|
+
<!-- 1. Custom step: fetch + write IMPEX/src/jobdata/catalog-*.xml -->
|
|
460
|
+
<step step-id="generateCatalog" type="custom.GenerateCatalogExport">
|
|
461
|
+
<parameters>
|
|
462
|
+
<parameter name="OutputFolder">jobdata</parameter>
|
|
463
|
+
</parameters>
|
|
464
|
+
</step>
|
|
465
|
+
|
|
466
|
+
<!-- 2. Standard step: import the file the custom step produced -->
|
|
467
|
+
<step step-id="importCatalog" type="ImportCatalog">
|
|
468
|
+
<parameters>
|
|
469
|
+
<parameter name="WorkingFolder">jobdata</parameter>
|
|
470
|
+
<parameter name="FileNamePattern">catalog-.*\.xml</parameter>
|
|
471
|
+
<parameter name="ImportMode">Merge</parameter>
|
|
472
|
+
<parameter name="NoFilesFoundHandling">ERROR</parameter>
|
|
473
|
+
<parameter name="ImportFailedHandling">ERROR</parameter>
|
|
474
|
+
<parameter name="AfterImportFileHandling">Archive</parameter>
|
|
475
|
+
</parameters>
|
|
476
|
+
</step>
|
|
477
|
+
|
|
478
|
+
<!-- 3. Standard step: publish to production via a preconfigured replication
|
|
479
|
+
process (on Staging only; configured in BM with activation 'Job Step') -->
|
|
480
|
+
<step step-id="publishCatalog" type="ExecutePreconfiguredDataReplicationProcess">
|
|
481
|
+
<parameters>
|
|
482
|
+
<parameter name="ReplicationProcessID">nightly-catalog-publish</parameter>
|
|
483
|
+
</parameters>
|
|
484
|
+
</step>
|
|
485
|
+
</flow>
|
|
486
|
+
</job>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
The custom step's `OutputFolder` and the standard step's `WorkingFolder` agree on `jobdata` (i.e. `IMPEX/src/jobdata/`), so the file written in step 1 is exactly what step 2 imports; step 3 then replicates the result. (In Business Manager you build the same flow visually: add your custom step, then the standard `ImportCatalog` step after it, then the replication step, setting each step's parameters in its form.)
|
|
490
|
+
|
|
491
|
+
### In-flow standard step vs. the CLI equivalent
|
|
492
|
+
|
|
493
|
+
Some standard steps overlap with `b2c` CLI commands (the CLI's `b2c job import`/`b2c job export` are themselves the `sfcc-site-archive-import`/`-export` system jobs). Choose based on where the data lives:
|
|
494
|
+
|
|
495
|
+
- **Use an in-flow standard step** when the file is produced or already staged **on the instance** — especially when an earlier step in the same flow generated it (no round-trip), when it should run on a Business Manager schedule, or when it must follow custom processing server-side. Example: the standard `ImportCatalog` step consuming a catalog XML that a prior custom step wrote to IMPEX.
|
|
496
|
+
- **Use the CLI** (`b2c job import`, `b2c job export`) when you are moving data **between your machine and the instance** — uploading a local archive, downloading an export, or scripting a one-off from CI.
|
|
497
|
+
|
|
498
|
+
Rule of thumb: data already on (or generated on) the instance → in-flow standard step; data crossing the machine/instance boundary → CLI. See the `b2c-cli:b2c-job` skill for the CLI side.
|
|
499
|
+
|
|
500
|
+
## Best Practices
|
|
501
|
+
|
|
502
|
+
1. **Use chunk-oriented** for bulk data - better progress tracking and resumability
|
|
503
|
+
2. **Close resources** in `afterStep()` - queries, files, connections
|
|
504
|
+
3. **Set explicit timeouts** - default may be too short
|
|
505
|
+
4. **Log progress** - helps debugging
|
|
506
|
+
5. **Handle errors gracefully** - return proper Status objects
|
|
507
|
+
6. **Don't rely on transactional=true** - use `Transaction.wrap()` for control
|
|
508
|
+
|
|
509
|
+
## Related Skills
|
|
510
|
+
|
|
511
|
+
- `b2c-cli:b2c-job` - For **running** existing jobs and importing site archives via CLI
|
|
512
|
+
- `b2c-cli:b2c-docs` - To look up standard job step type IDs and their parameters (`b2c docs read job-steps`, `b2c docs read <TypeID>`)
|
|
513
|
+
- `b2c:b2c-webservices` - When job steps need to call external HTTP services or APIs, use the webservices skill for service configuration and HTTP client patterns
|
|
514
|
+
|
|
515
|
+
## Detailed Reference
|
|
516
|
+
|
|
517
|
+
- [Task-Oriented Steps](references/TASK-ORIENTED.md) - Full task step patterns
|
|
518
|
+
- [Chunk-Oriented Steps](references/CHUNK-ORIENTED.md) - Full chunk step patterns
|
|
519
|
+
- [steptypes.json Reference](references/STEPTYPES-JSON.md) - Complete schema
|
|
520
|
+
- [jobs.xml Reference](references/JOBS-XML.md) - Authoring & importing a job definition (flows, steps, required triggers)
|