@salesforce/b2c-tooling-sdk 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/content-schemas/componenttype.json +79 -17
- package/data/content-schemas/pagetype.json +4 -0
- package/data/content-schemas/regiondefinition.json +1 -0
- package/data/guides/enrichment.json +11264 -0
- package/data/guides/index.json +15166 -0
- package/data/job-steps/CatalogDeltaExport.md +31 -0
- package/data/job-steps/CreateSitemap.md +22 -0
- package/data/job-steps/CustomerListsDeltaExport.md +30 -0
- package/data/job-steps/DownloadActiveDataFromStorage.md +24 -0
- package/data/job-steps/ExecuteCategorizationRules.md +25 -0
- package/data/job-steps/ExecuteDataReplication.md +24 -0
- package/data/job-steps/ExecutePipeline.md +24 -0
- package/data/job-steps/ExecutePreconfiguredCodeReplicationProcess.md +24 -0
- package/data/job-steps/ExecutePreconfiguredDataReplicationProcess.md +24 -0
- package/data/job-steps/ExecuteScriptModule.md +27 -0
- package/data/job-steps/ExportABTests.md +30 -0
- package/data/job-steps/ExportAssignments.md +30 -0
- package/data/job-steps/ExportCatalog.md +37 -0
- package/data/job-steps/ExportContent.md +31 -0
- package/data/job-steps/ExportContentSlots.md +30 -0
- package/data/job-steps/ExportCouponCodes.md +33 -0
- package/data/job-steps/ExportCoupons.md +30 -0
- package/data/job-steps/ExportCustomObjects.md +31 -0
- package/data/job-steps/ExportCustomerGroups.md +30 -0
- package/data/job-steps/ExportCustomerList.md +31 -0
- package/data/job-steps/ExportCustomers.md +30 -0
- package/data/job-steps/ExportFacebookFeed.md +26 -0
- package/data/job-steps/ExportGiftCertificates.md +30 -0
- package/data/job-steps/ExportInventoryLists.md +31 -0
- package/data/job-steps/ExportMetaData.md +32 -0
- package/data/job-steps/ExportOrders.md +42 -0
- package/data/job-steps/ExportPageLocalization.md +34 -0
- package/data/job-steps/ExportPriceBook.md +31 -0
- package/data/job-steps/ExportProductLists.md +34 -0
- package/data/job-steps/ExportPromotions.md +30 -0
- package/data/job-steps/ExportShippingMethods.md +30 -0
- package/data/job-steps/ExportSourceCodeGroups.md +30 -0
- package/data/job-steps/ExportStores.md +31 -0
- package/data/job-steps/ExportTaxTable.md +30 -0
- package/data/job-steps/ImportABTests.md +34 -0
- package/data/job-steps/ImportActiveData.md +33 -0
- package/data/job-steps/ImportAssignments.md +34 -0
- package/data/job-steps/ImportCatalog.md +34 -0
- package/data/job-steps/ImportContent.md +34 -0
- package/data/job-steps/ImportContentSlots.md +34 -0
- package/data/job-steps/ImportCouponCodeRedemptions.md +34 -0
- package/data/job-steps/ImportCoupons.md +34 -0
- package/data/job-steps/ImportCustomObjects.md +34 -0
- package/data/job-steps/ImportCustomerGroups.md +34 -0
- package/data/job-steps/ImportCustomerList.md +34 -0
- package/data/job-steps/ImportCustomerLists.md +34 -0
- package/data/job-steps/ImportCustomers.md +34 -0
- package/data/job-steps/ImportGiftCertificates.md +34 -0
- package/data/job-steps/ImportInventoryLists.md +35 -0
- package/data/job-steps/ImportKeyValueMapping.md +35 -0
- package/data/job-steps/ImportPageLocalization.md +34 -0
- package/data/job-steps/ImportPriceBook.md +34 -0
- package/data/job-steps/ImportProductLists.md +34 -0
- package/data/job-steps/ImportPromotions.md +34 -0
- package/data/job-steps/ImportShippingMethods.md +34 -0
- package/data/job-steps/ImportSiteArchive.md +30 -0
- package/data/job-steps/ImportSourceCodeGroups.md +34 -0
- package/data/job-steps/ImportStores.md +34 -0
- package/data/job-steps/ImportTaxTable.md +34 -0
- package/data/job-steps/IncludeStepsFromJob.md +24 -0
- package/data/job-steps/InvalidateCache.md +26 -0
- package/data/job-steps/LibraryDeltaExport.md +30 -0
- package/data/job-steps/SearchReindex.md +27 -0
- package/data/job-steps/SiteExport.md +32 -0
- package/data/job-steps/UndoPreconfiguredCodeReplicationProcess.md +24 -0
- package/data/job-steps/UndoPreconfiguredDataReplicationProcess.md +24 -0
- package/data/job-steps/UpdateStorefrontURLs.md +22 -0
- package/data/job-steps/UploadActiveDataBackupToStorage.md +22 -0
- package/data/job-steps/UploadActiveDataToStorage.md +24 -0
- package/data/job-steps/index.json +496 -0
- package/data/job-steps/job-steps.json +2910 -0
- package/data/job-steps/job-steps.md +96 -0
- package/data/script-api/TopLevel.APIException.md +1 -1
- package/data/script-api/dw.catalog.CatalogMgr.md +8 -2
- package/data/script-api/dw.crypto.Cipher.md +5 -1
- package/data/script-api/dw.customer.Profile.md +45 -0
- package/data/script-api/dw.customer.consent.ConsentStatusEntry.md +92 -0
- package/data/script-api/dw.customer.consent.MarketingConsentSubscription.md +247 -0
- package/data/script-api/dw.customer.consent.ShopperConsentErrorCodes.md +74 -0
- package/data/script-api/dw.customer.consent.ShopperConsentException.md +63 -0
- package/data/script-api/dw.customer.consent.ShopperConsentMgr.md +152 -0
- package/data/script-api/dw.customer.consent.md +10 -0
- package/data/script-api/dw.extensions.payments.SalesforcePaymentsHooks.md +24 -0
- package/data/script-api/dw.extensions.payments.SalesforcePaymentsSiteConfiguration.md +76 -0
- package/data/script-api/dw.object.CustomAttributes.md +72 -29
- package/data/script-api/dw.object.md +1 -1
- package/data/script-api/dw.order.Basket.md +3 -2
- package/data/script-api/dw.order.GiftCertificateLineItem.md +1 -1
- package/data/script-api/dw.order.LineItem.md +88 -0
- package/data/script-api/dw.order.LineItemCtnr.md +41 -11
- package/data/script-api/dw.order.LineItemTax.md +142 -0
- package/data/script-api/dw.order.OrderMgr.md +8 -0
- package/data/script-api/dw.order.PriceAdjustment.md +1 -1
- package/data/script-api/dw.order.ProductLineItem.md +1 -1
- package/data/script-api/dw.order.ProductShippingLineItem.md +1 -1
- package/data/script-api/dw.order.Shipment.md +12 -4
- package/data/script-api/dw.order.ShippingLineItem.md +1 -1
- package/data/script-api/dw.order.TaxMgr.md +54 -0
- package/data/script-api/dw.order.hooks.TaxHooks.md +495 -0
- package/data/script-api/dw.order.hooks.md +1 -0
- package/data/script-api/dw.order.md +1 -0
- package/data/script-api/dw.sitemap.SitemapFile.md +1 -1
- package/data/script-api/dw.sitemap.SitemapMgr.md +23 -0
- package/data/script-api/dw.system.Request.md +0 -1
- package/data/script-api/dw.util.Assert.md +29 -0
- package/data/script-api/dw.util.Locale.md +5 -2
- package/data/script-api/dw.web.Cookie.md +0 -6
- package/data/script-api/dw.web.PageMetaTag.md +25 -1
- package/data/script-api/dw.ws.WSUtil.md +2 -2
- package/data/script-api/index.json +2192 -37
- package/data/script-api/index.md +2 -1
- package/data/tooling/index.json +222 -0
- package/data/xsd/commercefeaturestate.xsd +1 -0
- package/data/xsd/customer.xsd +11 -0
- package/data/xsd/eventrouting.xsd +257 -0
- package/data/xsd/index.json +6 -2
- package/data/xsd/order.xsd +53 -0
- package/data/xsd/store.xsd +8 -0
- package/data/xsd/storefronts.xsd +57 -1
- package/dist/esm/auth/client-credentials.d.ts +27 -0
- package/dist/esm/auth/client-credentials.js +60 -0
- package/dist/esm/auth/client-credentials.js.map +1 -0
- package/dist/esm/auth/index.d.ts +1 -0
- package/dist/esm/auth/index.js +2 -0
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/auth/oauth.js +2 -1
- package/dist/esm/auth/oauth.js.map +1 -1
- package/dist/esm/cli/base-command.d.ts +40 -0
- package/dist/esm/cli/base-command.js +66 -5
- package/dist/esm/cli/base-command.js.map +1 -1
- package/dist/esm/cli/index.d.ts +2 -2
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/instance-command.d.ts +1 -1
- package/dist/esm/cli/instance-command.js +5 -3
- package/dist/esm/cli/instance-command.js.map +1 -1
- package/dist/esm/cli/oauth-command.d.ts +1 -1
- package/dist/esm/cli/oauth-command.js +5 -3
- package/dist/esm/cli/oauth-command.js.map +1 -1
- package/dist/esm/cli/ods-command.d.ts +1 -1
- package/dist/esm/cli/webdav-command.d.ts +1 -1
- package/dist/esm/config/sources/env-source.js +1 -0
- package/dist/esm/config/sources/env-source.js.map +1 -1
- package/dist/esm/discovery/detector.d.ts +0 -5
- package/dist/esm/discovery/detector.js +24 -3
- package/dist/esm/discovery/detector.js.map +1 -1
- package/dist/esm/discovery/index.d.ts +1 -0
- package/dist/esm/discovery/index.js +1 -0
- package/dist/esm/discovery/index.js.map +1 -1
- package/dist/esm/discovery/patterns/index.d.ts +4 -2
- package/dist/esm/discovery/patterns/index.js +9 -3
- package/dist/esm/discovery/patterns/index.js.map +1 -1
- package/dist/esm/discovery/patterns/pwa-kit.d.ts +12 -0
- package/dist/esm/discovery/patterns/pwa-kit.js +18 -7
- package/dist/esm/discovery/patterns/pwa-kit.js.map +1 -1
- package/dist/esm/discovery/patterns/sfra.d.ts +5 -4
- package/dist/esm/discovery/patterns/sfra.js +1 -1
- package/dist/esm/discovery/patterns/sfra.js.map +1 -1
- package/dist/esm/discovery/patterns/storefront-next.js +18 -2
- package/dist/esm/discovery/patterns/storefront-next.js.map +1 -1
- package/dist/esm/discovery/types.d.ts +13 -4
- package/dist/esm/discovery/types.js +11 -1
- package/dist/esm/discovery/types.js.map +1 -1
- package/dist/esm/docs/index.d.ts +3 -3
- package/dist/esm/docs/index.js +1 -1
- package/dist/esm/docs/index.js.map +1 -1
- package/dist/esm/docs/search.d.ts +113 -37
- package/dist/esm/docs/search.js +424 -72
- package/dist/esm/docs/search.js.map +1 -1
- package/dist/esm/docs/types.d.ts +57 -6
- package/dist/esm/docs/types.js +3 -0
- package/dist/esm/docs/types.js.map +1 -1
- package/dist/esm/slas/token.d.ts +9 -2
- package/dist/esm/slas/token.js +25 -29
- package/dist/esm/slas/token.js.map +1 -1
- package/dist/esm/telemetry/telemetry.d.ts +1 -0
- package/dist/esm/telemetry/telemetry.js +32 -0
- package/dist/esm/telemetry/telemetry.js.map +1 -1
- package/dist/esm/telemetry/types.d.ts +6 -0
- package/package.json +9 -2
package/data/xsd/order.xsd
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
custom-attributes of ProductShippingLineItem are exported. Since version 21.9 the
|
|
33
33
|
fields account-id and account-type are exported. Since version 22.9 details to a
|
|
34
34
|
Salesforce Payments payment are no longer exported in a custom method element.
|
|
35
|
+
Since version 26.5 multi-level tax items can be exported for line items.
|
|
35
36
|
</xsd:documentation>
|
|
36
37
|
</xsd:annotation>
|
|
37
38
|
<xsd:enumeration value="18.5" />
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
<xsd:enumeration value="22.1" />
|
|
44
45
|
<xsd:enumeration value="22.9" />
|
|
45
46
|
<xsd:enumeration value="23.4" />
|
|
47
|
+
<xsd:enumeration value="26.5" />
|
|
46
48
|
</xsd:restriction>
|
|
47
49
|
</xsd:simpleType>
|
|
48
50
|
|
|
@@ -211,6 +213,32 @@
|
|
|
211
213
|
</xsd:complexContent>
|
|
212
214
|
</xsd:complexType>
|
|
213
215
|
|
|
216
|
+
<xsd:complexType name="complexType.LineItemTaxItem">
|
|
217
|
+
<xsd:sequence>
|
|
218
|
+
<xsd:element name="tax-id" type="simpleType.Generic.NonEmptyString.256" minOccurs="1" maxOccurs="1">
|
|
219
|
+
<xsd:annotation>
|
|
220
|
+
<xsd:documentation>Tax identifier (e.g., "federal", "state_CA")</xsd:documentation>
|
|
221
|
+
</xsd:annotation>
|
|
222
|
+
</xsd:element>
|
|
223
|
+
<xsd:element name="tax-rate" type="xsd:decimal" minOccurs="1" maxOccurs="1">
|
|
224
|
+
<xsd:annotation>
|
|
225
|
+
<xsd:documentation>Tax rate as decimal (0.07 = 7%)</xsd:documentation>
|
|
226
|
+
</xsd:annotation>
|
|
227
|
+
</xsd:element>
|
|
228
|
+
<xsd:element name="tax-amount" type="xsd:decimal" minOccurs="1" maxOccurs="1">
|
|
229
|
+
<xsd:annotation>
|
|
230
|
+
<xsd:documentation>Tax amount in purchase currency.</xsd:documentation>
|
|
231
|
+
</xsd:annotation>
|
|
232
|
+
</xsd:element>
|
|
233
|
+
</xsd:sequence>
|
|
234
|
+
</xsd:complexType>
|
|
235
|
+
|
|
236
|
+
<xsd:complexType name="complexType.LineItemTaxItems">
|
|
237
|
+
<xsd:sequence>
|
|
238
|
+
<xsd:element name="tax-item" type="complexType.LineItemTaxItem" minOccurs="1" maxOccurs="10" />
|
|
239
|
+
</xsd:sequence>
|
|
240
|
+
</xsd:complexType>
|
|
241
|
+
|
|
214
242
|
<xsd:complexType name="complexType.ProductLineItem">
|
|
215
243
|
<xsd:complexContent>
|
|
216
244
|
<xsd:extension base="complexType.LineItemAmounts">
|
|
@@ -236,6 +264,11 @@
|
|
|
236
264
|
<xsd:element name="gift-message" type="simpleType.Generic.String.4000" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
237
265
|
<xsd:element name="external-line-item-status" type="simpleType.Generic.String.256" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
238
266
|
<xsd:element name="external-line-item-text" type="simpleType.Generic.String" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
267
|
+
<xsd:element name="tax-items" type="complexType.LineItemTaxItems" minOccurs="0" maxOccurs="1">
|
|
268
|
+
<xsd:annotation>
|
|
269
|
+
<xsd:documentation>Since version 26.5. Multi-level tax items per line item.</xsd:documentation>
|
|
270
|
+
</xsd:annotation>
|
|
271
|
+
</xsd:element>
|
|
239
272
|
<xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
240
273
|
<xsd:element name="price-adjustments" type="complexType.PriceAdjustments" maxOccurs="1" minOccurs="0"></xsd:element>
|
|
241
274
|
</xsd:sequence>
|
|
@@ -424,6 +457,11 @@
|
|
|
424
457
|
<xsd:element name="recipient-name" type="simpleType.Generic.String.256" maxOccurs="1" minOccurs="0"></xsd:element>
|
|
425
458
|
<xsd:element name="message" type="simpleType.Generic.String.4000" maxOccurs="1" minOccurs="0"></xsd:element>
|
|
426
459
|
<xsd:element name="shipment-id" type="simpleType.Generic.NonEmptyString.256" maxOccurs="1" minOccurs="0"></xsd:element>
|
|
460
|
+
<xsd:element name="tax-items" type="complexType.LineItemTaxItems" minOccurs="0" maxOccurs="1">
|
|
461
|
+
<xsd:annotation>
|
|
462
|
+
<xsd:documentation>Since version 26.5, multi-level tax items per line item are supported.</xsd:documentation>
|
|
463
|
+
</xsd:annotation>
|
|
464
|
+
</xsd:element>
|
|
427
465
|
<xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
428
466
|
</xsd:sequence>
|
|
429
467
|
</xsd:extension>
|
|
@@ -482,6 +520,11 @@
|
|
|
482
520
|
</xsd:element>
|
|
483
521
|
<xsd:element name="shipment-id" type="simpleType.Generic.NonEmptyString.256" maxOccurs="1" minOccurs="0"></xsd:element>
|
|
484
522
|
<xsd:element name="tax-rate" type="xsd:double" minOccurs="1"></xsd:element>
|
|
523
|
+
<xsd:element name="tax-items" type="complexType.LineItemTaxItems" minOccurs="0" maxOccurs="1">
|
|
524
|
+
<xsd:annotation>
|
|
525
|
+
<xsd:documentation>Since version 26.5. Multi-level tax items per line item.</xsd:documentation>
|
|
526
|
+
</xsd:annotation>
|
|
527
|
+
</xsd:element>
|
|
485
528
|
<xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
486
529
|
</xsd:sequence>
|
|
487
530
|
</xsd:extension>
|
|
@@ -495,6 +538,11 @@
|
|
|
495
538
|
<xsd:element name="quantity" type="complexType.Quantity" minOccurs="1"></xsd:element>
|
|
496
539
|
<xsd:element name="tax-rate" type="xsd:double" minOccurs="1"></xsd:element>
|
|
497
540
|
<xsd:element name="type" type="simpleType.ProductShippingCostType" minOccurs="1"></xsd:element>
|
|
541
|
+
<xsd:element name="tax-items" type="complexType.LineItemTaxItems" minOccurs="0" maxOccurs="1">
|
|
542
|
+
<xsd:annotation>
|
|
543
|
+
<xsd:documentation>Since version 26.5. Multi-level tax items per line item.</xsd:documentation>
|
|
544
|
+
</xsd:annotation>
|
|
545
|
+
</xsd:element>
|
|
498
546
|
<xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
499
547
|
<xsd:element name="price-adjustments" type="complexType.PriceAdjustments" minOccurs="0" maxOccurs="1" ></xsd:element>
|
|
500
548
|
</xsd:sequence>
|
|
@@ -544,6 +592,11 @@
|
|
|
544
592
|
<xsd:element name="option-id" type="simpleType.Generic.NonEmptyString.256"></xsd:element>
|
|
545
593
|
<xsd:element name="value-id" type="simpleType.Generic.NonEmptyString.256"></xsd:element>
|
|
546
594
|
<xsd:element name="product-id" type="simpleType.Generic.NonEmptyString.100" minOccurs="1" maxOccurs="1" ></xsd:element>
|
|
595
|
+
<xsd:element name="tax-items" type="complexType.LineItemTaxItems" minOccurs="0" maxOccurs="1">
|
|
596
|
+
<xsd:annotation>
|
|
597
|
+
<xsd:documentation>Since version 26.5. Multi-level tax items per line item.</xsd:documentation>
|
|
598
|
+
</xsd:annotation>
|
|
599
|
+
</xsd:element>
|
|
547
600
|
<xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1"></xsd:element>
|
|
548
601
|
<xsd:element name="price-adjustments" type="complexType.PriceAdjustments" minOccurs="0" maxOccurs="1" ></xsd:element>
|
|
549
602
|
</xsd:sequence>
|
package/data/xsd/store.xsd
CHANGED
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
</xsd:annotation>
|
|
55
55
|
</xsd:element>
|
|
56
56
|
<xsd:element name="pos-enabled-flag" type="xsd:boolean" minOccurs="0" maxOccurs="1" />
|
|
57
|
+
<xsd:element name="pos-store-id" type="simpleType.Generic.String.128" minOccurs="0" maxOccurs="1" />
|
|
57
58
|
<xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1" />
|
|
58
59
|
</xsd:sequence>
|
|
59
60
|
<xsd:attribute name="store-id" type="simpleType.Generic.NonEmptyString.256" use="required" />
|
|
@@ -128,6 +129,13 @@
|
|
|
128
129
|
</xsd:restriction>
|
|
129
130
|
</xsd:simpleType>
|
|
130
131
|
|
|
132
|
+
<xsd:simpleType name="simpleType.Generic.String.128">
|
|
133
|
+
<xsd:restriction base="simpleType.Generic.String">
|
|
134
|
+
<xsd:minLength value="0" />
|
|
135
|
+
<xsd:maxLength value="128" />
|
|
136
|
+
</xsd:restriction>
|
|
137
|
+
</xsd:simpleType>
|
|
138
|
+
|
|
131
139
|
<xsd:simpleType name="simpleType.Generic.String.256">
|
|
132
140
|
<xsd:restriction base="simpleType.Generic.String">
|
|
133
141
|
<xsd:minLength value="0" />
|
package/data/xsd/storefronts.xsd
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<xsd:element name="storefronts">
|
|
13
13
|
<xsd:complexType>
|
|
14
14
|
<xsd:sequence>
|
|
15
|
-
<xsd:element name="storefront" type="complexType.Storefront" minOccurs="0" maxOccurs="
|
|
15
|
+
<xsd:element name="storefront" type="complexType.Storefront" minOccurs="0" maxOccurs="1"/>
|
|
16
16
|
</xsd:sequence>
|
|
17
17
|
</xsd:complexType>
|
|
18
18
|
</xsd:element>
|
|
@@ -25,17 +25,31 @@
|
|
|
25
25
|
<xsd:sequence>
|
|
26
26
|
<xsd:element name="ecom-site" type="simpleType.Generic.String.48" minOccurs="0" maxOccurs="1"/>
|
|
27
27
|
<xsd:element name="storefront-type" type="simpleType.StorefrontType" minOccurs="1" maxOccurs="1"/>
|
|
28
|
+
<xsd:element name="storefront-status" type="simpleType.StorefrontStatus" minOccurs="1" maxOccurs="1"/>
|
|
28
29
|
<xsd:element name="associated-sites" type="complexType.AssociatedSites" minOccurs="0" maxOccurs="1"/>
|
|
29
30
|
<xsd:element name="user-id" type="simpleType.Generic.String.48" minOccurs="1" maxOccurs="1"/>
|
|
30
31
|
<xsd:element name="org-slug" type="simpleType.Generic.String.64" minOccurs="1" maxOccurs="1"/>
|
|
31
32
|
<xsd:element name="mrt-site" type="simpleType.Generic.String.64" minOccurs="1" maxOccurs="1"/>
|
|
32
33
|
<xsd:element name="scm-repo" type="simpleType.Generic.String.512" minOccurs="0" maxOccurs="1"/>
|
|
33
34
|
<xsd:element name="scm-target" type="simpleType.Generic.String.64" minOccurs="0" maxOccurs="1"/>
|
|
35
|
+
<xsd:element name="github-app-installation" type="complexType.GitHubAppInstallation" minOccurs="0" maxOccurs="1"/>
|
|
34
36
|
</xsd:sequence>
|
|
35
37
|
<xsd:attribute name="storefront-name" type="simpleType.Generic.NonEmptyString.64" use="required"/>
|
|
36
38
|
<xsd:attribute name="mode" type="simpleType.ImportMode"/>
|
|
37
39
|
</xsd:complexType>
|
|
38
40
|
|
|
41
|
+
<!-- GitHub App Installation -->
|
|
42
|
+
<xsd:complexType name="complexType.GitHubAppInstallation" mixed="false">
|
|
43
|
+
<xsd:sequence>
|
|
44
|
+
<xsd:element name="app-id" type="simpleType.Generic.String.64" minOccurs="1" maxOccurs="1"/>
|
|
45
|
+
<xsd:element name="installation-id" type="simpleType.Generic.String.64" minOccurs="1" maxOccurs="1"/>
|
|
46
|
+
<xsd:element name="target-id" type="simpleType.Generic.String.64" minOccurs="1" maxOccurs="1"/>
|
|
47
|
+
<xsd:element name="target-name" type="simpleType.Generic.String.256" minOccurs="1" maxOccurs="1"/>
|
|
48
|
+
<xsd:element name="target-url" type="simpleType.Generic.String.512" minOccurs="1" maxOccurs="1"/>
|
|
49
|
+
<xsd:element name="target-type" type="simpleType.Generic.String.32" minOccurs="1" maxOccurs="1"/>
|
|
50
|
+
</xsd:sequence>
|
|
51
|
+
</xsd:complexType>
|
|
52
|
+
|
|
39
53
|
<!-- Associated Sites -->
|
|
40
54
|
<xsd:complexType name="complexType.AssociatedSites" mixed="false">
|
|
41
55
|
<xsd:sequence>
|
|
@@ -51,6 +65,34 @@
|
|
|
51
65
|
</xsd:restriction>
|
|
52
66
|
</xsd:simpleType>
|
|
53
67
|
|
|
68
|
+
<!--
|
|
69
|
+
Storefront Status enumeration.
|
|
70
|
+
|
|
71
|
+
These values must stay in sync with StorefrontSetupStatusEnum (core/internal/storefront).
|
|
72
|
+
There is no compile-time link between this XSD and the Java enum; drift is caught by
|
|
73
|
+
comparing the JAXB-generated SimpleTypeStorefrontStatus against StorefrontSetupStatusEnum
|
|
74
|
+
in _JAXBStorefrontExportHandler (testStorefrontStatusEnumAndXsdInSync).
|
|
75
|
+
|
|
76
|
+
Export currently restricts output to SUCCESS storefronts only
|
|
77
|
+
(JAXBStorefrontExportHandler.mapStorefront). Adding a new exportable status requires:
|
|
78
|
+
1. Adding the value here
|
|
79
|
+
2. Adding the enum constant in StorefrontSetupStatusEnum
|
|
80
|
+
3. Updating the export guard in mapStorefront to allow the new status
|
|
81
|
+
4. Updating the sync unit test's expected set if needed
|
|
82
|
+
-->
|
|
83
|
+
<xsd:simpleType name="simpleType.StorefrontStatus">
|
|
84
|
+
<xsd:restriction base="xsd:string">
|
|
85
|
+
<xsd:enumeration value="in_progress"/>
|
|
86
|
+
<xsd:enumeration value="success"/>
|
|
87
|
+
<xsd:enumeration value="backfilled"/>
|
|
88
|
+
<xsd:enumeration value="failed"/>
|
|
89
|
+
<xsd:enumeration value="delete_in_progress"/>
|
|
90
|
+
<xsd:enumeration value="delete_failed"/>
|
|
91
|
+
<xsd:enumeration value="deleted"/>
|
|
92
|
+
<xsd:enumeration value="unknown"/>
|
|
93
|
+
</xsd:restriction>
|
|
94
|
+
</xsd:simpleType>
|
|
95
|
+
|
|
54
96
|
<!-- Import Mode -->
|
|
55
97
|
<xsd:simpleType name="simpleType.ImportMode">
|
|
56
98
|
<xsd:restriction base="xsd:string">
|
|
@@ -63,6 +105,13 @@
|
|
|
63
105
|
<xsd:restriction base="xsd:string"/>
|
|
64
106
|
</xsd:simpleType>
|
|
65
107
|
|
|
108
|
+
<xsd:simpleType name="simpleType.Generic.String.32">
|
|
109
|
+
<xsd:restriction base="simpleType.Generic.String">
|
|
110
|
+
<xsd:minLength value="0"/>
|
|
111
|
+
<xsd:maxLength value="32"/>
|
|
112
|
+
</xsd:restriction>
|
|
113
|
+
</xsd:simpleType>
|
|
114
|
+
|
|
66
115
|
<xsd:simpleType name="simpleType.Generic.String.48">
|
|
67
116
|
<xsd:restriction base="simpleType.Generic.String">
|
|
68
117
|
<xsd:minLength value="0"/>
|
|
@@ -77,6 +126,13 @@
|
|
|
77
126
|
</xsd:restriction>
|
|
78
127
|
</xsd:simpleType>
|
|
79
128
|
|
|
129
|
+
<xsd:simpleType name="simpleType.Generic.String.256">
|
|
130
|
+
<xsd:restriction base="simpleType.Generic.String">
|
|
131
|
+
<xsd:minLength value="0"/>
|
|
132
|
+
<xsd:maxLength value="256"/>
|
|
133
|
+
</xsd:restriction>
|
|
134
|
+
</xsd:simpleType>
|
|
135
|
+
|
|
80
136
|
<xsd:simpleType name="simpleType.Generic.String.512">
|
|
81
137
|
<xsd:restriction base="simpleType.Generic.String">
|
|
82
138
|
<xsd:minLength value="0"/>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encoding of OAuth client credentials for the HTTP Basic `Authorization` header.
|
|
3
|
+
*
|
|
4
|
+
* @module auth/client-credentials
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Builds the base64 payload for an `Authorization: Basic` header carrying OAuth
|
|
8
|
+
* client credentials, per RFC 6749 §2.3.1.
|
|
9
|
+
*
|
|
10
|
+
* The client identifier and client password are each form-url-encoded (RFC 6749
|
|
11
|
+
* Appendix B) *before* being joined with a colon and Base64-encoded (RFC 7617
|
|
12
|
+
* §2, the HTTP Basic scheme). Skipping the per-component encoding corrupts any
|
|
13
|
+
* credential containing characters the server form-url-decodes: a raw `+` is
|
|
14
|
+
* read as a space and a valid `%xx` escape is decoded to another byte (both
|
|
15
|
+
* yield `invalid_client` -- a wrong-but-valid secret), while an invalid escape
|
|
16
|
+
* such as `%zz` makes a strict decoder error out (`unauthorized_client` /
|
|
17
|
+
* "Unexpected error when authenticating client"). The same credential succeeds
|
|
18
|
+
* when sent in the request body, which is form-url-encoded by construction --
|
|
19
|
+
* the "body works, Basic fails" symptom.
|
|
20
|
+
*
|
|
21
|
+
* @param clientId - The OAuth client identifier
|
|
22
|
+
* @param clientSecret - The OAuth client password/secret
|
|
23
|
+
* @returns The Base64 string to place after `Basic ` in the `Authorization` header
|
|
24
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
|
|
25
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#appendix-B
|
|
26
|
+
*/
|
|
27
|
+
export declare function encodeBasicClientCredentials(clientId: string, clientSecret: string): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Encoding of OAuth client credentials for the HTTP Basic `Authorization` header.
|
|
8
|
+
*
|
|
9
|
+
* @module auth/client-credentials
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Form-url-encode a single value using the `application/x-www-form-urlencoded`
|
|
13
|
+
* escaping rules that RFC 6749 Appendix B references -- the W3C HTML form rules
|
|
14
|
+
* (UTF-8 first), NOT RFC 3986 percent-encoding. `URLSearchParams` implements
|
|
15
|
+
* exactly these rules.
|
|
16
|
+
*
|
|
17
|
+
* The two encodings differ only for a space (form rules -> `+`, RFC 3986 ->
|
|
18
|
+
* `%20`) and a few punctuation chars (`!`, `~`, `(`, `)`). They agree on every
|
|
19
|
+
* other byte, INCLUDING `+` and `%` -- the characters that actually trigger the
|
|
20
|
+
* auth failure this module fixes -- so the encoder choice does not affect that
|
|
21
|
+
* bug. We use the form rules (`URLSearchParams`) regardless because:
|
|
22
|
+
* 1. they are precisely the Appendix B algorithm -- its worked example encodes
|
|
23
|
+
* U+0020 (space) as `+`, which `URLSearchParams` reproduces; and
|
|
24
|
+
* 2. they are the same rules the token-request body uses, so a credential is
|
|
25
|
+
* byte-identical whether sent in the Basic header or in the body.
|
|
26
|
+
* The two are only interchangeable against a server that form-url-decodes (as
|
|
27
|
+
* Account Manager does); a strict RFC 3986 decoder would read a form-encoded
|
|
28
|
+
* space (`+`) as a literal `+`, so matching the algorithm the RFC names is the
|
|
29
|
+
* safe choice rather than a coincidence that happens to work.
|
|
30
|
+
*/
|
|
31
|
+
function formUrlEncodeComponent(value) {
|
|
32
|
+
// The name is empty, so the serialized "=value" is sliced to just the value.
|
|
33
|
+
return new URLSearchParams([['', value]]).toString().slice(1);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds the base64 payload for an `Authorization: Basic` header carrying OAuth
|
|
37
|
+
* client credentials, per RFC 6749 §2.3.1.
|
|
38
|
+
*
|
|
39
|
+
* The client identifier and client password are each form-url-encoded (RFC 6749
|
|
40
|
+
* Appendix B) *before* being joined with a colon and Base64-encoded (RFC 7617
|
|
41
|
+
* §2, the HTTP Basic scheme). Skipping the per-component encoding corrupts any
|
|
42
|
+
* credential containing characters the server form-url-decodes: a raw `+` is
|
|
43
|
+
* read as a space and a valid `%xx` escape is decoded to another byte (both
|
|
44
|
+
* yield `invalid_client` -- a wrong-but-valid secret), while an invalid escape
|
|
45
|
+
* such as `%zz` makes a strict decoder error out (`unauthorized_client` /
|
|
46
|
+
* "Unexpected error when authenticating client"). The same credential succeeds
|
|
47
|
+
* when sent in the request body, which is form-url-encoded by construction --
|
|
48
|
+
* the "body works, Basic fails" symptom.
|
|
49
|
+
*
|
|
50
|
+
* @param clientId - The OAuth client identifier
|
|
51
|
+
* @param clientSecret - The OAuth client password/secret
|
|
52
|
+
* @returns The Base64 string to place after `Basic ` in the `Authorization` header
|
|
53
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
|
|
54
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#appendix-B
|
|
55
|
+
*/
|
|
56
|
+
export function encodeBasicClientCredentials(clientId, clientSecret) {
|
|
57
|
+
const userPass = `${formUrlEncodeComponent(clientId)}:${formUrlEncodeComponent(clientSecret)}`;
|
|
58
|
+
return Buffer.from(userPass).toString('base64');
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=client-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-credentials.js","sourceRoot":"","sources":["../../../src/auth/client-credentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,sBAAsB,CAAC,KAAa;IAC3C,6EAA6E;IAC7E,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAgB,EAAE,YAAoB;IACjF,MAAM,QAAQ,GAAG,GAAG,sBAAsB,CAAC,QAAQ,CAAC,IAAI,sBAAsB,CAAC,YAAY,CAAC,EAAE,CAAC;IAC/F,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/esm/auth/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
*/
|
|
57
57
|
export type { AuthStrategy, FetchInit, AccessTokenResponse, DecodedJWT, AuthConfig, BasicAuthConfig, OAuthAuthConfig, ApiKeyAuthConfig, AuthMethod, AuthCredentials, } from './types.js';
|
|
58
58
|
export { ALL_AUTH_METHODS } from './types.js';
|
|
59
|
+
export { encodeBasicClientCredentials } from './client-credentials.js';
|
|
59
60
|
export { BasicAuthStrategy } from './basic.js';
|
|
60
61
|
export { OAuthStrategy, decodeJWT } from './oauth.js';
|
|
61
62
|
export type { OAuthConfig } from './oauth.js';
|
package/dist/esm/auth/index.js
CHANGED
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
* @module auth
|
|
61
61
|
*/
|
|
62
62
|
export { ALL_AUTH_METHODS } from './types.js';
|
|
63
|
+
// Client credential encoding (RFC 6749 §2.3.1)
|
|
64
|
+
export { encodeBasicClientCredentials } from './client-credentials.js';
|
|
63
65
|
// Strategies
|
|
64
66
|
export { BasicAuthStrategy } from './basic.js';
|
|
65
67
|
export { OAuthStrategy, decodeJWT } from './oauth.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAeH,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAE5C,aAAa;AACb,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AAGnE,sBAAsB;AACtB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAG7B,qBAAqB;AACrB,OAAO,EAAC,mBAAmB,EAAE,yBAAyB,EAAC,MAAM,cAAc,CAAC;AAG5E,kBAAkB;AAClB,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAeH,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAE5C,+CAA+C;AAC/C,OAAO,EAAC,4BAA4B,EAAC,MAAM,yBAAyB,CAAC;AAErE,aAAa;AACb,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AAGnE,sBAAsB;AACtB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAG7B,qBAAqB;AACrB,OAAO,EAAC,mBAAmB,EAAE,yBAAyB,EAAC,MAAM,cAAc,CAAC;AAG5E,kBAAkB;AAClB,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
|
package/dist/esm/auth/oauth.js
CHANGED
|
@@ -3,6 +3,7 @@ import { wrapNetworkError } from '../errors/network-error.js';
|
|
|
3
3
|
import { getLogger } from '../logging/logger.js';
|
|
4
4
|
import { DEFAULT_ACCOUNT_MANAGER_HOST } from '../defaults.js';
|
|
5
5
|
import { globalAuthMiddlewareRegistry, applyAuthRequestMiddleware, applyAuthResponseMiddleware } from './middleware.js';
|
|
6
|
+
import { encodeBasicClientCredentials } from './client-credentials.js';
|
|
6
7
|
// Module-level token cache to support multiple instances with same clientId
|
|
7
8
|
const ACCESS_TOKEN_CACHE = new Map();
|
|
8
9
|
// In-flight token requests, keyed by cacheKey, so concurrent callers coalesce
|
|
@@ -233,7 +234,7 @@ export class OAuthStrategy {
|
|
|
233
234
|
if (this.config.scopes && this.config.scopes.length > 0) {
|
|
234
235
|
params.append('scope', this.config.scopes.join(' '));
|
|
235
236
|
}
|
|
236
|
-
const credentials =
|
|
237
|
+
const credentials = encodeBasicClientCredentials(this.config.clientId, this.config.clientSecret);
|
|
237
238
|
// Build request object for middleware
|
|
238
239
|
let request = new Request(url, {
|
|
239
240
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/auth/oauth.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,4BAA4B,EAAE,0BAA0B,EAAE,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/auth/oauth.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,4BAA4B,EAAE,0BAA0B,EAAE,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;AACtH,OAAO,EAAC,4BAA4B,EAAC,MAAM,yBAAyB,CAAC;AAErE,4EAA4E;AAC5E,MAAM,kBAAkB,GAAqC,IAAI,GAAG,EAAE,CAAC;AAEvE,8EAA8E;AAC9E,4EAA4E;AAC5E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Q,CAAC,IAAI,EAAE,CAIlC,CAAC;QAEF,8BAA8B;QAC9B,MAAM,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAC,EAAE,oBAAoB,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC;QAEvG,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,EAAC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAC,EAAE,oBAAoB,CAAC,CAAC;QAEvD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAE5C,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,YAAY;YAC9B,OAAO,EAAE,UAAU;YACnB,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -8,6 +8,34 @@ import type { SafetyEvaluation } from '../safety/types.js';
|
|
|
8
8
|
import { Telemetry, type TelemetryAttributes } from '../telemetry/index.js';
|
|
9
9
|
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>;
|
|
10
10
|
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
11
|
+
/**
|
|
12
|
+
* Stable error-code values passed to oclif's `this.error(msg, {code})` so that
|
|
13
|
+
* {@link classifyError} can categorize the resulting telemetry without parsing
|
|
14
|
+
* error messages.
|
|
15
|
+
*
|
|
16
|
+
* - `VALIDATION` — user/config input error (missing flag, bad value). Expected,
|
|
17
|
+
* not a reliability defect.
|
|
18
|
+
* - `GUARDRAIL` — blocked by the user's own safety configuration. Working as
|
|
19
|
+
* intended, not a failure of the tool.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ERROR_CODE: {
|
|
22
|
+
readonly VALIDATION: "VALIDATION";
|
|
23
|
+
readonly GUARDRAIL: "GUARDRAIL";
|
|
24
|
+
};
|
|
25
|
+
/** Telemetry category recorded on COMMAND_ERROR (see {@link classifyError}). */
|
|
26
|
+
export type ErrorCategory = 'guardrail' | 'runtime' | 'validation';
|
|
27
|
+
/**
|
|
28
|
+
* Classify a thrown command error for telemetry so analytics can exclude
|
|
29
|
+
* expected validation/guardrail errors from reliability (defect-rate) metrics.
|
|
30
|
+
*
|
|
31
|
+
* Resolution order:
|
|
32
|
+
* 1. An explicit oclif `code` of {@link ERROR_CODE.VALIDATION} / `GUARDRAIL`
|
|
33
|
+
* (set at the throw site via `this.error(msg, {code})`).
|
|
34
|
+
* 2. Safety error class names thrown from HTTP/auth middleware that do not flow
|
|
35
|
+
* through `this.error` (`SafetyBlockedError`, `SafetyConfirmationRequired`).
|
|
36
|
+
* 3. Everything else is a genuine `runtime` error (the reliability signal).
|
|
37
|
+
*/
|
|
38
|
+
export declare function classifyError(err: unknown): ErrorCategory;
|
|
11
39
|
/**
|
|
12
40
|
* Base command class for B2C CLI tools.
|
|
13
41
|
*
|
|
@@ -105,6 +133,18 @@ export declare abstract class BaseCommand<T extends typeof Command> extends Comm
|
|
|
105
133
|
* COMMAND_EXCEPTION events include organizational context.
|
|
106
134
|
*/
|
|
107
135
|
protected addTelemetryContext(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Build a suffix appended to "X is required" config errors.
|
|
138
|
+
*
|
|
139
|
+
* When NO config source contributed any values (no dw.json found, no env
|
|
140
|
+
* vars, no flags — the dominant cause of these errors in telemetry), the user
|
|
141
|
+
* is almost certainly unconfigured rather than missing one specific field, so
|
|
142
|
+
* we point them at the configuration guide. When a source DID load, we stay
|
|
143
|
+
* quiet: the existing message already lists the precise flag/env var to set.
|
|
144
|
+
*
|
|
145
|
+
* @returns A "\n\nSee: <url>" suffix, or '' when config is already partially present.
|
|
146
|
+
*/
|
|
147
|
+
protected configDocsHint(): string;
|
|
108
148
|
/**
|
|
109
149
|
* Collects config sources from plugins via the `b2c:config-sources` hook.
|
|
110
150
|
*
|
|
@@ -19,6 +19,46 @@ import { initializeStatefulStore } from '../auth/stateful-store.js';
|
|
|
19
19
|
import { setUserAgent } from '../clients/user-agent.js';
|
|
20
20
|
import { createTelemetry, Telemetry } from '../telemetry/index.js';
|
|
21
21
|
const LOG_LEVELS = ['trace', 'debug', 'info', 'warn', 'error', 'silent'];
|
|
22
|
+
/**
|
|
23
|
+
* Stable error-code values passed to oclif's `this.error(msg, {code})` so that
|
|
24
|
+
* {@link classifyError} can categorize the resulting telemetry without parsing
|
|
25
|
+
* error messages.
|
|
26
|
+
*
|
|
27
|
+
* - `VALIDATION` — user/config input error (missing flag, bad value). Expected,
|
|
28
|
+
* not a reliability defect.
|
|
29
|
+
* - `GUARDRAIL` — blocked by the user's own safety configuration. Working as
|
|
30
|
+
* intended, not a failure of the tool.
|
|
31
|
+
*/
|
|
32
|
+
export const ERROR_CODE = {
|
|
33
|
+
VALIDATION: 'VALIDATION',
|
|
34
|
+
GUARDRAIL: 'GUARDRAIL',
|
|
35
|
+
};
|
|
36
|
+
/** Base URL for the online documentation site. */
|
|
37
|
+
const DOCS_BASE_URL = 'https://salesforcecommercecloud.github.io/b2c-developer-tooling';
|
|
38
|
+
/** Configuration guide — how to point the CLI at an instance and authenticate. */
|
|
39
|
+
const DOCS_CONFIGURATION_URL = `${DOCS_BASE_URL}/guide/configuration.html`;
|
|
40
|
+
/**
|
|
41
|
+
* Classify a thrown command error for telemetry so analytics can exclude
|
|
42
|
+
* expected validation/guardrail errors from reliability (defect-rate) metrics.
|
|
43
|
+
*
|
|
44
|
+
* Resolution order:
|
|
45
|
+
* 1. An explicit oclif `code` of {@link ERROR_CODE.VALIDATION} / `GUARDRAIL`
|
|
46
|
+
* (set at the throw site via `this.error(msg, {code})`).
|
|
47
|
+
* 2. Safety error class names thrown from HTTP/auth middleware that do not flow
|
|
48
|
+
* through `this.error` (`SafetyBlockedError`, `SafetyConfirmationRequired`).
|
|
49
|
+
* 3. Everything else is a genuine `runtime` error (the reliability signal).
|
|
50
|
+
*/
|
|
51
|
+
export function classifyError(err) {
|
|
52
|
+
const code = err?.code;
|
|
53
|
+
if (code === ERROR_CODE.VALIDATION)
|
|
54
|
+
return 'validation';
|
|
55
|
+
if (code === ERROR_CODE.GUARDRAIL)
|
|
56
|
+
return 'guardrail';
|
|
57
|
+
const name = err?.name;
|
|
58
|
+
if (name === 'SafetyBlockedError' || name === 'SafetyConfirmationRequired')
|
|
59
|
+
return 'guardrail';
|
|
60
|
+
return 'runtime';
|
|
61
|
+
}
|
|
22
62
|
/**
|
|
23
63
|
* Base command class for B2C CLI tools.
|
|
24
64
|
*
|
|
@@ -342,6 +382,25 @@ export class BaseCommand extends Command {
|
|
|
342
382
|
// Best-effort: telemetry context enrichment must never prevent command execution
|
|
343
383
|
}
|
|
344
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Build a suffix appended to "X is required" config errors.
|
|
387
|
+
*
|
|
388
|
+
* When NO config source contributed any values (no dw.json found, no env
|
|
389
|
+
* vars, no flags — the dominant cause of these errors in telemetry), the user
|
|
390
|
+
* is almost certainly unconfigured rather than missing one specific field, so
|
|
391
|
+
* we point them at the configuration guide. When a source DID load, we stay
|
|
392
|
+
* quiet: the existing message already lists the precise flag/env var to set.
|
|
393
|
+
*
|
|
394
|
+
* @returns A "\n\nSee: <url>" suffix, or '' when config is already partially present.
|
|
395
|
+
*/
|
|
396
|
+
configDocsHint() {
|
|
397
|
+
// resolvedConfig may be unset if the error is thrown before loadConfiguration().
|
|
398
|
+
const sources = this.resolvedConfig?.sources;
|
|
399
|
+
if (sources && sources.length === 0) {
|
|
400
|
+
return t('base.configDocsHint', '\n\nNo configuration was found. See the configuration guide to connect an instance: {{url}}', { url: DOCS_CONFIGURATION_URL });
|
|
401
|
+
}
|
|
402
|
+
return '';
|
|
403
|
+
}
|
|
345
404
|
/**
|
|
346
405
|
* Collects config sources from plugins via the `b2c:config-sources` hook.
|
|
347
406
|
*
|
|
@@ -471,14 +530,16 @@ export class BaseCommand extends Command {
|
|
|
471
530
|
async catch(err) {
|
|
472
531
|
const exitCode = err.exitCode ?? 1;
|
|
473
532
|
const duration = this.commandStartTime ? Date.now() - this.commandStartTime : undefined;
|
|
533
|
+
const errorCategory = classifyError(err);
|
|
474
534
|
// Send exception and COMMAND_ERROR event so the error appears in custom events (same view as COMMAND_START)
|
|
475
535
|
// Flush explicitly before stop to ensure events are sent before process exits
|
|
476
536
|
if (this.telemetry) {
|
|
477
|
-
this.telemetry.sendException(err, { command: this.id, exitCode, duration });
|
|
537
|
+
this.telemetry.sendException(err, { command: this.id, errorCategory, exitCode, duration });
|
|
478
538
|
this.telemetry.sendEvent('COMMAND_ERROR', {
|
|
479
539
|
command: this.id,
|
|
480
540
|
exitCode,
|
|
481
541
|
duration,
|
|
542
|
+
errorCategory,
|
|
482
543
|
errorMessage: err.message,
|
|
483
544
|
...(err.cause ? { errorCause: String(err.cause) } : {}),
|
|
484
545
|
});
|
|
@@ -564,7 +625,7 @@ export class BaseCommand extends Command {
|
|
|
564
625
|
operation,
|
|
565
626
|
safetyLevel,
|
|
566
627
|
description: describeSafetyLevel(safetyLevel),
|
|
567
|
-
}), { exit: 1 });
|
|
628
|
+
}), { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
568
629
|
}
|
|
569
630
|
/**
|
|
570
631
|
* Parse extra params from --extra-query, --extra-body, and --extra-headers flags.
|
|
@@ -652,7 +713,7 @@ export class BaseCommand extends Command {
|
|
|
652
713
|
commandId: this.id,
|
|
653
714
|
});
|
|
654
715
|
if (evaluation.action === 'block' && evaluation.rule) {
|
|
655
|
-
this.error(evaluation.reason, { exit: 1 });
|
|
716
|
+
this.error(evaluation.reason, { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
656
717
|
}
|
|
657
718
|
if (evaluation.action === 'confirm' && evaluation.rule) {
|
|
658
719
|
await this.confirmOrBlock(evaluation);
|
|
@@ -671,11 +732,11 @@ export class BaseCommand extends Command {
|
|
|
671
732
|
if (!process.stdin.isTTY) {
|
|
672
733
|
this.error(`Your safety configuration requires confirmation for this operation, ` +
|
|
673
734
|
`but no interactive session is available.\n\n ${evaluation.reason}\n\n` +
|
|
674
|
-
`To change this, update the "safety" section in your dw.json or the SFCC_SAFETY_CONFIRM environment variable.`, { exit: 1 });
|
|
735
|
+
`To change this, update the "safety" section in your dw.json or the SFCC_SAFETY_CONFIRM environment variable.`, { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
675
736
|
}
|
|
676
737
|
const confirmed = await safetyConfirm(`Your safety configuration requires confirmation for this operation:\n ${evaluation.reason}\n Proceed?`);
|
|
677
738
|
if (!confirmed) {
|
|
678
|
-
this.error('Operation cancelled.', { exit: 1 });
|
|
739
|
+
this.error('Operation cancelled.', { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
679
740
|
}
|
|
680
741
|
}
|
|
681
742
|
/**
|