@salesforce/b2c-cli 2.3.1 → 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/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 +21814 -18473
- package/package.json +11 -5
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# Task-Oriented Job Steps Reference
|
|
2
|
+
|
|
3
|
+
Complete patterns for task-oriented job steps.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- FTP file transfers
|
|
8
|
+
- Import/export operations
|
|
9
|
+
- Report generation
|
|
10
|
+
- External API calls
|
|
11
|
+
- Cleanup operations
|
|
12
|
+
- Any non-iterable task
|
|
13
|
+
|
|
14
|
+
## Basic Structure
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
var Status = require('dw/system/Status');
|
|
20
|
+
|
|
21
|
+
exports.execute = function (parameters, stepExecution) {
|
|
22
|
+
// Your logic here
|
|
23
|
+
return new Status(Status.OK);
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Status Codes
|
|
28
|
+
|
|
29
|
+
Custom status codes work **only** with `Status.OK`. Custom codes with `Status.ERROR` are replaced with ERROR.
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
// Custom OK codes work - these are useful for flow transitions
|
|
33
|
+
return new Status(Status.OK, 'NO_DATA', 'No files found');
|
|
34
|
+
return new Status(Status.OK, 'PARTIAL', 'Some items processed');
|
|
35
|
+
|
|
36
|
+
// ERROR always becomes ERROR - custom code is ignored
|
|
37
|
+
return new Status(Status.ERROR, null, 'Something failed'); // Code will be ERROR
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Step Execution Context
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
exports.execute = function (parameters, stepExecution) {
|
|
44
|
+
// Access job information
|
|
45
|
+
var jobId = stepExecution.jobExecution.jobID;
|
|
46
|
+
var stepId = stepExecution.stepID;
|
|
47
|
+
var stepTypeId = stepExecution.stepTypeID;
|
|
48
|
+
|
|
49
|
+
// Read a declared step parameter by name
|
|
50
|
+
var batchSize = stepExecution.getParameterValue('BatchSize');
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## FTP Download Example
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
'use strict';
|
|
58
|
+
|
|
59
|
+
var Status = require('dw/system/Status');
|
|
60
|
+
var FTPClient = require('dw/net/FTPClient');
|
|
61
|
+
var File = require('dw/io/File');
|
|
62
|
+
var Logger = require('dw/system/Logger');
|
|
63
|
+
|
|
64
|
+
var log = Logger.getLogger('job', 'FTPDownload');
|
|
65
|
+
|
|
66
|
+
exports.execute = function (parameters, stepExecution) {
|
|
67
|
+
var host = parameters.Host;
|
|
68
|
+
var username = parameters.Username;
|
|
69
|
+
var password = parameters.Password;
|
|
70
|
+
var remoteFile = parameters.RemoteFile;
|
|
71
|
+
var localPath = parameters.LocalPath;
|
|
72
|
+
|
|
73
|
+
var ftp = new FTPClient();
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
// Connect
|
|
77
|
+
log.info('Connecting to ' + host);
|
|
78
|
+
ftp.connect(host, username, password);
|
|
79
|
+
|
|
80
|
+
if (!ftp.connected) {
|
|
81
|
+
return new Status(Status.ERROR, 'CONNECT_FAILED', 'Failed to connect to FTP server');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Download file
|
|
85
|
+
log.info('Downloading ' + remoteFile);
|
|
86
|
+
var localFile = new File(File.IMPEX + localPath);
|
|
87
|
+
var success = ftp.getBinary(remoteFile, localFile);
|
|
88
|
+
|
|
89
|
+
if (!success) {
|
|
90
|
+
return new Status(Status.ERROR, 'DOWNLOAD_FAILED', 'Failed to download file');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
log.info('Download complete: ' + localFile.fullPath);
|
|
94
|
+
return new Status(Status.OK);
|
|
95
|
+
|
|
96
|
+
} catch (e) {
|
|
97
|
+
log.error('FTP error: ' + e.message);
|
|
98
|
+
return new Status(Status.ERROR, 'FTP_ERROR', e.message);
|
|
99
|
+
|
|
100
|
+
} finally {
|
|
101
|
+
if (ftp.connected) {
|
|
102
|
+
ftp.disconnect();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## SFTP Example
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
'use strict';
|
|
112
|
+
|
|
113
|
+
var Status = require('dw/system/Status');
|
|
114
|
+
var SFTPClient = require('dw/net/SFTPClient');
|
|
115
|
+
var File = require('dw/io/File');
|
|
116
|
+
var Logger = require('dw/system/Logger');
|
|
117
|
+
|
|
118
|
+
var log = Logger.getLogger('job', 'SFTPUpload');
|
|
119
|
+
|
|
120
|
+
exports.execute = function (parameters, stepExecution) {
|
|
121
|
+
var host = parameters.Host;
|
|
122
|
+
var port = parameters.Port || 22;
|
|
123
|
+
var username = parameters.Username;
|
|
124
|
+
var password = parameters.Password;
|
|
125
|
+
var localPath = parameters.LocalFile;
|
|
126
|
+
var remotePath = parameters.RemotePath;
|
|
127
|
+
|
|
128
|
+
var sftp = new SFTPClient();
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
sftp.connect(host, port, username, password);
|
|
132
|
+
|
|
133
|
+
if (!sftp.connected) {
|
|
134
|
+
return new Status(Status.ERROR, 'CONNECT_FAILED');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var localFile = new File(File.IMPEX + localPath);
|
|
138
|
+
if (!localFile.exists()) {
|
|
139
|
+
return new Status(Status.ERROR, 'FILE_NOT_FOUND', 'Local file not found');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
sftp.putBinary(remotePath, localFile);
|
|
143
|
+
log.info('Uploaded: ' + localFile.name + ' to ' + remotePath);
|
|
144
|
+
|
|
145
|
+
return new Status(Status.OK);
|
|
146
|
+
|
|
147
|
+
} finally {
|
|
148
|
+
if (sftp.connected) {
|
|
149
|
+
sftp.disconnect();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## HTTP/REST API Example
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
'use strict';
|
|
159
|
+
|
|
160
|
+
var Status = require('dw/system/Status');
|
|
161
|
+
var HTTPClient = require('dw/net/HTTPClient');
|
|
162
|
+
var Logger = require('dw/system/Logger');
|
|
163
|
+
|
|
164
|
+
var log = Logger.getLogger('job', 'APISync');
|
|
165
|
+
|
|
166
|
+
exports.execute = function (parameters, stepExecution) {
|
|
167
|
+
var apiUrl = parameters.APIUrl;
|
|
168
|
+
var apiKey = parameters.APIKey;
|
|
169
|
+
|
|
170
|
+
var http = new HTTPClient();
|
|
171
|
+
http.setTimeout(30000);
|
|
172
|
+
http.setRequestHeader('Authorization', 'Bearer ' + apiKey);
|
|
173
|
+
http.setRequestHeader('Content-Type', 'application/json');
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
http.open('POST', apiUrl);
|
|
177
|
+
http.send(JSON.stringify({ action: 'sync', timestamp: new Date().toISOString() }));
|
|
178
|
+
|
|
179
|
+
var statusCode = http.statusCode;
|
|
180
|
+
var responseText = http.text;
|
|
181
|
+
|
|
182
|
+
if (statusCode >= 200 && statusCode < 300) {
|
|
183
|
+
log.info('API sync successful');
|
|
184
|
+
return new Status(Status.OK);
|
|
185
|
+
} else {
|
|
186
|
+
log.error('API error: ' + statusCode + ' - ' + responseText);
|
|
187
|
+
return new Status(Status.ERROR, 'API_ERROR', 'HTTP ' + statusCode);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
} catch (e) {
|
|
191
|
+
log.error('HTTP error: ' + e.message);
|
|
192
|
+
return new Status(Status.ERROR, 'HTTP_ERROR', e.message);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## File Processing Example
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
'use strict';
|
|
201
|
+
|
|
202
|
+
var Status = require('dw/system/Status');
|
|
203
|
+
var File = require('dw/io/File');
|
|
204
|
+
var FileReader = require('dw/io/FileReader');
|
|
205
|
+
var FileWriter = require('dw/io/FileWriter');
|
|
206
|
+
var Logger = require('dw/system/Logger');
|
|
207
|
+
|
|
208
|
+
var log = Logger.getLogger('job', 'FileProcessor');
|
|
209
|
+
|
|
210
|
+
exports.execute = function (parameters, stepExecution) {
|
|
211
|
+
var inputPath = parameters.InputFile;
|
|
212
|
+
var outputPath = parameters.OutputFile;
|
|
213
|
+
|
|
214
|
+
var inputFile = new File(File.IMPEX + inputPath);
|
|
215
|
+
if (!inputFile.exists()) {
|
|
216
|
+
return new Status(Status.ERROR, 'FILE_NOT_FOUND', 'Input file not found');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
var outputFile = new File(File.IMPEX + outputPath);
|
|
220
|
+
var reader;
|
|
221
|
+
var writer;
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
reader = new FileReader(inputFile);
|
|
225
|
+
writer = new FileWriter(outputFile);
|
|
226
|
+
|
|
227
|
+
var line;
|
|
228
|
+
var lineCount = 0;
|
|
229
|
+
|
|
230
|
+
while ((line = reader.readLine()) !== null) {
|
|
231
|
+
// Process line
|
|
232
|
+
var processed = line.toUpperCase(); // Example transformation
|
|
233
|
+
writer.writeLine(processed);
|
|
234
|
+
lineCount++;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
log.info('Processed ' + lineCount + ' lines');
|
|
238
|
+
return new Status(Status.OK);
|
|
239
|
+
|
|
240
|
+
} finally {
|
|
241
|
+
if (reader) reader.close();
|
|
242
|
+
if (writer) writer.close();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Cleanup Example
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
'use strict';
|
|
251
|
+
|
|
252
|
+
var Status = require('dw/system/Status');
|
|
253
|
+
var File = require('dw/io/File');
|
|
254
|
+
var Logger = require('dw/system/Logger');
|
|
255
|
+
|
|
256
|
+
var log = Logger.getLogger('job', 'FileCleanup');
|
|
257
|
+
|
|
258
|
+
exports.execute = function (parameters, stepExecution) {
|
|
259
|
+
var directory = parameters.Directory;
|
|
260
|
+
var maxAgeHours = parameters.MaxAgeHours || 24;
|
|
261
|
+
|
|
262
|
+
var folder = new File(File.IMPEX + directory);
|
|
263
|
+
if (!folder.exists() || !folder.directory) {
|
|
264
|
+
return new Status(Status.ERROR, 'INVALID_PATH', 'Directory not found');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
var files = folder.listFiles();
|
|
268
|
+
var cutoffTime = Date.now() - (maxAgeHours * 60 * 60 * 1000);
|
|
269
|
+
var deletedCount = 0;
|
|
270
|
+
|
|
271
|
+
for (var i = 0; i < files.length; i++) {
|
|
272
|
+
var file = files[i];
|
|
273
|
+
if (!file.directory && file.lastModified() < cutoffTime) {
|
|
274
|
+
file.remove();
|
|
275
|
+
deletedCount++;
|
|
276
|
+
log.info('Deleted: ' + file.name);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
log.info('Cleanup complete. Deleted ' + deletedCount + ' files.');
|
|
281
|
+
return new Status(Status.OK, 'OK', 'Deleted ' + deletedCount + ' files');
|
|
282
|
+
};
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## steptypes.json for Task Steps
|
|
286
|
+
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"step-types": {
|
|
290
|
+
"script-module-step": [
|
|
291
|
+
{
|
|
292
|
+
"@type-id": "custom.FTPDownload",
|
|
293
|
+
"@supports-parallel-execution": "false",
|
|
294
|
+
"@supports-site-context": "true",
|
|
295
|
+
"@supports-organization-context": "false",
|
|
296
|
+
"description": "Download file from FTP server",
|
|
297
|
+
"module": "my_cartridge/cartridge/scripts/steps/ftpDownload.js",
|
|
298
|
+
"function": "execute",
|
|
299
|
+
"timeout-in-seconds": 600,
|
|
300
|
+
"parameters": {
|
|
301
|
+
"parameter": [
|
|
302
|
+
{
|
|
303
|
+
"@name": "Host",
|
|
304
|
+
"@type": "string",
|
|
305
|
+
"@required": "true",
|
|
306
|
+
"description": "FTP server hostname"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"@name": "Username",
|
|
310
|
+
"@type": "string",
|
|
311
|
+
"@required": "true"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"@name": "Password",
|
|
315
|
+
"@type": "string",
|
|
316
|
+
"@required": "true"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"@name": "RemoteFile",
|
|
320
|
+
"@type": "string",
|
|
321
|
+
"@required": "true",
|
|
322
|
+
"description": "Remote file path"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"@name": "LocalPath",
|
|
326
|
+
"@type": "string",
|
|
327
|
+
"@required": "true",
|
|
328
|
+
"description": "Local path (relative to IMPEX)"
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
"status-codes": {
|
|
333
|
+
"status": [
|
|
334
|
+
{ "@code": "OK", "description": "Download successful" },
|
|
335
|
+
{ "@code": "ERROR", "description": "Download failed" },
|
|
336
|
+
{ "@code": "CONNECT_FAILED", "description": "Connection failed" },
|
|
337
|
+
{ "@code": "DOWNLOAD_FAILED", "description": "File download failed" }
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: b2c-custom-objects
|
|
3
|
+
description: Store and query custom business data using CustomObjectMgr, OCAPI Data API, and Shopper Custom Objects API. Use this skill whenever the user needs to create, read, update, or search custom object instances, build processing queues with status fields, choose between site-scoped and organization-scoped storage, or query custom objects with bool/term filters. Also use when persisting non-standard data -- even if they just say 'store config per site' or 'query my custom data'.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# B2C Custom Objects
|
|
7
|
+
|
|
8
|
+
Custom objects store business data that doesn't fit into standard system objects. They support both site-scoped and organization-scoped (global) data, with full CRUD operations via Script API and OCAPI.
|
|
9
|
+
|
|
10
|
+
## When to Use Custom Objects
|
|
11
|
+
|
|
12
|
+
| Use Case | Example |
|
|
13
|
+
|----------|---------|
|
|
14
|
+
| Business configuration | Store configuration per site or globally |
|
|
15
|
+
| Integration data | Cache external system responses |
|
|
16
|
+
| Custom entities | Loyalty tiers, custom promotions, vendor data |
|
|
17
|
+
| Temporary processing | Job processing queues, import staging |
|
|
18
|
+
|
|
19
|
+
## Custom Object Types
|
|
20
|
+
|
|
21
|
+
Custom objects are defined in Business Manager under **Administration > Site Development > Custom Object Types**. Each type has:
|
|
22
|
+
|
|
23
|
+
- **ID**: Unique identifier (e.g., `CustomConfig`)
|
|
24
|
+
- **Key Attribute**: Primary key field for lookups
|
|
25
|
+
- **Attributes**: Custom attributes for data storage
|
|
26
|
+
- **Scope**: Site-scoped or organization-scoped (global)
|
|
27
|
+
|
|
28
|
+
## Script API (CustomObjectMgr)
|
|
29
|
+
|
|
30
|
+
### Getting Custom Objects
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
34
|
+
|
|
35
|
+
// Get a single custom object by type and key
|
|
36
|
+
var config = CustomObjectMgr.getCustomObject('CustomConfig', 'myConfigKey');
|
|
37
|
+
|
|
38
|
+
if (config) {
|
|
39
|
+
var value = config.custom.configValue;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Creating Custom Objects
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
47
|
+
var Transaction = require('dw/system/Transaction');
|
|
48
|
+
|
|
49
|
+
Transaction.wrap(function() {
|
|
50
|
+
// Create new custom object (type, keyValue)
|
|
51
|
+
var obj = CustomObjectMgr.createCustomObject('CustomConfig', 'newKey');
|
|
52
|
+
obj.custom.configValue = 'myValue';
|
|
53
|
+
obj.custom.isActive = true;
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Querying Custom Objects
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
61
|
+
|
|
62
|
+
// Query with attribute filter
|
|
63
|
+
var objects = CustomObjectMgr.queryCustomObjects(
|
|
64
|
+
'CustomConfig', // Type
|
|
65
|
+
'custom.isActive = {0}', // Query (uses positional params)
|
|
66
|
+
'creationDate desc', // Sort order
|
|
67
|
+
true // Parameter value for {0}
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
while (objects.hasNext()) {
|
|
71
|
+
var obj = objects.next();
|
|
72
|
+
// Process object
|
|
73
|
+
}
|
|
74
|
+
objects.close();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Deleting Custom Objects
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
81
|
+
var Transaction = require('dw/system/Transaction');
|
|
82
|
+
|
|
83
|
+
Transaction.wrap(function() {
|
|
84
|
+
var obj = CustomObjectMgr.getCustomObject('CustomConfig', 'keyToDelete');
|
|
85
|
+
if (obj) {
|
|
86
|
+
CustomObjectMgr.remove(obj);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Getting All Objects of a Type
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
95
|
+
|
|
96
|
+
// Get all objects of a type
|
|
97
|
+
var allConfigs = CustomObjectMgr.getAllCustomObjects('CustomConfig');
|
|
98
|
+
|
|
99
|
+
while (allConfigs.hasNext()) {
|
|
100
|
+
var config = allConfigs.next();
|
|
101
|
+
// Process
|
|
102
|
+
}
|
|
103
|
+
allConfigs.close();
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## CustomObjectMgr API Reference
|
|
107
|
+
|
|
108
|
+
| Method | Description |
|
|
109
|
+
|--------|-------------|
|
|
110
|
+
| `getCustomObject(type, keyValue)` | Get single object by type and key |
|
|
111
|
+
| `createCustomObject(type, keyValue)` | Create new object (within transaction) |
|
|
112
|
+
| `remove(object)` | Delete object (within transaction) |
|
|
113
|
+
| `queryCustomObjects(type, query, sortString, ...args)` | Query with filters |
|
|
114
|
+
| `getAllCustomObjects(type)` | Get all objects of a type |
|
|
115
|
+
| `describe(type)` | Get metadata about the custom object type |
|
|
116
|
+
|
|
117
|
+
## OCAPI Data API
|
|
118
|
+
|
|
119
|
+
### Get Custom Object
|
|
120
|
+
|
|
121
|
+
```http
|
|
122
|
+
GET /s/-/dw/data/v25_6/custom_objects/{object_type}/{key}
|
|
123
|
+
Authorization: Bearer {token}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Note:** Use `/s/{site_id}/dw/data/v25_6/custom_objects/...` for site-scoped objects, or `/s/-/dw/data/v25_6/custom_objects/...` for organization-scoped (global) objects.
|
|
127
|
+
|
|
128
|
+
### Create Custom Object
|
|
129
|
+
|
|
130
|
+
```http
|
|
131
|
+
PUT /s/-/dw/data/v25_6/custom_objects/{object_type}/{key}
|
|
132
|
+
Authorization: Bearer {token}
|
|
133
|
+
Content-Type: application/json
|
|
134
|
+
|
|
135
|
+
{
|
|
136
|
+
"key_property": "myKey",
|
|
137
|
+
"c_configValue": "myValue",
|
|
138
|
+
"c_isActive": true
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Update Custom Object
|
|
143
|
+
|
|
144
|
+
```http
|
|
145
|
+
PATCH /s/-/dw/data/v25_6/custom_objects/{object_type}/{key}
|
|
146
|
+
Authorization: Bearer {token}
|
|
147
|
+
Content-Type: application/json
|
|
148
|
+
|
|
149
|
+
{
|
|
150
|
+
"c_configValue": "updatedValue"
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Delete Custom Object
|
|
155
|
+
|
|
156
|
+
```http
|
|
157
|
+
DELETE /s/-/dw/data/v25_6/custom_objects/{object_type}/{key}
|
|
158
|
+
Authorization: Bearer {token}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Search Custom Objects
|
|
162
|
+
|
|
163
|
+
```http
|
|
164
|
+
POST /s/-/dw/data/v25_6/custom_objects_search/{object_type}
|
|
165
|
+
Authorization: Bearer {token}
|
|
166
|
+
Content-Type: application/json
|
|
167
|
+
|
|
168
|
+
{
|
|
169
|
+
"query": {
|
|
170
|
+
"bool_query": {
|
|
171
|
+
"must": [
|
|
172
|
+
{ "term_query": { "fields": ["c_isActive"], "operator": "is", "values": [true] } }
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"select": "(**)",
|
|
177
|
+
"sorts": [{ "field": "creation_date", "sort_order": "desc" }],
|
|
178
|
+
"start": 0,
|
|
179
|
+
"count": 25
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Search Query Types
|
|
184
|
+
|
|
185
|
+
| Query Type | Description | Example |
|
|
186
|
+
|------------|-------------|---------|
|
|
187
|
+
| `term_query` | Exact match / comparison | `{"fields": ["c_status"], "operator": "is", "values": ["active"]}` |
|
|
188
|
+
| `text_query` | Full-text search | `{"fields": ["c_name"], "search_phrase": "test"}` |
|
|
189
|
+
| `filtered_query` | Query plus a filter — use with `range_filter` for ranges | `{"query": {"match_all_query": {}}, "filter": {"range_filter":{"field": "c_count", "from": 1, "to": 10}}}` |
|
|
190
|
+
| `bool_query` | Combine queries | `{"must": [...], "should": [...], "must_not": [...]}` |
|
|
191
|
+
| `match_all_query` | Match all records | `{}` |
|
|
192
|
+
|
|
193
|
+
## Shopper Custom Objects API (SCAPI)
|
|
194
|
+
|
|
195
|
+
For read-only access from storefronts, use the Shopper Custom Objects API. This requires specific OAuth scopes.
|
|
196
|
+
|
|
197
|
+
### Get Custom Object (Shopper)
|
|
198
|
+
|
|
199
|
+
```http
|
|
200
|
+
GET https://{shortCode}.api.commercecloud.salesforce.com/custom-object/shopper-custom-objects/v1/organizations/{organizationId}/custom-objects/{objectType}/{key}?siteId={siteId}
|
|
201
|
+
Authorization: Bearer {shopper_token}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Required Scopes
|
|
205
|
+
|
|
206
|
+
For the Shopper Custom Objects API, configure these scopes in your SLAS client:
|
|
207
|
+
|
|
208
|
+
- `sfcc.shopper-custom-objects` - Global read access to all custom object types
|
|
209
|
+
- `sfcc.shopper-custom-objects.{objectType}` - Type-specific read access
|
|
210
|
+
|
|
211
|
+
**Note:** SLAS clients can have a maximum of 20 custom object scopes.
|
|
212
|
+
|
|
213
|
+
The custom object type must also be enabled for shopper access in Business Manager.
|
|
214
|
+
|
|
215
|
+
### Searchable System Fields
|
|
216
|
+
|
|
217
|
+
All custom objects have these system fields available for OCAPI search queries:
|
|
218
|
+
|
|
219
|
+
- `creation_date` - When the object was created (Date)
|
|
220
|
+
- `last_modified` - When the object was last modified (Date)
|
|
221
|
+
- `key_value_string` - String key value
|
|
222
|
+
- `key_value_integer` - Integer key value
|
|
223
|
+
- `site_id` - Site identifier (for site-scoped objects)
|
|
224
|
+
|
|
225
|
+
## Best Practices
|
|
226
|
+
|
|
227
|
+
### Do
|
|
228
|
+
|
|
229
|
+
- Use transactions for create/update/delete operations
|
|
230
|
+
- Close query iterators when done (`objects.close()`)
|
|
231
|
+
- Use meaningful key values for efficient lookups
|
|
232
|
+
- Index frequently queried attributes
|
|
233
|
+
- Use site-scoped objects for site-specific data
|
|
234
|
+
- Use organization-scoped objects for shared configuration
|
|
235
|
+
|
|
236
|
+
### Don't
|
|
237
|
+
|
|
238
|
+
- Store sensitive data without encryption
|
|
239
|
+
- Create excessive custom object types
|
|
240
|
+
- Use custom objects for high-volume transactional data
|
|
241
|
+
- Forget to handle null returns from `getCustomObject()`
|
|
242
|
+
- Leave query iterators open (causes resource leaks)
|
|
243
|
+
|
|
244
|
+
## Common Patterns
|
|
245
|
+
|
|
246
|
+
### Configuration Store
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
250
|
+
var Site = require('dw/system/Site');
|
|
251
|
+
|
|
252
|
+
function getConfig(key, defaultValue) {
|
|
253
|
+
var configKey = Site.current.ID + '_' + key;
|
|
254
|
+
var obj = CustomObjectMgr.getCustomObject('SiteConfig', configKey);
|
|
255
|
+
|
|
256
|
+
if (obj && obj.custom.value !== null) {
|
|
257
|
+
return JSON.parse(obj.custom.value);
|
|
258
|
+
}
|
|
259
|
+
return defaultValue;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function setConfig(key, value) {
|
|
263
|
+
var Transaction = require('dw/system/Transaction');
|
|
264
|
+
var configKey = Site.current.ID + '_' + key;
|
|
265
|
+
|
|
266
|
+
Transaction.wrap(function() {
|
|
267
|
+
var obj = CustomObjectMgr.getCustomObject('SiteConfig', configKey);
|
|
268
|
+
if (!obj) {
|
|
269
|
+
obj = CustomObjectMgr.createCustomObject('SiteConfig', configKey);
|
|
270
|
+
}
|
|
271
|
+
obj.custom.value = JSON.stringify(value);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Processing Queue
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
|
|
280
|
+
var Transaction = require('dw/system/Transaction');
|
|
281
|
+
|
|
282
|
+
// Add to queue
|
|
283
|
+
function enqueue(data) {
|
|
284
|
+
var key = 'job_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
|
|
285
|
+
Transaction.wrap(function() {
|
|
286
|
+
var obj = CustomObjectMgr.createCustomObject('JobQueue', key);
|
|
287
|
+
obj.custom.data = JSON.stringify(data);
|
|
288
|
+
obj.custom.status = 'pending';
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Process queue
|
|
293
|
+
function processQueue() {
|
|
294
|
+
var pending = CustomObjectMgr.queryCustomObjects(
|
|
295
|
+
'JobQueue',
|
|
296
|
+
'custom.status = {0}',
|
|
297
|
+
'creationDate asc',
|
|
298
|
+
'pending'
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
while (pending.hasNext()) {
|
|
302
|
+
var job = pending.next();
|
|
303
|
+
Transaction.wrap(function() {
|
|
304
|
+
job.custom.status = 'processing';
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
var data = JSON.parse(job.custom.data);
|
|
309
|
+
processJob(data);
|
|
310
|
+
|
|
311
|
+
Transaction.wrap(function() {
|
|
312
|
+
CustomObjectMgr.remove(job);
|
|
313
|
+
});
|
|
314
|
+
} catch (e) {
|
|
315
|
+
Transaction.wrap(function() {
|
|
316
|
+
job.custom.status = 'failed';
|
|
317
|
+
job.custom.error = e.message;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
pending.close();
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Detailed References
|
|
326
|
+
|
|
327
|
+
- [OCAPI Search Queries](references/OCAPI-SEARCH.md) - Full search query syntax and examples
|