This is page 8 of 43. Use http://codebase.md/taurgis/sfcc-dev-mcp?page={x} to view the full context. # Directory Structure ``` ├── .DS_Store ├── .github │ ├── dependabot.yml │ ├── instructions │ │ ├── mcp-node-tests.instructions.md │ │ └── mcp-yml-tests.instructions.md │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.yml │ │ ├── config.yml │ │ ├── documentation.yml │ │ ├── feature_request.yml │ │ └── question.yml │ ├── PULL_REQUEST_TEMPLATE │ │ ├── bug_fix.md │ │ ├── documentation.md │ │ └── new_tool.md │ ├── pull_request_template.md │ └── workflows │ ├── ci.yml │ ├── deploy-pages.yml │ ├── publish.yml │ └── update-docs.yml ├── .gitignore ├── .husky │ └── pre-commit ├── aegis.config.docs-only.json ├── aegis.config.json ├── aegis.config.with-dw.json ├── AGENTS.md ├── ai-instructions │ ├── claude-desktop │ │ └── claude_custom_instructions.md │ ├── cursor │ │ └── .cursor │ │ └── rules │ │ ├── debugging-workflows.mdc │ │ ├── hooks-development.mdc │ │ ├── isml-templates.mdc │ │ ├── job-framework.mdc │ │ ├── performance-optimization.mdc │ │ ├── scapi-endpoints.mdc │ │ ├── security-patterns.mdc │ │ ├── sfcc-development.mdc │ │ ├── sfra-controllers.mdc │ │ ├── sfra-models.mdc │ │ ├── system-objects.mdc │ │ └── testing-patterns.mdc │ └── github-copilot │ └── copilot-instructions.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── docs │ ├── best-practices │ │ ├── cartridge_creation.md │ │ ├── isml_templates.md │ │ ├── job_framework.md │ │ ├── localserviceregistry.md │ │ ├── ocapi_hooks.md │ │ ├── performance.md │ │ ├── scapi_custom_endpoint.md │ │ ├── scapi_hooks.md │ │ ├── security.md │ │ ├── sfra_client_side_js.md │ │ ├── sfra_controllers.md │ │ ├── sfra_models.md │ │ └── sfra_scss.md │ ├── dw_campaign │ │ ├── ABTest.md │ │ ├── ABTestMgr.md │ │ ├── ABTestSegment.md │ │ ├── AmountDiscount.md │ │ ├── ApproachingDiscount.md │ │ ├── BonusChoiceDiscount.md │ │ ├── BonusDiscount.md │ │ ├── Campaign.md │ │ ├── CampaignMgr.md │ │ ├── CampaignStatusCodes.md │ │ ├── Coupon.md │ │ ├── CouponMgr.md │ │ ├── CouponRedemption.md │ │ ├── CouponStatusCodes.md │ │ ├── Discount.md │ │ ├── DiscountPlan.md │ │ ├── FixedPriceDiscount.md │ │ ├── FixedPriceShippingDiscount.md │ │ ├── FreeDiscount.md │ │ ├── FreeShippingDiscount.md │ │ ├── PercentageDiscount.md │ │ ├── PercentageOptionDiscount.md │ │ ├── PriceBookPriceDiscount.md │ │ ├── Promotion.md │ │ ├── PromotionMgr.md │ │ ├── PromotionPlan.md │ │ ├── SlotContent.md │ │ ├── SourceCodeGroup.md │ │ ├── SourceCodeInfo.md │ │ ├── SourceCodeStatusCodes.md │ │ └── TotalFixedPriceDiscount.md │ ├── dw_catalog │ │ ├── Catalog.md │ │ ├── CatalogMgr.md │ │ ├── Category.md │ │ ├── CategoryAssignment.md │ │ ├── CategoryLink.md │ │ ├── PriceBook.md │ │ ├── PriceBookMgr.md │ │ ├── Product.md │ │ ├── ProductActiveData.md │ │ ├── ProductAttributeModel.md │ │ ├── ProductAvailabilityLevels.md │ │ ├── ProductAvailabilityModel.md │ │ ├── ProductInventoryList.md │ │ ├── ProductInventoryMgr.md │ │ ├── ProductInventoryRecord.md │ │ ├── ProductLink.md │ │ ├── ProductMgr.md │ │ ├── ProductOption.md │ │ ├── ProductOptionModel.md │ │ ├── ProductOptionValue.md │ │ ├── ProductPriceInfo.md │ │ ├── ProductPriceModel.md │ │ ├── ProductPriceTable.md │ │ ├── ProductSearchHit.md │ │ ├── ProductSearchModel.md │ │ ├── ProductSearchRefinementDefinition.md │ │ ├── ProductSearchRefinements.md │ │ ├── ProductSearchRefinementValue.md │ │ ├── ProductVariationAttribute.md │ │ ├── ProductVariationAttributeValue.md │ │ ├── ProductVariationModel.md │ │ ├── Recommendation.md │ │ ├── SearchModel.md │ │ ├── SearchRefinementDefinition.md │ │ ├── SearchRefinements.md │ │ ├── SearchRefinementValue.md │ │ ├── SortingOption.md │ │ ├── SortingRule.md │ │ ├── Store.md │ │ ├── StoreGroup.md │ │ ├── StoreInventoryFilter.md │ │ ├── StoreInventoryFilterValue.md │ │ ├── StoreMgr.md │ │ ├── Variant.md │ │ └── VariationGroup.md │ ├── dw_content │ │ ├── Content.md │ │ ├── ContentMgr.md │ │ ├── ContentSearchModel.md │ │ ├── ContentSearchRefinementDefinition.md │ │ ├── ContentSearchRefinements.md │ │ ├── ContentSearchRefinementValue.md │ │ ├── Folder.md │ │ ├── Library.md │ │ ├── MarkupText.md │ │ └── MediaFile.md │ ├── dw_crypto │ │ ├── CertificateRef.md │ │ ├── CertificateUtils.md │ │ ├── Cipher.md │ │ ├── Encoding.md │ │ ├── JWE.md │ │ ├── JWEHeader.md │ │ ├── JWS.md │ │ ├── JWSHeader.md │ │ ├── KeyRef.md │ │ ├── Mac.md │ │ ├── MessageDigest.md │ │ ├── SecureRandom.md │ │ ├── Signature.md │ │ ├── WeakCipher.md │ │ ├── WeakMac.md │ │ ├── WeakMessageDigest.md │ │ ├── WeakSignature.md │ │ └── X509Certificate.md │ ├── dw_customer │ │ ├── AddressBook.md │ │ ├── AgentUserMgr.md │ │ ├── AgentUserStatusCodes.md │ │ ├── AuthenticationStatus.md │ │ ├── Credentials.md │ │ ├── Customer.md │ │ ├── CustomerActiveData.md │ │ ├── CustomerAddress.md │ │ ├── CustomerCDPData.md │ │ ├── CustomerContextMgr.md │ │ ├── CustomerGroup.md │ │ ├── CustomerList.md │ │ ├── CustomerMgr.md │ │ ├── CustomerPasswordConstraints.md │ │ ├── CustomerPaymentInstrument.md │ │ ├── CustomerStatusCodes.md │ │ ├── EncryptedObject.md │ │ ├── ExternalProfile.md │ │ ├── OrderHistory.md │ │ ├── ProductList.md │ │ ├── ProductListItem.md │ │ ├── ProductListItemPurchase.md │ │ ├── ProductListMgr.md │ │ ├── ProductListRegistrant.md │ │ ├── Profile.md │ │ └── Wallet.md │ ├── dw_extensions.applepay │ │ ├── ApplePayHookResult.md │ │ └── ApplePayHooks.md │ ├── dw_extensions.facebook │ │ ├── FacebookFeedHooks.md │ │ └── FacebookProduct.md │ ├── dw_extensions.paymentrequest │ │ ├── PaymentRequestHookResult.md │ │ └── PaymentRequestHooks.md │ ├── dw_extensions.payments │ │ ├── SalesforceBancontactPaymentDetails.md │ │ ├── SalesforceCardPaymentDetails.md │ │ ├── SalesforceEpsPaymentDetails.md │ │ ├── SalesforceIdealPaymentDetails.md │ │ ├── SalesforceKlarnaPaymentDetails.md │ │ ├── SalesforcePaymentDetails.md │ │ ├── SalesforcePaymentIntent.md │ │ ├── SalesforcePaymentMethod.md │ │ ├── SalesforcePaymentRequest.md │ │ ├── SalesforcePaymentsHooks.md │ │ ├── SalesforcePaymentsMgr.md │ │ ├── SalesforcePaymentsSiteConfiguration.md │ │ ├── SalesforcePayPalOrder.md │ │ ├── SalesforcePayPalOrderAddress.md │ │ ├── SalesforcePayPalOrderPayer.md │ │ ├── SalesforcePayPalPaymentDetails.md │ │ ├── SalesforceSepaDebitPaymentDetails.md │ │ └── SalesforceVenmoPaymentDetails.md │ ├── dw_extensions.pinterest │ │ ├── PinterestAvailability.md │ │ ├── PinterestFeedHooks.md │ │ ├── PinterestOrder.md │ │ ├── PinterestOrderHooks.md │ │ └── PinterestProduct.md │ ├── dw_io │ │ ├── CSVStreamReader.md │ │ ├── CSVStreamWriter.md │ │ ├── File.md │ │ ├── FileReader.md │ │ ├── FileWriter.md │ │ ├── InputStream.md │ │ ├── OutputStream.md │ │ ├── PrintWriter.md │ │ ├── RandomAccessFileReader.md │ │ ├── Reader.md │ │ ├── StringWriter.md │ │ ├── Writer.md │ │ ├── XMLIndentingStreamWriter.md │ │ ├── XMLStreamConstants.md │ │ ├── XMLStreamReader.md │ │ └── XMLStreamWriter.md │ ├── dw_job │ │ ├── JobExecution.md │ │ └── JobStepExecution.md │ ├── dw_net │ │ ├── FTPClient.md │ │ ├── FTPFileInfo.md │ │ ├── HTTPClient.md │ │ ├── HTTPRequestPart.md │ │ ├── Mail.md │ │ ├── SFTPClient.md │ │ ├── SFTPFileInfo.md │ │ ├── WebDAVClient.md │ │ └── WebDAVFileInfo.md │ ├── dw_object │ │ ├── ActiveData.md │ │ ├── CustomAttributes.md │ │ ├── CustomObject.md │ │ ├── CustomObjectMgr.md │ │ ├── Extensible.md │ │ ├── ExtensibleObject.md │ │ ├── Note.md │ │ ├── ObjectAttributeDefinition.md │ │ ├── ObjectAttributeGroup.md │ │ ├── ObjectAttributeValueDefinition.md │ │ ├── ObjectTypeDefinition.md │ │ ├── PersistentObject.md │ │ ├── SimpleExtensible.md │ │ └── SystemObjectMgr.md │ ├── dw_order │ │ ├── AbstractItem.md │ │ ├── AbstractItemCtnr.md │ │ ├── Appeasement.md │ │ ├── AppeasementItem.md │ │ ├── Basket.md │ │ ├── BasketMgr.md │ │ ├── BonusDiscountLineItem.md │ │ ├── CouponLineItem.md │ │ ├── CreateAgentBasketLimitExceededException.md │ │ ├── CreateBasketFromOrderException.md │ │ ├── CreateCouponLineItemException.md │ │ ├── CreateOrderException.md │ │ ├── CreateTemporaryBasketLimitExceededException.md │ │ ├── GiftCertificate.md │ │ ├── GiftCertificateLineItem.md │ │ ├── GiftCertificateMgr.md │ │ ├── GiftCertificateStatusCodes.md │ │ ├── Invoice.md │ │ ├── InvoiceItem.md │ │ ├── LineItem.md │ │ ├── LineItemCtnr.md │ │ ├── Order.md │ │ ├── OrderAddress.md │ │ ├── OrderItem.md │ │ ├── OrderMgr.md │ │ ├── OrderPaymentInstrument.md │ │ ├── OrderProcessStatusCodes.md │ │ ├── PaymentCard.md │ │ ├── PaymentInstrument.md │ │ ├── PaymentMethod.md │ │ ├── PaymentMgr.md │ │ ├── PaymentProcessor.md │ │ ├── PaymentStatusCodes.md │ │ ├── PaymentTransaction.md │ │ ├── PriceAdjustment.md │ │ ├── PriceAdjustmentLimitTypes.md │ │ ├── ProductLineItem.md │ │ ├── ProductShippingCost.md │ │ ├── ProductShippingLineItem.md │ │ ├── ProductShippingModel.md │ │ ├── Return.md │ │ ├── ReturnCase.md │ │ ├── ReturnCaseItem.md │ │ ├── ReturnItem.md │ │ ├── Shipment.md │ │ ├── ShipmentShippingCost.md │ │ ├── ShipmentShippingModel.md │ │ ├── ShippingLineItem.md │ │ ├── ShippingLocation.md │ │ ├── ShippingMethod.md │ │ ├── ShippingMgr.md │ │ ├── ShippingOrder.md │ │ ├── ShippingOrderItem.md │ │ ├── SumItem.md │ │ ├── TaxGroup.md │ │ ├── TaxItem.md │ │ ├── TaxMgr.md │ │ ├── TrackingInfo.md │ │ └── TrackingRef.md │ ├── dw_order.hooks │ │ ├── CalculateHooks.md │ │ ├── OrderHooks.md │ │ ├── PaymentHooks.md │ │ ├── ReturnHooks.md │ │ └── ShippingOrderHooks.md │ ├── dw_rpc │ │ ├── SOAPUtil.md │ │ ├── Stub.md │ │ └── WebReference.md │ ├── dw_suggest │ │ ├── BrandSuggestions.md │ │ ├── CategorySuggestions.md │ │ ├── ContentSuggestions.md │ │ ├── CustomSuggestions.md │ │ ├── ProductSuggestions.md │ │ ├── SearchPhraseSuggestions.md │ │ ├── SuggestedCategory.md │ │ ├── SuggestedContent.md │ │ ├── SuggestedPhrase.md │ │ ├── SuggestedProduct.md │ │ ├── SuggestedTerm.md │ │ ├── SuggestedTerms.md │ │ ├── Suggestions.md │ │ └── SuggestModel.md │ ├── dw_svc │ │ ├── FTPService.md │ │ ├── FTPServiceDefinition.md │ │ ├── HTTPFormService.md │ │ ├── HTTPFormServiceDefinition.md │ │ ├── HTTPService.md │ │ ├── HTTPServiceDefinition.md │ │ ├── LocalServiceRegistry.md │ │ ├── Result.md │ │ ├── Service.md │ │ ├── ServiceCallback.md │ │ ├── ServiceConfig.md │ │ ├── ServiceCredential.md │ │ ├── ServiceDefinition.md │ │ ├── ServiceProfile.md │ │ ├── ServiceRegistry.md │ │ ├── SOAPService.md │ │ └── SOAPServiceDefinition.md │ ├── dw_system │ │ ├── AgentUserStatusCodes.md │ │ ├── Cache.md │ │ ├── CacheMgr.md │ │ ├── HookMgr.md │ │ ├── InternalObject.md │ │ ├── JobProcessMonitor.md │ │ ├── Log.md │ │ ├── Logger.md │ │ ├── LogNDC.md │ │ ├── OrganizationPreferences.md │ │ ├── Pipeline.md │ │ ├── PipelineDictionary.md │ │ ├── RemoteInclude.md │ │ ├── Request.md │ │ ├── RequestHooks.md │ │ ├── Response.md │ │ ├── RESTErrorResponse.md │ │ ├── RESTResponseMgr.md │ │ ├── RESTSuccessResponse.md │ │ ├── SearchStatus.md │ │ ├── Session.md │ │ ├── Site.md │ │ ├── SitePreferences.md │ │ ├── Status.md │ │ ├── StatusItem.md │ │ ├── System.md │ │ └── Transaction.md │ ├── dw_util │ │ ├── ArrayList.md │ │ ├── Assert.md │ │ ├── BigInteger.md │ │ ├── Bytes.md │ │ ├── Calendar.md │ │ ├── Collection.md │ │ ├── Currency.md │ │ ├── DateUtils.md │ │ ├── Decimal.md │ │ ├── FilteringCollection.md │ │ ├── Geolocation.md │ │ ├── HashMap.md │ │ ├── HashSet.md │ │ ├── Iterator.md │ │ ├── LinkedHashMap.md │ │ ├── LinkedHashSet.md │ │ ├── List.md │ │ ├── Locale.md │ │ ├── Map.md │ │ ├── MapEntry.md │ │ ├── MappingKey.md │ │ ├── MappingMgr.md │ │ ├── PropertyComparator.md │ │ ├── SecureEncoder.md │ │ ├── SecureFilter.md │ │ ├── SeekableIterator.md │ │ ├── Set.md │ │ ├── SortedMap.md │ │ ├── SortedSet.md │ │ ├── StringUtils.md │ │ ├── Template.md │ │ └── UUIDUtils.md │ ├── dw_value │ │ ├── EnumValue.md │ │ ├── MimeEncodedText.md │ │ ├── Money.md │ │ └── Quantity.md │ ├── dw_web │ │ ├── ClickStream.md │ │ ├── ClickStreamEntry.md │ │ ├── Cookie.md │ │ ├── Cookies.md │ │ ├── CSRFProtection.md │ │ ├── Form.md │ │ ├── FormAction.md │ │ ├── FormElement.md │ │ ├── FormElementValidationResult.md │ │ ├── FormField.md │ │ ├── FormFieldOption.md │ │ ├── FormFieldOptions.md │ │ ├── FormGroup.md │ │ ├── FormList.md │ │ ├── FormListItem.md │ │ ├── Forms.md │ │ ├── HttpParameter.md │ │ ├── HttpParameterMap.md │ │ ├── LoopIterator.md │ │ ├── PageMetaData.md │ │ ├── PageMetaTag.md │ │ ├── PagingModel.md │ │ ├── Resource.md │ │ ├── URL.md │ │ ├── URLAction.md │ │ ├── URLParameter.md │ │ ├── URLRedirect.md │ │ ├── URLRedirectMgr.md │ │ └── URLUtils.md │ ├── sfra │ │ ├── account.md │ │ ├── address.md │ │ ├── billing.md │ │ ├── cart.md │ │ ├── categories.md │ │ ├── content.md │ │ ├── locale.md │ │ ├── order.md │ │ ├── payment.md │ │ ├── price-default.md │ │ ├── price-range.md │ │ ├── price-tiered.md │ │ ├── product-bundle.md │ │ ├── product-full.md │ │ ├── product-line-items.md │ │ ├── product-search.md │ │ ├── product-tile.md │ │ ├── querystring.md │ │ ├── render.md │ │ ├── request.md │ │ ├── response.md │ │ ├── server.md │ │ ├── shipping.md │ │ ├── store.md │ │ ├── stores.md │ │ └── totals.md │ └── TopLevel │ ├── APIException.md │ ├── arguments.md │ ├── Array.md │ ├── ArrayBuffer.md │ ├── BigInt.md │ ├── Boolean.md │ ├── ConversionError.md │ ├── DataView.md │ ├── Date.md │ ├── Error.md │ ├── ES6Iterator.md │ ├── EvalError.md │ ├── Fault.md │ ├── Float32Array.md │ ├── Float64Array.md │ ├── Function.md │ ├── Generator.md │ ├── global.md │ ├── Int16Array.md │ ├── Int32Array.md │ ├── Int8Array.md │ ├── InternalError.md │ ├── IOError.md │ ├── Iterable.md │ ├── Iterator.md │ ├── JSON.md │ ├── Map.md │ ├── Math.md │ ├── Module.md │ ├── Namespace.md │ ├── Number.md │ ├── Object.md │ ├── QName.md │ ├── RangeError.md │ ├── ReferenceError.md │ ├── RegExp.md │ ├── Set.md │ ├── StopIteration.md │ ├── String.md │ ├── Symbol.md │ ├── SyntaxError.md │ ├── SystemError.md │ ├── TypeError.md │ ├── Uint16Array.md │ ├── Uint32Array.md │ ├── Uint8Array.md │ ├── Uint8ClampedArray.md │ ├── URIError.md │ ├── WeakMap.md │ ├── WeakSet.md │ ├── XML.md │ ├── XMLList.md │ └── XMLStreamError.md ├── docs-site │ ├── .gitignore │ ├── App.tsx │ ├── components │ │ ├── Badge.tsx │ │ ├── BreadcrumbSchema.tsx │ │ ├── CodeBlock.tsx │ │ ├── Collapsible.tsx │ │ ├── ConfigBuilder.tsx │ │ ├── ConfigHero.tsx │ │ ├── ConfigModeTabs.tsx │ │ ├── icons.tsx │ │ ├── Layout.tsx │ │ ├── LightCodeContainer.tsx │ │ ├── NewcomerCTA.tsx │ │ ├── NextStepsStrip.tsx │ │ ├── OnThisPage.tsx │ │ ├── Search.tsx │ │ ├── SEO.tsx │ │ ├── Sidebar.tsx │ │ ├── StructuredData.tsx │ │ ├── ToolCard.tsx │ │ ├── ToolFilters.tsx │ │ ├── Typography.tsx │ │ └── VersionBadge.tsx │ ├── constants.tsx │ ├── index.html │ ├── main.tsx │ ├── metadata.json │ ├── package-lock.json │ ├── package.json │ ├── pages │ │ ├── AIInterfacesPage.tsx │ │ ├── ConfigurationPage.tsx │ │ ├── DevelopmentPage.tsx │ │ ├── ExamplesPage.tsx │ │ ├── FeaturesPage.tsx │ │ ├── HomePage.tsx │ │ ├── SecurityPage.tsx │ │ ├── ToolsPage.tsx │ │ └── TroubleshootingPage.tsx │ ├── postcss.config.js │ ├── public │ │ ├── .well-known │ │ │ └── security.txt │ │ ├── 404.html │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── explain-product-pricing-methods-no-mcp.png │ │ ├── explain-product-pricing-methods.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── llms.txt │ │ ├── robots.txt │ │ ├── site.webmanifest │ │ └── sitemap.xml │ ├── README.md │ ├── scripts │ │ ├── generate-search-index.js │ │ ├── generate-sitemap.js │ │ └── search-dev.js │ ├── src │ │ └── styles │ │ ├── input.css │ │ └── prism-theme.css │ ├── tailwind.config.js │ ├── tsconfig.json │ ├── types.ts │ ├── utils │ │ ├── search.ts │ │ └── toolsData.ts │ └── vite.config.ts ├── eslint.config.js ├── jest.config.js ├── LICENSE ├── package-lock.json ├── package.json ├── README.md ├── scripts │ └── convert-docs.js ├── SECURITY.md ├── server.json ├── src │ ├── clients │ │ ├── base │ │ │ ├── http-client.ts │ │ │ ├── oauth-token.ts │ │ │ └── ocapi-auth-client.ts │ │ ├── best-practices-client.ts │ │ ├── cartridge-generation-client.ts │ │ ├── docs │ │ │ ├── class-content-parser.ts │ │ │ ├── class-name-resolver.ts │ │ │ ├── documentation-scanner.ts │ │ │ ├── index.ts │ │ │ └── referenced-types-extractor.ts │ │ ├── docs-client.ts │ │ ├── log-client.ts │ │ ├── logs │ │ │ ├── index.ts │ │ │ ├── log-analyzer.ts │ │ │ ├── log-client.ts │ │ │ ├── log-constants.ts │ │ │ ├── log-file-discovery.ts │ │ │ ├── log-file-reader.ts │ │ │ ├── log-formatter.ts │ │ │ ├── log-processor.ts │ │ │ ├── log-types.ts │ │ │ └── webdav-client-manager.ts │ │ ├── ocapi │ │ │ ├── code-versions-client.ts │ │ │ ├── site-preferences-client.ts │ │ │ └── system-objects-client.ts │ │ ├── ocapi-client.ts │ │ └── sfra-client.ts │ ├── config │ │ ├── configuration-factory.ts │ │ └── dw-json-loader.ts │ ├── core │ │ ├── handlers │ │ │ ├── abstract-log-tool-handler.ts │ │ │ ├── base-handler.ts │ │ │ ├── best-practices-handler.ts │ │ │ ├── cartridge-handler.ts │ │ │ ├── client-factory.ts │ │ │ ├── code-version-handler.ts │ │ │ ├── docs-handler.ts │ │ │ ├── job-log-handler.ts │ │ │ ├── job-log-tool-config.ts │ │ │ ├── log-handler.ts │ │ │ ├── log-tool-config.ts │ │ │ ├── sfra-handler.ts │ │ │ ├── system-object-handler.ts │ │ │ └── validation-helpers.ts │ │ ├── server.ts │ │ └── tool-definitions.ts │ ├── index.ts │ ├── main.ts │ ├── services │ │ ├── file-system-service.ts │ │ ├── index.ts │ │ └── path-service.ts │ ├── tool-configs │ │ ├── best-practices-tool-config.ts │ │ ├── cartridge-tool-config.ts │ │ ├── code-version-tool-config.ts │ │ ├── docs-tool-config.ts │ │ ├── job-log-tool-config.ts │ │ ├── log-tool-config.ts │ │ ├── sfra-tool-config.ts │ │ └── system-object-tool-config.ts │ ├── types │ │ └── types.ts │ └── utils │ ├── cache.ts │ ├── job-log-tool-config.ts │ ├── job-log-utils.ts │ ├── log-cache.ts │ ├── log-tool-config.ts │ ├── log-tool-constants.ts │ ├── log-tool-utils.ts │ ├── logger.ts │ ├── ocapi-url-builder.ts │ ├── path-resolver.ts │ ├── query-builder.ts │ ├── utils.ts │ └── validator.ts ├── tests │ ├── __mocks__ │ │ ├── docs-client.ts │ │ ├── src │ │ │ └── clients │ │ │ └── base │ │ │ └── http-client.js │ │ └── webdav.js │ ├── base-handler.test.ts │ ├── base-http-client.test.ts │ ├── best-practices-handler.test.ts │ ├── cache.test.ts │ ├── cartridge-handler.test.ts │ ├── class-content-parser.test.ts │ ├── class-name-resolver.test.ts │ ├── client-factory.test.ts │ ├── code-version-handler.test.ts │ ├── code-versions-client.test.ts │ ├── config.test.ts │ ├── configuration-factory.test.ts │ ├── docs-handler.test.ts │ ├── documentation-scanner.test.ts │ ├── file-system-service.test.ts │ ├── job-log-handler.test.ts │ ├── job-log-utils.test.ts │ ├── log-client.test.ts │ ├── log-handler.test.ts │ ├── log-processor.test.ts │ ├── logger.test.ts │ ├── mcp │ │ ├── AGENTS.md │ │ ├── node │ │ │ ├── activate-code-version-advanced.full-mode.programmatic.test.js │ │ │ ├── code-versions.full-mode.programmatic.test.js │ │ │ ├── generate-cartridge-structure.docs-only.programmatic.test.js │ │ │ ├── get-available-best-practice-guides.docs-only.programmatic.test.js │ │ │ ├── get-available-sfra-documents.programmatic.test.js │ │ │ ├── get-best-practice-guide.docs-only.programmatic.test.js │ │ │ ├── get-hook-reference.docs-only.programmatic.test.js │ │ │ ├── get-job-execution-summary.full-mode.programmatic.test.js │ │ │ ├── get-job-log-entries.full-mode.programmatic.test.js │ │ │ ├── get-latest-debug.full-mode.programmatic.test.js │ │ │ ├── get-latest-error.full-mode.programmatic.test.js │ │ │ ├── get-latest-info.full-mode.programmatic.test.js │ │ │ ├── get-latest-job-log-files.full-mode.programmatic.test.js │ │ │ ├── get-latest-warn.full-mode.programmatic.test.js │ │ │ ├── get-log-file-contents.full-mode.programmatic.test.js │ │ │ ├── get-sfcc-class-documentation.docs-only.programmatic.test.js │ │ │ ├── get-sfcc-class-info.docs-only.programmatic.test.js │ │ │ ├── get-sfra-categories.docs-only.programmatic.test.js │ │ │ ├── get-sfra-document.programmatic.test.js │ │ │ ├── get-sfra-documents-by-category.docs-only.programmatic.test.js │ │ │ ├── get-system-object-definition.full-mode.programmatic.test.js │ │ │ ├── get-system-object-definitions.docs-only.programmatic.test.js │ │ │ ├── get-system-object-definitions.full-mode.programmatic.test.js │ │ │ ├── list-log-files.full-mode.programmatic.test.js │ │ │ ├── list-sfcc-classes.docs-only.programmatic.test.js │ │ │ ├── search-best-practices.docs-only.programmatic.test.js │ │ │ ├── search-custom-object-attribute-definitions.full-mode.programmatic.test.js │ │ │ ├── search-job-logs-by-name.full-mode.programmatic.test.js │ │ │ ├── search-job-logs.full-mode.programmatic.test.js │ │ │ ├── search-logs.full-mode.programmatic.test.js │ │ │ ├── search-sfcc-classes.docs-only.programmatic.test.js │ │ │ ├── search-sfcc-methods.docs-only.programmatic.test.js │ │ │ ├── search-sfra-documentation.docs-only.programmatic.test.js │ │ │ ├── search-site-preferences.full-mode.programmatic.test.js │ │ │ ├── search-system-object-attribute-definitions.full-mode.programmatic.test.js │ │ │ ├── search-system-object-attribute-groups.full-mode.programmatic.test.js │ │ │ ├── summarize-logs.full-mode.programmatic.test.js │ │ │ ├── tools.docs-only.programmatic.test.js │ │ │ └── tools.full-mode.programmatic.test.js │ │ ├── README.md │ │ ├── test-fixtures │ │ │ └── dw.json │ │ └── yaml │ │ ├── activate-code-version.docs-only.test.mcp.yml │ │ ├── activate-code-version.full-mode.test.mcp.yml │ │ ├── get_latest_error.test.mcp.yml │ │ ├── get-available-best-practice-guides.docs-only.test.mcp.yml │ │ ├── get-available-best-practice-guides.full-mode.test.mcp.yml │ │ ├── get-available-sfra-documents.docs-only.test.mcp.yml │ │ ├── get-available-sfra-documents.full-mode.test.mcp.yml │ │ ├── get-best-practice-guide.docs-only.test.mcp.yml │ │ ├── get-best-practice-guide.full-mode.test.mcp.yml │ │ ├── get-code-versions.docs-only.test.mcp.yml │ │ ├── get-code-versions.full-mode.test.mcp.yml │ │ ├── get-hook-reference.docs-only.test.mcp.yml │ │ ├── get-hook-reference.full-mode.test.mcp.yml │ │ ├── get-job-execution-summary.full-mode.test.mcp.yml │ │ ├── get-job-log-entries.full-mode.test.mcp.yml │ │ ├── get-latest-debug.full-mode.test.mcp.yml │ │ ├── get-latest-error.full-mode.test.mcp.yml │ │ ├── get-latest-info.full-mode.test.mcp.yml │ │ ├── get-latest-job-log-files.full-mode.test.mcp.yml │ │ ├── get-latest-warn.full-mode.test.mcp.yml │ │ ├── get-log-file-contents.full-mode.test.mcp.yml │ │ ├── get-sfcc-class-documentation.docs-only.test.mcp.yml │ │ ├── get-sfcc-class-documentation.full-mode.test.mcp.yml │ │ ├── get-sfcc-class-info.docs-only.test.mcp.yml │ │ ├── get-sfcc-class-info.full-mode.test.mcp.yml │ │ ├── get-sfra-categories.docs-only.test.mcp.yml │ │ ├── get-sfra-categories.full-mode.test.mcp.yml │ │ ├── get-sfra-document.docs-only.test.mcp.yml │ │ ├── get-sfra-document.full-mode.test.mcp.yml │ │ ├── get-sfra-documents-by-category.docs-only.test.mcp.yml │ │ ├── get-sfra-documents-by-category.full-mode.test.mcp.yml │ │ ├── get-system-object-definition.docs-only.test.mcp.yml │ │ ├── get-system-object-definition.full-mode.test.mcp.yml │ │ ├── get-system-object-definitions.docs-only.test.mcp.yml │ │ ├── get-system-object-definitions.full-mode.test.mcp.yml │ │ ├── list-log-files.full-mode.test.mcp.yml │ │ ├── list-sfcc-classes.docs-only.test.mcp.yml │ │ ├── list-sfcc-classes.full-mode.test.mcp.yml │ │ ├── search-best-practices.docs-only.test.mcp.yml │ │ ├── search-best-practices.full-mode.test.mcp.yml │ │ ├── search-custom-object-attribute-definitions.docs-only.test.mcp.yml │ │ ├── search-custom-object-attribute-definitions.test.mcp.yml │ │ ├── search-job-logs-by-name.full-mode.test.mcp.yml │ │ ├── search-job-logs.full-mode.test.mcp.yml │ │ ├── search-logs.full-mode.test.mcp.yml │ │ ├── search-sfcc-classes.docs-only.test.mcp.yml │ │ ├── search-sfcc-classes.full-mode.test.mcp.yml │ │ ├── search-sfcc-methods.docs-only.test.mcp.yml │ │ ├── search-sfcc-methods.full-mode.test.mcp.yml │ │ ├── search-sfra-documentation.docs-only.test.mcp.yml │ │ ├── search-sfra-documentation.full-mode.test.mcp.yml │ │ ├── search-site-preferences.docs-only.test.mcp.yml │ │ ├── search-site-preferences.full-mode.test.mcp.yml │ │ ├── search-system-object-attribute-definitions.docs-only.test.mcp.yml │ │ ├── search-system-object-attribute-definitions.full-mode.test.mcp.yml │ │ ├── search-system-object-attribute-groups.docs-only.test.mcp.yml │ │ ├── search-system-object-attribute-groups.full-mode.test.mcp.yml │ │ ├── summarize-logs.full-mode.test.mcp.yml │ │ ├── tools.docs-only.test.mcp.yml │ │ └── tools.full-mode.test.mcp.yml │ ├── oauth-token.test.ts │ ├── ocapi-auth-client.test.ts │ ├── ocapi-client.test.ts │ ├── path-service.test.ts │ ├── query-builder.test.ts │ ├── referenced-types-extractor.test.ts │ ├── servers │ │ ├── sfcc-mock-server │ │ │ ├── mock-data │ │ │ │ └── ocapi │ │ │ │ ├── code-versions.json │ │ │ │ ├── custom-object-attributes-customapi.json │ │ │ │ ├── custom-object-attributes-globalsettings.json │ │ │ │ ├── custom-object-attributes-versionhistory.json │ │ │ │ ├── site-preferences-ccv.json │ │ │ │ ├── site-preferences-fastforward.json │ │ │ │ ├── site-preferences-sfra.json │ │ │ │ ├── site-preferences-storefront.json │ │ │ │ ├── site-preferences-system.json │ │ │ │ ├── system-object-attribute-groups-campaign.json │ │ │ │ ├── system-object-attribute-groups-category.json │ │ │ │ ├── system-object-attribute-groups-order.json │ │ │ │ ├── system-object-attribute-groups-product.json │ │ │ │ ├── system-object-attribute-groups-sitepreferences.json │ │ │ │ ├── system-object-attributes-customeraddress.json │ │ │ │ ├── system-object-attributes-product-expanded.json │ │ │ │ ├── system-object-attributes-product.json │ │ │ │ ├── system-object-definition-category.json │ │ │ │ ├── system-object-definition-customer.json │ │ │ │ ├── system-object-definition-customeraddress.json │ │ │ │ ├── system-object-definition-order.json │ │ │ │ ├── system-object-definition-product.json │ │ │ │ ├── system-object-definitions-old.json │ │ │ │ └── system-object-definitions.json │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── README.md │ │ │ ├── scripts │ │ │ │ └── setup-logs.js │ │ │ ├── server.js │ │ │ └── src │ │ │ ├── app.js │ │ │ ├── config │ │ │ │ └── server-config.js │ │ │ ├── middleware │ │ │ │ ├── auth.js │ │ │ │ ├── cors.js │ │ │ │ └── logging.js │ │ │ ├── routes │ │ │ │ ├── ocapi │ │ │ │ │ ├── code-versions-handler.js │ │ │ │ │ ├── oauth-handler.js │ │ │ │ │ ├── ocapi-error-utils.js │ │ │ │ │ ├── ocapi-utils.js │ │ │ │ │ ├── site-preferences-handler.js │ │ │ │ │ └── system-objects-handler.js │ │ │ │ ├── ocapi.js │ │ │ │ └── webdav.js │ │ │ └── utils │ │ │ ├── mock-data-loader.js │ │ │ └── webdav-xml.js │ │ └── sfcc-mock-server-manager.ts │ ├── sfcc-mock-server.test.ts │ ├── site-preferences-client.test.ts │ ├── system-objects-client.test.ts │ ├── utils.test.ts │ ├── validation-helpers.test.ts │ └── validator.test.ts ├── tsconfig.json └── tsconfig.test.json ``` # Files -------------------------------------------------------------------------------- /src/tool-configs/log-tool-config.ts: -------------------------------------------------------------------------------- ```typescript import { GenericToolSpec, ToolExecutionContext } from '../core/handlers/base-handler.js'; import { ToolArguments } from '../core/handlers/base-handler.js'; import { LogToolValidators, LogMessageFormatter } from '../utils/log-tool-utils.js'; import { ValidationHelpers, CommonValidations } from '../core/handlers/validation-helpers.js'; import { LogToolName, getLimit } from '../utils/log-tool-constants.js'; import { SFCCLogClient } from '../clients/log-client.js'; /** * Configuration for standard log tools * Maps each tool to its validation, execution, and messaging logic */ export const LOG_TOOL_CONFIG: Record<LogToolName, GenericToolSpec<ToolArguments, any>> = { get_latest_error: { defaults: (args: ToolArguments) => ({ limit: getLimit(args.limit as number, 'latest'), }), validate: (args: ToolArguments) => LogToolValidators.validateLimit(args.limit as number, 'get_latest_error'), exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.getLatestLogs('error', args.limit as number, args.date as string); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatLatestLogs('error', args.limit as number, args.date as string), }, get_latest_warn: { defaults: (args: ToolArguments) => ({ limit: getLimit(args.limit as number, 'latest'), }), validate: (args: ToolArguments) => LogToolValidators.validateLimit(args.limit as number, 'get_latest_warn'), exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.getLatestLogs('warn', args.limit as number, args.date as string); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatLatestLogs('warn', args.limit as number, args.date as string), }, get_latest_info: { defaults: (args: ToolArguments) => ({ limit: getLimit(args.limit as number, 'latest'), }), validate: (args: ToolArguments) => LogToolValidators.validateLimit(args.limit as number, 'get_latest_info'), exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.getLatestLogs('info', args.limit as number, args.date as string); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatLatestLogs('info', args.limit as number, args.date as string), }, get_latest_debug: { defaults: (args: ToolArguments) => ({ limit: getLimit(args.limit as number, 'latest'), }), validate: (args: ToolArguments) => LogToolValidators.validateLimit(args.limit as number, 'get_latest_debug'), exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.getLatestLogs('debug', args.limit as number, args.date as string); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatLatestLogs('debug', args.limit as number, args.date as string), }, summarize_logs: { exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.summarizeLogs(args.date as string); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatSummarizeLogs(args.date as string), }, search_logs: { defaults: (args: ToolArguments) => ({ limit: getLimit(args.limit as number, 'search'), }), validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('pattern'), toolName); LogToolValidators.validateLimit(args.limit as number, toolName); if (args.logLevel) { LogToolValidators.validateLogLevel(args.logLevel as string, toolName); } }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.searchLogs( args.pattern as string, args.logLevel as any, args.limit as number, args.date as string, ); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatSearchLogs( args.pattern as string, args.logLevel as string, args.limit as number, args.date as string, ), }, list_log_files: { exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.listLogFiles(); }, logMessage: () => LogMessageFormatter.formatListLogFiles(), }, get_log_file_contents: { validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('filename'), toolName); LogToolValidators.validateFilename(args.filename as string, toolName); LogToolValidators.validateMaxBytes(args.maxBytes as number, toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.logClient as SFCCLogClient; return client.getLogFileContents( args.filename as string, args.maxBytes as number, args.tailOnly as boolean, ); }, logMessage: (args: ToolArguments) => LogMessageFormatter.formatGetLogFileContents( args.filename as string, args.maxBytes as number, args.tailOnly as boolean, ), }, }; ``` -------------------------------------------------------------------------------- /tests/mcp/yaml/search-logs.full-mode.test.mcp.yml: -------------------------------------------------------------------------------- ```yaml --- description: "Test search_logs tool in full mode - Aegis framework validation" tests: # Core Aegis framework tests - basic functionality - it: "should search for patterns with matches and proper response structure" request: jsonrpc: "2.0" id: "search-basic" method: "tools/call" params: name: "search_logs" arguments: pattern: "INFO" limit: 2 expect: response: jsonrpc: "2.0" id: "search-basic" result: content: match:arrayElements: match:partial: type: "text" text: "match:regex:Found \\d+ matches for" isError: false stderr: "toBeEmpty" performance: maxResponseTime: "1500ms" - it: "should handle no matches gracefully" request: jsonrpc: "2.0" id: "search-no-matches" method: "tools/call" params: name: "search_logs" arguments: pattern: "nonexistentpattern123456789" expect: response: jsonrpc: "2.0" id: "search-no-matches" result: content: match:arrayElements: match:partial: type: "text" text: "match:regex:No matches found for.*nonexistentpattern123456789" isError: false stderr: "toBeEmpty" performance: maxResponseTime: "1000ms" # Error handling validation - it: "should reject empty pattern with proper error response" request: jsonrpc: "2.0" id: "search-empty-pattern" method: "tools/call" params: name: "search_logs" arguments: pattern: "" expect: response: jsonrpc: "2.0" id: "search-empty-pattern" result: content: match:arrayElements: match:partial: type: "text" text: "match:contains:pattern must be a non-empty string" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "800ms" - it: "should reject invalid log level with proper error response" request: jsonrpc: "2.0" id: "search-invalid-level" method: "tools/call" params: name: "search_logs" arguments: pattern: "INFO" logLevel: "invalid_level" expect: response: jsonrpc: "2.0" id: "search-invalid-level" result: content: match:arrayElements: match:partial: type: "text" text: "match:contains:Invalid log level" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "800ms" # Parameter validation tests - it: "should validate limit parameter bounds" request: jsonrpc: "2.0" id: "search-invalid-limit" method: "tools/call" params: name: "search_logs" arguments: pattern: "INFO" limit: 0 expect: response: jsonrpc: "2.0" id: "search-invalid-limit" result: content: match:arrayElements: match:partial: type: "text" text: "match:contains:Invalid limit" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "800ms" # Content structure validation - key patterns for Aegis testing - it: "should return properly structured log entries with SFCC patterns" request: jsonrpc: "2.0" id: "search-content-structure" method: "tools/call" params: name: "search_logs" arguments: pattern: "SystemJobThread" limit: 1 expect: response: jsonrpc: "2.0" id: "search-content-structure" result: content: match:arrayElements: match:partial: type: "text" text: "match:regex:(Found \\d+ matches|No matches found)" isError: false stderr: "toBeEmpty" performance: maxResponseTime: "1500ms" # Parameter combination test - ensures Aegis handles multiple params - it: "should handle combined parameters correctly" request: jsonrpc: "2.0" id: "search-combined-params" method: "tools/call" params: name: "search_logs" arguments: pattern: "Sites" logLevel: "info" limit: 3 expect: response: jsonrpc: "2.0" id: "search-combined-params" result: content: match:arrayElements: match:partial: type: "text" text: "match:type:string" isError: false stderr: "toBeEmpty" performance: maxResponseTime: "1500ms" # Performance validation - basic SLA testing - it: "should handle larger result sets within reasonable time" request: jsonrpc: "2.0" id: "search-performance" method: "tools/call" params: name: "search_logs" arguments: pattern: "INFO" limit: 20 expect: response: jsonrpc: "2.0" id: "search-performance" result: content: match:arrayElements: match:partial: type: "text" text: "match:type:string" isError: false stderr: "toBeEmpty" performance: maxResponseTime: "2000ms" ``` -------------------------------------------------------------------------------- /docs/dw_catalog/ProductVariationAttributeValue.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.catalog # Class ProductVariationAttributeValue ## Inheritance Hierarchy - Object - dw.catalog.ProductVariationAttributeValue ## Description Represents a product variation attribute ## Properties ### description **Type:** String (Read Only) The description of the product variation attribute value in the current locale. ### displayValue **Type:** String (Read Only) The display value for the product variation attribute value, which can be used in the user interface. ### ID **Type:** String (Read Only) The ID of the product variation attribute value. ### value **Type:** Object (Read Only) The value for the product variation attribute value. ## Constructor Summary ## Method Summary ### equals **Signature:** `equals(obj : Object) : boolean` Returns true if the specified object is equal to this object. ### getDescription **Signature:** `getDescription() : String` Returns the description of the product variation attribute value in the current locale. ### getDisplayValue **Signature:** `getDisplayValue() : String` Returns the display value for the product variation attribute value, which can be used in the user interface. ### getID **Signature:** `getID() : String` Returns the ID of the product variation attribute value. ### getImage **Signature:** `getImage(viewtype : String, index : Number) : MediaFile` The method calls getImages(String) and returns the image at the specific index. ### getImage **Signature:** `getImage(viewtype : String) : MediaFile` The method calls getImages(String) and returns the first image of the list. ### getImages **Signature:** `getImages(viewtype : String) : List` Returns all images that match the given view type and have the variant value of this value, which is typically the 'color' attribute. ### getValue **Signature:** `getValue() : Object` Returns the value for the product variation attribute value. ### hashCode **Signature:** `hashCode() : Number` Calculates the hash code for a product variation attribute value. ## Method Detail ## Method Details ### equals **Signature:** `equals(obj : Object) : boolean` **Description:** Returns true if the specified object is equal to this object. **Parameters:** - `obj`: the object to test. **Returns:** true if the specified object is equal to this object. --- ### getDescription **Signature:** `getDescription() : String` **Description:** Returns the description of the product variation attribute value in the current locale. **Returns:** the description of the product variation attribute value in the current locale, or null if it wasn't found. --- ### getDisplayValue **Signature:** `getDisplayValue() : String` **Description:** Returns the display value for the product variation attribute value, which can be used in the user interface. **Returns:** the display value for the product variation attribute value, which can be used in the user interface. --- ### getID **Signature:** `getID() : String` **Description:** Returns the ID of the product variation attribute value. **Returns:** the ID of the product variation attribute value. --- ### getImage **Signature:** `getImage(viewtype : String, index : Number) : MediaFile` **Description:** The method calls getImages(String) and returns the image at the specific index. If images are defined for this view type and variant, but not for specified index, the method returns null. If no images are defined for this variant and specified view type, the image at the specified index of the master product images is returned. If no master product image for specified index is defined, the method returns null. **Parameters:** - `viewtype`: the view type annotated to image - `index`: the index number of the image within image list **Returns:** the MediaFile or null **Throws:** NullArgumentException - if viewtype is null --- ### getImage **Signature:** `getImage(viewtype : String) : MediaFile` **Description:** The method calls getImages(String) and returns the first image of the list. The method is specifically built for handling color swatches in an apparel site. If no images are defined for this variant and specified view type, then the first image of the master product images for that view type is returned. If no master product images are defined, the method returns null. **Parameters:** - `viewtype`: the view type annotated to image **Returns:** the MediaFile or null **Throws:** NullArgumentException - if viewtype is null --- ### getImages **Signature:** `getImages(viewtype : String) : List` **Description:** Returns all images that match the given view type and have the variant value of this value, which is typically the 'color' attribute. The images are returned in the order of their index number ascending. If no images are defined for this variant, then the images of the master for that view type are returned. **Parameters:** - `viewtype`: the view type annotated to images **Returns:** a list of MediaFile objects, possibly empty **Throws:** NullArgumentException - if viewtype is null --- ### getValue **Signature:** `getValue() : Object` **Description:** Returns the value for the product variation attribute value. **Returns:** the value for the product variation attribute value. --- ### hashCode **Signature:** `hashCode() : Number` **Description:** Calculates the hash code for a product variation attribute value. **Returns:** the hash code for a product variation attribute value. --- ``` -------------------------------------------------------------------------------- /src/config/dw-json-loader.ts: -------------------------------------------------------------------------------- ```typescript /** * Configuration loader for SFCC MCP Server * * This module handles secure loading and validation of dw.json files * with comprehensive security checks for file access. */ import { readFileSync, existsSync, statSync } from 'fs'; import { resolve, basename, extname } from 'path'; import { DwJsonConfig } from '../types/types.js'; /** * Validates that a file path is safe to access and prevents path traversal attacks * * @param filePath - The file path to validate * @returns The validated and resolved path * @throws Error if the path is unsafe */ function validateSecurePath(filePath: string): string { // Prevent null bytes and other dangerous characters if (filePath.includes('\0') || filePath.includes('\x00')) { throw new Error('Invalid characters in file path'); } // Prevent excessively long paths that could cause DoS if (filePath.length > 1000) { throw new Error('File path too long'); } // Check if file extension is allowed (only .json files) const ext = extname(filePath).toLowerCase(); if (ext !== '.json') { throw new Error('Only .json files are allowed'); } // Normalize the path to prevent path traversal const resolvedPath = resolve(filePath); // Additional check: ensure the resolved path still ends with .json // This prevents attacks like "file.json/../../../etc/passwd" if (!resolvedPath.toLowerCase().endsWith('.json')) { throw new Error('Invalid file path'); } // Prevent access to system directories (additional security layer) // Allow CI workspace paths like /home/runner/work/ but block sensitive system paths const dangerousPaths = ['/etc/', '/proc/', '/sys/', '/dev/', '/root/']; const lowerPath = resolvedPath.toLowerCase(); // Check for dangerous system paths if (dangerousPaths.some(dangerous => lowerPath.includes(dangerous))) { throw new Error('Access to system directories not allowed'); } // Block /home/ but allow CI workspace paths (/home/runner/work/) if (lowerPath.includes('/home/') && !lowerPath.includes('/home/runner/work/')) { throw new Error('Access to system directories not allowed'); } return resolvedPath; } /** * Validates file size to prevent reading excessively large files * * @param filePath - The file path to check * @throws Error if file is too large */ function validateFileSize(filePath: string): void { try { const stats = statSync(filePath); const maxSize = 1024 * 1024; // 1MB limit for config files if (stats.size > maxSize) { throw new Error('Configuration file too large'); } } catch (error) { if (error instanceof Error && error.message === 'Configuration file too large') { throw error; } // Don't expose detailed file system errors throw new Error('Unable to access configuration file'); } } /** * Validates the content of a dw.json configuration * * @param dwConfig - The parsed dw.json configuration * @throws Error if required fields are missing or invalid */ function validateDwJsonContent(dwConfig: DwJsonConfig): void { // Validate required fields if (!dwConfig.hostname || !dwConfig.username || !dwConfig.password) { throw new Error('Configuration file must contain hostname, username, and password fields'); } // Additional validation for hostname format (trim whitespace first) const trimmedHostname = dwConfig.hostname.trim(); if (!trimmedHostname?.match(/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/)) { throw new Error('Invalid hostname format in configuration'); } } /** * Securely loads and parses a dw.json file with comprehensive validation * * This function handles all security aspects of file loading including path validation, * file size checks, and content validation. It returns the raw parsed JSON without * any transformation to SFCCConfig format. * * @param dwJsonPath - Path to the dw.json file * @returns Parsed and validated dw.json configuration * @throws Error if file doesn't exist, is invalid, or fails security checks */ export function loadSecureDwJson(dwJsonPath: string): DwJsonConfig { let resolvedPath: string; try { // Validate and secure the path resolvedPath = validateSecurePath(dwJsonPath); } catch (error) { throw new Error( `Invalid file path: ${error instanceof Error ? error.message : 'Unknown error'}`, ); } if (!existsSync(resolvedPath)) { // Don't expose the full path in error messages for security throw new Error(`Configuration file not found: ${basename(dwJsonPath)}`); } // Validate file size before reading try { validateFileSize(resolvedPath); } catch (error) { throw new Error( `File validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`, ); } try { const dwJsonContent = readFileSync(resolvedPath, 'utf-8'); // Additional validation: ensure the content is not empty and doesn't contain suspicious patterns if (!dwJsonContent.trim()) { throw new Error('Configuration file is empty'); } // Basic check for potential binary content (null bytes) if (dwJsonContent.includes('\0')) { throw new Error('Configuration file contains invalid content'); } const dwConfig: DwJsonConfig = JSON.parse(dwJsonContent); // Validate the parsed configuration validateDwJsonContent(dwConfig); return dwConfig; } catch (error) { if (error instanceof SyntaxError) { throw new Error(`Invalid JSON in configuration file: ${error.message}`); } throw error; } } ``` -------------------------------------------------------------------------------- /docs/dw_util/Map.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.util # Class Map ## Inheritance Hierarchy - Object - dw.util.Map ## Description Represents a Map of objects. ## Properties ### empty **Type:** boolean (Read Only) Identifies if this map is empty. ### length **Type:** Number (Read Only) The size of the map. This is a bean attribute method and supports the access to the collections length similar to a ECMA array, such as 'products.length'. ## Constructor Summary ## Method Summary ### clear **Signature:** `clear() : void` Clears the map of all objects. ### containsKey **Signature:** `containsKey(key : Object) : boolean` Identifies if this map contains an element identfied by the specified key. ### containsValue **Signature:** `containsValue(value : Object) : boolean` Identifies if this map contains an element identfied by the specified value. ### entrySet **Signature:** `entrySet() : Set` Returns a set of the map's entries. ### get **Signature:** `get(key : Object) : Object` Returns the object associated with the key or null. ### getLength **Signature:** `getLength() : Number` REturns the size of the map. ### isEmpty **Signature:** `isEmpty() : boolean` Identifies if this map is empty. ### keySet **Signature:** `keySet() : Set` Returns a set of the map's keys. ### put **Signature:** `put(key : Object, value : Object) : Object` Puts the specified value into the map using the specified key to identify it. ### putAll **Signature:** `putAll(other : Map) : void` Copies all of the objects inside the specified map into this map. ### remove **Signature:** `remove(key : Object) : Object` Removes the object from the map that is identified by the key. ### size **Signature:** `size() : Number` Returns the size of the map. ### values **Signature:** `values() : Collection` Returns a collection of the values contained in this map. ### values **Signature:** `values() : Collection` Returns a collection of the values contained in this map. ## Method Detail ## Method Details ### clear **Signature:** `clear() : void` **Description:** Clears the map of all objects. --- ### containsKey **Signature:** `containsKey(key : Object) : boolean` **Description:** Identifies if this map contains an element identfied by the specified key. **Parameters:** - `key`: the key to use. **Returns:** true if this map contains an element whose key is equal to the specified key. --- ### containsValue **Signature:** `containsValue(value : Object) : boolean` **Description:** Identifies if this map contains an element identfied by the specified value. **Parameters:** - `value`: the value to use. **Returns:** true if this map contains an element whose value is equal to the specified value. --- ### entrySet **Signature:** `entrySet() : Set` **Description:** Returns a set of the map's entries. The returned set is actually a view to the entries of this map. **Returns:** a set of the map's entries. --- ### get **Signature:** `get(key : Object) : Object` **Description:** Returns the object associated with the key or null. **Parameters:** - `key`: the key to use. **Returns:** the object associated with the key or null. --- ### getLength **Signature:** `getLength() : Number` **Description:** REturns the size of the map. This is a bean attribute method and supports the access to the collections length similar to a ECMA array, such as 'products.length'. **Returns:** the number of objects in the map. --- ### isEmpty **Signature:** `isEmpty() : boolean` **Description:** Identifies if this map is empty. **Returns:** true if the map is empty, false otherwise. --- ### keySet **Signature:** `keySet() : Set` **Description:** Returns a set of the map's keys. The returned set is actually a view to the keys of this map. **Returns:** a set of the map's keys. --- ### put **Signature:** `put(key : Object, value : Object) : Object` **Description:** Puts the specified value into the map using the specified key to identify it. **Parameters:** - `key`: the key to use to identify the value. - `value`: the object to put into the map. **Returns:** previous value associated with specified key, or null if there was no mapping for key. --- ### putAll **Signature:** `putAll(other : Map) : void` **Description:** Copies all of the objects inside the specified map into this map. **Parameters:** - `other`: the map whose contents are copied into this map. --- ### remove **Signature:** `remove(key : Object) : Object` **Description:** Removes the object from the map that is identified by the key. **Parameters:** - `key`: the key that identifies the object to remove. **Returns:** the removed object or null. --- ### size **Signature:** `size() : Number` **Description:** Returns the size of the map. **Returns:** the number of objects in the map. --- ### values **Signature:** `values() : Collection` **Description:** Returns a collection of the values contained in this map. **API Versioned:** No longer available as of version 16.1. Returns an independent modifiable collection holding all values. **Returns:** a collection of the values contained in this map --- ### values **Signature:** `values() : Collection` **Description:** Returns a collection of the values contained in this map. **API Versioned:** From version 16.1. Returns a view on the values of this map like keySet() and entrySet() do. Former version returned a shallow copy of this. **Returns:** a collection of the values contained in this map --- ``` -------------------------------------------------------------------------------- /docs/dw_campaign/Discount.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.campaign # Class Discount ## Inheritance Hierarchy - Object - dw.campaign.Discount ## Description Superclass of all specific discount classes. ## Constants ### TYPE_AMOUNT **Type:** String = "AMOUNT" Constant representing discounts of type amount. ### TYPE_BONUS **Type:** String = "BONUS" Constant representing discounts of type bonus. ### TYPE_BONUS_CHOICE **Type:** String = "BONUS_CHOICE" Constant representing discounts of type bonus choice. ### TYPE_FIXED_PRICE **Type:** String = "FIXED_PRICE" Constant representing discounts of type fixed-price. ### TYPE_FIXED_PRICE_SHIPPING **Type:** String = "FIXED_PRICE_SHIPPING" Constant representing discounts of type fixed price shipping. ### TYPE_FREE **Type:** String = "FREE" Constant representing discounts of type free. ### TYPE_FREE_SHIPPING **Type:** String = "FREE_SHIPPING" Constant representing discounts of type free shipping. ### TYPE_PERCENTAGE **Type:** String = "PERCENTAGE" Constant representing discounts of type percentage. ### TYPE_PERCENTAGE_OFF_OPTIONS **Type:** String = "PERCENTAGE_OFF_OPTIONS" Constant representing discounts of type percent off options. ### TYPE_PRICEBOOK_PRICE **Type:** String = "PRICE_BOOK_PRICE" Constant representing discounts of type price book price. ### TYPE_TOTAL_FIXED_PRICE **Type:** String = "TOTAL_FIXED_PRICE" Constant representing discounts of type total fixed price. ## Properties ### itemPromotionTiers **Type:** Map (Read Only) The tier index by quantity Id of Product promotion. ProductLineItems may have more than one quantity, but not all items of that SKU may have received the same tier of promotion. Each quantity of the ProductLineItem is indexed from 1 to n, where n is the quantity of the ProductLineItem, and this method returns a mapping from that quantity index to the index of tier of the promotion that item received. For more information about tier indexes, see getPromotionTier() method. ### promotion **Type:** Promotion (Read Only) The promotion this discount is based on. ### promotionTier **Type:** Number (Read Only) The tier index for promotion at order level or bonus product. Promotion tiers are always evaluated in the order of the highest threshold (e.g. quantity, or amount) to the lowest threshold. The tier that is evaluated first (i.e. the highest quantity or amount) is indexed as 0, the next tier 1, etc. The lowest tier will have index n - 1, where n is the total number of tiers. ### quantity **Type:** Number (Read Only) The quantity of the discount. This quantity specifies how often this discount applies to its target object. For example, a 10% off discount with quantity 2 associated to a product line item with quantity 3 is applied to two items of the product line item. Discounts of order and shipping promotions, and bonus discounts have a fix quantity of 1. ### type **Type:** String (Read Only) The type of the discount. ## Constructor Summary ## Method Summary ### getItemPromotionTiers **Signature:** `getItemPromotionTiers() : Map` Returns the tier index by quantity Id of Product promotion. ### getPromotion **Signature:** `getPromotion() : Promotion` Returns the promotion this discount is based on. ### getPromotionTier **Signature:** `getPromotionTier() : Number` Returns the tier index for promotion at order level or bonus product. ### getQuantity **Signature:** `getQuantity() : Number` Returns the quantity of the discount. ### getType **Signature:** `getType() : String` Returns the type of the discount. ## Method Detail ## Method Details ### getItemPromotionTiers **Signature:** `getItemPromotionTiers() : Map` **Description:** Returns the tier index by quantity Id of Product promotion. ProductLineItems may have more than one quantity, but not all items of that SKU may have received the same tier of promotion. Each quantity of the ProductLineItem is indexed from 1 to n, where n is the quantity of the ProductLineItem, and this method returns a mapping from that quantity index to the index of tier of the promotion that item received. For more information about tier indexes, see getPromotionTier() method. **Returns:** Map of Tier index by quantity Id or empty map **See Also:** getPromotionTier() --- ### getPromotion **Signature:** `getPromotion() : Promotion` **Description:** Returns the promotion this discount is based on. **Returns:** Promotion related to this discount --- ### getPromotionTier **Signature:** `getPromotionTier() : Number` **Description:** Returns the tier index for promotion at order level or bonus product. Promotion tiers are always evaluated in the order of the highest threshold (e.g. quantity, or amount) to the lowest threshold. The tier that is evaluated first (i.e. the highest quantity or amount) is indexed as 0, the next tier 1, etc. The lowest tier will have index n - 1, where n is the total number of tiers. **Returns:** Tier index or null --- ### getQuantity **Signature:** `getQuantity() : Number` **Description:** Returns the quantity of the discount. This quantity specifies how often this discount applies to its target object. For example, a 10% off discount with quantity 2 associated to a product line item with quantity 3 is applied to two items of the product line item. Discounts of order and shipping promotions, and bonus discounts have a fix quantity of 1. **Returns:** Discount quantity --- ### getType **Signature:** `getType() : String` **Description:** Returns the type of the discount. **Returns:** Discount type --- ``` -------------------------------------------------------------------------------- /tests/mcp/yaml/search-system-object-attribute-definitions.docs-only.test.mcp.yml: -------------------------------------------------------------------------------- ```yaml # ================================================================================== # SFCC MCP Server - search_system_object_attribute_definitions Tool YAML Tests (Docs-Only Mode) # Validates that system object search tools are NOT available in docs-only mode # This tool requires SFCC credentials and should not be available without them # # Quick Test Commands: # aegis "tests/mcp/yaml/search-system-object-attribute-definitions.docs-only.test.mcp.yml" --config "aegis.config.docs-only.json" --verbose # aegis query search_system_object_attribute_definitions '{"objectType": "Product", "searchRequest": {"query": {"match_all_query": {}}}}' --config "aegis.config.docs-only.json" # ================================================================================== description: "search_system_object_attribute_definitions tool docs-only mode tests - Tool unavailability validation" tests: # ================================================================================== # TOOL UNAVAILABILITY IN DOCS-ONLY MODE # ================================================================================== - it: "should NOT list search_system_object_attribute_definitions tool in docs-only mode" request: jsonrpc: "2.0" id: "tool-not-available-docs" method: "tools/list" params: {} expect: response: jsonrpc: "2.0" id: "tool-not-available-docs" result: tools: match:arrayElements: match:partial: name: "match:type:string" description: "match:type:string" match:extractField: "tools.*.name" value: "match:not:arrayContains:search_system_object_attribute_definitions" stderr: "toBeEmpty" # ================================================================================== # AUTHENTICATION ERROR TESTS (Tool Can Be Called But Returns Error) # ================================================================================== - it: "should return authentication error when calling search_system_object_attribute_definitions in docs-only mode" request: jsonrpc: "2.0" id: "auth-error-product" method: "tools/call" params: name: "search_system_object_attribute_definitions" arguments: objectType: "Product" searchRequest: query: match_all_query: {} expect: response: jsonrpc: "2.0" id: "auth-error-product" result: content: - type: "text" text: "match:contains:OCAPI client not configured" isError: true performance: maxResponseTime: "500ms" stderr: "toBeEmpty" - it: "should return authentication error for text query search requests" request: jsonrpc: "2.0" id: "auth-error-text-query" method: "tools/call" params: name: "search_system_object_attribute_definitions" arguments: objectType: "Customer" searchRequest: query: text_query: fields: ["id", "display_name"] search_phrase: "test" expect: response: jsonrpc: "2.0" id: "auth-error-text-query" result: content: - type: "text" text: "match:contains:credentials are provided" isError: true performance: maxResponseTime: "500ms" stderr: "toBeEmpty" - it: "should return authentication error for term query requests" request: jsonrpc: "2.0" id: "auth-error-term-query" method: "tools/call" params: name: "search_system_object_attribute_definitions" arguments: objectType: "Order" searchRequest: query: term_query: fields: ["value_type"] operator: "is" values: ["string"] expect: response: jsonrpc: "2.0" id: "auth-error-term-query" result: content: - type: "text" text: "match:contains:full mode" isError: true performance: maxResponseTime: "500ms" stderr: "toBeEmpty" - it: "should handle malformed parameters with same authentication error" request: jsonrpc: "2.0" id: "auth-error-malformed" method: "tools/call" params: name: "search_system_object_attribute_definitions" arguments: invalidParam: "test" expect: response: jsonrpc: "2.0" id: "auth-error-malformed" result: content: - type: "text" text: "match:contains:OCAPI client not configured" isError: true performance: maxResponseTime: "500ms" stderr: "toBeEmpty" # ================================================================================== # CONSISTENT ERROR RESPONSE VALIDATION # ================================================================================== - it: "should consistently return isError: true for all docs-only calls" request: jsonrpc: "2.0" id: "consistent-error-flag" method: "tools/call" params: name: "search_system_object_attribute_definitions" arguments: objectType: "Site" searchRequest: query: match_all_query: {} expect: response: jsonrpc: "2.0" id: "consistent-error-flag" result: content: - type: "text" text: "match:type:string" isError: true performance: maxResponseTime: "500ms" stderr: "toBeEmpty" ``` -------------------------------------------------------------------------------- /docs/sfra/stores.md: -------------------------------------------------------------------------------- ```markdown # SFRA Stores Model ## Overview The Stores model represents a collection of store locations in SFRA applications. It provides store locator functionality, map integration capabilities, and formatted store information for display in store finder interfaces. ## Constructor ```javascript function stores(storesResultsObject, searchKey, searchRadius, actionUrl, apiKey) ``` Creates a Stores model instance with store collection and search parameters. ### Parameters - `storesResultsObject` (dw.util.Set) - A set of dw.catalog.Store objects - `searchKey` (Object) - What the user searched by (location or postal code) - `searchRadius` (number) - The radius used in the search - `actionUrl` (dw.web.URL) - A relative URL for the search action - `apiKey` (string) - The Google Maps API key that is set in site preferences ## Properties ### stores **Type:** Array<StoreModel> Array of individual store models, each containing complete store information including location, contact details, and hours. ### searchKey **Type:** Object The search term or location used to find the stores (e.g., ZIP code, address, city). ### radius **Type:** number The search radius in miles/kilometers used to limit store results. ### actionUrl **Type:** dw.web.URL A relative URL for the search action. ### googleMapsApi **Type:** string | null URL for Google Maps API integration, or null if no API key is configured. ### radiusOptions **Type:** Array<number> Array of available radius options: [15, 30, 50, 100, 300]. ### storesResultsHtml **Type:** string | null HTML-formatted string of store results for display, or null if no stores found. ### locations **Type:** string JSON stringified array of location objects optimized for map display. Each location contains: - `name` (string) - Store name - `latitude` (number) - Geographic latitude - `longitude` (number) - Geographic longitude - `infoWindowHtml` (string) - Rendered HTML for map info windows ## Helper Functions ### createStoresObject(storesObject) Converts a set of store objects into an array of StoreModel instances. **Parameters:** - `storesObject` (dw.util.Set) - Set of dw.catalog.Store objects **Returns:** Array<StoreModel> - Array of formatted store models ### createGeoLocationObject(storesObject) Creates location objects with coordinates and rendered info window HTML for map display. **Parameters:** - `storesObject` (dw.util.Set) - Set of dw.catalog.Store objects **Returns:** Array<Object> - Array of location objects with map data ### getGoogleMapsApi(apiKey) Constructs Google Maps API URL if API key is available. **Parameters:** - `apiKey` (string) - Google Maps API key **Returns:** string | null - Complete API URL or null if no key ## Usage Example ```javascript var stores = require('*/cartridge/models/stores'); var storeHelpers = require('*/cartridge/scripts/helpers/storeHelpers'); // Search for stores var searchResults = storeHelpers.findStores('10001', 25); var apiKey = Site.getCurrent().getCustomPreferenceValue('googleMapsApiKey'); var actionUrl = URLUtils.url('Stores-FindStores'); var storesModel = new stores( searchResults.stores, '10001', 25, actionUrl, apiKey ); // Access store collection console.log('Found ' + storesModel.stores.length + ' stores'); console.log('Search: ' + storesModel.searchKey + ' within ' + storesModel.radius + ' miles'); // Parse JSON locations for map var locations = JSON.parse(storesModel.locations); // Iterate through stores storesModel.stores.forEach(function(store) { console.log(store.name + ' - ' + store.city); }); // Use for map integration if (storesModel.googleMapsApi) { // Load Google Maps with locations var locations = JSON.parse(storesModel.locations); locations.forEach(function(location) { // Add markers to map using latitude/longitude // Use infoWindowHtml for marker popups }); } // Display pre-rendered HTML results if (storesModel.storesResultsHtml) { // Use the pre-rendered HTML for store display } ``` ## Map Integration The model provides comprehensive mapping support: ### Google Maps Integration - **googleMapsApi** - Ready-to-use API URL - **locations** - JSON string of coordinates with info windows (needs parsing) - **infoWindowHtml** - Pre-rendered HTML for map popups ### Location Data Structure Each location object (after JSON parsing) includes: - Geographic coordinates for marker placement - Store name for marker labels - Rendered HTML content for info windows ## Search Context The model preserves search context: - **searchKey** - Original search term for reference - **radius** - Search distance for display and refinement - **actionUrl** - URL for additional search actions - **radiusOptions** - Available radius choices for refinement - Enables search result pagination and refinement ## Template Integration Info windows use the `storeLocator/storeInfoWindow` template: - Consistent store information display - Customizable popup content - Integrated with SFRA template system ## Notes - Converts SFCC store objects to structured models - Provides map-ready coordinate data as JSON string - Includes pre-rendered HTML for info windows and store results - Supports Google Maps API integration - Maintains search context for user reference - Includes predefined radius options for search refinement - Handles missing API keys gracefully - Optimized for store locator interfaces - Uses storeHelpers.createStoresResultsHtml for consistent display ## Related Models - **StoreModel** - Individual store representation - **Search Models** - May include store search results - **Address Models** - Similar location structure - **Product Models** - May include store availability ``` -------------------------------------------------------------------------------- /docs/dw_customer/CustomerPaymentInstrument.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.customer # Class CustomerPaymentInstrument ## Inheritance Hierarchy - Object - dw.object.PersistentObject - dw.object.ExtensibleObject - dw.customer.EncryptedObject - dw.order.PaymentInstrument - dw.customer.CustomerPaymentInstrument ## Description Represents any payment instrument stored in the customers profile, such as credit card or bank transfer. The object defines standard methods for credit card payment, and can be extended by attributes appropriate for other payment methods. ## Properties ### bankAccountDriversLicense **Type:** String (Read Only) The driver's license number of the bank account number if the calling context meets the following criteria: If the method call happens in the context of a storefront request and the current customer is registered and authenticated, and the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS Otherwise, the method returns the masked driver's license number of the bank account. Note: this method handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. ### bankAccountNumber **Type:** String (Read Only) The bank account number if the calling context meets the following criteria: If the method call happens in the context of a storefront request, the current customer is registered and authenticated, the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS Otherwise, the method returns the masked bank account number. Note: this method handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. ### creditCardNumber **Type:** String (Read Only) The decrypted credit card number if the calling context meets the following criteria: If the method call happens in the context of a storefront request, the current customer is registered and authenticated, the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS. Otherwise, the method returns the masked credit card number. Note: this method handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. ## Constructor Summary ## Method Summary ### getBankAccountDriversLicense **Signature:** `getBankAccountDriversLicense() : String` Returns the driver's license number of the bank account number if the calling context meets the following criteria: If the method call happens in the context of a storefront request and the current customer is registered and authenticated, and the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS Otherwise, the method returns the masked driver's license number of the bank account. ### getBankAccountNumber **Signature:** `getBankAccountNumber() : String` Returns the bank account number if the calling context meets the following criteria: If the method call happens in the context of a storefront request, the current customer is registered and authenticated, the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS Otherwise, the method returns the masked bank account number. ### getCreditCardNumber **Signature:** `getCreditCardNumber() : String` Returns the decrypted credit card number if the calling context meets the following criteria: If the method call happens in the context of a storefront request, the current customer is registered and authenticated, the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS. ## Method Detail ## Method Details ### getBankAccountDriversLicense **Signature:** `getBankAccountDriversLicense() : String` **Description:** Returns the driver's license number of the bank account number if the calling context meets the following criteria: If the method call happens in the context of a storefront request and the current customer is registered and authenticated, and the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS Otherwise, the method returns the masked driver's license number of the bank account. Note: this method handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. --- ### getBankAccountNumber **Signature:** `getBankAccountNumber() : String` **Description:** Returns the bank account number if the calling context meets the following criteria: If the method call happens in the context of a storefront request, the current customer is registered and authenticated, the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS Otherwise, the method returns the masked bank account number. Note: this method handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. --- ### getCreditCardNumber **Signature:** `getCreditCardNumber() : String` **Description:** Returns the decrypted credit card number if the calling context meets the following criteria: If the method call happens in the context of a storefront request, the current customer is registered and authenticated, the payment instrument is associated to the profile of the current customer, and the current protocol is HTTPS. Otherwise, the method returns the masked credit card number. Note: this method handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. --- ``` -------------------------------------------------------------------------------- /docs/dw_system/Logger.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.system # Class Logger ## Inheritance Hierarchy - Object - dw.system.Logger ## Description The Logger class provides logging utility methods. ## Properties ### debugEnabled **Type:** boolean (Read Only) This method returns true if debug logging is enabled. ### errorEnabled **Type:** boolean (Read Only) This method returns true if error logging is enabled. ### infoEnabled **Type:** boolean (Read Only) This method returns true if info logging is enabled. ### rootLogger **Type:** Log (Read Only) The root logger object. ### warnEnabled **Type:** boolean (Read Only) This method returns true if warning logging is enabled. ## Constructor Summary ## Method Summary ### debug **Signature:** `static debug(msg : String, args : Object...) : void` The method reports an debug level message. ### error **Signature:** `static error(msg : String, args : Object...) : void` The method reports an error level message. ### getLogger **Signature:** `static getLogger(category : String) : Log` Returns the logger object for the given category. ### getLogger **Signature:** `static getLogger(fileNamePrefix : String, category : String) : Log` Returns the logger object for the given file name prefix and category. ### getRootLogger **Signature:** `static getRootLogger() : Log` Returns the root logger object. ### info **Signature:** `static info(msg : String, args : Object...) : void` The method reports an information level message. ### isDebugEnabled **Signature:** `static isDebugEnabled() : boolean` This method returns true if debug logging is enabled. ### isErrorEnabled **Signature:** `static isErrorEnabled() : boolean` This method returns true if error logging is enabled. ### isInfoEnabled **Signature:** `static isInfoEnabled() : boolean` This method returns true if info logging is enabled. ### isWarnEnabled **Signature:** `static isWarnEnabled() : boolean` This method returns true if warning logging is enabled. ### warn **Signature:** `static warn(msg : String, args : Object...) : void` The method reports an warning level message. ## Method Detail ## Method Details ### debug **Signature:** `static debug(msg : String, args : Object...) : void` **Description:** The method reports an debug level message. Arguments can be embedded into the message, e.g. like "Failure {0} in {1}". The method implements the Java MessageFormat.format() syntax. **Parameters:** - `msg`: the message to log. - `args`: the arguments to insert into the message. --- ### error **Signature:** `static error(msg : String, args : Object...) : void` **Description:** The method reports an error level message. Arguments can be embedded into the message, e.g. like "Failure {0} in {1}". The method implements the Java MessageFormat.format() syntax. **Parameters:** - `msg`: the message to log. - `args`: the arguments to insert into the message. --- ### getLogger **Signature:** `static getLogger(category : String) : Log` **Description:** Returns the logger object for the given category. **Parameters:** - `category`: - the category to get the logger for **Returns:** the logger object for the given category. --- ### getLogger **Signature:** `static getLogger(fileNamePrefix : String, category : String) : Log` **Description:** Returns the logger object for the given file name prefix and category. Throws an exception if maximum number of custom log files per day has already been obtained. **Parameters:** - `fileNamePrefix`: - the file name prefix to identify the logger must not be null or an empty string, must be at least 3 characters long, can contain characters a-z A-Z 0-9 '-' '_' only, can have up to 25 characters must not start or end with '-' or '_' can only start or end with a-z A-Z 0-9 - `category`: - the category to get the logger for, must not be null **Returns:** the logger object for the given category. --- ### getRootLogger **Signature:** `static getRootLogger() : Log` **Description:** Returns the root logger object. **Returns:** the root logger object. --- ### info **Signature:** `static info(msg : String, args : Object...) : void` **Description:** The method reports an information level message. Arguments can be embedded into the message, e.g. like "Failure {0} in {1}". The method implements the Java MessageFormat.format() syntax. **Parameters:** - `msg`: the message to log. - `args`: the arguments to insert into the message. --- ### isDebugEnabled **Signature:** `static isDebugEnabled() : boolean` **Description:** This method returns true if debug logging is enabled. **Returns:** true if logging of debug messages is enabled, false otherwise. --- ### isErrorEnabled **Signature:** `static isErrorEnabled() : boolean` **Description:** This method returns true if error logging is enabled. **Returns:** true if logging of error messages is enabled, false otherwise. --- ### isInfoEnabled **Signature:** `static isInfoEnabled() : boolean` **Description:** This method returns true if info logging is enabled. **Returns:** true if logging of info messages is enabled, false otherwise. --- ### isWarnEnabled **Signature:** `static isWarnEnabled() : boolean` **Description:** This method returns true if warning logging is enabled. **Returns:** true if logging of warn messages is enabled, false otherwise. --- ### warn **Signature:** `static warn(msg : String, args : Object...) : void` **Description:** The method reports an warning level message. Arguments can be embedded into the message, e.g. like "Failure {0} in {1}". The method implements the Java MessageFormat.format() syntax. **Parameters:** - `msg`: the message to log. - `args`: the arguments to insert into the message. --- ``` -------------------------------------------------------------------------------- /docs/dw_order/ShippingMgr.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.order # Class ShippingMgr ## Inheritance Hierarchy - Object - dw.order.ShippingMgr ## Description Provides methods to access the shipping information. ## Properties ### allShippingMethods **Type:** Collection (Read Only) The active shipping methods of the current site applicable to the session currency and current customer group. ### defaultShippingMethod **Type:** ShippingMethod (Read Only) The default shipping method of the current site applicable to the session currency. Does an additional check if there is a base method and if their currencies are the same. Returns NULL if the two currencies are different. ## Constructor Summary ## Method Summary ### applyShippingCost **Signature:** `static applyShippingCost(lineItemCtnr : LineItemCtnr) : void` Applies product and shipment-level shipping cost to the specified line item container. ### getAllShippingMethods **Signature:** `static getAllShippingMethods() : Collection` Returns the active shipping methods of the current site applicable to the session currency and current customer group. ### getDefaultShippingMethod **Signature:** `static getDefaultShippingMethod() : ShippingMethod` Returns the default shipping method of the current site applicable to the session currency. ### getProductShippingModel **Signature:** `static getProductShippingModel(product : Product) : ProductShippingModel` Returns the shipping model for the specified product. ### getShipmentShippingModel **Signature:** `static getShipmentShippingModel(shipment : Shipment) : ShipmentShippingModel` Returns the shipping model for the specified shipment. ### getShippingCost **Signature:** `static getShippingCost(shippingMethod : ShippingMethod, orderValue : Money) : Money` Returns the shipping cost amount for the specified shipping method and the specified order value. ## Method Detail ## Method Details ### applyShippingCost **Signature:** `static applyShippingCost(lineItemCtnr : LineItemCtnr) : void` **Description:** Applies product and shipment-level shipping cost to the specified line item container. For each product line item in the specified line item container, a product shipping line item is created if product-level shipping cost is defined for the product. If no product-level shipping cost is defined for the product, an existing product shipping line item is removed. For each shipment in the specified line item container, shipment-level shipping cost is calculated. This cost is determined based on the merchandise total of the shipment after all product and order discounts. Only products without or with surcharge product-specific shipping cost count towards this merchandise total. Products with fixed product-specific shipping cost don't count towards the merchandise total used to calculate shipment-level shipping cost. The calculated shipping cost is set at the standard shipping line item of the shipment. If 'net' taxation is configured for the site, the merchandise total before tax is used. If 'gross' taxation is configured for the site, the merchandise total after tax is used. If no shipping method is set for a shipment, neither product nor shipment-level shipping cost can be calculated. In this case, the amount of the standard shipment shipping line item will be set to N/A, and shipping line items of product line items in this shipment will be removed from the line item container. Special cases for product-level shipping cost: if a product is member of multiple shipping cost groups, the lowest shipping cost takes precedence if fixed and surcharge shipping cost is defined for a product, the fixed cost takes precedence shipping cost defined for a master product is also defined for all variants of this master shipping cost is not applied to bundled product line items or options line items **Parameters:** - `lineItemCtnr`: the line item container to use. --- ### getAllShippingMethods **Signature:** `static getAllShippingMethods() : Collection` **Description:** Returns the active shipping methods of the current site applicable to the session currency and current customer group. **Returns:** the active shipping methods of the current site applicable to the session currency and current customer group. --- ### getDefaultShippingMethod **Signature:** `static getDefaultShippingMethod() : ShippingMethod` **Description:** Returns the default shipping method of the current site applicable to the session currency. Does an additional check if there is a base method and if their currencies are the same. Returns NULL if the two currencies are different. **Returns:** the default shipping method of the current site applicable to the session currency or null. --- ### getProductShippingModel **Signature:** `static getProductShippingModel(product : Product) : ProductShippingModel` **Description:** Returns the shipping model for the specified product. **Parameters:** - `product`: Product **Returns:** Shipping model for specified product --- ### getShipmentShippingModel **Signature:** `static getShipmentShippingModel(shipment : Shipment) : ShipmentShippingModel` **Description:** Returns the shipping model for the specified shipment. **Parameters:** - `shipment`: the shipment to use. **Returns:** Shipping model for specified product --- ### getShippingCost **Signature:** `static getShippingCost(shippingMethod : ShippingMethod, orderValue : Money) : Money` **Description:** Returns the shipping cost amount for the specified shipping method and the specified order value. If shipping cost cannot be calculated for any reason, Money.NA is returned. **Parameters:** - `shippingMethod`: Selected shipping method - `orderValue`: Order value **Returns:** Shipping cost --- ``` -------------------------------------------------------------------------------- /docs/dw_web/HttpParameterMap.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.web # Class HttpParameterMap ## Inheritance Hierarchy - Object - dw.web.HttpParameterMap ## Description A map of HTTP parameters. ## Properties ### parameterCount **Type:** Number (Read Only) The number of paramters in this http parameter map. ### parameterNames **Type:** Set (Read Only) A collection of all parameter names. ### requestBodyAsString **Type:** String (Read Only) The HTTP request body as string (e.g. useful for XML posts). A body is only returned if the request is a POST or PUT request and was not send with "application/x-www-form-urlencoded" encoding. If the request was send with that encoding it is interpreted as form data and the body will be empty. ## Constructor Summary ## Method Summary ### get **Signature:** `get(name : Object) : HttpParameter` Returns the http parameter for the given key or an empty http parameter, if no parameter is defined for that key. ### getParameterCount **Signature:** `getParameterCount() : Number` Returns the number of paramters in this http parameter map. ### getParameterMap **Signature:** `getParameterMap(prefix : String) : HttpParameterMap` Returns a sub-map containing all parameters that start with the given prefix. ### getParameterNames **Signature:** `getParameterNames() : Set` Returns a collection of all parameter names. ### getRequestBodyAsString **Signature:** `getRequestBodyAsString() : String` Returns the HTTP request body as string (e.g. ### isParameterSubmitted **Signature:** `isParameterSubmitted(key : String) : boolean` Identifies if the parameter has been submitted. ### processMultipart **Signature:** `processMultipart(callback : Function) : LinkedHashMap` This method can be called to process a form submission for an HTML form with encoding type "multipart/form-data". ## Method Detail ## Method Details ### get **Signature:** `get(name : Object) : HttpParameter` **Description:** Returns the http parameter for the given key or an empty http parameter, if no parameter is defined for that key. An empty parameter returns false for the method isDefined(). **Parameters:** - `name`: the key whose associated http parameter is to be returned. **Returns:** the http parameter or an empty http parameter. --- ### getParameterCount **Signature:** `getParameterCount() : Number` **Description:** Returns the number of paramters in this http parameter map. **Returns:** the number parameters. --- ### getParameterMap **Signature:** `getParameterMap(prefix : String) : HttpParameterMap` **Description:** Returns a sub-map containing all parameters that start with the given prefix. The prefix will be removed from the parameter names in the returned sub-map. For example with the parameters "pre_P1" and "pre_p2" a call with "pre_" as parameter will return a HttpParameterMap containing "P1" and "P2". **Parameters:** - `prefix`: the prefix to use when creating the sub-map. **Returns:** the sub-map containing the target parameters. --- ### getParameterNames **Signature:** `getParameterNames() : Set` **Description:** Returns a collection of all parameter names. **Returns:** a set of all parameter names --- ### getRequestBodyAsString **Signature:** `getRequestBodyAsString() : String` **Description:** Returns the HTTP request body as string (e.g. useful for XML posts). A body is only returned if the request is a POST or PUT request and was not send with "application/x-www-form-urlencoded" encoding. If the request was send with that encoding it is interpreted as form data and the body will be empty. **Returns:** the http request body --- ### isParameterSubmitted **Signature:** `isParameterSubmitted(key : String) : boolean` **Description:** Identifies if the parameter has been submitted. **Parameters:** - `key`: the parameter to check. **Returns:** true if the parameter has been submitted, false otherwise. --- ### processMultipart **Signature:** `processMultipart(callback : Function) : LinkedHashMap` **Description:** This method can be called to process a form submission for an HTML form with encoding type "multipart/form-data". Such a form can have a mixture of "regular" HTML form fields and also file uploads. Form fields are available via get(Object) without calling this method. Uploaded files still need to be processed via the passed callback function. This callback function is called for each file upload part in the request. The parameters are the field name, the content type and the original file name. The function can return either a null, which means that the upload of this part should be skipped, or return a dw.io.File instance. If the file is an existing directory the system will automatically generate a unique file name. If the file is not an existing directory the uploaded content will be directly stored into that file. An existing file with the same name will be deleted. If the file can't be deleted for whatever reason, the upload is stored with a generated unique file name in the indicated directory. An automatically generated file name consists of the the prefix "upload", a time stamp, a unique id and the extension tmp. For example: "upload_20070114221535_bc7H1aOadI9qYaaacovPd3lqna.tmp". var params : HttpParameterMap = pdict.CurrentHttpParameterMap; // Get the file name from the first field. This is works because the // parameter map is updated before the file part is parsed. var files : LinkedHashMap = params.processMultipart( (function( field, ct, oname ){ return new File( File.IMPEX + "/" + params.firstField ); }) ); **Parameters:** - `callback`: a callback function, which takes the field name, content type and original file name as input **Returns:** a LinkedHashMap where the keys are the actual file names and the values are references to the File, or null if this is not a multipart request --- ``` -------------------------------------------------------------------------------- /docs/dw_web/FormGroup.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.web # Class FormGroup ## Inheritance Hierarchy - Object - dw.web.FormElement - dw.web.FormGroup ## Description The class is the central class within the whole form handling. It is the container element for fields and other form elements. A form group can contain other forms, also called sub-forms. Access to the elements of a form is provided via an index based access or via an associative array access. For example, the field "firstname" can be accessed with the expression "myform.firstname". ## Properties ### childCount **Type:** Number (Read Only) The number of elements in the form. ### error **Type:** String (Read Only) A form-wide error message. If no error message is present the method returns null. ### object **Type:** Object (Read Only) The object that was bound to this form group. ### submittedAction **Type:** FormAction (Read Only) The action that was submitted with the last request. The action is set independent whether the form must be valid for this action. The method returns null if no action at all was submitted with the last request for this form group. ### triggeredAction **Type:** FormAction (Read Only) The action that was triggered with the last request. An action is only marked as triggered if the constraints regarding form validation are meet. The method returns null if no action was marked as triggered. ## Constructor Summary ## Method Summary ### accept **Signature:** `accept() : void` The method copies the value from a form into the object, which was previously bound to the form. ### copyFrom **Signature:** `copyFrom(obj : Object) : void` The method updates the form with the values from the given object. The method call is basically equivalent to the pipelet UpdateFormWithObject. The method not only copies the value, it also binds the object to the form. ### copyTo **Signature:** `copyTo(obj : Object) : void` The method updates the object with the values from the form. The method call is basically equivalent to the pipelet UpdateObjectWithForm. The method needs a submitted form. ### getChildCount **Signature:** `getChildCount() : Number` Returns the number of elements in the form. ### getError **Signature:** `getError() : String` Returns a form-wide error message. ### getObject **Signature:** `getObject() : Object` The object that was bound to this form group. ### getSubmittedAction **Signature:** `getSubmittedAction() : FormAction` Returns the action that was submitted with the last request. ### getTriggeredAction **Signature:** `getTriggeredAction() : FormAction` Returns the action that was triggered with the last request. ## Method Detail ## Method Details ### accept **Signature:** `accept() : void` **Description:** The method copies the value from a form into the object, which was previously bound to the form. The method is equivalent to the pipelet AcceptForm. This method is equivalent to the call formgroup.copyFrom( formgroup.object ). --- ### copyFrom **Signature:** `copyFrom(obj : Object) : void` **Description:** The method updates the form with the values from the given object. The method call is basically equivalent to the pipelet UpdateFormWithObject. The method not only copies the value, it also binds the object to the form. Binding means that the form keeps the information from which objects the values were taken. This can be used for two purposes: for lists it makes it easier in the code to find the associated object, for example in case of a related action, and it allows to copy back the values from the form into the object (see accept()). Because of this bind behavior, the operation is also sometimes called a bind-operation. **Parameters:** - `obj`: the object from, which the values are read --- ### copyTo **Signature:** `copyTo(obj : Object) : void` **Description:** The method updates the object with the values from the form. The method call is basically equivalent to the pipelet UpdateObjectWithForm. The method needs a submitted form. The copyTo call is delegated to the form fields. Each form field than checks if its value was submitted as part of the form: If this is true, the object gets updated with the form field value. If this is false, the object will not be updated. This is the reason why you cannot copy values from one object into another object by using copyFrom(Object) and copyTo(Object) within the same request (e.g. by one call to a script or controller). **Parameters:** - `obj`: the object, which is updated from the form --- ### getChildCount **Signature:** `getChildCount() : Number` **Description:** Returns the number of elements in the form. **Returns:** the number of elements in the form. --- ### getError **Signature:** `getError() : String` **Description:** Returns a form-wide error message. If no error message is present the method returns null. **Returns:** a form-wide error message or null. --- ### getObject **Signature:** `getObject() : Object` **Description:** The object that was bound to this form group. **Returns:** the bound object. --- ### getSubmittedAction **Signature:** `getSubmittedAction() : FormAction` **Description:** Returns the action that was submitted with the last request. The action is set independent whether the form must be valid for this action. The method returns null if no action at all was submitted with the last request for this form group. **Returns:** the action that was submitted with the last request or null. --- ### getTriggeredAction **Signature:** `getTriggeredAction() : FormAction` **Description:** Returns the action that was triggered with the last request. An action is only marked as triggered if the constraints regarding form validation are meet. The method returns null if no action was marked as triggered. **Returns:** the action that was triggered with the last request. --- ``` -------------------------------------------------------------------------------- /src/tool-configs/system-object-tool-config.ts: -------------------------------------------------------------------------------- ```typescript import { GenericToolSpec, ToolExecutionContext } from '../core/handlers/base-handler.js'; import { ToolArguments } from '../core/handlers/base-handler.js'; import { ValidationHelpers, CommonValidations } from '../core/handlers/validation-helpers.js'; import { OCAPIClient } from '../clients/ocapi-client.js'; export const SYSTEM_OBJECT_TOOL_NAMES = [ 'get_system_object_definitions', 'get_system_object_definition', 'search_system_object_attribute_definitions', 'search_custom_object_attribute_definitions', 'search_site_preferences', 'search_system_object_attribute_groups', ] as const; export type SystemObjectToolName = typeof SYSTEM_OBJECT_TOOL_NAMES[number]; export const SYSTEM_OBJECT_TOOL_NAMES_SET = new Set<SystemObjectToolName>(SYSTEM_OBJECT_TOOL_NAMES); /** * Configuration for system object tools * Maps each tool to its validation, execution, and messaging logic */ export const SYSTEM_OBJECT_TOOL_CONFIG: Record<SystemObjectToolName, GenericToolSpec<ToolArguments, any>> = { get_system_object_definitions: { defaults: (args: ToolArguments) => args, validate: (_args: ToolArguments, _toolName: string) => { // No validation needed for list operation }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.ocapiClient as OCAPIClient; // Pass pagination parameters to the client const params = { start: args.start as number, count: args.count as number, select: args.select as string, }; // Remove undefined values to avoid sending them Object.keys(params).forEach(key => { if (params[key as keyof typeof params] === undefined) { delete params[key as keyof typeof params]; } }); return client.systemObjects.getSystemObjectDefinitions(Object.keys(params).length > 0 ? params : undefined); }, logMessage: (args: ToolArguments) => `Get system object definitions (start: ${args?.start ?? 0}, count: ${args?.count ?? 200})`, }, get_system_object_definition: { defaults: (args: ToolArguments) => args, validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('objectType'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.ocapiClient as OCAPIClient; return client.systemObjects.getSystemObjectDefinition(args.objectType as string); }, logMessage: (args: ToolArguments) => `Get system object definition for ${args?.objectType}`, }, search_system_object_attribute_definitions: { defaults: (args: ToolArguments) => ({ ...args, searchRequest: args.searchRequest ?? { query: { match_all_query: {} }, select: '(**)', count: 200, }, }), validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('objectType'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.ocapiClient as OCAPIClient; return client.systemObjects.searchSystemObjectAttributeDefinitions( args.objectType as string, args.searchRequest as any, ); }, logMessage: (args: ToolArguments) => `Search system object attributes for ${args?.objectType}`, }, search_custom_object_attribute_definitions: { defaults: (args: ToolArguments) => ({ ...args, searchRequest: args.searchRequest ?? { query: { match_all_query: {} }, count: 200, }, }), validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('objectType'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.ocapiClient as OCAPIClient; return client.systemObjects.searchCustomObjectAttributeDefinitions( args.objectType as string, args.searchRequest as any, ); }, logMessage: (args: ToolArguments) => `Search custom object attributes for ${args?.objectType}`, }, search_site_preferences: { defaults: (args: ToolArguments) => ({ ...args, instanceType: args.instanceType ?? 'sandbox', searchRequest: args.searchRequest ?? { query: { match_all_query: {} }, count: 200, }, options: args.options ?? { expand: 'value' }, }), validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('groupId'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.ocapiClient as OCAPIClient; return client.sitePreferences.searchSitePreferences( args.groupId as string, args.instanceType as string, args.searchRequest as any, args.options as any, ); }, logMessage: (args: ToolArguments) => `Search site preferences group ${args?.groupId}`, }, search_system_object_attribute_groups: { defaults: (args: ToolArguments) => ({ ...args, searchRequest: args.searchRequest ?? { query: { match_all_query: {} }, count: 200, }, }), validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('objectType'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.ocapiClient as OCAPIClient; return client.systemObjects.searchSystemObjectAttributeGroups( args.objectType as string, args.searchRequest as any, ); }, logMessage: (args: ToolArguments) => `Search attribute groups for ${args?.objectType}`, }, }; ``` -------------------------------------------------------------------------------- /docs/sfra/shipping.md: -------------------------------------------------------------------------------- ```markdown # SFRA Shipping Model ## Overview The Shipping model represents shipping information for a shipment in SFRA applications. It provides comprehensive shipping data including addresses, methods, product line items, and gift options for checkout and order processing. ## Constructor ```javascript function ShippingModel(shipment, address, customer, containerView) ``` Creates a Shipping model instance with complete shipping information. ### Parameters - `shipment` (dw.order.Shipment) - The default shipment of the current basket - `address` (Object) - The address to use to filter the shipping method list - `customer` (Object) - The current customer model - `containerView` (string) - The view of the product line items ('order' or 'basket') ## Properties ### UUID **Type:** string | null Unique identifier for the shipment. ### productLineItems **Type:** ProductLineItemsModel | null Product line items model containing all products in this shipment with detailed information. Created using `ProductLineItemsModel` (note the "Model" suffix). ### applicableShippingMethods **Type:** Array<Object> Array of shipping methods available for this shipment. Retrieved using `shippingHelpers.getApplicableShippingMethods(shipment, address)`. ### selectedShippingMethod **Type:** ShippingMethodModel | null Currently selected shipping method for this shipment, or null if none selected. ### shippingAddress **Type:** Object Shipping address for this shipment. Logic: - If shipment has address data (checked via `emptyAddress()` helper), uses `new AddressModel(shipment.shippingAddress).address` - Otherwise, uses the provided `address` parameter ### matchingAddressId **Type:** string | boolean ID of matching customer address, or false if no match found in customer's address book. ### isGift **Type:** boolean | null Indicates whether this shipment is marked as a gift. ### giftMessage **Type:** string | null Gift message for the shipment if it's marked as a gift. ## Helper Functions ### getProductLineItemsModel(shipment, containerView) Creates a product line items model for the shipment's products. **Parameters:** - `shipment` (dw.order.Shipment) - Target shipment - `containerView` (string) - View context **Returns:** ProductLineItemsModel | null ### getSelectedShippingMethod(shipment) Gets the selected shipping method for a shipment. **Parameters:** - `shipment` (dw.order.Shipment) - Target shipment **Returns:** ShippingMethodModel | null ### getShipmentUUID(shipment) Extracts the UUID from a shipment. **Parameters:** - `shipment` (dw.order.Shipment) - Target shipment **Returns:** string | null ### getAssociatedAddress(shipment, customer) Finds matching customer address for the shipping address. **Parameters:** - `shipment` (dw.order.Shipment) - Target shipment - `customer` (Object) - Customer model **Returns:** string | boolean - Matching address ID or false ### emptyAddress(shipment) Checks if the shipment has any address information populated. **Parameters:** - `shipment` (dw.order.Shipment) - Target shipment **Returns:** boolean - True if ANY of the address fields ['firstName', 'lastName', 'address1', 'address2', 'phone', 'city', 'postalCode', 'stateCode'] have values ## Address Handling The model provides flexible address handling: - **Address Population Check**: Uses `emptyAddress()` to check if shipment has address data - **Existing Address**: Uses `new AddressModel(shipment.shippingAddress).address` if address is populated - **Fallback Address**: Uses provided address parameter if shipment address is empty - **Address Matching**: Finds matching addresses in customer's address book using `isEquivalentAddress()` ## Usage Example ```javascript var ShippingModel = require('*/cartridge/models/shipping'); var BasketMgr = require('dw/order/BasketMgr'); var currentBasket = BasketMgr.getCurrentBasket(); var shipment = currentBasket.defaultShipment; var shippingAddress = getShippingAddress(); // Your address object var customer = req.currentCustomer; var shipping = new ShippingModel(shipment, shippingAddress, customer, 'basket'); // Access shipping information console.log('Shipment UUID: ' + shipping.UUID); console.log('Available methods: ' + shipping.applicableShippingMethods.length); if (shipping.selectedShippingMethod) { console.log('Selected: ' + shipping.selectedShippingMethod.displayName); } // Check address matching if (shipping.matchingAddressId) { console.log('Matches customer address: ' + shipping.matchingAddressId); } // Check for gift options if (shipping.isGift) { console.log('Gift message: ' + shipping.giftMessage); } // Access products in shipment (if productLineItems is not null) if (shipping.productLineItems) { shipping.productLineItems.items.forEach(function(item) { console.log(item.productName + ' x ' + item.quantity); }); } ``` ## Gift Functionality The model supports gift shipments: - **isGift** - Boolean flag for gift marking - **giftMessage** - Custom message for gift recipients - Integrates with gift wrapping and messaging features ## Notes - Handles both populated and empty shipping addresses with conditional logic - Integrates with `shippingHelpers.getApplicableShippingMethods()` for method calculation - Uses `AddressModel` for address formatting when shipment address exists - Provides address matching using `isEquivalentAddress()` for saved customer addresses - Supports gift functionality with boolean flags and message text - Works with both basket and order contexts via `containerView` parameter - Uses `ProductLineItemsModel` (with "Model" suffix) for line item information - All properties handle null shipments gracefully ## Related Models - **AddressModel** - Used for shipping address formatting - **ProductLineItemsModel** - Used for shipment products - **ShippingMethodModel** - Used for shipping method details - **Cart Model** - Uses shipping models for checkout - **Order Model** - Uses shipping models for order information ``` -------------------------------------------------------------------------------- /docs/dw_svc/Service.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.svc # Class Service ## Inheritance Hierarchy - Object - dw.svc.Service ## Description Base class of Services. A service represents a call-specific configuration. Any configuration set here is local to the currently executing call. ## Properties ### configuration **Type:** ServiceConfig (Read Only) The Service Configuration. ### credentialID **Type:** String The ID of the currently associated Credential. ### mock **Type:** boolean The status of whether this service is executing in mock mode. ### requestData **Type:** Object (Read Only) The property that stores the object returned by createRequest. ### response **Type:** Object (Read Only) The property that stores the object returned by the service. This property is only useful after the service call(Object...) completes, and is the same as the object inside the Result. ### throwOnError **Type:** boolean The status of whether this service will throw an error when encountering a problem. ### URL **Type:** String The current URL, excluding any custom query parameters. ## Constructor Summary ## Method Summary ### call **Signature:** `call(args : Object...) : Result` Invokes the service. ### getConfiguration **Signature:** `getConfiguration() : ServiceConfig` Returns the Service Configuration. ### getCredentialID **Signature:** `getCredentialID() : String` Returns the ID of the currently associated Credential. ### getRequestData **Signature:** `getRequestData() : Object` Returns the property that stores the object returned by createRequest. ### getResponse **Signature:** `getResponse() : Object` Returns the property that stores the object returned by the service. ### getURL **Signature:** `getURL() : String` Returns the current URL, excluding any custom query parameters. ### isMock **Signature:** `isMock() : boolean` Returns the status of whether this service is executing in mock mode. ### isThrowOnError **Signature:** `isThrowOnError() : boolean` Returns the status of whether this service will throw an error when encountering a problem. ### setCredentialID **Signature:** `setCredentialID(id : String) : Service` Override the Credential by the credential object with the given ID. ### setMock **Signature:** `setMock() : Service` Forces the mock mode to be enabled. ### setThrowOnError **Signature:** `setThrowOnError() : Service` Forces a Service to throw an error when there is a problem instead of returning a Result with non-OK status. ### setURL **Signature:** `setURL(url : String) : Service` Override the URL to the given value. ## Method Detail ## Method Details ### call **Signature:** `call(args : Object...) : Result` **Description:** Invokes the service. **Parameters:** - `args`: Arguments to pass. If there is a single argument and that argument is an array, then each item in the array will become a separate argument. For example, the following results in three separate arguments to the service: svc.call( [1,2,3] ) and is functionally equivalent to svc.call( 1, 2, 3 ) This can be avoided by explicitly forming a List, enclosing the array in another array, or by sending a second argument. The following will all send the array as a List in the first argument. svc.call( ArrayList([1,2,3]) ) svc.call( [[1,2,3]] ) svc.call( [1,2,3], "" ) Another option is to change the definition of the associated ServiceCallback.createRequest(Service, Object...) to accept an object instead, and pass the array as a field of that object: svc.call( { 'data': [1,2,3] } ) **Returns:** Result of the service. --- ### getConfiguration **Signature:** `getConfiguration() : ServiceConfig` **Description:** Returns the Service Configuration. **Returns:** Service Configuration. --- ### getCredentialID **Signature:** `getCredentialID() : String` **Description:** Returns the ID of the currently associated Credential. **Returns:** Credential Name. --- ### getRequestData **Signature:** `getRequestData() : Object` **Description:** Returns the property that stores the object returned by createRequest. **Returns:** Object returned by createRequest. --- ### getResponse **Signature:** `getResponse() : Object` **Description:** Returns the property that stores the object returned by the service. This property is only useful after the service call(Object...) completes, and is the same as the object inside the Result. **Returns:** Object returned by the service. --- ### getURL **Signature:** `getURL() : String` **Description:** Returns the current URL, excluding any custom query parameters. **Returns:** URL. --- ### isMock **Signature:** `isMock() : boolean` **Description:** Returns the status of whether this service is executing in mock mode. **Returns:** true for mock mode, false otherwise. --- ### isThrowOnError **Signature:** `isThrowOnError() : boolean` **Description:** Returns the status of whether this service will throw an error when encountering a problem. **Returns:** true to throw an error, false otherwise. --- ### setCredentialID **Signature:** `setCredentialID(id : String) : Service` **Description:** Override the Credential by the credential object with the given ID. If the URL is also overridden, that URL will continue to override the URL in this credential. **Parameters:** - `id`: Credential ID. It must exist. **Returns:** this Service. --- ### setMock **Signature:** `setMock() : Service` **Description:** Forces the mock mode to be enabled. **Returns:** this Service. --- ### setThrowOnError **Signature:** `setThrowOnError() : Service` **Description:** Forces a Service to throw an error when there is a problem instead of returning a Result with non-OK status. **Returns:** this Service. --- ### setURL **Signature:** `setURL(url : String) : Service` **Description:** Override the URL to the given value. Any query parameters (if applicable) will be appended to this URL. **Parameters:** - `url`: Force the URL to the given value. **Returns:** this Service. --- ``` -------------------------------------------------------------------------------- /docs/dw_util/Bytes.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.util # Class Bytes ## Inheritance Hierarchy - Object - dw.util.Bytes ## Description A simple immutable class representing an array of bytes, used for working with binary data in a scripting context. It acts as a view to ArrayBuffer. The buffer can be accessed through asUint8Array(). Limitation: The size of the resulting byte representation is limited by the quota api.jsArrayBufferSize that is defining the max size for a ArrayBuffer. ## Constants ### MAX_BYTES **Type:** Number = 10240L The maximum number of bytes that a Bytes object can represent == 10KB ## Properties ### length **Type:** Number (Read Only) The number of bytes represented by this object. ## Constructor Summary Bytes(arrayBufferOrView : Object) Construct a Bytes object from the given ArrayBuffer or view. Bytes(string : String) Construct a Bytes object from the given string using the default encoding. Bytes(string : String, encoding : String) Construct a Bytes object from the given string using the given encoding. ## Method Summary ### asUint8Array **Signature:** `asUint8Array() : Object` Returns a Uint8Array based on the ArrayBuffer used for this Bytes object. ### byteAt **Signature:** `byteAt(index : Number) : Number` Returns the value of the byte at position index as an integer. ### bytesAt **Signature:** `bytesAt(index : Number, length : Number) : Bytes` Return a new Bytes object containing the subsequence of this object's bytes specified by the index and length parameters. ### getLength **Signature:** `getLength() : Number` Returns the number of bytes represented by this object. ### intAt **Signature:** `intAt(index : Number) : Number` Absolute get method for reading a signed integer value (32 bit) in network byte order(= big endian). ### reverse **Signature:** `reverse() : Bytes` Return a new Bytes object which has the same bytes as this one in reverse order. ### shortAt **Signature:** `shortAt(index : Number) : Number` Absolute get method for reading a signed short value (16 bit) in network byte order(= big endian). ### toString **Signature:** `toString() : String` Constructs a new String by decoding this array of bytes using the default encoding. ### toString **Signature:** `toString(encoding : String) : String` Constructs a new String by decoding this array of bytes using the specified encoding. ## Constructor Detail ## Method Detail ## Method Details ### asUint8Array **Signature:** `asUint8Array() : Object` **Description:** Returns a Uint8Array based on the ArrayBuffer used for this Bytes object. Changes to the returned ArrayBuffer will be visible in the Bytes object. **API Versioned:** From version 21.2. **Returns:** A newly created Uint8Array based on the existing ArrayBuffer. --- ### byteAt **Signature:** `byteAt(index : Number) : Number` **Description:** Returns the value of the byte at position index as an integer. If index is out of range an exception is thrown. The byte is interpreted as signed and so the value returned will always be between -128 and +127. **Parameters:** - `index`: The index of the byte. **Returns:** The byte value at the specified index. **Throws:** IndexOutOfBoundsException - If the index argument is negative or not less than the length of this byte array. --- ### bytesAt **Signature:** `bytesAt(index : Number, length : Number) : Bytes` **Description:** Return a new Bytes object containing the subsequence of this object's bytes specified by the index and length parameters. The returned object is a new view onto the same data, no data is copied. **Parameters:** - `index`: The initial index for the new view, inclusive. - `length`: The number of bytes visible in the new view. **Returns:** a new Bytes object representing a subsequence of this Bytes object. **Throws:** ArrayIndexOutOfBoundsException - If index < 0 or index > getLength() or index + length > getLength() IllegalArgumentException - If length < 0 --- ### getLength **Signature:** `getLength() : Number` **Description:** Returns the number of bytes represented by this object. **Returns:** The number of bytes. --- ### intAt **Signature:** `intAt(index : Number) : Number` **Description:** Absolute get method for reading a signed integer value (32 bit) in network byte order(= big endian). **Parameters:** - `index`: The byte index at which to read the number. **Returns:** The read number. **Throws:** IndexOutOfBoundsException - If index is negative or not smaller than the number of bytes minus three. --- ### reverse **Signature:** `reverse() : Bytes` **Description:** Return a new Bytes object which has the same bytes as this one in reverse order. **Returns:** a new Bytes object representing the reverse of this Bytes object. --- ### shortAt **Signature:** `shortAt(index : Number) : Number` **Description:** Absolute get method for reading a signed short value (16 bit) in network byte order(= big endian). **Parameters:** - `index`: The byte index at which to read the number. **Returns:** The read number. **Throws:** IndexOutOfBoundsException - If index is negative or not smaller than the number of bytes minus one. --- ### toString **Signature:** `toString() : String` **Description:** Constructs a new String by decoding this array of bytes using the default encoding. Convenience for toString( "UTF-8" ). Limitation: The method is protected by the quota api.jsStringLength that prevents creation of too long strings. **Returns:** A String representing the decoded array of bytes. --- ### toString **Signature:** `toString(encoding : String) : String` **Description:** Constructs a new String by decoding this array of bytes using the specified encoding. Limitation: The method is protected by the quota api.jsStringLength that prevents creation of too long strings. **Parameters:** - `encoding`: The name of a supported encoding. **Returns:** A String representing the decoded array of bytes. **Throws:** IllegalArgumentException - If the named encoding is not supported. --- ``` -------------------------------------------------------------------------------- /docs/dw_order/ShippingLocation.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.order # Class ShippingLocation ## Inheritance Hierarchy - Object - dw.order.ShippingLocation ## Description Represents a specific location for a shipment. Note: this class allows access to sensitive personal and private information. Pay attention to appropriate legal and regulatory requirements related to this data. ## Properties ### address1 **Type:** String The shipping location's first address. ### address2 **Type:** String The shipping location's second address. ### city **Type:** String The shipping location's city. ### countryCode **Type:** String The shipping location's country code. ### postalCode **Type:** String The shipping location's postal code. ### postBox **Type:** String The shipping location's post box. ### stateCode **Type:** String The shipping location's state code. ### suite **Type:** String The shipping location's suite. ## Constructor Summary ShippingLocation() Constructs a new shipping location. ShippingLocation(address : CustomerAddress) Constructs a new shipping location and initializes it with the values of the specified address object. ShippingLocation(address : OrderAddress) Constructs a new shipping location and initializes it with the values of the specified address object. ## Method Summary ### getAddress1 **Signature:** `getAddress1() : String` Returns the shipping location's first address. ### getAddress2 **Signature:** `getAddress2() : String` Returns the shipping location's second address. ### getCity **Signature:** `getCity() : String` Returns the shipping location's city. ### getCountryCode **Signature:** `getCountryCode() : String` Returns the shipping location's country code. ### getPostalCode **Signature:** `getPostalCode() : String` Returns the shipping location's postal code. ### getPostBox **Signature:** `getPostBox() : String` Returns the shipping location's post box. ### getStateCode **Signature:** `getStateCode() : String` Returns the shipping location's state code. ### getSuite **Signature:** `getSuite() : String` Returns the shipping location's suite. ### setAddress1 **Signature:** `setAddress1(aValue : String) : void` Sets the shipping location's first address. ### setAddress2 **Signature:** `setAddress2(aValue : String) : void` Sets the shipping location's second address. ### setCity **Signature:** `setCity(aValue : String) : void` Sets the shipping location's city. ### setCountryCode **Signature:** `setCountryCode(aValue : String) : void` Sets the shipping location's country code. ### setPostalCode **Signature:** `setPostalCode(aValue : String) : void` Sets the shipping location's postal code. ### setPostBox **Signature:** `setPostBox(aValue : String) : void` Sets the shipping location's post box. ### setStateCode **Signature:** `setStateCode(aValue : String) : void` Sets the shipping location's state code. ### setSuite **Signature:** `setSuite(aValue : String) : void` Sets the shipping location's suite. ## Constructor Detail ## Method Detail ## Method Details ### getAddress1 **Signature:** `getAddress1() : String` **Description:** Returns the shipping location's first address. **Returns:** the shipping location's first address. --- ### getAddress2 **Signature:** `getAddress2() : String` **Description:** Returns the shipping location's second address. **Returns:** the shipping location's second address. --- ### getCity **Signature:** `getCity() : String` **Description:** Returns the shipping location's city. **Returns:** the shipping location's city. --- ### getCountryCode **Signature:** `getCountryCode() : String` **Description:** Returns the shipping location's country code. **Returns:** the shipping location's country code. --- ### getPostalCode **Signature:** `getPostalCode() : String` **Description:** Returns the shipping location's postal code. **Returns:** the shipping location's postal code. --- ### getPostBox **Signature:** `getPostBox() : String` **Description:** Returns the shipping location's post box. **Returns:** the shipping location's post box. --- ### getStateCode **Signature:** `getStateCode() : String` **Description:** Returns the shipping location's state code. **Returns:** the shipping location's state code. --- ### getSuite **Signature:** `getSuite() : String` **Description:** Returns the shipping location's suite. **Returns:** the shipping location's suite. --- ### setAddress1 **Signature:** `setAddress1(aValue : String) : void` **Description:** Sets the shipping location's first address. **Parameters:** - `aValue`: the shipping location's first address. --- ### setAddress2 **Signature:** `setAddress2(aValue : String) : void` **Description:** Sets the shipping location's second address. **Parameters:** - `aValue`: the shipping location's second address. --- ### setCity **Signature:** `setCity(aValue : String) : void` **Description:** Sets the shipping location's city. **Parameters:** - `aValue`: the shipping location's city. --- ### setCountryCode **Signature:** `setCountryCode(aValue : String) : void` **Description:** Sets the shipping location's country code. **Parameters:** - `aValue`: the shipping location's country code. --- ### setPostalCode **Signature:** `setPostalCode(aValue : String) : void` **Description:** Sets the shipping location's postal code. **Parameters:** - `aValue`: the shipping location's postal code. --- ### setPostBox **Signature:** `setPostBox(aValue : String) : void` **Description:** Sets the shipping location's post box. **Parameters:** - `aValue`: the shipping location's post box. --- ### setStateCode **Signature:** `setStateCode(aValue : String) : void` **Description:** Sets the shipping location's state code. **Parameters:** - `aValue`: the shipping location's state code. --- ### setSuite **Signature:** `setSuite(aValue : String) : void` **Description:** Sets the shipping location's suite. **Parameters:** - `aValue`: the shipping location's suite. --- ``` -------------------------------------------------------------------------------- /docs/dw_catalog/Recommendation.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.catalog # Class Recommendation ## Inheritance Hierarchy - Object - dw.object.PersistentObject - dw.object.ExtensibleObject - dw.catalog.Recommendation ## Description Represents a recommendation in Commerce Cloud Digital. ## Constants ### RECOMMENDATION_TYPE_CROSS_SELL **Type:** Number = 1 Represents a cross-sell recommendation. ### RECOMMENDATION_TYPE_OTHER **Type:** Number = 3 Represents a recommendation that is neither a cross-sell or an up-sell. ### RECOMMENDATION_TYPE_UP_SELL **Type:** Number = 2 Represents an up-sell recommendation. ## Properties ### calloutMsg **Type:** MarkupText (Read Only) The recommendation's callout message in the current locale. ### catalog **Type:** Catalog (Read Only) Return the catalog containing the recommendation. ### image **Type:** MediaFile (Read Only) The recommendation's image. ### longDescription **Type:** MarkupText (Read Only) The recommendation's long description in the current locale. ### name **Type:** String (Read Only) The name of the recommended item in the current locale. ### recommendationType **Type:** Number (Read Only) The type of the recommendation. ### recommendedItem **Type:** Object (Read Only) Return a reference to the recommended item. This will always be an object of type dw.catalog.Product since this is the only currently supported recommendation target type. ### recommendedItemID **Type:** String (Read Only) Return the ID of the recommended item. This will always be a product ID since this is the only currently supported recommendation target type. ### shortDescription **Type:** MarkupText (Read Only) The recommendation's short description in the current locale. ### sourceItem **Type:** Object (Read Only) Return a reference to the source item. This will be an object of type dw.catalog.Product or dw.catalog.Category. ### sourceItemID **Type:** String (Read Only) Return the ID of the recommendation source item. This will either be a product ID or category name. ## Constructor Summary ## Method Summary ### getCalloutMsg **Signature:** `getCalloutMsg() : MarkupText` Returns the recommendation's callout message in the current locale. ### getCatalog **Signature:** `getCatalog() : Catalog` Return the catalog containing the recommendation. ### getImage **Signature:** `getImage() : MediaFile` Returns the recommendation's image. ### getLongDescription **Signature:** `getLongDescription() : MarkupText` Returns the recommendation's long description in the current locale. ### getName **Signature:** `getName() : String` Returns the name of the recommended item in the current locale. ### getRecommendationType **Signature:** `getRecommendationType() : Number` Returns the type of the recommendation. ### getRecommendedItem **Signature:** `getRecommendedItem() : Object` Return a reference to the recommended item. ### getRecommendedItemID **Signature:** `getRecommendedItemID() : String` Return the ID of the recommended item. ### getShortDescription **Signature:** `getShortDescription() : MarkupText` Returns the recommendation's short description in the current locale. ### getSourceItem **Signature:** `getSourceItem() : Object` Return a reference to the source item. ### getSourceItemID **Signature:** `getSourceItemID() : String` Return the ID of the recommendation source item. ## Method Detail ## Method Details ### getCalloutMsg **Signature:** `getCalloutMsg() : MarkupText` **Description:** Returns the recommendation's callout message in the current locale. **Returns:** the recommendation's callout message in the current locale, or null if it wasn't found. --- ### getCatalog **Signature:** `getCatalog() : Catalog` **Description:** Return the catalog containing the recommendation. **Returns:** the catalog containing the recommendation. --- ### getImage **Signature:** `getImage() : MediaFile` **Description:** Returns the recommendation's image. **Returns:** the recommendation's image. --- ### getLongDescription **Signature:** `getLongDescription() : MarkupText` **Description:** Returns the recommendation's long description in the current locale. **Returns:** The recommendation's long description in the current locale, or null if it wasn't found. --- ### getName **Signature:** `getName() : String` **Description:** Returns the name of the recommended item in the current locale. **Returns:** The name of the recommended item for the current locale, or null if it wasn't found. --- ### getRecommendationType **Signature:** `getRecommendationType() : Number` **Description:** Returns the type of the recommendation. **Returns:** the type of the recommendation expressed as an integer. --- ### getRecommendedItem **Signature:** `getRecommendedItem() : Object` **Description:** Return a reference to the recommended item. This will always be an object of type dw.catalog.Product since this is the only currently supported recommendation target type. **Returns:** the recommended item, possibly null if the item does not exist. --- ### getRecommendedItemID **Signature:** `getRecommendedItemID() : String` **Description:** Return the ID of the recommended item. This will always be a product ID since this is the only currently supported recommendation target type. **Returns:** the recommended item ID. --- ### getShortDescription **Signature:** `getShortDescription() : MarkupText` **Description:** Returns the recommendation's short description in the current locale. **Returns:** the recommendations's short description in the current locale, or null if it wasn't found. --- ### getSourceItem **Signature:** `getSourceItem() : Object` **Description:** Return a reference to the source item. This will be an object of type dw.catalog.Product or dw.catalog.Category. **Returns:** the source item. --- ### getSourceItemID **Signature:** `getSourceItemID() : String` **Description:** Return the ID of the recommendation source item. This will either be a product ID or category name. **Returns:** the source item ID. --- ``` -------------------------------------------------------------------------------- /docs/dw_campaign/BonusChoiceDiscount.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.campaign # Class BonusChoiceDiscount ## Inheritance Hierarchy - Object - dw.campaign.Discount - dw.campaign.BonusChoiceDiscount ## Description Represents a choice of bonus products discount in the discount plan, for example "Choose 3 DVDs from a list of 20 options with your purchase of any DVD player." ## Properties ### bonusProducts **Type:** List (Read Only) Get the list of bonus products which the customer is allowed to choose from for this discount. This list is configured by a merchant entering a list of SKUs for the discount. Products which do not exist in the system, or are offline, or are not assigned to a category in the site catalog are filtered out. Unavailable (i.e. out-of-stock) products are NOT filtered out. This allows merchants to display out-of-stock bonus products with appropriate messaging. If a returned product is a master product, the customer is entitled to choose from any variant. If the product is an option product, the customer is entitled to choose any value for each option. Since the promotions engine does not touch the value of the product option line items, it is the responsibility of custom code to set option prices. If the promotion is rule based, then this method will return an empty list. A ProductSearchModel should be used to return the bonus products the customer may choose from instead. See ProductSearchModel.PROMOTION_PRODUCT_TYPE_BONUS and ProductSearchModel.setPromotionID(String) ### maxBonusItems **Type:** Number (Read Only) The maximum number of bonus items that a customer is entitled to select for this discount. ### ruleBased **Type:** ProductSearchModel (Static) (Read Only) Returns true if this is a "rule based" bonus choice discount. For such discounts, there is no static list of bonus products associated with the discount but rather a discounted product rule associated with the promotion which defines the bonus products. To retrieve the list of selectable bonus products for display in the storefront, it is necessary to search for the bonus products using the ProductSearchModel API since the method getBonusProducts() in this class will always return an empty list. Furthermore, for rule based bonus-choice discounts, getBonusProductPrice(Product) will always return a price of 0.00 for bonus products. ## Constructor Summary ## Method Summary ### getBonusProductPrice **Signature:** `getBonusProductPrice(product : Product) : Number` Get the effective price for the passed bonus product. ### getBonusProducts **Signature:** `getBonusProducts() : List` Get the list of bonus products which the customer is allowed to choose from for this discount. ### getMaxBonusItems **Signature:** `getMaxBonusItems() : Number` Returns the maximum number of bonus items that a customer is entitled to select for this discount. ### isRuleBased **Signature:** `isRuleBased() : boolean` Returns true if this is a "rule based" bonus choice discount. ## Method Detail ## Method Details ### getBonusProductPrice **Signature:** `getBonusProductPrice(product : Product) : Number` **Description:** Get the effective price for the passed bonus product. This is expected to be one of the products returned by getBonusProducts() with one exception: If a master product is configured as a bonus product, this implies that a customer may choose from any of its variants. In this case, it is allowed to pass in a variant to this method and a price will be returned. If the passed product is not a valid bonus product, this method throws an exception. **Parameters:** - `product`: The bonus product to retrieve a price for, must not be null. **Returns:** The price of the passed bonus product as a Number. --- ### getBonusProducts **Signature:** `getBonusProducts() : List` **Description:** Get the list of bonus products which the customer is allowed to choose from for this discount. This list is configured by a merchant entering a list of SKUs for the discount. Products which do not exist in the system, or are offline, or are not assigned to a category in the site catalog are filtered out. Unavailable (i.e. out-of-stock) products are NOT filtered out. This allows merchants to display out-of-stock bonus products with appropriate messaging. If a returned product is a master product, the customer is entitled to choose from any variant. If the product is an option product, the customer is entitled to choose any value for each option. Since the promotions engine does not touch the value of the product option line items, it is the responsibility of custom code to set option prices. If the promotion is rule based, then this method will return an empty list. A ProductSearchModel should be used to return the bonus products the customer may choose from instead. See ProductSearchModel.PROMOTION_PRODUCT_TYPE_BONUS and ProductSearchModel.setPromotionID(String) **Returns:** An ordered list of bonus products that the customer may choose from for this discount. --- ### getMaxBonusItems **Signature:** `getMaxBonusItems() : Number` **Description:** Returns the maximum number of bonus items that a customer is entitled to select for this discount. **Returns:** The maximum number of bonus items that this discount permits a customer to select. --- ### isRuleBased **Signature:** `isRuleBased() : boolean` **Description:** Returns true if this is a "rule based" bonus choice discount. For such discounts, there is no static list of bonus products associated with the discount but rather a discounted product rule associated with the promotion which defines the bonus products. To retrieve the list of selectable bonus products for display in the storefront, it is necessary to search for the bonus products using the ProductSearchModel API since the method getBonusProducts() in this class will always return an empty list. Furthermore, for rule based bonus-choice discounts, getBonusProductPrice(Product) will always return a price of 0.00 for bonus products. **Returns:** True if this is a rule-based bonus-choice discount, or false if this discount defines a simple static list of bonus products. --- ``` -------------------------------------------------------------------------------- /docs/dw_svc/HTTPServiceDefinition.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.svc # Class HTTPServiceDefinition ## Inheritance Hierarchy - Object - dw.svc.ServiceDefinition - dw.svc.HTTPServiceDefinition ## Description Represents an HTTP Service Definition. The HTTP Service will use the return value of the createRequest callback as the request body (if supported by the HTTP method). If this is an array of non-null HTTPRequestPart objects, then a multi-part request will be formed. Otherwise the object is converted to a String and used. See also XML.toXMLString() and JSON.stringify(Object), which must be explicitly called if needed. ## Properties ### authentication **Type:** String The authentication type. ### cachingTTL **Type:** Number The caching time to live value. ### encoding **Type:** String The request body encoding to declare. ### outFile **Type:** File The output file, or null if there is none. ### requestMethod **Type:** String The request method. ## Constructor Summary ## Method Summary ### addHeader **Signature:** `addHeader(name : String, val : String) : HTTPServiceDefinition` Adds an HTTP Header. ### addParam **Signature:** `addParam(name : String, val : String) : HTTPServiceDefinition` Adds a query parameter that will be appended to the URL. ### getAuthentication **Signature:** `getAuthentication() : String` Returns the authentication type. ### getCachingTTL **Signature:** `getCachingTTL() : Number` Returns the caching time to live value. ### getEncoding **Signature:** `getEncoding() : String` Returns the request body encoding to declare. ### getOutFile **Signature:** `getOutFile() : File` Returns the output file, or null if there is none. ### getRequestMethod **Signature:** `getRequestMethod() : String` Returns the request method. ### setAuthentication **Signature:** `setAuthentication(authentication : String) : HTTPServiceDefinition` Sets the type of authentication. ### setCachingTTL **Signature:** `setCachingTTL(ttl : Number) : HTTPServiceDefinition` Enables caching for GET requests. ### setEncoding **Signature:** `setEncoding(encoding : String) : HTTPServiceDefinition` Sets the encoding of the request body (if any). ### setOutFile **Signature:** `setOutFile(outFile : File) : HTTPServiceDefinition` Sets the output file in which to write the HTTP response body. ### setRequestMethod **Signature:** `setRequestMethod(requestMethod : String) : HTTPServiceDefinition` Sets the HTTP request method. ## Method Detail ## Method Details ### addHeader **Signature:** `addHeader(name : String, val : String) : HTTPServiceDefinition` **Description:** Adds an HTTP Header. **Parameters:** - `name`: Header name. - `val`: Header value. **Returns:** this HTTP Service Definition. --- ### addParam **Signature:** `addParam(name : String, val : String) : HTTPServiceDefinition` **Description:** Adds a query parameter that will be appended to the URL. **Parameters:** - `name`: Parameter name. - `val`: Parameter value. **Returns:** this HTTP Service Definition. --- ### getAuthentication **Signature:** `getAuthentication() : String` **Description:** Returns the authentication type. **Returns:** Authentication type. --- ### getCachingTTL **Signature:** `getCachingTTL() : Number` **Description:** Returns the caching time to live value. **Returns:** The caching time to live value in seconds. **See Also:** setCachingTTL(Number) --- ### getEncoding **Signature:** `getEncoding() : String` **Description:** Returns the request body encoding to declare. **Returns:** Request encoding. --- ### getOutFile **Signature:** `getOutFile() : File` **Description:** Returns the output file, or null if there is none. **Returns:** Output file or null. --- ### getRequestMethod **Signature:** `getRequestMethod() : String` **Description:** Returns the request method. **Returns:** HTTP Request method. --- ### setAuthentication **Signature:** `setAuthentication(authentication : String) : HTTPServiceDefinition` **Description:** Sets the type of authentication. Valid values include "BASIC" and "NONE". The default value is BASIC. **Parameters:** - `authentication`: Type of authentication. **Returns:** this HTTP Service Definition. --- ### setCachingTTL **Signature:** `setCachingTTL(ttl : Number) : HTTPServiceDefinition` **Description:** Enables caching for GET requests. This only caches status codes 2xx with a content length and size of less than 50k that are not immediately written to file. The URL and the user name are used as cache keys. The total size of cacheable content and the number of cached items is limited and automatically managed by the system. Cache control information sent by the remote server is ignored. Caching HTTP responses should be done very carefully. It is important to ensure that the response really depends only on the URL and doesn't contain any remote state information or time information which is independent of the URL. It is also important to verify that the application sends exactly the same URL multiple times. **Parameters:** - `ttl`: The time to live for the cached content in seconds. A value of 0 or less disables caching. **See Also:** HTTPClient.enableCaching(Number) --- ### setEncoding **Signature:** `setEncoding(encoding : String) : HTTPServiceDefinition` **Description:** Sets the encoding of the request body (if any). The default value is UTF-8. **Parameters:** - `encoding`: Encoding of the request body. **Returns:** this HTTP Service Definition. --- ### setOutFile **Signature:** `setOutFile(outFile : File) : HTTPServiceDefinition` **Description:** Sets the output file in which to write the HTTP response body. The default behavior is to not write a file. **Parameters:** - `outFile`: Output file, or null to disable. **Returns:** this HTTP Service Definition. --- ### setRequestMethod **Signature:** `setRequestMethod(requestMethod : String) : HTTPServiceDefinition` **Description:** Sets the HTTP request method. Valid values include GET, PUT, POST, and DELETE. The default value is POST. **Parameters:** - `requestMethod`: HTTP request method. **Returns:** this HTTP Service Definition. --- ``` -------------------------------------------------------------------------------- /docs/sfra/order.md: -------------------------------------------------------------------------------- ```markdown # SFRA Order Model ## Overview The Order model represents an order or basket in SFRA applications, providing comprehensive or## Helper Functions ### getCheckoutStepInformation(lineItemContainer) Returns checkout step completion status. **Parameters:** - `lineItemContainer` (dw.order.LineItemCtnr) - Order or basket **Returns:** Object - Checkout step status with shipping and billing completion flags ### getFirstProductLineItem(productLineItemsModel) Returns image information for the first product line item. **Parameters:** - `productLineItemsModel` (Object) - Product line items model **Returns:** Object | null - Object with imageURL, alt, and title properties, or null ### getAssociatedAddress(lineItemContainer, customer) Returns the matching address ID for a billing address. **Parameters:** - `lineItemContainer` (dw.order.LineItemCtnr) - Order or basket - `customer` (Object) - Customer model **Returns:** string | boolean - Matching shipment UUID or customer address ID, or false if no matchuding line items, totals, billing, shipping, and checkout step status. It's used for order confirmation pages, order history, and checkout processes. ## Constructor ```javascript function OrderModel(lineItemContainer, options) ``` Creates an Order model instance from a line item container (order or basket). ### Parameters - `lineItemContainer` (dw.order.LineItemCtnr) - Order or basket object - `options` (Object) - Configuration options including: - `config` (Object) - Configuration object with `numberOfLineItems` setting - `countryCode` (string) - Current request country code - `customer` (Object) - Customer object - `containerView` (string) - View context ('order' or 'basket') - `usingMultiShipping` (boolean) - Whether using multiple shipping addresses - `shippable` (boolean) - Whether order contains shippable items ## Properties ### resources **Type:** Object Resource strings for order-related messaging and labels. ### orderNumber **Type:** string | null The order number for completed orders, or null for baskets. ### creationDate **Type:** Date | null Date when the order was created, or null for baskets. ### orderEmail **Type:** string Customer email address associated with the order. ### orderStatus **Type:** Object | null Order status information, or null for baskets. ### usingMultiShipping **Type:** boolean Indicates whether the order uses multiple shipping addresses. ### shippable **Type:** boolean Indicates whether the order contains shippable items. ### priceTotal **Type:** string | null Formatted grand total amount from the totals model. ### productQuantityTotal **Type:** number | null Total quantity of all products in the order. ## Conditional Properties (when numberOfLineItems = '*') ### totals **Type:** TotalsModel Order totals including subtotals, taxes, shipping costs, and grand total. ### lineItemTotal **Type:** number | null Total number of line items in the order. ### steps **Type:** Object | null Checkout step information with completion status. ### items **Type:** ProductLineItemsModel Product line items model containing all order items with detailed product information. ### billing **Type:** BillingModel Billing information including billing address and payment methods. ### shipping **Type:** Array<Object> Array of shipping models containing shipping address and method information for each shipment. ## Conditional Properties (when numberOfLineItems = 'single') ### firstLineItem **Type:** Object | null Information about the first product line item including image details. ### shippedToFirstName **Type:** string First name from the first shipment's shipping address. ### shippedToLastName **Type:** string Last name from the first shipment's shipping address. ## Helper Functions ### getCheckoutStepInformation(lineItemContainer) Creates checkout step completion information. **Parameters:** - `lineItemContainer` (dw.order.LineItemCtnr) - Order or basket container **Returns:** Object - Checkout step status information ### getFirstProductLineItem(productLineItemsModel) Returns image information for the first product line item. **Parameters:** - `productLineItemsModel` (Object) - Product line items model **Returns:** Object | null - First item image information or null ### getAssociatedAddress(basket, customer) Returns the matching address ID for a billing address. **Parameters:** - `basket` (dw.order.Basket) - Customer's basket - `customer` (Object) - Customer model **Returns:** string | boolean - Matching address ID or false ## Usage Example ```javascript var OrderModel = require('*/cartridge/models/order'); var OrderMgr = require('dw/order/OrderMgr'); // For completed order var order = OrderMgr.getOrder('order-number'); var orderModel = new OrderModel(order, { numberOfLineItems: '*' }); // Access order properties console.log(orderModel.orderNumber); console.log(orderModel.totals.grandTotal); console.log(orderModel.billing.billingAddress); console.log(orderModel.items.length); // For checkout basket var currentBasket = BasketMgr.getCurrentBasket(); var checkoutModel = new OrderModel(currentBasket); console.log(checkoutModel.checkoutStep.shipping.iscompleted); ``` ## Configuration Options The model supports configuration through the options parameter: - **numberOfLineItems**: Controls how many line items to include - `'*'` - Include all line items (default) - Number - Include specific number of line items ## Notes - Works with both orders and baskets (line item containers) - Automatically determines checkout step completion status - Includes comprehensive totals with all discount calculations - Provides first line item image for order thumbnails - Handles multiple shipments with individual shipping information - All monetary values are properly formatted for display - Includes extensive localized resources for UI display ## Related Models - **TotalsModel** - Used for order total calculations - **ProductLineItemsModel** - Used for line item information - **BillingModel** - Used for billing information - **AddressModel** - Used for address formatting - **PaymentModel** - Used for payment information ``` -------------------------------------------------------------------------------- /tests/mcp/yaml/get-code-versions.docs-only.test.mcp.yml: -------------------------------------------------------------------------------- ```yaml # ================================================================================== # SFCC MCP Server - get_code_versions Tool YAML Tests (Docs-Only Mode) # Validates that code version tools are NOT available in docs-only mode # This tool requires SFCC credentials and should not be available without them # # Quick Test Commands: # aegis "tests/mcp/yaml/get-code-versions.docs-only.test.mcp.yml" --config "aegis.config.docs-only.json" --verbose # aegis query get_code_versions '{}' --config "aegis.config.docs-only.json" # ================================================================================== description: "get_code_versions tool docs-only mode tests - Tool unavailability validation" tests: # ================================================================================== # TOOL UNAVAILABILITY IN DOCS-ONLY MODE # ================================================================================== - it: "should NOT list get_code_versions tool in docs-only mode" request: jsonrpc: "2.0" id: "tool-not-available-docs" method: "tools/list" params: {} expect: response: jsonrpc: "2.0" id: "tool-not-available-docs" result: tools: match:arrayElements: match:partial: name: "match:type:string" description: "match:type:string" match:extractField: "tools.*.name" value: "match:not:arrayContains:get_code_versions" stderr: "toBeEmpty" # ================================================================================== # AUTHENTICATION ERROR TESTS (Tool Can Be Called But Returns Error) # ================================================================================== - it: "should return authentication error when calling get_code_versions in docs-only mode" request: jsonrpc: "2.0" id: "auth-error-default" method: "tools/call" params: name: "get_code_versions" arguments: {} expect: response: jsonrpc: "2.0" id: "auth-error-default" result: content: match:arrayElements: type: "text" text: "match:contains:OCAPI client not configured" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "1000ms" - it: "should return consistent error message for authentication failure" request: jsonrpc: "2.0" id: "auth-error-consistent" method: "tools/call" params: name: "get_code_versions" arguments: {} expect: response: jsonrpc: "2.0" id: "auth-error-consistent" result: content: match:arrayElements: type: "text" text: "match:regex:Error[\\s\\S]*OCAPI[\\s\\S]*not configured[\\s\\S]*" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "1000ms" # ================================================================================== # ERROR RESPONSE VALIDATION # ================================================================================== - it: "should return proper error structure in docs-only mode" request: jsonrpc: "2.0" id: "error-structure" method: "tools/call" params: name: "get_code_versions" arguments: {} expect: response: jsonrpc: "2.0" id: "error-structure" result: content: match:arrayElements: match:partial: type: "text" text: "match:type:string" isError: true stderr: "toBeEmpty" - it: "should handle parameters gracefully even when returning error" request: jsonrpc: "2.0" id: "error-with-params" method: "tools/call" params: name: "get_code_versions" arguments: extraParam: "ignored" expect: response: jsonrpc: "2.0" id: "error-with-params" result: content: match:arrayElements: type: "text" text: "match:contains:OCAPI client not configured" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "1000ms" # ================================================================================== # PERFORMANCE TESTS FOR ERROR RESPONSES # ================================================================================== - it: "should fail fast when credentials not available" request: jsonrpc: "2.0" id: "fail-fast" method: "tools/call" params: name: "get_code_versions" arguments: {} expect: response: jsonrpc: "2.0" id: "fail-fast" result: content: match:arrayElements: match:partial: type: "text" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "500ms" - it: "should maintain consistent error performance" request: jsonrpc: "2.0" id: "error-performance-consistency" method: "tools/call" params: name: "get_code_versions" arguments: {} expect: response: jsonrpc: "2.0" id: "error-performance-consistency" result: content: match:arrayElements: match:partial: type: "text" isError: true stderr: "toBeEmpty" performance: maxResponseTime: "800ms" # ================================================================================== # NEGATIVE TESTING - Invalid Tool Calls # ================================================================================== - it: "should handle invalid method calls gracefully" request: jsonrpc: "2.0" id: "invalid-method" method: "tools/call_invalid" params: name: "get_code_versions" arguments: {} expect: response: jsonrpc: "2.0" id: "invalid-method" error: code: "match:type:number" message: "match:type:string" stderr: "toBeEmpty" ``` -------------------------------------------------------------------------------- /docs-site/components/Layout.tsx: -------------------------------------------------------------------------------- ```typescript import React, { useState, useEffect } from 'react'; import { useLocation, Outlet } from 'react-router-dom'; import Sidebar from './Sidebar'; import OnThisPage from './OnThisPage'; import { TocItem } from '../types'; const Layout: React.FC = () => { const [toc, setToc] = useState<TocItem[]>([]); const [sidebarOpen, setSidebarOpen] = useState(false); const location = useLocation(); // Close sidebar on route change (mobile) useEffect(() => { setSidebarOpen(false); }, [location.pathname]); // Scroll restoration - scroll to top on route change or to specific element if hash is present useEffect(() => { // Only run on client side if (typeof window === 'undefined') return; const scrollToTarget = () => { let targetId = ''; // Check for hash fragment in location.hash if (location.hash) { targetId = location.hash.substring(1); // Remove the # symbol } // Check for URL-encoded hash (%23) in the pathname else if (location.pathname.includes('%23')) { const parts = location.pathname.split('%23'); if (parts.length > 1) { targetId = decodeURIComponent(parts[1]); } } if (targetId) { // If there's a target ID, try to scroll to that element const targetElement = document.getElementById(targetId); if (targetElement) { // Use multiple attempts with increasing delays to ensure DOM is ready const attemptScroll = (attempt = 0) => { const element = document.getElementById(targetId); if (element) { element.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }); } else if (attempt < 5) { // Retry up to 5 times with increasing delay setTimeout(() => attemptScroll(attempt + 1), (attempt + 1) * 100); } }; // Initial attempt with small delay setTimeout(() => attemptScroll(), 100); } else { // Element not found immediately, try again after content loads setTimeout(() => { const retryElement = document.getElementById(targetId); if (retryElement) { retryElement.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }); } }, 500); } } else { // No hash, scroll to top window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }); } }; scrollToTarget(); }, [location.pathname, location.hash]); useEffect(() => { // Only run on client side if (typeof window === 'undefined') return; // Use a small timeout to ensure the DOM has been updated with new content const timeoutId = setTimeout(() => { const mainContent = document.getElementById('main-content'); if (mainContent) { const headings = mainContent.querySelectorAll('h2'); const newToc: TocItem[] = Array.from(headings).map(heading => ({ id: heading.id, label: heading.textContent || '', level: 2, })); setToc(newToc); } }, 50); return () => clearTimeout(timeoutId); }, [location.pathname]); // Changed dependency to location.pathname return ( <div className="min-h-screen bg-white overflow-x-hidden"> {/* Mobile Header */} <header className="lg:hidden bg-white border-b border-slate-200 sticky top-0 z-50"> <div className="flex items-center justify-between px-4 py-3"> <div className="flex items-center gap-2 min-w-0"> <h1 className="text-xl font-bold text-slate-800">SFCC Dev</h1> <span className="text-xl font-light text-orange-500">MCP</span> <span className="text-xs text-slate-500 self-start mt-1">v1</span> </div> <button onClick={() => setSidebarOpen(!sidebarOpen)} className="p-2 text-slate-600 hover:text-slate-900 hover:bg-slate-100 rounded-md flex-shrink-0" aria-label="Toggle navigation" > <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" > {sidebarOpen ? ( <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" /> ) : ( <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" /> )} </svg> </button> </div> </header> {/* Mobile Sidebar Overlay */} {sidebarOpen && ( <div className="lg:hidden fixed inset-0 z-40 bg-black bg-opacity-50" onClick={() => setSidebarOpen(false)} /> )} <div className="relative flex min-h-screen overflow-x-hidden"> {/* Desktop Sidebar */} <div className="fixed top-0 left-0 h-full w-64 hidden lg:block bg-slate-50 border-r border-slate-200"> <Sidebar /> </div> {/* Mobile Sidebar */} <div className={`lg:hidden fixed top-0 left-0 h-full w-64 bg-slate-50 border-r border-slate-200 transform transition-transform duration-200 ease-in-out z-50 ${ sidebarOpen ? 'translate-x-0' : '-translate-x-full' }`}> <Sidebar /> </div> <div className="lg:pl-64 flex-1 min-w-0 max-w-full"> <div className="flex min-w-0 max-w-full"> <main id="main-content" className="flex-1 max-w-4xl mx-auto sm:p-4 lg:p-12 min-w-0 overflow-hidden"> <div className="prose prose-slate max-w-none min-w-0 break-words"> <Outlet /> </div> </main> <aside className="hidden xl:block w-64 flex-shrink-0"> <div className="fixed top-0 right-0 h-full w-64 p-8"> <OnThisPage items={toc} /> </div> </aside> </div> </div> </div> </div> ); }; export default Layout; ``` -------------------------------------------------------------------------------- /tests/mcp/yaml/get-latest-info.full-mode.test.mcp.yml: -------------------------------------------------------------------------------- ```yaml description: "get_latest_info tool tests - Access recent info-level log entries" tests: # ======================================== # CORE FUNCTIONALITY # ======================================== - it: "should get latest info entries with default parameters" request: jsonrpc: "2.0" id: "get-latest-info-default" method: "tools/call" params: name: "get_latest_info" arguments: {} expect: response: jsonrpc: "2.0" id: "get-latest-info-default" result: content: match:arrayElements: match:partial: type: "text" text: "match:contains:Latest" isError: false stderr: "toBeEmpty" - it: "should respect custom limit parameter" request: jsonrpc: "2.0" id: "get-latest-info-limit" method: "tools/call" params: name: "get_latest_info" arguments: limit: 3 expect: response: jsonrpc: "2.0" id: "get-latest-info-limit" result: content: match:arrayElements: match:partial: text: "match:contains:Latest 3 info messages" isError: false - it: "should contain INFO log level and log files" request: jsonrpc: "2.0" id: "get-latest-info-content" method: "tools/call" params: name: "get_latest_info" arguments: limit: 2 expect: response: jsonrpc: "2.0" id: "get-latest-info-content" result: content: match:arrayElements: match:partial: text: "match:contains:INFO" isError: false - it: "should format multiple entries with separators" request: jsonrpc: "2.0" id: "get-latest-info-separators" method: "tools/call" params: name: "get_latest_info" arguments: limit: 3 expect: response: jsonrpc: "2.0" id: "get-latest-info-separators" result: content: match:arrayElements: match:partial: text: "match:contains:---" isError: false # ======================================== # PARAMETER VALIDATION # ======================================== - it: "should return error for zero limit" request: jsonrpc: "2.0" id: "get-latest-info-zero-limit" method: "tools/call" params: name: "get_latest_info" arguments: limit: 0 expect: response: jsonrpc: "2.0" id: "get-latest-info-zero-limit" result: content: match:arrayElements: match:partial: text: "match:contains:Invalid limit '0'" isError: true - it: "should return error for negative limit" request: jsonrpc: "2.0" id: "get-latest-info-negative-limit" method: "tools/call" params: name: "get_latest_info" arguments: limit: -5 expect: response: jsonrpc: "2.0" id: "get-latest-info-negative-limit" result: content: match:arrayElements: match:partial: text: "match:contains:Invalid limit '-5'" isError: true - it: "should handle invalid limit type gracefully" request: jsonrpc: "2.0" id: "get-latest-info-invalid-limit" method: "tools/call" params: name: "get_latest_info" arguments: limit: "invalid" expect: response: jsonrpc: "2.0" id: "get-latest-info-invalid-limit" result: content: match:arrayElements: match:partial: text: "match:contains:Invalid limit 'invalid'" isError: true - it: "should handle invalid date gracefully" request: jsonrpc: "2.0" id: "get-latest-info-invalid-date" method: "tools/call" params: name: "get_latest_info" arguments: date: "invalid-date" limit: 3 expect: response: jsonrpc: "2.0" id: "get-latest-info-invalid-date" result: content: match:arrayElements: match:partial: text: "match:contains:No info log files found" isError: false # ======================================== # EDGE CASES # ======================================== - it: "should handle limit of 1" request: jsonrpc: "2.0" id: "get-latest-info-limit-one" method: "tools/call" params: name: "get_latest_info" arguments: limit: 1 expect: response: jsonrpc: "2.0" id: "get-latest-info-limit-one" result: content: match:arrayElements: match:partial: text: "match:contains:Latest 1 info messages" isError: false - it: "should handle large limit values" request: jsonrpc: "2.0" id: "get-latest-info-large-limit" method: "tools/call" params: name: "get_latest_info" arguments: limit: 100 expect: response: jsonrpc: "2.0" id: "get-latest-info-large-limit" result: content: match:arrayElements: match:partial: text: "match:contains:Latest 100 info messages" isError: false # ======================================== # PERFORMANCE VALIDATION # ======================================== - it: "should respond within reasonable time" request: jsonrpc: "2.0" id: "get-latest-info-perf" method: "tools/call" params: name: "get_latest_info" arguments: limit: 10 expect: response: jsonrpc: "2.0" id: "get-latest-info-perf" result: content: match:arrayElements: match:partial: type: "text" text: "match:type:string" isError: false performance: maxResponseTime: "800ms" ``` -------------------------------------------------------------------------------- /docs/dw_object/ObjectTypeDefinition.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.object # Class ObjectTypeDefinition ## Inheritance Hierarchy - Object - dw.object.ObjectTypeDefinition ## Description The class provides access to the meta data of a system object or custom object. A short example should suffice to demonstrate how this metadata can be used in a script: var co : CustomObject = CustomObjectMgr.getCustomObject("sample", "MyCustomObject"); // get the object type definition var typeDef : ObjectTypeDefinition = co.describe(); // get the custom object attribute definition for name "enumIntValue" var attrDef : ObjectAttributeDefinition = typeDef.getCustomAttributeDefinition( "enumIntValue" ); // get the collection of object attribute value definitions var valueDefs : Collection = attrDef.getValues(); // return function if there are no object attribute value definitions if(valueDefs.isEmpty()) { return; } var displayValue : String; // loop over object attribute value definitions collection for each ( var valueDef : ObjectAttributeValueDefinition in valueDefs ) { if( valueDef.getValue() == co.custom.intValue ) { displayValue = valueDef.getDisplayValue(); break; } } ## Properties ### attributeDefinitions **Type:** Collection (Read Only) A collection of all declared attributes for the object. The collection contains both system and custom attributes. There might be system and custom attribute with identical names. So the name of the attribute is not a uniqueness criteria. Additional the isCustom() flag must be checked. ### attributeGroups **Type:** Collection (Read Only) A collection of all declared attribute groups. A attribute group is a collection of attribute, which are typically displayed together as a visual group. ### displayName **Type:** String (Read Only) The display name of the definition, which can be used in the user interface. ### ID **Type:** String (Read Only) The type id of the business objects. ### system **Type:** boolean (Read Only) Identifies if this object definition is for a system type or a custom type. ## Constructor Summary ## Method Summary ### getAttributeDefinitions **Signature:** `getAttributeDefinitions() : Collection` Returns a collection of all declared attributes for the object. ### getAttributeGroup **Signature:** `getAttributeGroup(name : String) : ObjectAttributeGroup` Returns the attribute group with the given name within this object type definition. ### getAttributeGroups **Signature:** `getAttributeGroups() : Collection` Returns a collection of all declared attribute groups. ### getCustomAttributeDefinition **Signature:** `getCustomAttributeDefinition(name : String) : ObjectAttributeDefinition` Returns the custom attribute definition with the given name. ### getDisplayName **Signature:** `getDisplayName() : String` Returns the display name of the definition, which can be used in the user interface. ### getID **Signature:** `getID() : String` Returns the type id of the business objects. ### getSystemAttributeDefinition **Signature:** `getSystemAttributeDefinition(name : String) : ObjectAttributeDefinition` Returns the system attribute definition with the given name. ### isSystem **Signature:** `isSystem() : boolean` Identifies if this object definition is for a system type or a custom type. ## Method Detail ## Method Details ### getAttributeDefinitions **Signature:** `getAttributeDefinitions() : Collection` **Description:** Returns a collection of all declared attributes for the object. The collection contains both system and custom attributes. There might be system and custom attribute with identical names. So the name of the attribute is not a uniqueness criteria. Additional the isCustom() flag must be checked. **Returns:** a collection of all declared attributes for the object. --- ### getAttributeGroup **Signature:** `getAttributeGroup(name : String) : ObjectAttributeGroup` **Description:** Returns the attribute group with the given name within this object type definition. **Parameters:** - `name`: The name of the attribute scope to return. **Returns:** The matching attribute scope or null if no such scope exists. --- ### getAttributeGroups **Signature:** `getAttributeGroups() : Collection` **Description:** Returns a collection of all declared attribute groups. A attribute group is a collection of attribute, which are typically displayed together as a visual group. **Returns:** a collection of all declared attribute groups. --- ### getCustomAttributeDefinition **Signature:** `getCustomAttributeDefinition(name : String) : ObjectAttributeDefinition` **Description:** Returns the custom attribute definition with the given name. The method returns null if no custom attribute is defined with that name. **Parameters:** - `name`: The unique name of the custom attribute definition within the object type. **Returns:** The matching attribute definition or null in case no such definition exists. --- ### getDisplayName **Signature:** `getDisplayName() : String` **Description:** Returns the display name of the definition, which can be used in the user interface. **Returns:** the display name of the definition, which can be used in the user interface. --- ### getID **Signature:** `getID() : String` **Description:** Returns the type id of the business objects. **Returns:** the type id of the business objects. --- ### getSystemAttributeDefinition **Signature:** `getSystemAttributeDefinition(name : String) : ObjectAttributeDefinition` **Description:** Returns the system attribute definition with the given name. The method returns null if no system attribute is defined with that name. Only system objects have system attributes. A CustomObject has no system attributes and so the method will always return null for a CustomObject. **Parameters:** - `name`: The unique name of the custom attribute definition within the object type. **Returns:** The matching attribute definition or null in case no such definition exists. --- ### isSystem **Signature:** `isSystem() : boolean` **Description:** Identifies if this object definition is for a system type or a custom type. **Returns:** true if this object definition is for a system type, false otherwise. --- ``` -------------------------------------------------------------------------------- /docs/dw_util/Geolocation.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.util # Class Geolocation ## Inheritance Hierarchy - Object - dw.util.Geolocation ## Description Read-only class representing a position on the earth (latitude and longitude) and information associated with that location (e.g. country, city, etc). The Commerce Cloud Digital system can provide geolocation information for a Request and this information can be used in customer group segmentation rules. Note: This class is not related to the store locator API (i.e. the GetNearestStores pipelet) which uses a static set of store locations loaded into the system by the merchant. This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com. ## Properties ### available **Type:** boolean (Read Only) Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise. ### city **Type:** String (Read Only) Get the city name in English associated with this location. ### countryCode **Type:** String (Read Only) Get the ISO country code associated with this location. ### countryName **Type:** String (Read Only) Get the country name in English that the system associates with this location on the earth. ### latitude **Type:** Number (Read Only) Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0. ### longitude **Type:** Number (Read Only) Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0. ### metroCode **Type:** String (Read Only) Get the metro code associated with this location. ### postalCode **Type:** String (Read Only) Get the postal code associated with this location. ### regionCode **Type:** String (Read Only) Get the region (e.g. province or state) code for this location. ### regionName **Type:** String (Read Only) Get the region (e.g. province in state) name in English that the system associates with this location. ## Constructor Summary Geolocation(countryCode : String, countryName : String, regionCode : String, regionName : String, metroCode : String, city : String, postalCode : String, latitude : Number, longitude : Number) Constructor for a Geolocation object ## Method Summary ### getCity **Signature:** `getCity() : String` Get the city name in English associated with this location. ### getCountryCode **Signature:** `getCountryCode() : String` Get the ISO country code associated with this location. ### getCountryName **Signature:** `getCountryName() : String` Get the country name in English that the system associates with this location on the earth. ### getLatitude **Signature:** `getLatitude() : Number` Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0. ### getLongitude **Signature:** `getLongitude() : Number` Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0. ### getMetroCode **Signature:** `getMetroCode() : String` Get the metro code associated with this location. ### getPostalCode **Signature:** `getPostalCode() : String` Get the postal code associated with this location. ### getRegionCode **Signature:** `getRegionCode() : String` Get the region (e.g. ### getRegionName **Signature:** `getRegionName() : String` Get the region (e.g. ### isAvailable **Signature:** `isAvailable() : boolean` Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise. ## Constructor Detail ## Method Detail ## Method Details ### getCity **Signature:** `getCity() : String` **Description:** Get the city name in English associated with this location. **Returns:** the city that the system associates with this location on the earth. --- ### getCountryCode **Signature:** `getCountryCode() : String` **Description:** Get the ISO country code associated with this location. **Returns:** The two-character ISO 3166-1 alpha code for the country. --- ### getCountryName **Signature:** `getCountryName() : String` **Description:** Get the country name in English that the system associates with this location on the earth. **Returns:** the country name that the system associates with this location on the earth. --- ### getLatitude **Signature:** `getLatitude() : Number` **Description:** Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0. **Returns:** The latitude of the location as a floating point number. --- ### getLongitude **Signature:** `getLongitude() : Number` **Description:** Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0. **Returns:** The longitude of the location as a floating point number. --- ### getMetroCode **Signature:** `getMetroCode() : String` **Description:** Get the metro code associated with this location. **Returns:** The metro code of the location if the location is in the US. See the Google AdWords API for returned values. --- ### getPostalCode **Signature:** `getPostalCode() : String` **Description:** Get the postal code associated with this location. **Returns:** The postal code of the location. Postal codes are not available for all countries. In some countries, this will only contain part of the postal code. --- ### getRegionCode **Signature:** `getRegionCode() : String` **Description:** Get the region (e.g. province or state) code for this location. **Returns:** This is a string up to three characters long containing the subdivision portion of the code. --- ### getRegionName **Signature:** `getRegionName() : String` **Description:** Get the region (e.g. province in state) name in English that the system associates with this location. **Returns:** the region name that the system associates with this location on the earth. --- ### isAvailable **Signature:** `isAvailable() : boolean` **Description:** Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise. **Returns:** 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise. --- ``` -------------------------------------------------------------------------------- /docs/dw_crypto/Encoding.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.crypto # Class Encoding ## Inheritance Hierarchy - Object - dw.crypto.Encoding ## Description Utility class which handles several common character encodings. ## Constructor Summary ## Method Summary ### fromBase64 **Signature:** `static fromBase64(string : String) : Bytes` Decode the given string which represents a sequence of characters encoded in base-64 to a byte array. ### fromHex **Signature:** `static fromHex(string : String) : Bytes` Converts a String representing hexadecimal values into an array of bytes of those same values. ### fromURI **Signature:** `static fromURI(string : String) : String` Decodes a URL safe string into its original form. ### fromURI **Signature:** `static fromURI(string : String, encoding : String) : String` Decodes a URL safe string into its original form using the specified encoding. ### toBase64 **Signature:** `static toBase64(bytes : Bytes) : String` Convert the given byte array to a string encoded in base-64. ### toBase64URL **Signature:** `static toBase64URL(bytes : Bytes) : String` Convert the given byte array to a string encoded in base-64 for URLs. ### toHex **Signature:** `static toHex(bytes : Bytes) : String` Converts an array of bytes into a string representing the hexadecimal values of each byte in order. ### toURI **Signature:** `static toURI(string : String) : String` Encodes a string into its URL safe form according to the "application/x-www-form-urlencoded" encoding scheme using the default encoding. ### toURI **Signature:** `static toURI(string : String, encoding : String) : String` Encodes a string into its URL safe form according to the "application/x-www-form-urlencoded" encoding scheme using the specified encoding. ## Method Detail ## Method Details ### fromBase64 **Signature:** `static fromBase64(string : String) : Bytes` **Description:** Decode the given string which represents a sequence of characters encoded in base-64 to a byte array. This operation supports both the base-64 and base-64 for URL formats. Characters not in the base-64 alphabet are ignored. An exception is thrown if a null value is passed. Note: This decoding operation is limited to the maximum number of bytes that a Bytes object can hold. See Bytes. **Parameters:** - `string`: A string consisting of characters in base-64 alphabet to decode. **Returns:** The decoded array of bytes. --- ### fromHex **Signature:** `static fromHex(string : String) : Bytes` **Description:** Converts a String representing hexadecimal values into an array of bytes of those same values. The returned byte array will be half the length of the passed, as it takes two characters to represent any given byte. An exception is thrown if the passed string has an odd number of character or if any characters in the string are not valid hexadecimal characters. An exception is thrown if a null value is passed. Note: This decoding operation is limited to the maximum number of bytes that a Bytes object can hold. See Bytes. **Parameters:** - `string`: A string containing only hex characters to decode. **Returns:** The decoded array of bytes. --- ### fromURI **Signature:** `static fromURI(string : String) : String` **Description:** Decodes a URL safe string into its original form. Escaped characters are converted back to their original representation. An exception is thrown if URL decoding is unsuccessful or if null is passed. **Parameters:** - `string`: The string to decode. **Returns:** The decoded string. --- ### fromURI **Signature:** `static fromURI(string : String, encoding : String) : String` **Description:** Decodes a URL safe string into its original form using the specified encoding. Escaped characters are converted back to their original representation. An exception is thrown if URL decoding is unsuccessful or if the specified encoding is unsupported or if null is passed for either argument. **Parameters:** - `string`: The string to decode. - `encoding`: The name of a supported encoding. **Returns:** The decoded string. --- ### toBase64 **Signature:** `static toBase64(bytes : Bytes) : String` **Description:** Convert the given byte array to a string encoded in base-64. This method does not chunk the data by adding line breaks. An exception is thrown if a null value is passed. **Parameters:** - `bytes`: The array of bytes to encode. **Returns:** The encoded string containing only Base64 characters. --- ### toBase64URL **Signature:** `static toBase64URL(bytes : Bytes) : String` **Description:** Convert the given byte array to a string encoded in base-64 for URLs. This method does not chunk the data by adding line breaks and it does not add any padding. An exception is thrown if a null value is passed. **Parameters:** - `bytes`: The array of bytes to encode. **Returns:** The encoded string containing only Base64URL characters. --- ### toHex **Signature:** `static toHex(bytes : Bytes) : String` **Description:** Converts an array of bytes into a string representing the hexadecimal values of each byte in order. The returned string will be double the length of the passed array, as it takes two characters to represent any given byte. An exception is thrown if a null value is passed. **Parameters:** - `bytes`: The array of bytes to encode. **Returns:** The encoded string containing only hex characters. --- ### toURI **Signature:** `static toURI(string : String) : String` **Description:** Encodes a string into its URL safe form according to the "application/x-www-form-urlencoded" encoding scheme using the default encoding. Unsafe characters are escaped. An exception is thrown if a null value is passed. **Parameters:** - `string`: The string to encode. **Returns:** The encoded string. --- ### toURI **Signature:** `static toURI(string : String, encoding : String) : String` **Description:** Encodes a string into its URL safe form according to the "application/x-www-form-urlencoded" encoding scheme using the specified encoding. Unsafe characters are escaped. An exception is thrown if the specified encoding is unsupported. An exception is thrown if either argument is null. **Parameters:** - `string`: The string to encode. - `encoding`: The name of a supported encoding. **Returns:** The encoded string. --- ``` -------------------------------------------------------------------------------- /docs/dw_order/CouponLineItem.md: -------------------------------------------------------------------------------- ```markdown ## Package: dw.order # Class CouponLineItem ## Inheritance Hierarchy - Object - dw.object.PersistentObject - dw.object.ExtensibleObject - dw.order.CouponLineItem ## Description The CouponLineItem class is used to store redeemed coupons in the Basket. ## Properties ### applied **Type:** boolean (Read Only) Identifies if the coupon is currently applied in the basket. A coupon line is applied if there exists at least one price adjustment related to the coupon line item. ### basedOnCampaign **Type:** boolean (Read Only) Returns true if the line item represents a coupon of a campaign. If the coupon line item represents a custom coupon code, the method returns false. ### bonusDiscountLineItems **Type:** Collection (Read Only) The bonus discount line items of the line item container triggered by this coupon. ### couponCode **Type:** String (Read Only) The coupon code. ### priceAdjustments **Type:** Collection (Read Only) The price adjustments of the line item container triggered by this coupon. ### promotion **Type:** Promotion (Read Only) The promotion related to the coupon line item. ### promotionID **Type:** String (Read Only) The id of the related promotion. ### statusCode **Type:** String (Read Only) This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid. ### valid **Type:** CouponStatusCodes.APPLIED (Read Only) Allows to check whether the coupon code of this coupon line item instance is valid. Coupon line item is valid, if status code is one of the following: CouponStatusCodes.APPLIED CouponStatusCodes.NO_APPLICABLE_PROMOTION ## Constructor Summary ## Method Summary ### associatePriceAdjustment **Signature:** `associatePriceAdjustment(priceAdjustment : PriceAdjustment) : void` Associates the specified price adjustment with the coupon line item. ### getBonusDiscountLineItems **Signature:** `getBonusDiscountLineItems() : Collection` Returns the bonus discount line items of the line item container triggered by this coupon. ### getCouponCode **Signature:** `getCouponCode() : String` Returns the coupon code. ### getPriceAdjustments **Signature:** `getPriceAdjustments() : Collection` Returns the price adjustments of the line item container triggered by this coupon. ### getPromotion **Signature:** `getPromotion() : Promotion` Returns the promotion related to the coupon line item. ### getPromotionID **Signature:** `getPromotionID() : String` Returns the id of the related promotion. ### getStatusCode **Signature:** `getStatusCode() : String` This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid. ### isApplied **Signature:** `isApplied() : boolean` Identifies if the coupon is currently applied in the basket. ### isBasedOnCampaign **Signature:** `isBasedOnCampaign() : boolean` Returns true if the line item represents a coupon of a campaign. ### isValid **Signature:** `isValid() : boolean` Allows to check whether the coupon code of this coupon line item instance is valid. ## Method Detail ## Method Details ### associatePriceAdjustment **Signature:** `associatePriceAdjustment(priceAdjustment : PriceAdjustment) : void` **Description:** Associates the specified price adjustment with the coupon line item. This method is only applicable if used for price adjustments and coupon line items NOT based on B2C Commerce campaigns. **Parameters:** - `priceAdjustment`: Price adjustment to be associated with coupon line item. --- ### getBonusDiscountLineItems **Signature:** `getBonusDiscountLineItems() : Collection` **Description:** Returns the bonus discount line items of the line item container triggered by this coupon. **Returns:** Price adjustments triggered by the coupon --- ### getCouponCode **Signature:** `getCouponCode() : String` **Description:** Returns the coupon code. **Returns:** Coupon code --- ### getPriceAdjustments **Signature:** `getPriceAdjustments() : Collection` **Description:** Returns the price adjustments of the line item container triggered by this coupon. **Returns:** Price adjustments triggered by the coupon --- ### getPromotion **Signature:** `getPromotion() : Promotion` **Description:** Returns the promotion related to the coupon line item. **Deprecated:** A coupon code and its coupon can be associated with multiple promotions. Therefore, this method is not appropriate anymore. For backward-compatibility, the method returns one of the promotions associated with the coupon code. **Returns:** Promotion related to coupon represented by line item --- ### getPromotionID **Signature:** `getPromotionID() : String` **Description:** Returns the id of the related promotion. **Deprecated:** A coupon code and it's coupon can be associated with multiple promotions. Therefore, this method is not appropriate anymore. For backward-compatibility, the method returns the ID of one of the promotions associated with the coupon code. **Returns:** the id of the related promotion. --- ### getStatusCode **Signature:** `getStatusCode() : String` **Description:** This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid. **Returns:** Returns APPLIED if coupon is applied, and otherwise one of the codes defined in CouponStatusCodes --- ### isApplied **Signature:** `isApplied() : boolean` **Description:** Identifies if the coupon is currently applied in the basket. A coupon line is applied if there exists at least one price adjustment related to the coupon line item. **Returns:** true if the coupon is currently applied in the basket. --- ### isBasedOnCampaign **Signature:** `isBasedOnCampaign() : boolean` **Description:** Returns true if the line item represents a coupon of a campaign. If the coupon line item represents a custom coupon code, the method returns false. --- ### isValid **Signature:** `isValid() : boolean` **Description:** Allows to check whether the coupon code of this coupon line item instance is valid. Coupon line item is valid, if status code is one of the following: CouponStatusCodes.APPLIED CouponStatusCodes.NO_APPLICABLE_PROMOTION **Returns:** true if the coupon code is valid, false otherwise. --- ``` -------------------------------------------------------------------------------- /tests/servers/sfcc-mock-server/mock-data/ocapi/system-object-attributes-product.json: -------------------------------------------------------------------------------- ```json { "_v": "23.2", "_type": "object_attribute_definition_search_result", "count": 20, "hits": [ { "_type": "object_attribute_definition", "_resource_state": "47de03c012d48eee975077f45131088fe24f34660ecf4dc69de5737257836fda", "id": "EAN", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/EAN" }, { "_type": "object_attribute_definition", "_resource_state": "d9215260b911efb2f40c78cb1b9a7134feca85bf429a9462371db6a16d22e456", "id": "ID", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/ID" }, { "_type": "object_attribute_definition", "_resource_state": "5d41eb23dc9228d397af90560aaa1b8b0ff825e6d8699a56977366d3534c5cc6", "id": "UPC", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/UPC" }, { "_type": "object_attribute_definition", "_resource_state": "461201495377a8c0e50340bbce3ce929cecfbb74022d1ba87ff3bfeb2501b295", "id": "UUID", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/UUID" }, { "_type": "object_attribute_definition", "_resource_state": "94d3911611a738b687448c2742b6b61216925f45e60627906e871da0d752f35b", "id": "Wool", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/Wool" }, { "_type": "object_attribute_definition", "_resource_state": "f3714641f6cd57c36db45c8976a743e21dafdb52d753ea67013ef9a9209488f3", "id": "available", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/available" }, { "_type": "object_attribute_definition", "_resource_state": "5945247ee819586780982084e8099326c6cc04499492ff82f8603ecb224172d0", "id": "availableForInStorePickup", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/availableForInStorePickup" }, { "_type": "object_attribute_definition", "_resource_state": "835703bec9a082f3525872afaa1d371c985c70359812e1e4a751fb2d9b200df6", "id": "batteryLife", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/batteryLife" }, { "_type": "object_attribute_definition", "_resource_state": "c9b45424b52db1a01c9bcd6f2ae1919fe6a2262c3cb28ea2fbfb02324e5455b5", "id": "batteryType", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/batteryType" }, { "_type": "object_attribute_definition", "_resource_state": "725a285570d393052705c7cec8cdc689b808a455ab269a79eba2b9b945b79b5b", "id": "bootType", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/bootType" }, { "_type": "object_attribute_definition", "_resource_state": "d9c7203446e6892ca1359b6db401418f7de92065ee5a117cc3e3d7dfeef89cfc", "id": "bottomType", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/bottomType" }, { "_type": "object_attribute_definition", "_resource_state": "aa8ad7704c3818641e179362b17cdca0b56a411e0b0c2bbcd99689bc54193554", "id": "brand", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/brand" }, { "_type": "object_attribute_definition", "_resource_state": "503a227e5ed4449c29e36df3d093f000f5da55a8c3f15d50136e3a6371a0aa0a", "id": "color", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/color" }, { "_type": "object_attribute_definition", "_resource_state": "899c76f81068c25aa2ed6f38087f3247cd6452c4633bf1c261e608e21fda838f", "id": "consoleWarranty", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/consoleWarranty" }, { "_type": "object_attribute_definition", "_resource_state": "004d9acfb27ca3e2fa335ae09c02a07fd6c060c140e58ce2e6e4aa915d2afcd0", "id": "creationDate", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/creationDate" }, { "_type": "object_attribute_definition", "_resource_state": "dacb68edca840f891239ee0b21c3f49a837868a1711b7a1eaf62e4d33e468214", "id": "customCSSFile", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/customCSSFile" }, { "_type": "object_attribute_definition", "_resource_state": "743064fb382bc45d6af651418323da1cca6b7224a852267e2484fc68e442d496", "id": "digitalCameraFeatures", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/digitalCameraFeatures" }, { "_type": "object_attribute_definition", "_resource_state": "afc1313f41b50bfd537bae069415cfb31b04075fd03cae98a2983a3a13a31372", "id": "digitalCameraPixels", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/digitalCameraPixels" }, { "_type": "object_attribute_definition", "_resource_state": "94726ddc9bb160d07151aa07311b1bddea4caead2be714b6c658830faa60019b", "id": "digitalCameraType", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/digitalCameraType" }, { "_type": "object_attribute_definition", "_resource_state": "127032df7c9398dfa107757c42579619096b8864874fa63f60a1852487068bee", "id": "digitalCameraWarranty", "link": "https://localhost:3000/s/-/dw/data/v23_2/system_object_definitions/Product/attribute_definitions/digitalCameraWarranty" } ], "next": { "_type": "result_page", "count": 20, "start": 20 }, "query": { "match_all_query": { "_type": "match_all_query" } }, "start": 0, "total": 113 } ```