@salesforce/b2c-tooling-sdk 1.18.0 → 1.19.1
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/dist/esm/clients/index.d.ts +2 -0
- package/dist/esm/clients/index.js +1 -0
- package/dist/esm/clients/index.js.map +1 -1
- package/dist/esm/clients/metrics.d.ts +123 -0
- package/dist/esm/clients/metrics.generated.d.ts +1016 -0
- package/dist/esm/clients/metrics.generated.js +6 -0
- package/dist/esm/clients/metrics.generated.js.map +1 -0
- package/dist/esm/clients/metrics.js +65 -0
- package/dist/esm/clients/metrics.js.map +1 -0
- package/dist/esm/clients/middleware-registry.d.ts +1 -1
- package/dist/esm/clients/middleware-registry.js.map +1 -1
- package/dist/esm/discovery/detector.d.ts +1 -0
- package/dist/esm/discovery/detector.js +3 -1
- package/dist/esm/discovery/detector.js.map +1 -1
- package/dist/esm/discovery/index.d.ts +1 -1
- package/dist/esm/discovery/patterns/cartridges.js +4 -2
- package/dist/esm/discovery/patterns/cartridges.js.map +1 -1
- package/dist/esm/discovery/patterns/sfra.js +10 -5
- package/dist/esm/discovery/patterns/sfra.js.map +1 -1
- package/dist/esm/discovery/types.d.ts +20 -1
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operations/code/cartridges.d.ts +18 -0
- package/dist/esm/operations/code/cartridges.js +31 -20
- package/dist/esm/operations/code/cartridges.js.map +1 -1
- package/dist/esm/operations/logs/filter.d.ts +6 -1
- package/dist/esm/operations/logs/filter.js +7 -2
- package/dist/esm/operations/logs/filter.js.map +1 -1
- package/dist/esm/operations/metrics/index.d.ts +371 -0
- package/dist/esm/operations/metrics/index.js +478 -0
- package/dist/esm/operations/metrics/index.js.map +1 -0
- package/dist/esm/operations/metrics/tags.d.ts +148 -0
- package/dist/esm/operations/metrics/tags.js +235 -0
- package/dist/esm/operations/metrics/tags.js.map +1 -0
- package/package.json +6 -2
- package/specs/metrics-v1.json +1713 -0
|
@@ -138,6 +138,8 @@ export { createMrtB2CClient, DEFAULT_MRT_B2C_ORIGIN } from './mrt-b2c.js';
|
|
|
138
138
|
export type { MrtB2CClient, MrtB2CClientConfig, MrtB2CError, MrtB2CResponse, B2COrgInfo, B2CTargetInfo, PatchedB2CTargetInfo, paths as MrtB2CPaths, components as MrtB2CComponents, } from './mrt-b2c.js';
|
|
139
139
|
export { createCipClient, CipClient, DEFAULT_CIP_HOST, DEFAULT_CIP_STAGING_HOST } from './cip.js';
|
|
140
140
|
export type { CipClientConfig, CipColumn, CipExecuteResponse, CipFetchResponse, CipFrame, CipQueryOptions, CipQueryResult, } from './cip.js';
|
|
141
|
+
export { createMetricsClient, METRICS_DEFAULT_SCOPES } from './metrics.js';
|
|
142
|
+
export type { MetricsClient, MetricsClientConfig, MetricsResponse, MetricsDataResponse, Metric, MetricDataSeries, MetricDataPoint, MetricsError, paths as MetricsPaths, components as MetricsComponents, } from './metrics.js';
|
|
141
143
|
export { createGranularReplicationsClient } from './granular-replications.js';
|
|
142
144
|
export type { GranularReplicationsClient, GranularReplicationsClientConfig, GranularReplicationsError, GranularReplicationsResponse, ProductItem, PriceTableItem, ContentAssetItemPrivate, ContentAssetItemShared, PublishProcessResponse, PublishProcessListResponse, PublishIdResponse, paths as GranularReplicationsPaths, components as GranularReplicationsComponents, } from './granular-replications.js';
|
|
143
145
|
export { getApiErrorMessage } from './error-utils.js';
|
|
@@ -131,6 +131,7 @@ export { createAccountManagerClient, createAccountManagerUsersClient, getUser, l
|
|
|
131
131
|
export { createCdnZonesClient, CDN_ZONES_READ_SCOPES, CDN_ZONES_RW_SCOPES } from './cdn-zones.js';
|
|
132
132
|
export { createMrtB2CClient, DEFAULT_MRT_B2C_ORIGIN } from './mrt-b2c.js';
|
|
133
133
|
export { createCipClient, CipClient, DEFAULT_CIP_HOST, DEFAULT_CIP_STAGING_HOST } from './cip.js';
|
|
134
|
+
export { createMetricsClient, METRICS_DEFAULT_SCOPES } from './metrics.js';
|
|
134
135
|
export { createGranularReplicationsClient } from './granular-replications.js';
|
|
135
136
|
export { getApiErrorMessage } from './error-utils.js';
|
|
136
137
|
export { createTlsDispatcher } from './tls-dispatcher.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;AAUjD,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAUzC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAW7D,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAU1B,OAAO,EAAC,wBAAwB,EAAE,4BAA4B,EAAC,MAAM,oBAAoB,CAAC;AAa1F,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,OAAO,EACP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|
|
2
|
+
* Metrics API client for B2C Commerce (Observability).
|
|
3
|
+
*
|
|
4
|
+
* Provides a fully typed client for the SCAPI Observability Metrics API
|
|
5
|
+
* (`observability/metrics/v1`) using openapi-fetch with OAuth authentication
|
|
6
|
+
* middleware. The API exposes time-series operational metrics (overall, sales,
|
|
7
|
+
* eCDN, third-party services, SCAPI, SCAPI hooks, MRT, controllers, and OCAPI)
|
|
8
|
+
* for an organization.
|
|
9
|
+
*
|
|
10
|
+
* @module clients/metrics
|
|
11
|
+
*/
|
|
12
|
+
import { type Client } from 'openapi-fetch';
|
|
13
|
+
import type { AuthStrategy } from '../auth/types.js';
|
|
14
|
+
import type { paths, components } from './metrics.generated.js';
|
|
15
|
+
import { type MiddlewareRegistry } from './middleware-registry.js';
|
|
16
|
+
/**
|
|
17
|
+
* Re-export generated types for external use.
|
|
18
|
+
*/
|
|
19
|
+
export type { paths, components };
|
|
20
|
+
/**
|
|
21
|
+
* The typed Metrics API client for retrieving observability metrics.
|
|
22
|
+
*
|
|
23
|
+
* ## Common Endpoints
|
|
24
|
+
*
|
|
25
|
+
* | Method | Path | Description |
|
|
26
|
+
* |--------|------|-------------|
|
|
27
|
+
* | GET | `/organizations/{organizationId}/metrics/overall` | Overall application metrics |
|
|
28
|
+
* | GET | `/organizations/{organizationId}/metrics/sales` | Sales metrics |
|
|
29
|
+
* | GET | `/organizations/{organizationId}/metrics/scapi` | SCAPI request metrics |
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { createMetricsClient, toOrganizationId } from '@salesforce/b2c-tooling-sdk/clients';
|
|
34
|
+
* import { OAuthStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
35
|
+
*
|
|
36
|
+
* const auth = new OAuthStrategy({ clientId: '...', clientSecret: '...' });
|
|
37
|
+
* const client = createMetricsClient({ shortCode: 'kv7kzm78', tenantId: 'zzxy_prd' }, auth);
|
|
38
|
+
*
|
|
39
|
+
* const { data, error } = await client.GET('/organizations/{organizationId}/metrics/overall', {
|
|
40
|
+
* params: { path: { organizationId: toOrganizationId('zzxy_prd') } },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see {@link createMetricsClient} for instantiation
|
|
45
|
+
*/
|
|
46
|
+
export type MetricsClient = Client<paths>;
|
|
47
|
+
/**
|
|
48
|
+
* Helper type to extract response data from an operation.
|
|
49
|
+
*/
|
|
50
|
+
export type MetricsResponse<T> = T extends {
|
|
51
|
+
content: {
|
|
52
|
+
'application/json': infer R;
|
|
53
|
+
};
|
|
54
|
+
} ? R : never;
|
|
55
|
+
/**
|
|
56
|
+
* The metrics data response envelope returned by every metrics operation.
|
|
57
|
+
*/
|
|
58
|
+
export type MetricsDataResponse = components['schemas']['MetricsDataResponse'];
|
|
59
|
+
/**
|
|
60
|
+
* A single metric with its metadata and one or more data series.
|
|
61
|
+
*/
|
|
62
|
+
export type Metric = components['schemas']['Metric'];
|
|
63
|
+
/**
|
|
64
|
+
* A named series of data points belonging to a {@link Metric}.
|
|
65
|
+
*/
|
|
66
|
+
export type MetricDataSeries = components['schemas']['DataSeries'];
|
|
67
|
+
/**
|
|
68
|
+
* A single `{timestamp, value}` data point. `timestamp` is epoch milliseconds.
|
|
69
|
+
*/
|
|
70
|
+
export type MetricDataPoint = components['schemas']['DataPoint'];
|
|
71
|
+
/**
|
|
72
|
+
* Standard RFC 7807 problem-details error response from the Metrics API.
|
|
73
|
+
*/
|
|
74
|
+
export type MetricsError = components['schemas']['ErrorResponse'];
|
|
75
|
+
/** Default OAuth scope required for the Metrics API (read-only). */
|
|
76
|
+
export declare const METRICS_DEFAULT_SCOPES: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Configuration for creating a Metrics API client.
|
|
79
|
+
*/
|
|
80
|
+
export interface MetricsClientConfig {
|
|
81
|
+
/**
|
|
82
|
+
* The short code for the SCAPI instance.
|
|
83
|
+
* This is typically a 4-8 character alphanumeric code.
|
|
84
|
+
* @example "kv7kzm78"
|
|
85
|
+
*/
|
|
86
|
+
shortCode: string;
|
|
87
|
+
/**
|
|
88
|
+
* The tenant ID (with or without f_ecom_ prefix).
|
|
89
|
+
* Used to build the organizationId path parameter and tenant-specific OAuth scope.
|
|
90
|
+
* @example "zzxy_prd" or "f_ecom_zzxy_prd"
|
|
91
|
+
*/
|
|
92
|
+
tenantId: string;
|
|
93
|
+
/**
|
|
94
|
+
* Optional scope override. If not provided, defaults to the domain scope
|
|
95
|
+
* (sfcc.metrics) plus the tenant-specific scope (SALESFORCE_COMMERCE_API:{tenant}).
|
|
96
|
+
*/
|
|
97
|
+
scopes?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* Middleware registry to use for this client.
|
|
100
|
+
* If not specified, uses the global middleware registry.
|
|
101
|
+
*/
|
|
102
|
+
middlewareRegistry?: MiddlewareRegistry;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Creates a typed Metrics API client.
|
|
106
|
+
*
|
|
107
|
+
* Returns the openapi-fetch client directly, with authentication handled via
|
|
108
|
+
* middleware. This gives full access to all openapi-fetch features with
|
|
109
|
+
* type-safe paths, parameters, and responses.
|
|
110
|
+
*
|
|
111
|
+
* The client automatically handles OAuth scope requirements:
|
|
112
|
+
* - Domain scope: `sfcc.metrics` (or custom via config.scopes)
|
|
113
|
+
* - Tenant scope: `SALESFORCE_COMMERCE_API:{tenantId}`
|
|
114
|
+
*
|
|
115
|
+
* @param config - Metrics client configuration including shortCode and tenantId
|
|
116
|
+
* @param auth - Authentication strategy (typically OAuth client-credentials)
|
|
117
|
+
* @returns Typed openapi-fetch client
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* const auth = new OAuthStrategy({ clientId: '...', clientSecret: '...' });
|
|
121
|
+
* const client = createMetricsClient({ shortCode: 'kv7kzm78', tenantId: 'zzxy_prd' }, auth);
|
|
122
|
+
*/
|
|
123
|
+
export declare function createMetricsClient(config: MetricsClientConfig, auth: AuthStrategy): MetricsClient;
|