@salesforce/b2c-tooling-sdk 0.12.0 → 1.0.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/README.md +6 -0
- package/dist/cjs/auth/oauth-implicit.d.ts +6 -0
- package/dist/cjs/auth/oauth-implicit.js +8 -3
- package/dist/cjs/auth/oauth-implicit.js.map +1 -1
- package/dist/cjs/auth/resolve.js +2 -0
- package/dist/cjs/auth/resolve.js.map +1 -1
- package/dist/cjs/auth/types.d.ts +8 -0
- package/dist/cjs/auth/types.js.map +1 -1
- package/dist/cjs/cli/am-command.js +2 -2
- package/dist/cjs/cli/am-command.js.map +1 -1
- package/dist/cjs/cli/base-command.js +1 -1
- package/dist/cjs/cli/base-command.js.map +1 -1
- package/dist/cjs/cli/oauth-command.d.ts +4 -0
- package/dist/cjs/cli/oauth-command.js +7 -1
- package/dist/cjs/cli/oauth-command.js.map +1 -1
- package/dist/cjs/cli/ods-command.js +2 -2
- package/dist/cjs/cli/ods-command.js.map +1 -1
- package/dist/cjs/clients/granular-replications.d.ts +70 -0
- package/dist/cjs/clients/granular-replications.generated.d.ts +416 -0
- package/dist/cjs/clients/granular-replications.generated.js +6 -0
- package/dist/cjs/clients/granular-replications.generated.js.map +1 -0
- package/dist/cjs/clients/granular-replications.js +70 -0
- package/dist/cjs/clients/granular-replications.js.map +1 -0
- package/dist/cjs/clients/index.d.ts +2 -0
- package/dist/cjs/clients/index.js +1 -0
- package/dist/cjs/clients/index.js.map +1 -1
- package/dist/cjs/clients/middleware-registry.d.ts +1 -1
- package/dist/cjs/clients/middleware-registry.js.map +1 -1
- package/dist/cjs/clients/mrt.js +2 -1
- package/dist/cjs/clients/mrt.js.map +1 -1
- package/dist/cjs/config/mapping.d.ts +13 -1
- package/dist/cjs/config/mapping.js +27 -1
- package/dist/cjs/config/mapping.js.map +1 -1
- package/dist/cjs/config/resolved-config.d.ts +1 -1
- package/dist/cjs/config/resolved-config.js +4 -2
- package/dist/cjs/config/resolved-config.js.map +1 -1
- package/dist/cjs/config/resolver.js +4 -1
- package/dist/cjs/config/resolver.js.map +1 -1
- package/dist/cjs/config/types.d.ts +6 -1
- package/dist/cjs/defaults.d.ts +8 -0
- package/dist/cjs/defaults.js +20 -0
- package/dist/cjs/defaults.js.map +1 -1
- package/dist/cjs/errors/index.d.ts +6 -0
- package/dist/cjs/errors/index.js +6 -0
- package/dist/cjs/errors/index.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instance/index.js +2 -0
- package/dist/cjs/instance/index.js.map +1 -1
- package/dist/cjs/operations/bm-roles/index.d.ts +52 -0
- package/dist/cjs/operations/bm-roles/index.js +57 -0
- package/dist/cjs/operations/bm-roles/index.js.map +1 -0
- package/dist/cjs/operations/bm-roles/roles.d.ts +155 -0
- package/dist/cjs/operations/bm-roles/roles.js +194 -0
- package/dist/cjs/operations/bm-roles/roles.js.map +1 -0
- package/dist/cjs/operations/jobs/index.d.ts +1 -1
- package/dist/cjs/operations/jobs/index.js.map +1 -1
- package/dist/cjs/operations/jobs/run.d.ts +24 -9
- package/dist/cjs/operations/jobs/run.js +19 -17
- package/dist/cjs/operations/jobs/run.js.map +1 -1
- package/dist/cjs/operations/mrt/env.d.ts +25 -10
- package/dist/cjs/operations/mrt/env.js +22 -11
- package/dist/cjs/operations/mrt/env.js.map +1 -1
- package/dist/cjs/operations/mrt/index.d.ts +1 -1
- package/dist/cjs/operations/mrt/index.js.map +1 -1
- package/dist/cjs/operations/mrt/tail-logs.js +3 -2
- package/dist/cjs/operations/mrt/tail-logs.js.map +1 -1
- package/dist/cjs/operations/sites/cartridges.d.ts +114 -0
- package/dist/cjs/operations/sites/cartridges.js +378 -0
- package/dist/cjs/operations/sites/cartridges.js.map +1 -0
- package/dist/cjs/operations/sites/index.d.ts +46 -0
- package/dist/cjs/operations/sites/index.js +51 -0
- package/dist/cjs/operations/sites/index.js.map +1 -0
- package/dist/esm/auth/oauth-implicit.d.ts +6 -0
- package/dist/esm/auth/oauth-implicit.js +8 -3
- package/dist/esm/auth/oauth-implicit.js.map +1 -1
- package/dist/esm/auth/resolve.js +2 -0
- package/dist/esm/auth/resolve.js.map +1 -1
- package/dist/esm/auth/types.d.ts +8 -0
- package/dist/esm/auth/types.js.map +1 -1
- package/dist/esm/cli/am-command.js +2 -2
- package/dist/esm/cli/am-command.js.map +1 -1
- package/dist/esm/cli/base-command.js +1 -1
- package/dist/esm/cli/base-command.js.map +1 -1
- package/dist/esm/cli/oauth-command.d.ts +4 -0
- package/dist/esm/cli/oauth-command.js +7 -1
- package/dist/esm/cli/oauth-command.js.map +1 -1
- package/dist/esm/cli/ods-command.js +2 -2
- package/dist/esm/cli/ods-command.js.map +1 -1
- package/dist/esm/clients/granular-replications.d.ts +70 -0
- package/dist/esm/clients/granular-replications.generated.d.ts +416 -0
- package/dist/esm/clients/granular-replications.generated.js +6 -0
- package/dist/esm/clients/granular-replications.generated.js.map +1 -0
- package/dist/esm/clients/granular-replications.js +70 -0
- package/dist/esm/clients/granular-replications.js.map +1 -0
- 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/middleware-registry.d.ts +1 -1
- package/dist/esm/clients/middleware-registry.js.map +1 -1
- package/dist/esm/clients/mrt.js +2 -1
- package/dist/esm/clients/mrt.js.map +1 -1
- package/dist/esm/config/mapping.d.ts +13 -1
- package/dist/esm/config/mapping.js +27 -1
- package/dist/esm/config/mapping.js.map +1 -1
- package/dist/esm/config/resolved-config.d.ts +1 -1
- package/dist/esm/config/resolved-config.js +4 -2
- package/dist/esm/config/resolved-config.js.map +1 -1
- package/dist/esm/config/resolver.js +4 -1
- package/dist/esm/config/resolver.js.map +1 -1
- package/dist/esm/config/types.d.ts +6 -1
- package/dist/esm/defaults.d.ts +8 -0
- package/dist/esm/defaults.js +20 -0
- package/dist/esm/defaults.js.map +1 -1
- package/dist/esm/errors/index.d.ts +6 -0
- package/dist/esm/errors/index.js +6 -0
- package/dist/esm/errors/index.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instance/index.js +2 -0
- package/dist/esm/instance/index.js.map +1 -1
- package/dist/esm/operations/bm-roles/index.d.ts +52 -0
- package/dist/esm/operations/bm-roles/index.js +57 -0
- package/dist/esm/operations/bm-roles/index.js.map +1 -0
- package/dist/esm/operations/bm-roles/roles.d.ts +155 -0
- package/dist/esm/operations/bm-roles/roles.js +194 -0
- package/dist/esm/operations/bm-roles/roles.js.map +1 -0
- package/dist/esm/operations/jobs/index.d.ts +1 -1
- package/dist/esm/operations/jobs/index.js.map +1 -1
- package/dist/esm/operations/jobs/run.d.ts +24 -9
- package/dist/esm/operations/jobs/run.js +19 -17
- package/dist/esm/operations/jobs/run.js.map +1 -1
- package/dist/esm/operations/mrt/env.d.ts +25 -10
- package/dist/esm/operations/mrt/env.js +22 -11
- package/dist/esm/operations/mrt/env.js.map +1 -1
- package/dist/esm/operations/mrt/index.d.ts +1 -1
- package/dist/esm/operations/mrt/index.js.map +1 -1
- package/dist/esm/operations/mrt/tail-logs.js +3 -2
- package/dist/esm/operations/mrt/tail-logs.js.map +1 -1
- package/dist/esm/operations/sites/cartridges.d.ts +114 -0
- package/dist/esm/operations/sites/cartridges.js +378 -0
- package/dist/esm/operations/sites/cartridges.js.map +1 -0
- package/dist/esm/operations/sites/index.d.ts +46 -0
- package/dist/esm/operations/sites/index.js +51 -0
- package/dist/esm/operations/sites/index.js.map +1 -0
- package/package.json +52 -2
- package/specs/granular-replications-v1.yaml +657 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
export interface paths {
|
|
6
|
+
"/organizations/{organizationId}/granular-processes": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path: {
|
|
11
|
+
/**
|
|
12
|
+
* @description An identifier for the organization the request is being made by
|
|
13
|
+
* @example f_ecom_zzxy_prd
|
|
14
|
+
*/
|
|
15
|
+
organizationId: components["parameters"]["organizationId"];
|
|
16
|
+
};
|
|
17
|
+
cookie?: never;
|
|
18
|
+
};
|
|
19
|
+
/** Retrieve a list of all publish processes with pagination support. */
|
|
20
|
+
get: operations["listPublishProcesses"];
|
|
21
|
+
put?: never;
|
|
22
|
+
/**
|
|
23
|
+
* Queue item for publishing
|
|
24
|
+
* @description Queues items, such as products, price tables, and content assets, for the upcoming publish operation. You can have multiple items in the queue, but you must send a separate request for each item.
|
|
25
|
+
*
|
|
26
|
+
* Note: The published price table is always the table with the continuously valid period.
|
|
27
|
+
*
|
|
28
|
+
* ## Publishing Limit
|
|
29
|
+
* This endpoint is limited to 50 items per publish operation. The HTTP status code 409 (Conflict) is returned if the limit is exceeded.
|
|
30
|
+
*/
|
|
31
|
+
post: operations["publishItems"];
|
|
32
|
+
delete?: never;
|
|
33
|
+
options?: never;
|
|
34
|
+
head?: never;
|
|
35
|
+
patch?: never;
|
|
36
|
+
trace?: never;
|
|
37
|
+
};
|
|
38
|
+
"/organizations/{organizationId}/granular-processes/{id}": {
|
|
39
|
+
parameters: {
|
|
40
|
+
query?: never;
|
|
41
|
+
header?: never;
|
|
42
|
+
path: {
|
|
43
|
+
/**
|
|
44
|
+
* @description An identifier for the organization the request is being made by
|
|
45
|
+
* @example f_ecom_zzxy_prd
|
|
46
|
+
*/
|
|
47
|
+
organizationId: components["parameters"]["organizationId"];
|
|
48
|
+
/** @description Publish process ID */
|
|
49
|
+
id: components["parameters"]["id"];
|
|
50
|
+
};
|
|
51
|
+
cookie?: never;
|
|
52
|
+
};
|
|
53
|
+
/** Retrieve details of a specific publish process using its ID. */
|
|
54
|
+
get: operations["getPublishProcess"];
|
|
55
|
+
put?: never;
|
|
56
|
+
post?: never;
|
|
57
|
+
delete?: never;
|
|
58
|
+
options?: never;
|
|
59
|
+
head?: never;
|
|
60
|
+
patch?: never;
|
|
61
|
+
trace?: never;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export type webhooks = Record<string, never>;
|
|
65
|
+
export interface components {
|
|
66
|
+
schemas: {
|
|
67
|
+
/**
|
|
68
|
+
* @description An identifier for the organization the request is being made by
|
|
69
|
+
* @example f_ecom_zzxy_prd
|
|
70
|
+
*/
|
|
71
|
+
OrganizationId: string;
|
|
72
|
+
/**
|
|
73
|
+
* Format: int32
|
|
74
|
+
* @description The total number of hits that match the search's criteria. This can be greater than the number of results returned as search results are paginated.
|
|
75
|
+
* @default 0
|
|
76
|
+
* @example 10
|
|
77
|
+
*/
|
|
78
|
+
Total: number;
|
|
79
|
+
/**
|
|
80
|
+
* Format: int32
|
|
81
|
+
* @description The offset for the search results (pagination).
|
|
82
|
+
* @default 0
|
|
83
|
+
* @example 0
|
|
84
|
+
*/
|
|
85
|
+
Offset: number;
|
|
86
|
+
/** @description Base type for results */
|
|
87
|
+
ResultBase: {
|
|
88
|
+
total: components["schemas"]["Total"];
|
|
89
|
+
/** @default 20 */
|
|
90
|
+
limit: number;
|
|
91
|
+
};
|
|
92
|
+
/** @description Paginated list of publish processes */
|
|
93
|
+
PublishProcessListResponse: {
|
|
94
|
+
data: components["schemas"]["PublishProcessResponse"][];
|
|
95
|
+
offset: components["schemas"]["Offset"];
|
|
96
|
+
} & components["schemas"]["ResultBase"];
|
|
97
|
+
/**
|
|
98
|
+
* @description Publish process ID of the published item
|
|
99
|
+
* @example xmRhi7394HymoeRkfwAAAZeg3WiM
|
|
100
|
+
*/
|
|
101
|
+
id: string;
|
|
102
|
+
/**
|
|
103
|
+
* @description The id (SKU) of the product.
|
|
104
|
+
* @example apple-ipod-classic
|
|
105
|
+
*/
|
|
106
|
+
ProductId: string;
|
|
107
|
+
/** @description Details of the published product (only available if a product was published) */
|
|
108
|
+
ProductItem: {
|
|
109
|
+
productId: components["schemas"]["ProductId"];
|
|
110
|
+
};
|
|
111
|
+
/** @description Details of the published price table (only available if a price table was published) */
|
|
112
|
+
PriceTableItem: {
|
|
113
|
+
/**
|
|
114
|
+
* @description ID of the price table
|
|
115
|
+
* @example usd-list-prices
|
|
116
|
+
*/
|
|
117
|
+
priceTableId: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @description The site ID
|
|
121
|
+
* @example RefArch
|
|
122
|
+
*/
|
|
123
|
+
SiteId: string;
|
|
124
|
+
ContentAssetItem: components["schemas"]["ContentAssetItemPrivate"] | components["schemas"]["ContentAssetItemShared"];
|
|
125
|
+
/** @description Details of the published content asset from a private library */
|
|
126
|
+
ContentAssetItemPrivate: {
|
|
127
|
+
/**
|
|
128
|
+
* @description ID of the content asset
|
|
129
|
+
* @example homepage-hero-banner
|
|
130
|
+
*/
|
|
131
|
+
contentId: string;
|
|
132
|
+
/**
|
|
133
|
+
* @description The type of library (private) from which the content asset originates.
|
|
134
|
+
* @example private
|
|
135
|
+
* @enum {string}
|
|
136
|
+
*/
|
|
137
|
+
type: "private";
|
|
138
|
+
siteId: components["schemas"]["SiteId"];
|
|
139
|
+
};
|
|
140
|
+
/** @description Details of the published content asset from a shared library */
|
|
141
|
+
ContentAssetItemShared: {
|
|
142
|
+
/**
|
|
143
|
+
* @description ID of the content asset
|
|
144
|
+
* @example homepage-hero-banner
|
|
145
|
+
*/
|
|
146
|
+
contentId: string;
|
|
147
|
+
/**
|
|
148
|
+
* @description The type of library (shared) from which the content asset originates.
|
|
149
|
+
* @example shared
|
|
150
|
+
* @enum {string}
|
|
151
|
+
*/
|
|
152
|
+
type: "shared";
|
|
153
|
+
/**
|
|
154
|
+
* @description ID of the shared library
|
|
155
|
+
* @example sharedLibrary
|
|
156
|
+
*/
|
|
157
|
+
libraryId: string;
|
|
158
|
+
};
|
|
159
|
+
/** @description Publish process details */
|
|
160
|
+
PublishProcessResponse: {
|
|
161
|
+
id: components["schemas"]["id"];
|
|
162
|
+
/**
|
|
163
|
+
* @description Status of the publish process
|
|
164
|
+
* @example completed
|
|
165
|
+
* @enum {string}
|
|
166
|
+
*/
|
|
167
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
168
|
+
/**
|
|
169
|
+
* Format: date-time
|
|
170
|
+
* @description Timestamp at which the publish process was started
|
|
171
|
+
* @example 2024-03-15T10:30:00Z
|
|
172
|
+
*/
|
|
173
|
+
startTime: string;
|
|
174
|
+
/**
|
|
175
|
+
* Format: date-time
|
|
176
|
+
* @description Timestamp at which the publish process was completed (only available if the status is "completed" or "failed")
|
|
177
|
+
* @example 2024-03-15T10:30:45Z
|
|
178
|
+
*/
|
|
179
|
+
endTime?: string;
|
|
180
|
+
/**
|
|
181
|
+
* @description User or ID of the client application that initiated the publish process
|
|
182
|
+
* @example user@example.com
|
|
183
|
+
*/
|
|
184
|
+
initiatedBy: string;
|
|
185
|
+
productItem?: components["schemas"]["ProductItem"];
|
|
186
|
+
priceTableItem?: components["schemas"]["PriceTableItem"];
|
|
187
|
+
contentAssetItem?: components["schemas"]["ContentAssetItem"];
|
|
188
|
+
};
|
|
189
|
+
ProductPublishRequest: {
|
|
190
|
+
product: components["schemas"]["ProductItem"];
|
|
191
|
+
};
|
|
192
|
+
PriceTablePublishRequest: {
|
|
193
|
+
priceTable: components["schemas"]["PriceTableItem"];
|
|
194
|
+
};
|
|
195
|
+
ContentAssetPublishRequest: {
|
|
196
|
+
contentAsset: components["schemas"]["ContentAssetItemPrivate"] | components["schemas"]["ContentAssetItemShared"];
|
|
197
|
+
};
|
|
198
|
+
PublishItemRequest: components["schemas"]["ProductPublishRequest"] | components["schemas"]["PriceTablePublishRequest"] | components["schemas"]["ContentAssetPublishRequest"];
|
|
199
|
+
/** @description Item successfully queued for publishing */
|
|
200
|
+
PublishIdResponse: {
|
|
201
|
+
id: components["schemas"]["id"];
|
|
202
|
+
};
|
|
203
|
+
/** @description Standard error response following RFC 7807 */
|
|
204
|
+
ErrorResponse: {
|
|
205
|
+
/**
|
|
206
|
+
* @description A URI reference that identifies the problem type
|
|
207
|
+
* @example https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-request-body
|
|
208
|
+
*/
|
|
209
|
+
type: string;
|
|
210
|
+
/**
|
|
211
|
+
* @description A short, human-readable summary of the problem type
|
|
212
|
+
* @example NotEnoughMoney
|
|
213
|
+
*/
|
|
214
|
+
title: string;
|
|
215
|
+
/**
|
|
216
|
+
* @description A human-readable explanation specific to this occurrence of the problem.
|
|
217
|
+
* @example Your current balance is 30, but that costs 50
|
|
218
|
+
*/
|
|
219
|
+
detail?: string;
|
|
220
|
+
/**
|
|
221
|
+
* @description A URI reference that identifies the specific occurrence of the problem
|
|
222
|
+
* @example /account/12345/msgs/abc
|
|
223
|
+
*/
|
|
224
|
+
instance?: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
responses: {
|
|
228
|
+
/** @description Invalid query parameter */
|
|
229
|
+
"400BadRequest_GetProcesses": {
|
|
230
|
+
headers: {
|
|
231
|
+
[name: string]: unknown;
|
|
232
|
+
};
|
|
233
|
+
content: {
|
|
234
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* @description Forbidden. Your access token is valid, but you don't have the required permissions to access the resource,
|
|
239
|
+
* or the Granular Replication feature is disabled.
|
|
240
|
+
*/
|
|
241
|
+
"403Forbidden": {
|
|
242
|
+
headers: {
|
|
243
|
+
[name: string]: unknown;
|
|
244
|
+
};
|
|
245
|
+
content: {
|
|
246
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
/** @description If the request was not sent to a staging instance */
|
|
250
|
+
"422UnprocessableContent": {
|
|
251
|
+
headers: {
|
|
252
|
+
[name: string]: unknown;
|
|
253
|
+
};
|
|
254
|
+
content: {
|
|
255
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
/** @description Invalid request body */
|
|
259
|
+
"400BadRequest_CreateProcess": {
|
|
260
|
+
headers: {
|
|
261
|
+
[name: string]: unknown;
|
|
262
|
+
};
|
|
263
|
+
content: {
|
|
264
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/** @description The item was not found */
|
|
268
|
+
"404NotFound_CreateProcess": {
|
|
269
|
+
headers: {
|
|
270
|
+
[name: string]: unknown;
|
|
271
|
+
};
|
|
272
|
+
content: {
|
|
273
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
/** @description Conflict - item already published, limit exceeded, or replication running */
|
|
277
|
+
"409Conflict_CreateProcess": {
|
|
278
|
+
headers: {
|
|
279
|
+
[name: string]: unknown;
|
|
280
|
+
};
|
|
281
|
+
content: {
|
|
282
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
/** @description The item could not get processed */
|
|
286
|
+
"422UnprocessableContent_CreateProcess": {
|
|
287
|
+
headers: {
|
|
288
|
+
[name: string]: unknown;
|
|
289
|
+
};
|
|
290
|
+
content: {
|
|
291
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
/** @description The publish process for given ID was not found */
|
|
295
|
+
"404NotFound_GetProcess": {
|
|
296
|
+
headers: {
|
|
297
|
+
[name: string]: unknown;
|
|
298
|
+
};
|
|
299
|
+
content: {
|
|
300
|
+
"application/problem+json": components["schemas"]["ErrorResponse"];
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
parameters: {
|
|
305
|
+
/**
|
|
306
|
+
* @description An identifier for the organization the request is being made by
|
|
307
|
+
* @example f_ecom_zzxy_prd
|
|
308
|
+
*/
|
|
309
|
+
organizationId: components["schemas"]["OrganizationId"];
|
|
310
|
+
/** @description Publish process ID */
|
|
311
|
+
id: components["schemas"]["id"];
|
|
312
|
+
};
|
|
313
|
+
requestBodies: never;
|
|
314
|
+
headers: never;
|
|
315
|
+
pathItems: never;
|
|
316
|
+
}
|
|
317
|
+
export type $defs = Record<string, never>;
|
|
318
|
+
export interface operations {
|
|
319
|
+
listPublishProcesses: {
|
|
320
|
+
parameters: {
|
|
321
|
+
query?: {
|
|
322
|
+
limit?: number;
|
|
323
|
+
offset?: number;
|
|
324
|
+
};
|
|
325
|
+
header?: never;
|
|
326
|
+
path: {
|
|
327
|
+
/**
|
|
328
|
+
* @description An identifier for the organization the request is being made by
|
|
329
|
+
* @example f_ecom_zzxy_prd
|
|
330
|
+
*/
|
|
331
|
+
organizationId: components["parameters"]["organizationId"];
|
|
332
|
+
};
|
|
333
|
+
cookie?: never;
|
|
334
|
+
};
|
|
335
|
+
requestBody?: never;
|
|
336
|
+
responses: {
|
|
337
|
+
/** @description Retrieved list of publish processes successfully. */
|
|
338
|
+
200: {
|
|
339
|
+
headers: {
|
|
340
|
+
[name: string]: unknown;
|
|
341
|
+
};
|
|
342
|
+
content: {
|
|
343
|
+
"application/json": components["schemas"]["PublishProcessListResponse"];
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
400: components["responses"]["400BadRequest_GetProcesses"];
|
|
347
|
+
403: components["responses"]["403Forbidden"];
|
|
348
|
+
422: components["responses"]["422UnprocessableContent"];
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
publishItems: {
|
|
352
|
+
parameters: {
|
|
353
|
+
query?: never;
|
|
354
|
+
header?: never;
|
|
355
|
+
path: {
|
|
356
|
+
/**
|
|
357
|
+
* @description An identifier for the organization the request is being made by
|
|
358
|
+
* @example f_ecom_zzxy_prd
|
|
359
|
+
*/
|
|
360
|
+
organizationId: components["parameters"]["organizationId"];
|
|
361
|
+
};
|
|
362
|
+
cookie?: never;
|
|
363
|
+
};
|
|
364
|
+
requestBody: {
|
|
365
|
+
content: {
|
|
366
|
+
"application/json": components["schemas"]["PublishItemRequest"];
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
responses: {
|
|
370
|
+
/** @description Item successfully queued for publishing */
|
|
371
|
+
201: {
|
|
372
|
+
headers: {
|
|
373
|
+
[name: string]: unknown;
|
|
374
|
+
};
|
|
375
|
+
content: {
|
|
376
|
+
"application/json": components["schemas"]["PublishIdResponse"];
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
400: components["responses"]["400BadRequest_CreateProcess"];
|
|
380
|
+
403: components["responses"]["403Forbidden"];
|
|
381
|
+
404: components["responses"]["404NotFound_CreateProcess"];
|
|
382
|
+
409: components["responses"]["409Conflict_CreateProcess"];
|
|
383
|
+
422: components["responses"]["422UnprocessableContent_CreateProcess"];
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
getPublishProcess: {
|
|
387
|
+
parameters: {
|
|
388
|
+
query?: never;
|
|
389
|
+
header?: never;
|
|
390
|
+
path: {
|
|
391
|
+
/**
|
|
392
|
+
* @description An identifier for the organization the request is being made by
|
|
393
|
+
* @example f_ecom_zzxy_prd
|
|
394
|
+
*/
|
|
395
|
+
organizationId: components["parameters"]["organizationId"];
|
|
396
|
+
/** @description Publish process ID */
|
|
397
|
+
id: components["parameters"]["id"];
|
|
398
|
+
};
|
|
399
|
+
cookie?: never;
|
|
400
|
+
};
|
|
401
|
+
requestBody?: never;
|
|
402
|
+
responses: {
|
|
403
|
+
/** @description Publish process details retrieved successfully. */
|
|
404
|
+
200: {
|
|
405
|
+
headers: {
|
|
406
|
+
[name: string]: unknown;
|
|
407
|
+
};
|
|
408
|
+
content: {
|
|
409
|
+
"application/json": components["schemas"]["PublishProcessResponse"];
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
403: components["responses"]["403Forbidden"];
|
|
413
|
+
404: components["responses"]["404NotFound_GetProcess"];
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"granular-replications.generated.js","sourceRoot":"","sources":["../../../src/clients/granular-replications.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
import createClient from 'openapi-fetch';
|
|
7
|
+
import { createAuthMiddleware, createLoggingMiddleware, createRateLimitMiddleware } from './middleware.js';
|
|
8
|
+
import { globalMiddlewareRegistry } from './middleware-registry.js';
|
|
9
|
+
import { OAuthStrategy } from '../auth/oauth.js';
|
|
10
|
+
import { buildTenantScope, toOrganizationId, normalizeTenantId } from './custom-apis.js';
|
|
11
|
+
export { toOrganizationId, normalizeTenantId, buildTenantScope };
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Granular Replications API client for publishing individual items.
|
|
14
|
+
*
|
|
15
|
+
* The Granular Replications API enables programmatic publishing of individual items
|
|
16
|
+
* (products, price tables, content assets) from staging to production environments.
|
|
17
|
+
*
|
|
18
|
+
* @param config - Client configuration with shortCode and tenantId
|
|
19
|
+
* @param auth - OAuth authentication strategy
|
|
20
|
+
* @returns Typed Granular Replications API client
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import {createGranularReplicationsClient, OAuthStrategy} from '@salesforce/b2c-tooling-sdk';
|
|
25
|
+
*
|
|
26
|
+
* const auth = new OAuthStrategy({
|
|
27
|
+
* clientId: 'your-client-id',
|
|
28
|
+
* clientSecret: 'your-client-secret',
|
|
29
|
+
* tokenEndpoint: 'https://account.demandware.com/dwsso/oauth2/access_token'
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* const client = createGranularReplicationsClient({
|
|
33
|
+
* shortCode: 'kv7kzm78',
|
|
34
|
+
* tenantId: 'zzxy_prd'
|
|
35
|
+
* }, auth);
|
|
36
|
+
*
|
|
37
|
+
* // Queue a product for publishing
|
|
38
|
+
* const result = await client.POST('/organizations/{organizationId}/granular-processes', {
|
|
39
|
+
* params: {path: {organizationId: 'f_ecom_zzxy_prd'}},
|
|
40
|
+
* body: {product: {productId: 'PROD-123'}}
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // List all publish processes
|
|
44
|
+
* const processes = await client.GET('/organizations/{organizationId}/granular-processes', {
|
|
45
|
+
* params: {
|
|
46
|
+
* path: {organizationId: 'f_ecom_zzxy_prd'},
|
|
47
|
+
* query: {limit: 20, offset: 0}
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see https://developer.salesforce.com/docs/commerce/commerce-api/references/replications
|
|
53
|
+
*/
|
|
54
|
+
export function createGranularReplicationsClient(config, auth) {
|
|
55
|
+
const registry = config.middlewareRegistry ?? globalMiddlewareRegistry;
|
|
56
|
+
const client = createClient({
|
|
57
|
+
baseUrl: `https://${config.shortCode}.api.commercecloud.salesforce.com/operation/replications/v1`,
|
|
58
|
+
});
|
|
59
|
+
// Build required scopes: domain scope + tenant-specific scope
|
|
60
|
+
const requiredScopes = config.scopes ?? ['sfcc.granular-replications.rw', buildTenantScope(config.tenantId)];
|
|
61
|
+
const scopedAuth = auth instanceof OAuthStrategy ? auth.withAdditionalScopes(requiredScopes) : auth;
|
|
62
|
+
client.use(createAuthMiddleware(scopedAuth));
|
|
63
|
+
for (const middleware of registry.getMiddleware('granular-replications')) {
|
|
64
|
+
client.use(middleware);
|
|
65
|
+
}
|
|
66
|
+
client.use(createRateLimitMiddleware({ prefix: 'GRANULAR-REPLICATIONS' }));
|
|
67
|
+
client.use(createLoggingMiddleware('GRANULAR-REPLICATIONS'));
|
|
68
|
+
return client;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=granular-replications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"granular-replications.js","sourceRoot":"","sources":["../../../src/clients/granular-replications.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,YAA2B,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAC,oBAAoB,EAAE,uBAAuB,EAAE,yBAAyB,EAAC,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAC,wBAAwB,EAA0B,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEvF,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,CAAC;AAuB/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,gCAAgC,CAC9C,MAAwC,EACxC,IAAkB;IAElB,MAAM,QAAQ,GAAG,MAAM,CAAC,kBAAkB,IAAI,wBAAwB,CAAC;IAEvE,MAAM,MAAM,GAAG,YAAY,CAAQ;QACjC,OAAO,EAAE,WAAW,MAAM,CAAC,SAAS,6DAA6D;KAClG,CAAC,CAAC;IAEH,8DAA8D;IAC9D,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,+BAA+B,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7G,MAAM,UAAU,GAAG,IAAI,YAAY,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;IAE7C,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACzE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAC,MAAM,EAAE,uBAAuB,EAAC,CAAC,CAAC,CAAC;IACzE,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAE7D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -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 { createGranularReplicationsClient } from './granular-replications.js';
|
|
142
|
+
export type { GranularReplicationsClient, GranularReplicationsClientConfig, GranularReplicationsError, GranularReplicationsResponse, ProductItem, PriceTableItem, ContentAssetItemPrivate, ContentAssetItemShared, PublishProcessResponse, PublishProcessListResponse, PublishIdResponse, paths as GranularReplicationsPaths, components as GranularReplicationsComponents, } from './granular-replications.js';
|
|
141
143
|
export { getApiErrorMessage } from './error-utils.js';
|
|
142
144
|
export { createTlsDispatcher } from './tls-dispatcher.js';
|
|
143
145
|
export type { TlsOptions } from './tls-dispatcher.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 { createGranularReplicationsClient } from './granular-replications.js';
|
|
134
135
|
export { getApiErrorMessage } from './error-utils.js';
|
|
135
136
|
export { createTlsDispatcher } from './tls-dispatcher.js';
|
|
136
137
|
//# sourceMappingURL=index.js.map
|
|
@@ -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,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,+BAA+B,EAC/B,OAAO,EACP,SAAS,EACT,oCAAoC,EACpC,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAmCrB,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAgBhG,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAC;AAaxE,OAAO,EAAC,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAWhG,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
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,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,+BAA+B,EAC/B,OAAO,EACP,SAAS,EACT,oCAAoC,EACpC,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAmCrB,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAgBhG,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAC;AAaxE,OAAO,EAAC,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAWhG,OAAO,EAAC,gCAAgC,EAAC,MAAM,4BAA4B,CAAC;AAiB5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -38,7 +38,7 @@ import type { Middleware } from 'openapi-fetch';
|
|
|
38
38
|
/**
|
|
39
39
|
* Types of HTTP clients that can receive middleware.
|
|
40
40
|
*/
|
|
41
|
-
export type HttpClientType = 'cip' | 'ocapi' | 'slas' | 'ods' | 'mrt' | 'mrt-b2c' | 'custom-apis' | 'scapi-schemas' | 'cdn-zones' | 'webdav' | 'am-users-api' | 'am-roles-api' | 'am-apiclients-api' | 'am-orgs-api';
|
|
41
|
+
export type HttpClientType = 'cip' | 'ocapi' | 'slas' | 'ods' | 'mrt' | 'mrt-b2c' | 'custom-apis' | 'scapi-schemas' | 'cdn-zones' | 'granular-replications' | 'webdav' | 'am-users-api' | 'am-roles-api' | 'am-apiclients-api' | 'am-orgs-api';
|
|
42
42
|
/**
|
|
43
43
|
* Middleware interface compatible with openapi-fetch.
|
|
44
44
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-registry.js","sourceRoot":"","sources":["../../../src/clients/middleware-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"middleware-registry.js","sourceRoot":"","sources":["../../../src/clients/middleware-registry.ts"],"names":[],"mappings":"AAkIA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,kBAAkB;IACrB,SAAS,GAA6B,EAAE,CAAC;IAEjD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAgC;QACvC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,IAAY;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAC/D,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,UAA0B;QACtC,MAAM,UAAU,GAAwB,EAAE,CAAC;QAE3C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC7C,IAAI,CAAC,EAAE,CAAC;gBACN,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
package/dist/cjs/clients/mrt.js
CHANGED
|
@@ -64,7 +64,8 @@ export const DEFAULT_MRT_ORIGIN = 'https://cloud.mobify.com';
|
|
|
64
64
|
export function createMrtClient(config, auth) {
|
|
65
65
|
let origin = config.origin || DEFAULT_MRT_ORIGIN;
|
|
66
66
|
const registry = config.middlewareRegistry ?? globalMiddlewareRegistry;
|
|
67
|
-
// Normalize origin: add https:// if no protocol specified
|
|
67
|
+
// Normalize origin: add https:// if no protocol specified.
|
|
68
|
+
// The config resolver also normalizes, but this is a safety net for direct SDK usage.
|
|
68
69
|
if (origin && !origin.startsWith('http://') && !origin.startsWith('https://')) {
|
|
69
70
|
origin = `https://${origin}`;
|
|
70
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mrt.js","sourceRoot":"","sources":["../../../src/clients/mrt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;GAQG;AACH,OAAO,YAA2B,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAC,oBAAoB,EAAE,uBAAuB,EAAE,yBAAyB,EAAC,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAC,wBAAwB,EAA0B,MAAM,0BAA0B,CAAC;AAwF3F;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,IAAkB;IACzE,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,kBAAkB,CAAC;IACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,kBAAkB,IAAI,wBAAwB,CAAC;IAEvE,
|
|
1
|
+
{"version":3,"file":"mrt.js","sourceRoot":"","sources":["../../../src/clients/mrt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;GAQG;AACH,OAAO,YAA2B,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAC,oBAAoB,EAAE,uBAAuB,EAAE,yBAAyB,EAAC,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAC,wBAAwB,EAA0B,MAAM,0BAA0B,CAAC;AAwF3F;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,IAAkB;IACzE,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,kBAAkB,CAAC;IACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,kBAAkB,IAAI,wBAAwB,CAAC;IAEvE,2DAA2D;IAC3D,sFAAsF;IACtF,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9E,MAAM,GAAG,WAAW,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAQ;QACjC,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IAEH,8BAA8B;IAC9B,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvC,kCAAkC;IAClC,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,mFAAmF;IACnF,MAAM,CAAC,GAAG,CACR,yBAAyB,CAAC;QACxB,MAAM,EAAE,KAAK;KACd,CAAC,CACH,CAAC;IAEF,yEAAyE;IACzE,MAAM,CAAC,GAAG,CACR,uBAAuB,CAAC;QACtB,MAAM,EAAE,KAAK;QACb,gDAAgD;QAChD,YAAY,EAAE,CAAC,MAAM,CAAC;KACvB,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -10,6 +10,15 @@ import type { AuthConfig } from '../auth/types.js';
|
|
|
10
10
|
import { B2CInstance } from '../instance/index.js';
|
|
11
11
|
import type { DwJsonConfig } from './dw-json.js';
|
|
12
12
|
import type { NormalizedConfig, ConfigWarning } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes a URL origin string by ensuring it has an `https://` protocol prefix.
|
|
15
|
+
* Accepts both bare hostnames (`cloud.mobify.com`) and full URLs (`https://cloud.mobify.com`).
|
|
16
|
+
* Strips trailing slashes for consistency.
|
|
17
|
+
*
|
|
18
|
+
* @param origin - A hostname or URL origin string
|
|
19
|
+
* @returns The origin with `https://` protocol, or undefined if input is undefined
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeOriginUrl(origin: string | undefined): string | undefined;
|
|
13
22
|
/**
|
|
14
23
|
* Converts a kebab-case string to camelCase.
|
|
15
24
|
*
|
|
@@ -178,4 +187,7 @@ export declare function buildAuthConfigFromNormalized(config: NormalizedConfig):
|
|
|
178
187
|
* await instance.webdav.mkcol('Cartridges/v1');
|
|
179
188
|
* ```
|
|
180
189
|
*/
|
|
181
|
-
export declare function createInstanceFromConfig(config: NormalizedConfig
|
|
190
|
+
export declare function createInstanceFromConfig(config: NormalizedConfig, options?: {
|
|
191
|
+
redirectUri?: string;
|
|
192
|
+
openBrowser?: (url: string) => Promise<void>;
|
|
193
|
+
}): B2CInstance;
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { B2CInstance } from '../instance/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a URL origin string by ensuring it has an `https://` protocol prefix.
|
|
4
|
+
* Accepts both bare hostnames (`cloud.mobify.com`) and full URLs (`https://cloud.mobify.com`).
|
|
5
|
+
* Strips trailing slashes for consistency.
|
|
6
|
+
*
|
|
7
|
+
* @param origin - A hostname or URL origin string
|
|
8
|
+
* @returns The origin with `https://` protocol, or undefined if input is undefined
|
|
9
|
+
*/
|
|
10
|
+
export function normalizeOriginUrl(origin) {
|
|
11
|
+
if (!origin)
|
|
12
|
+
return undefined;
|
|
13
|
+
let normalized = origin;
|
|
14
|
+
if (!normalized.startsWith('http://') && !normalized.startsWith('https://')) {
|
|
15
|
+
normalized = `https://${normalized}`;
|
|
16
|
+
}
|
|
17
|
+
// Strip trailing slash for consistency
|
|
18
|
+
return normalized.replace(/\/+$/, '');
|
|
19
|
+
}
|
|
2
20
|
/**
|
|
3
21
|
* Converts a kebab-case string to camelCase.
|
|
4
22
|
*
|
|
@@ -399,7 +417,7 @@ export function buildAuthConfigFromNormalized(config) {
|
|
|
399
417
|
* await instance.webdav.mkcol('Cartridges/v1');
|
|
400
418
|
* ```
|
|
401
419
|
*/
|
|
402
|
-
export function createInstanceFromConfig(config) {
|
|
420
|
+
export function createInstanceFromConfig(config, options) {
|
|
403
421
|
if (!config.hostname) {
|
|
404
422
|
throw new Error('Hostname is required. Set in dw.json or provide via overrides.');
|
|
405
423
|
}
|
|
@@ -417,6 +435,14 @@ export function createInstanceFromConfig(config) {
|
|
|
417
435
|
: undefined,
|
|
418
436
|
};
|
|
419
437
|
const authConfig = buildAuthConfigFromNormalized(config);
|
|
438
|
+
// Inject implicit auth options into OAuth config when present
|
|
439
|
+
if (authConfig.oauth && (options?.redirectUri || options?.openBrowser)) {
|
|
440
|
+
authConfig.oauth = {
|
|
441
|
+
...authConfig.oauth,
|
|
442
|
+
redirectUri: options.redirectUri,
|
|
443
|
+
openBrowser: options.openBrowser,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
420
446
|
return new B2CInstance(instanceConfig, authConfig);
|
|
421
447
|
}
|
|
422
448
|
//# sourceMappingURL=mapping.js.map
|