@salesforce/b2c-tooling-sdk 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/guides/enrichment.json +291 -0
- package/data/guides/index.json +426 -37
- package/data/schemas/dw.schema.json +590 -0
- package/data/tooling/index.json +18 -9
- package/dist/esm/cli/base-command.d.ts +20 -1
- package/dist/esm/cli/base-command.js +61 -11
- package/dist/esm/cli/base-command.js.map +1 -1
- package/dist/esm/cli/cartridge-command.js +2 -1
- package/dist/esm/cli/cartridge-command.js.map +1 -1
- package/dist/esm/cli/command-search.d.ts +85 -0
- package/dist/esm/cli/command-search.js +147 -0
- package/dist/esm/cli/command-search.js.map +1 -0
- package/dist/esm/cli/config.d.ts +10 -1
- package/dist/esm/cli/config.js +18 -9
- package/dist/esm/cli/config.js.map +1 -1
- package/dist/esm/cli/hooks.d.ts +13 -0
- package/dist/esm/cli/hooks.js +11 -0
- package/dist/esm/cli/hooks.js.map +1 -1
- package/dist/esm/cli/index.d.ts +2 -0
- package/dist/esm/cli/index.js +2 -0
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/instance-command.d.ts +1 -0
- package/dist/esm/cli/instance-command.js +2 -1
- package/dist/esm/cli/instance-command.js.map +1 -1
- package/dist/esm/cli/mrt-command.d.ts +3 -2
- package/dist/esm/cli/mrt-command.js +4 -4
- package/dist/esm/cli/mrt-command.js.map +1 -1
- package/dist/esm/cli/oauth-command.d.ts +1 -0
- package/dist/esm/cli/ods-command.d.ts +1 -0
- package/dist/esm/cli/webdav-command.d.ts +1 -0
- package/dist/esm/clients/custom-apis.d.ts +36 -2
- package/dist/esm/clients/custom-apis.js +57 -4
- package/dist/esm/clients/custom-apis.js.map +1 -1
- package/dist/esm/clients/index.d.ts +1 -1
- package/dist/esm/clients/index.js +1 -1
- package/dist/esm/clients/index.js.map +1 -1
- package/dist/esm/clients/scapi-backend-utils.d.ts +15 -0
- package/dist/esm/clients/scapi-backend-utils.js +28 -1
- package/dist/esm/clients/scapi-backend-utils.js.map +1 -1
- package/dist/esm/clients/scapi-fallback-backend.js +2 -2
- package/dist/esm/clients/scapi-fallback-backend.js.map +1 -1
- package/dist/esm/clients/scapi-schemas.generated.d.ts +2 -2
- package/dist/esm/compat/dispatcher.js +2 -2
- package/dist/esm/compat/dispatcher.js.map +1 -1
- package/dist/esm/config/config-origins.d.ts +19 -0
- package/dist/esm/config/config-origins.js +11 -0
- package/dist/esm/config/config-origins.js.map +1 -0
- package/dist/esm/config/config-write.d.ts +86 -0
- package/dist/esm/config/config-write.js +296 -0
- package/dist/esm/config/config-write.js.map +1 -0
- package/dist/esm/config/dw-json-schema.d.ts +14 -0
- package/dist/esm/config/dw-json-schema.js +269 -0
- package/dist/esm/config/dw-json-schema.js.map +1 -0
- package/dist/esm/config/dw-json.d.ts +2 -0
- package/dist/esm/config/dw-json.js +10 -6
- package/dist/esm/config/dw-json.js.map +1 -1
- package/dist/esm/config/index.d.ts +13 -4
- package/dist/esm/config/index.js +8 -3
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/config/instance-manager.d.ts +64 -28
- package/dist/esm/config/instance-manager.js +145 -63
- package/dist/esm/config/instance-manager.js.map +1 -1
- package/dist/esm/config/mapping.d.ts +5 -0
- package/dist/esm/config/mapping.js +20 -1
- package/dist/esm/config/mapping.js.map +1 -1
- package/dist/esm/config/project-environment.d.ts +62 -0
- package/dist/esm/config/project-environment.js +113 -0
- package/dist/esm/config/project-environment.js.map +1 -1
- package/dist/esm/config/resolver.d.ts +22 -0
- package/dist/esm/config/resolver.js +106 -37
- package/dist/esm/config/resolver.js.map +1 -1
- package/dist/esm/config/sources/dw-json-source.d.ts +9 -1
- package/dist/esm/config/sources/dw-json-source.js +59 -23
- package/dist/esm/config/sources/dw-json-source.js.map +1 -1
- package/dist/esm/config/sources/env-source.d.ts +70 -9
- package/dist/esm/config/sources/env-source.js +205 -47
- package/dist/esm/config/sources/env-source.js.map +1 -1
- package/dist/esm/config/sources/index.d.ts +1 -1
- package/dist/esm/config/sources/index.js +1 -1
- package/dist/esm/config/sources/index.js.map +1 -1
- package/dist/esm/config/types.d.ts +53 -3
- package/dist/esm/docs/search.js +3 -1
- package/dist/esm/docs/search.js.map +1 -1
- package/dist/esm/docs/types.d.ts +3 -1
- package/dist/esm/guidance/bundle.d.ts +33 -0
- package/dist/esm/guidance/bundle.js +268 -0
- package/dist/esm/guidance/bundle.js.map +1 -0
- package/dist/esm/guidance/catalog.d.ts +8 -1
- package/dist/esm/guidance/catalog.js +48 -6
- package/dist/esm/guidance/catalog.js.map +1 -1
- package/dist/esm/guidance/index.d.ts +1 -0
- package/dist/esm/guidance/index.js +1 -0
- package/dist/esm/guidance/index.js.map +1 -1
- package/dist/esm/guidance/types.d.ts +17 -1
- package/dist/esm/guidance/types.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operations/jobs/run-system-job.js +2 -2
- package/dist/esm/operations/jobs/run-system-job.js.map +1 -1
- package/dist/esm/plugins/discovery.js +2 -1
- package/dist/esm/plugins/discovery.js.map +1 -1
- package/dist/esm/scapi/catalog.d.ts +5 -2
- package/dist/esm/scapi/catalog.js.map +1 -1
- package/dist/esm/scapi/index.d.ts +6 -2
- package/dist/esm/scapi/index.js +4 -2
- package/dist/esm/scapi/index.js.map +1 -1
- package/dist/esm/scapi/live.d.ts +14 -3
- package/dist/esm/scapi/live.js +33 -5
- package/dist/esm/scapi/live.js.map +1 -1
- package/dist/esm/scapi/local.d.ts +26 -0
- package/dist/esm/scapi/local.js +143 -0
- package/dist/esm/scapi/local.js.map +1 -0
- package/dist/esm/scapi/request.d.ts +2 -2
- package/dist/esm/scapi/request.js +4 -2
- package/dist/esm/scapi/request.js.map +1 -1
- package/dist/esm/scapi/runtime.d.ts +5 -0
- package/dist/esm/scapi/runtime.js.map +1 -1
- package/dist/esm/scapi/schema-source.d.ts +90 -0
- package/dist/esm/scapi/schema-source.js +146 -0
- package/dist/esm/scapi/schema-source.js.map +1 -0
- package/dist/esm/scapi/worker-source.js +31 -7
- package/dist/esm/scapi/worker-source.js.map +1 -1
- package/dist/esm/telemetry/telemetry.d.ts +1 -0
- package/dist/esm/telemetry/telemetry.js +18 -1
- package/dist/esm/telemetry/telemetry.js.map +1 -1
- package/dist/esm/telemetry/types.d.ts +9 -0
- package/dist/esm/test-utils/config-isolation.js +21 -15
- package/dist/esm/test-utils/config-isolation.js.map +1 -1
- package/dist/esm/ux/agent-context.d.ts +69 -0
- package/dist/esm/ux/agent-context.js +133 -0
- package/dist/esm/ux/agent-context.js.map +1 -0
- package/dist/esm/ux/confirm.d.ts +27 -0
- package/dist/esm/ux/confirm.js +32 -0
- package/dist/esm/ux/confirm.js.map +1 -1
- package/dist/esm/ux/index.d.ts +2 -1
- package/dist/esm/ux/index.js +2 -1
- package/dist/esm/ux/index.js.map +1 -1
- package/node_modules/@salesforce/b2c-api-schemas/manifest.json +83 -42
- package/node_modules/@salesforce/b2c-api-schemas/package.json +1 -1
- package/node_modules/@salesforce/b2c-api-schemas/scapi/cdn/zones/v1.json +6798 -238
- package/node_modules/@salesforce/b2c-api-schemas/scapi/checkout/orders/v1.json +2296 -205
- package/node_modules/@salesforce/b2c-api-schemas/scapi/checkout/shopper-baskets/v1.json +5571 -666
- package/node_modules/@salesforce/b2c-api-schemas/scapi/checkout/shopper-baskets/v2.json +6062 -371
- package/node_modules/@salesforce/b2c-api-schemas/scapi/checkout/shopper-orders/v1.json +3426 -360
- package/node_modules/@salesforce/b2c-api-schemas/scapi/checkout/shopper-payments/v1.json +351 -99
- package/node_modules/@salesforce/b2c-api-schemas/scapi/configuration/cors/v1.json +172 -12
- package/node_modules/@salesforce/b2c-api-schemas/scapi/configuration/preferences/v1.json +1497 -111
- package/node_modules/@salesforce/b2c-api-schemas/scapi/configuration/shopper-configurations/v1.json +202 -36
- package/node_modules/@salesforce/b2c-api-schemas/scapi/configuration/timeouts/v1.json +79 -10
- package/node_modules/@salesforce/b2c-api-schemas/scapi/custom-object/custom-objects/v1.json +785 -49
- package/node_modules/@salesforce/b2c-api-schemas/scapi/custom-object/shopper-custom-objects/v1.json +191 -40
- package/node_modules/@salesforce/b2c-api-schemas/scapi/customer/customers/v1.json +1483 -107
- package/node_modules/@salesforce/b2c-api-schemas/scapi/customer/shopper-customers/v1.json +4854 -787
- package/node_modules/@salesforce/b2c-api-schemas/scapi/dx/custom-apis/v1.json +119 -15
- package/node_modules/@salesforce/b2c-api-schemas/scapi/dx/object-definitions/v1.json +1699 -80
- package/node_modules/@salesforce/b2c-api-schemas/scapi/dx/scapi-schemas/v1.json +252 -18
- package/node_modules/@salesforce/b2c-api-schemas/scapi/dx/scripts/v1.json +329 -23
- package/node_modules/@salesforce/b2c-api-schemas/scapi/experience/experiences/v1.json +4208 -234
- package/node_modules/@salesforce/b2c-api-schemas/scapi/experience/shopper-experience/v1.json +1591 -247
- package/node_modules/@salesforce/b2c-api-schemas/scapi/intelligence/analytics/v1.json +396 -8
- package/node_modules/@salesforce/b2c-api-schemas/scapi/inventory/availability/v1.json +1242 -69
- package/node_modules/@salesforce/b2c-api-schemas/scapi/inventory/impex/v1.json +2354 -248
- package/node_modules/@salesforce/b2c-api-schemas/scapi/inventory/reservation/v1.json +1550 -45
- package/node_modules/@salesforce/b2c-api-schemas/scapi/inventory/segmentation/v1.json +6615 -0
- package/node_modules/@salesforce/b2c-api-schemas/scapi/merchant/roles/v1.json +1520 -59
- package/node_modules/@salesforce/b2c-api-schemas/scapi/merchant/users/v1.json +397 -17
- package/node_modules/@salesforce/b2c-api-schemas/scapi/observability/metrics/v1.json +1241 -27
- package/node_modules/@salesforce/b2c-api-schemas/scapi/operation/jobs/v1.json +1069 -68
- package/node_modules/@salesforce/b2c-api-schemas/scapi/operation/replications/v1.json +410 -23
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/assignments/v1.json +502 -102
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/campaigns/v1.json +1112 -94
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/coupons/v1.json +820 -93
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/gift-certificates/v1.json +845 -92
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/promotions/v1.json +2716 -674
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/shopper-gift-certificates/v1.json +130 -47
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/shopper-promotions/v1.json +233 -63
- package/node_modules/@salesforce/b2c-api-schemas/scapi/pricing/source-code-groups/v1.json +630 -70
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/catalogs/v1.json +2886 -348
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/inventory-lists/v1.json +520 -19
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/price-books/v1.json +3115 -293
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/products/v1.json +3313 -138
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/shopper-availability/v1.json +266 -52
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/shopper-delivery-estimates/v1.json +256 -48
- package/node_modules/@salesforce/b2c-api-schemas/scapi/product/shopper-products/v1.json +1744 -306
- package/node_modules/@salesforce/b2c-api-schemas/scapi/search/shopper-search/v1.json +1661 -120
- package/node_modules/@salesforce/b2c-api-schemas/scapi/shopper/auth/v1.json +2174 -118
- package/node_modules/@salesforce/b2c-api-schemas/scapi/shopper/auth-admin/v1.json +1373 -24
- package/node_modules/@salesforce/b2c-api-schemas/scapi/shopper/consents/v1.json +531 -20
- package/node_modules/@salesforce/b2c-api-schemas/scapi/shopper/shopper-agents/v1.json +154 -6
- package/node_modules/@salesforce/b2c-api-schemas/scapi/shopper/shopper-consents/v1.json +596 -79
- package/node_modules/@salesforce/b2c-api-schemas/scapi/shopper/shopper-context/v1.json +456 -42
- package/node_modules/@salesforce/b2c-api-schemas/scapi/site/seo/v1.json +101 -23
- package/node_modules/@salesforce/b2c-api-schemas/scapi/site/shopper-seo/v1.json +184 -41
- package/node_modules/@salesforce/b2c-api-schemas/scapi/site/sites/v1.json +995 -47
- package/node_modules/@salesforce/b2c-api-schemas/scapi/store/shopper-stores/v1.json +370 -67
- package/node_modules/@salesforce/b2c-api-schemas/scapi/store/store-redirect-mappings/v1.json +319 -11
- package/node_modules/@salesforce/b2c-api-schemas/scapi/store/stores/v1.json +1109 -64
- package/node_modules/@salesforce/b2c-api-schemas/scapi/storefront/deployments/v1.json +1442 -0
- package/node_modules/@salesforce/b2c-api-schemas/scapi/storefront/environments/v1.json +4293 -0
- package/node_modules/@salesforce/b2c-api-schemas/scapi/storefront/storefronts/v1.json +1371 -0
- package/package.json +5 -2
- package/specs/scapi-schemas-v1.yaml +4 -1
|
@@ -89,6 +89,53 @@ export const SCAPI_TENANT_SCOPE_PREFIX = 'SALESFORCE_COMMERCE_API:';
|
|
|
89
89
|
export function toOrganizationId(tenantId) {
|
|
90
90
|
return `${ORGANIZATION_ID_PREFIX}${normalizeTenantId(tenantId)}`;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Sandbox hostnames encode the tenant ID in their first label, for example
|
|
94
|
+
* `abcd-123.dx.commercecloud.salesforce.com` (tenant `abcd_123`).
|
|
95
|
+
*/
|
|
96
|
+
const SANDBOX_HOSTNAME_REGEX = /^([a-z\d]{4})-(\d{3})\.(?:[a-z\d-]+\.)*dx\.commercecloud\.salesforce\.com$/i;
|
|
97
|
+
/**
|
|
98
|
+
* Derives a tenant ID from a sandbox hostname.
|
|
99
|
+
*
|
|
100
|
+
* Returns `undefined` for any hostname that doesn't follow the sandbox naming
|
|
101
|
+
* convention, so callers never infer a tenant from an ambiguous hostname such as
|
|
102
|
+
* a primary instance group host.
|
|
103
|
+
*
|
|
104
|
+
* @param hostname - Instance hostname
|
|
105
|
+
* @returns The tenant ID in canonical underscore format, or undefined
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* tenantIdFromSandboxHostname('zzpq-013.dx.commercecloud.salesforce.com') // Returns 'zzpq_013'
|
|
109
|
+
* tenantIdFromSandboxHostname('staging-realm-customer.demandware.net') // Returns undefined
|
|
110
|
+
*/
|
|
111
|
+
export function tenantIdFromSandboxHostname(hostname) {
|
|
112
|
+
const match = hostname.trim().match(SANDBOX_HOSTNAME_REGEX);
|
|
113
|
+
if (!match)
|
|
114
|
+
return undefined;
|
|
115
|
+
return `${match[1]}_${match[2]}`.toLowerCase();
|
|
116
|
+
}
|
|
117
|
+
/** Sandbox tenant IDs are a four-character realm and a three-digit instance number. */
|
|
118
|
+
const SANDBOX_TENANT_ID_REGEX = /^([a-z\d]{4})_(\d{3})$/i;
|
|
119
|
+
/**
|
|
120
|
+
* Derives the sandbox hostname from a sandbox tenant ID.
|
|
121
|
+
*
|
|
122
|
+
* Returns `undefined` for any tenant ID that doesn't follow the sandbox naming
|
|
123
|
+
* convention (for example a production `abcd_prd` tenant), whose hostname can't
|
|
124
|
+
* be inferred.
|
|
125
|
+
*
|
|
126
|
+
* @param tenantId - Tenant ID or organization ID
|
|
127
|
+
* @returns The sandbox hostname, or undefined
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* sandboxHostnameFromTenantId('f_ecom_zzpq_013') // Returns 'zzpq-013.dx.commercecloud.salesforce.com'
|
|
131
|
+
* sandboxHostnameFromTenantId('zzxy_prd') // Returns undefined
|
|
132
|
+
*/
|
|
133
|
+
export function sandboxHostnameFromTenantId(tenantId) {
|
|
134
|
+
const match = normalizeTenantId(tenantId).match(SANDBOX_TENANT_ID_REGEX);
|
|
135
|
+
if (!match)
|
|
136
|
+
return undefined;
|
|
137
|
+
return `${match[1]}-${match[2]}.dx.commercecloud.salesforce.com`.toLowerCase();
|
|
138
|
+
}
|
|
92
139
|
/**
|
|
93
140
|
* Normalizes any parseable tenant/organization ID form to the canonical underscore format.
|
|
94
141
|
*
|
|
@@ -99,19 +146,25 @@ export function toOrganizationId(tenantId) {
|
|
|
99
146
|
* - `f_ecom_abcd-123` — org ID with hyphenated tenant
|
|
100
147
|
* - `abcd-123.dx.commercecloud.salesforce.com` — sandbox hostname
|
|
101
148
|
*
|
|
102
|
-
*
|
|
149
|
+
* Only sandbox hostnames carry the tenant ID by convention. Other hostnames
|
|
150
|
+
* (for example `staging-realm-customer.demandware.net`) are returned unchanged
|
|
151
|
+
* rather than guessing a tenant from the first label.
|
|
152
|
+
*
|
|
153
|
+
* @param value - The tenant ID, organization ID, or sandbox hostname
|
|
103
154
|
* @returns The normalized tenant ID in canonical underscore format (e.g., "abcd_123")
|
|
104
155
|
*
|
|
105
156
|
* @example
|
|
106
157
|
* normalizeTenantId('f_ecom_zzxy_prd') // Returns 'zzxy_prd'
|
|
107
158
|
* normalizeTenantId('zzxy-prd') // Returns 'zzxy_prd'
|
|
108
|
-
* normalizeTenantId('zzxy-
|
|
159
|
+
* normalizeTenantId('zzxy-001.dx.commercecloud.salesforce.com') // Returns 'zzxy_001'
|
|
109
160
|
*/
|
|
110
161
|
export function normalizeTenantId(value) {
|
|
111
162
|
let id = value.trim();
|
|
112
|
-
// Extract hostname prefix: "abcd-123.dx.commercecloud.salesforce.com" → "abcd-123"
|
|
113
163
|
if (id.includes('.')) {
|
|
114
|
-
|
|
164
|
+
const fromHostname = tenantIdFromSandboxHostname(id);
|
|
165
|
+
if (!fromHostname)
|
|
166
|
+
return id;
|
|
167
|
+
id = fromHostname;
|
|
115
168
|
}
|
|
116
169
|
// Strip f_ecom_ prefix (handles org ID form)
|
|
117
170
|
if (id.startsWith(ORGANIZATION_ID_PREFIX)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-apis.js","sourceRoot":"","sources":["../../../src/clients/custom-apis.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;GAQG;AACH,OAAO,YAAY,EAAE,EAAa,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAC,oBAAoB,EAAE,uBAAuB,EAAC,MAAM,iBAA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;;;GAqBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAEtB,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,YAAY,GAAG,2BAA2B,CAAC,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY;YAAE,OAAO,EAAE,CAAC;QAC7B,EAAE,GAAG,YAAY,CAAC;IACpB,CAAC;IAED,6CAA6C;IAC7C,IAAI,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC1C,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,iCAAiC;IACjC,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE7B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,GAAG,yBAAyB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;AACtE,CAAC"}
|
|
@@ -128,7 +128,7 @@ export { createOdsClient } from './ods.js';
|
|
|
128
128
|
export type { OdsClient, OdsClientConfig, OdsError, OdsResponse, paths as OdsPaths, components as OdsComponents, } from './ods.js';
|
|
129
129
|
export { createMrtClient, createMrtMaintenanceMiddleware, runWithMrtReadOnlyListener, DEFAULT_MRT_ORIGIN, MRT_READ_ONLY_HEADER, isMrtReadOnlyResponse, MrtMaintenanceError, } from './mrt.js';
|
|
130
130
|
export type { MrtClient, MrtClientConfig, MrtError, MrtResponse, MrtReadOnlyListener, BuildPushResponse, paths as MrtPaths, components as MrtComponents, } from './mrt.js';
|
|
131
|
-
export { createCustomApisClient, toOrganizationId, normalizeTenantId, buildTenantScope, ORGANIZATION_ID_PREFIX, SCAPI_TENANT_SCOPE_PREFIX, CUSTOM_APIS_DEFAULT_SCOPES, } from './custom-apis.js';
|
|
131
|
+
export { createCustomApisClient, toOrganizationId, normalizeTenantId, tenantIdFromSandboxHostname, sandboxHostnameFromTenantId, buildTenantScope, ORGANIZATION_ID_PREFIX, SCAPI_TENANT_SCOPE_PREFIX, CUSTOM_APIS_DEFAULT_SCOPES, } from './custom-apis.js';
|
|
132
132
|
export type { CustomApisClient, CustomApisClientConfig, CustomApisError, CustomApisResponse, paths as CustomApisPaths, components as CustomApisComponents, } from './custom-apis.js';
|
|
133
133
|
export { createScapiSchemasClient, SCAPI_SCHEMAS_DEFAULT_SCOPES } from './scapi-schemas.js';
|
|
134
134
|
export type { ScapiSchemasClient, ScapiSchemasClientConfig, ScapiSchemasError, ScapiSchemasResponse, SchemaListItem, SchemaListResult, OpenApiSchema, paths as ScapiSchemasPaths, components as ScapiSchemasComponents, } from './scapi-schemas.js';
|
|
@@ -126,7 +126,7 @@ export { createSlasClient } from './slas-admin.js';
|
|
|
126
126
|
export { createSlasShopperClient } from './slas-shopper.js';
|
|
127
127
|
export { createOdsClient } from './ods.js';
|
|
128
128
|
export { createMrtClient, createMrtMaintenanceMiddleware, runWithMrtReadOnlyListener, DEFAULT_MRT_ORIGIN, MRT_READ_ONLY_HEADER, isMrtReadOnlyResponse, MrtMaintenanceError, } from './mrt.js';
|
|
129
|
-
export { createCustomApisClient, toOrganizationId, normalizeTenantId, buildTenantScope, ORGANIZATION_ID_PREFIX, SCAPI_TENANT_SCOPE_PREFIX, CUSTOM_APIS_DEFAULT_SCOPES, } from './custom-apis.js';
|
|
129
|
+
export { createCustomApisClient, toOrganizationId, normalizeTenantId, tenantIdFromSandboxHostname, sandboxHostnameFromTenantId, buildTenantScope, ORGANIZATION_ID_PREFIX, SCAPI_TENANT_SCOPE_PREFIX, CUSTOM_APIS_DEFAULT_SCOPES, } from './custom-apis.js';
|
|
130
130
|
export { createScapiSchemasClient, SCAPI_SCHEMAS_DEFAULT_SCOPES } from './scapi-schemas.js';
|
|
131
131
|
export { createAccountManagerClient, createAccountManagerUsersClient, getUser, listUsers, createUser, updateUser, deleteUser, purgeUser, resetUser, findUserByLogin, fetchRoleMapping, resolveToInternalRole, resolveFromInternalRole, createAccountManagerRolesClient, getRole, listRoles, createAccountManagerApiClientsClient, createAccountManagerOrgsClient, isValidRoleTenantFilter, ROLE_TENANT_FILTER_PATTERN, } from './am-api.js';
|
|
132
132
|
export { createCdnZonesClient, CDN_ZONES_READ_SCOPES, CDN_ZONES_RW_SCOPES } from './cdn-zones.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AACH,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAQzB,iDAAiD;AACjD,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAC,kBAAkB,EAAE,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAGtF,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAU7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,uBAAuB,EAAuD,MAAM,mBAAmB,CAAC;AAWhH,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAUzC,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,EAC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,EAAC,kCAAkC,EAAE,+BAA+B,EAAC,MAAM,8BAA8B,CAAC;AAejH,mEAAmE;AACnE,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,6BAA6B,EAC7B,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,4BAA4B,EAC5B,iCAAiC,EACjC,+BAA+B,EAC/B,iBAAiB,EACjB,6BAA6B,EAC7B,uBAAuB,EACvB,iCAAiC,EACjC,UAAU,GACX,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -77,6 +77,9 @@ export declare function assertOcapiCompatibilityAllowed(preference: ApiBackendPr
|
|
|
77
77
|
* These are safe for the temporary `auto` compatibility mode to retry over
|
|
78
78
|
* OCAPI. Ambiguous responses (`429`, `5xx`) and network failures are excluded
|
|
79
79
|
* because a mutating request might already have reached the platform.
|
|
80
|
+
* `400` is excluded too: the request was authenticated and understood well
|
|
81
|
+
* enough to be validated, so the body/params are wrong and OCAPI would only
|
|
82
|
+
* hide that error (or fail differently). Fix the request instead.
|
|
80
83
|
*/
|
|
81
84
|
export declare const SAFE_SCAPI_FALLBACK_STATUSES: Set<number>;
|
|
82
85
|
/**
|
|
@@ -105,6 +108,18 @@ export declare function createScapiRequestError(error: unknown, response: Respon
|
|
|
105
108
|
* a safe client-error status.
|
|
106
109
|
*/
|
|
107
110
|
export declare function isFallbackTrigger(error: unknown): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Runs the OCAPI half of a SCAPI → OCAPI fallback and keeps the SCAPI failure
|
|
113
|
+
* visible if OCAPI also fails.
|
|
114
|
+
*
|
|
115
|
+
* Without this, a SCAPI rejection that reveals a real request problem (for
|
|
116
|
+
* example a 400 body-shape error) is replaced by an unrelated OCAPI error
|
|
117
|
+
* (typically "access isn't allowed for the current client"), which sends
|
|
118
|
+
* callers chasing the wrong cause. The OCAPI error is rethrown (type
|
|
119
|
+
* preserved) with the SCAPI rejection appended to its message and attached as
|
|
120
|
+
* `scapiError`.
|
|
121
|
+
*/
|
|
122
|
+
export declare function runOcapiFallback<T>(scapiError: unknown, ocapi: () => Promise<T>): Promise<T>;
|
|
108
123
|
/**
|
|
109
124
|
* Inputs to `resolveScapiOrOcapi`.
|
|
110
125
|
*/
|
|
@@ -80,8 +80,11 @@ export function assertOcapiCompatibilityAllowed(preference, capability) {
|
|
|
80
80
|
* These are safe for the temporary `auto` compatibility mode to retry over
|
|
81
81
|
* OCAPI. Ambiguous responses (`429`, `5xx`) and network failures are excluded
|
|
82
82
|
* because a mutating request might already have reached the platform.
|
|
83
|
+
* `400` is excluded too: the request was authenticated and understood well
|
|
84
|
+
* enough to be validated, so the body/params are wrong and OCAPI would only
|
|
85
|
+
* hide that error (or fail differently). Fix the request instead.
|
|
83
86
|
*/
|
|
84
|
-
export const SAFE_SCAPI_FALLBACK_STATUSES = new Set([
|
|
87
|
+
export const SAFE_SCAPI_FALLBACK_STATUSES = new Set([401, 403, 404, 405, 406, 415]);
|
|
85
88
|
/**
|
|
86
89
|
* A structured SCAPI response failure. Backends must retain the response
|
|
87
90
|
* status so the shared fallback policy can distinguish a definite rejection
|
|
@@ -115,6 +118,30 @@ export function isFallbackTrigger(error) {
|
|
|
115
118
|
error instanceof ScapiCapabilityUnsupportedError ||
|
|
116
119
|
(error instanceof ScapiRequestError && SAFE_SCAPI_FALLBACK_STATUSES.has(error.status)));
|
|
117
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Runs the OCAPI half of a SCAPI → OCAPI fallback and keeps the SCAPI failure
|
|
123
|
+
* visible if OCAPI also fails.
|
|
124
|
+
*
|
|
125
|
+
* Without this, a SCAPI rejection that reveals a real request problem (for
|
|
126
|
+
* example a 400 body-shape error) is replaced by an unrelated OCAPI error
|
|
127
|
+
* (typically "access isn't allowed for the current client"), which sends
|
|
128
|
+
* callers chasing the wrong cause. The OCAPI error is rethrown (type
|
|
129
|
+
* preserved) with the SCAPI rejection appended to its message and attached as
|
|
130
|
+
* `scapiError`.
|
|
131
|
+
*/
|
|
132
|
+
export async function runOcapiFallback(scapiError, ocapi) {
|
|
133
|
+
try {
|
|
134
|
+
return await ocapi();
|
|
135
|
+
}
|
|
136
|
+
catch (ocapiError) {
|
|
137
|
+
const scapiMessage = scapiError instanceof Error ? scapiError.message : String(scapiError);
|
|
138
|
+
if (ocapiError instanceof Error) {
|
|
139
|
+
ocapiError.message = `${ocapiError.message}\nThe SCAPI attempt was rejected first: ${scapiMessage}\nThe SCAPI error is usually the actionable one; retry with the SCAPI backend only (--api-backend scapi, or api-backend "scapi" in config / SFCC_API_BACKEND=scapi) to see only it.`;
|
|
140
|
+
ocapiError.scapiError = scapiError;
|
|
141
|
+
}
|
|
142
|
+
throw ocapiError;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
118
145
|
/**
|
|
119
146
|
* Message for when explicit SCAPI is requested but the instance can't reach it.
|
|
120
147
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scapi-backend-utils.js","sourceRoot":"","sources":["../../../src/clients/scapi-backend-utils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAWpD,uFAAuF;AACvF,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAWxD,mGAAmG;AACnG,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD;QACE,KAAK,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KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IAE3C,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO;IACP,OAAO,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA2B;IAC7D,MAAM,EAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAC,GAAG,IAAI,CAAC;IACtD,OAAO,uBAAuB,CAAC;QAC7B,UAAU;QACV,OAAO,EAAE,OAAO;QAChB,cAAc;QACd,kBAAkB,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,UAAU,CAAC;KAC9D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @module clients/scapi-fallback-backend
|
|
21
21
|
*/
|
|
22
22
|
import { getLogger } from '../logging/logger.js';
|
|
23
|
-
import { isFallbackTrigger } from './scapi-backend-utils.js';
|
|
23
|
+
import { isFallbackTrigger, runOcapiFallback } from './scapi-backend-utils.js';
|
|
24
24
|
/**
|
|
25
25
|
* Wraps a SCAPI call with automatic OCAPI fallback on a recognized
|
|
26
26
|
* fallback trigger ({@link isFallbackTrigger}).
|
|
@@ -51,7 +51,7 @@ async function withFallback(state, fn) {
|
|
|
51
51
|
if (isFallbackTrigger(error)) {
|
|
52
52
|
getLogger().info(`SCAPI ${state.domainName} unavailable for this operation, falling back to OCAPI`);
|
|
53
53
|
state.resolved = state.ocapi;
|
|
54
|
-
return fn(state.ocapi);
|
|
54
|
+
return runOcapiFallback(error, () => fn(state.ocapi));
|
|
55
55
|
}
|
|
56
56
|
throw error;
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scapi-fallback-backend.js","sourceRoot":"","sources":["../../../src/clients/scapi-fallback-backend.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"scapi-fallback-backend.js","sourceRoot":"","sources":["../../../src/clients/scapi-fallback-backend.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAc/F;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CACzB,KAAuB,EACvB,EAA8B;IAE9B,4EAA4E;IAC5E,oDAAoD;IACpD,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,wEAAwE;IACxE,yEAAyE;IACzE,0EAA0E;IAC1E,qEAAqE;IACrE,uEAAuE;IACvE,oDAAoD;IACpD,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,QAAQ;YAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;QAClD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,SAAS,EAAE,CAAC,IAAI,CAAC,SAAS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AAC,CAAC;oBACxE,OAAQ,EAA4C,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBAC1E,CAAC,CAAC;YACJ,CAAC;YAED,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE,CAC5B,YAAY,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;gBAC9B,MAAM,EAAE,GAAI,OAAuD,CAAC,IAAI,CAAC,CAAC;gBAC1E,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;oBAC7B,MAAM,IAAI,SAAS,CAAC,UAAU,MAAM,CAAC,IAAI,CAAC,yBAAyB,OAAO,CAAC,IAAI,UAAU,CAAC,CAAC;gBAC7F,CAAC;gBACD,OAAQ,EAA4C,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;QACP,CAAC;KACF,CAAM,CAAC;AACV,CAAC"}
|
|
@@ -183,7 +183,7 @@ export interface components {
|
|
|
183
183
|
apiNamePath: string;
|
|
184
184
|
/** @description The API version (e.g., v1) */
|
|
185
185
|
apiVersionPath: string;
|
|
186
|
-
/** @description
|
|
186
|
+
/** @description Sections to add to the contract, as one comma-separated value (a repeated parameter is rejected). One or more of: all, custom_properties, descriptions, examples, external_docs, summaries, tags, titles. `all` includes every other value. Without it the contract omits operation summaries and descriptions. */
|
|
187
187
|
expand: string;
|
|
188
188
|
};
|
|
189
189
|
requestBodies: never;
|
|
@@ -257,7 +257,7 @@ export interface operations {
|
|
|
257
257
|
getSchema: {
|
|
258
258
|
parameters: {
|
|
259
259
|
query?: {
|
|
260
|
-
/** @description
|
|
260
|
+
/** @description Sections to add to the contract, as one comma-separated value (a repeated parameter is rejected). One or more of: all, custom_properties, descriptions, examples, external_docs, summaries, tags, titles. `all` includes every other value. Without it the contract omits operation summaries and descriptions. */
|
|
261
261
|
expand?: components["parameters"]["expand"];
|
|
262
262
|
};
|
|
263
263
|
header?: never;
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @module compat/dispatcher
|
|
51
51
|
*/
|
|
52
52
|
import { getLogger } from '../logging/logger.js';
|
|
53
|
-
import { isFallbackTrigger, scapiUnavailableMessage } from '../clients/scapi-backend-utils.js';
|
|
53
|
+
import { isFallbackTrigger, runOcapiFallback, scapiUnavailableMessage, } from '../clients/scapi-backend-utils.js';
|
|
54
54
|
/**
|
|
55
55
|
* Stateful router that runs SCAPI optimistically and falls back to OCAPI
|
|
56
56
|
* once on a safe capability/auth/request rejection, caching the choice for the lifetime of the
|
|
@@ -115,7 +115,7 @@ export class BackendDispatcher {
|
|
|
115
115
|
if (isFallbackTrigger(error)) {
|
|
116
116
|
getLogger().info(`SCAPI ${this.domainName} unavailable for this operation, falling back to OCAPI`);
|
|
117
117
|
this.resolved = 'ocapi';
|
|
118
|
-
return branches.ocapi
|
|
118
|
+
return runOcapiFallback(error, branches.ocapi);
|
|
119
119
|
}
|
|
120
120
|
throw error;
|
|
121
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../../src/compat/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../../src/compat/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,mCAAmC,CAAC;AAkB3C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IAiBT;IAhBX,QAAQ,CAAmB;IAC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AChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,SAAS,EAAE,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,wDAAwD,CAAC,CAAC;gBACnG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;gBACxB,OAAO,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YACjD,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Links resolution results to the source objects that produced them.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of {@link ConfigSourceInfo} so serialized diagnostics never carry
|
|
5
|
+
* source instances (which may hold environment maps or secrets).
|
|
6
|
+
*
|
|
7
|
+
* @module config/config-origins
|
|
8
|
+
*/
|
|
9
|
+
import type { ConfigSource, ConfigSourceInfo, ResolveConfigOptions } from './types.js';
|
|
10
|
+
/** A source that took part in resolution, with the options it was loaded with. */
|
|
11
|
+
export interface ConfigOrigin {
|
|
12
|
+
source: ConfigSource;
|
|
13
|
+
info: ConfigSourceInfo;
|
|
14
|
+
options: ResolveConfigOptions;
|
|
15
|
+
}
|
|
16
|
+
/** @internal Associate origins with a resolution result or resolved config. */
|
|
17
|
+
export declare function recordConfigOrigins(target: object, entries: readonly ConfigOrigin[] | undefined): void;
|
|
18
|
+
/** Origins recorded for a resolution result or resolved config, in priority order. */
|
|
19
|
+
export declare function getConfigOrigins(target: object): readonly ConfigOrigin[] | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const origins = new WeakMap();
|
|
2
|
+
/** @internal Associate origins with a resolution result or resolved config. */
|
|
3
|
+
export function recordConfigOrigins(target, entries) {
|
|
4
|
+
if (entries)
|
|
5
|
+
origins.set(target, entries);
|
|
6
|
+
}
|
|
7
|
+
/** Origins recorded for a resolution result or resolved config, in priority order. */
|
|
8
|
+
export function getConfigOrigins(target) {
|
|
9
|
+
return origins.get(target);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config-origins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-origins.js","sourceRoot":"","sources":["../../../src/config/config-origins.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAmC,CAAC;AAE/D,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,OAA4C;IAC9F,IAAI,OAAO;QAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read and write individual configuration fields at the source that supplies them.
|
|
3
|
+
*
|
|
4
|
+
* Writes go to the highest-priority source currently supplying a field, so the
|
|
5
|
+
* new value always takes effect. A field no source supplies goes to the entry
|
|
6
|
+
* that selected the instance (for example the active dw.json config). Sources
|
|
7
|
+
* that don't implement {@link ConfigSource.updateConfig} (shell environment,
|
|
8
|
+
* ~/.mobify, package.json) are never written; credential stores are written
|
|
9
|
+
* through {@link ConfigSource.storeCredential} for their declared fields.
|
|
10
|
+
*
|
|
11
|
+
* @module config/config-write
|
|
12
|
+
*/
|
|
13
|
+
import { type ConfigOrigin } from './config-origins.js';
|
|
14
|
+
import { type JsonSchema } from './dw-json-schema.js';
|
|
15
|
+
import type { ConfigSourceInfo, ConfigUpdateResult, NormalizedConfig, ResolvedB2CConfig } from './types.js';
|
|
16
|
+
/** A settable configuration key. */
|
|
17
|
+
export interface ConfigKey {
|
|
18
|
+
/** dw.json key (kebab-case) */
|
|
19
|
+
key: string;
|
|
20
|
+
/** Normalized config field */
|
|
21
|
+
field: keyof NormalizedConfig;
|
|
22
|
+
/** JSON Schema for the value */
|
|
23
|
+
schema: JsonSchema;
|
|
24
|
+
}
|
|
25
|
+
/** Error raised when a configuration field can't be read or written safely. */
|
|
26
|
+
export declare class ConfigWriteError extends Error {
|
|
27
|
+
readonly code: 'CONFIG_KEY_UNKNOWN' | 'CONFIG_VALUE_INVALID' | 'CONFIG_SOURCE_READ_ONLY' | 'CONFIG_NO_WRITE_TARGET' | 'CONFIG_NOT_SET';
|
|
28
|
+
constructor(code: 'CONFIG_KEY_UNKNOWN' | 'CONFIG_VALUE_INVALID' | 'CONFIG_SOURCE_READ_ONLY' | 'CONFIG_NO_WRITE_TARGET' | 'CONFIG_NOT_SET', message: string);
|
|
29
|
+
}
|
|
30
|
+
/** All keys `setup set` accepts, in dw.json order. */
|
|
31
|
+
export declare function listConfigKeys(): ConfigKey[];
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a user-supplied key (dw.json kebab-case, camelCase, a legacy alias,
|
|
34
|
+
* or the normalized field name) to a settable configuration key.
|
|
35
|
+
*
|
|
36
|
+
* @throws ConfigWriteError for unknown or unsettable keys
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveConfigKey(input: string): ConfigKey;
|
|
39
|
+
/**
|
|
40
|
+
* Coerce a command-line value to the key's type.
|
|
41
|
+
*
|
|
42
|
+
* String keys keep the text as given. Other keys accept JSON (`true`,
|
|
43
|
+
* `["a","b"]`, `{"level":"NO_DELETE"}`); string-list keys also accept a
|
|
44
|
+
* plain or comma-separated value (`./schemas` becomes `["./schemas"]`).
|
|
45
|
+
*
|
|
46
|
+
* @throws ConfigWriteError when the value doesn't match the key's schema
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseConfigValue(key: ConfigKey, raw: string): unknown;
|
|
49
|
+
/** Where a field's value comes from and where a write would go. */
|
|
50
|
+
export interface ConfigFieldLocation {
|
|
51
|
+
/** Source currently supplying the field, if any */
|
|
52
|
+
supplier?: ConfigSourceInfo;
|
|
53
|
+
/** Origin that a write would update */
|
|
54
|
+
target?: ConfigOrigin;
|
|
55
|
+
/** Why the field can't be written, when {@link target} is absent */
|
|
56
|
+
error?: ConfigWriteError;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Locate a field in a resolved configuration: which source supplies it and
|
|
60
|
+
* which source a write should update.
|
|
61
|
+
*
|
|
62
|
+
* The target is, in order: the source supplying the field; the source
|
|
63
|
+
* supplying the other half of its credential pair; or, for a field nothing
|
|
64
|
+
* sets, the source that supplied the instance itself (its `instanceName`, else
|
|
65
|
+
* its `hostname`). A derived value (a sandbox hostname worked out from its
|
|
66
|
+
* tenant ID) counts as supplied by the source of the field it came from. Every
|
|
67
|
+
* rule uses only {@link ConfigSourceInfo} and the optional write methods, so
|
|
68
|
+
* plugin sources take part the same way dw.json does.
|
|
69
|
+
*/
|
|
70
|
+
export declare function locateConfigField(config: ResolvedB2CConfig, field: keyof NormalizedConfig): ConfigFieldLocation;
|
|
71
|
+
/**
|
|
72
|
+
* Set or remove (`value === undefined`) a field at the source that supplies it.
|
|
73
|
+
*
|
|
74
|
+
* @throws ConfigWriteError when the field has no writable target
|
|
75
|
+
*/
|
|
76
|
+
export declare function writeConfigField(config: ResolvedB2CConfig, field: keyof NormalizedConfig, value: unknown): Promise<ConfigUpdateResult & {
|
|
77
|
+
source: string;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Remove a field from the source that supplies it.
|
|
81
|
+
*
|
|
82
|
+
* @throws ConfigWriteError when the field isn't set or its source can't be written
|
|
83
|
+
*/
|
|
84
|
+
export declare function removeConfigField(config: ResolvedB2CConfig, field: keyof NormalizedConfig): Promise<ConfigUpdateResult & {
|
|
85
|
+
source: string;
|
|
86
|
+
}>;
|