@salesforce/b2c-tooling-sdk 0.0.0-nightly.20260121201541 → 0.0.0-nightly.20260122144746
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/cjs/cli/mrt-command.d.ts +2 -1
- package/dist/cjs/cli/mrt-command.js +3 -2
- package/dist/cjs/cli/mrt-command.js.map +1 -1
- package/dist/cjs/clients/cdn-zones.d.ts +154 -0
- package/dist/cjs/clients/cdn-zones.generated.d.ts +8330 -0
- package/dist/cjs/clients/cdn-zones.generated.js +6 -0
- package/dist/cjs/clients/cdn-zones.generated.js.map +1 -0
- package/dist/cjs/clients/cdn-zones.js +100 -0
- package/dist/cjs/clients/cdn-zones.js.map +1 -0
- package/dist/cjs/clients/error-utils.d.ts +35 -0
- package/dist/cjs/clients/error-utils.js +69 -0
- package/dist/cjs/clients/error-utils.js.map +1 -0
- package/dist/cjs/clients/index.d.ts +5 -0
- package/dist/cjs/clients/index.js +3 -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-b2c.d.ts +114 -0
- package/dist/cjs/clients/mrt-b2c.generated.d.ts +176 -0
- package/dist/cjs/clients/mrt-b2c.generated.js +6 -0
- package/dist/cjs/clients/mrt-b2c.generated.js.map +1 -0
- package/dist/cjs/clients/mrt-b2c.js +86 -0
- package/dist/cjs/clients/mrt-b2c.js.map +1 -0
- package/dist/cjs/config/dw-json.d.ts +4 -0
- package/dist/cjs/config/dw-json.js.map +1 -1
- package/dist/cjs/config/mapping.js +1 -0
- package/dist/cjs/config/mapping.js.map +1 -1
- package/dist/cjs/config/resolver.js +3 -0
- package/dist/cjs/config/resolver.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/operations/code/deploy.js +9 -3
- package/dist/cjs/operations/code/deploy.js.map +1 -1
- package/dist/cjs/operations/mrt/access-control.d.ts +192 -0
- package/dist/cjs/operations/mrt/access-control.js +152 -0
- package/dist/cjs/operations/mrt/access-control.js.map +1 -0
- package/dist/cjs/operations/mrt/b2c-config.d.ts +201 -0
- package/dist/cjs/operations/mrt/b2c-config.js +195 -0
- package/dist/cjs/operations/mrt/b2c-config.js.map +1 -0
- package/dist/cjs/operations/mrt/cache.d.ts +80 -0
- package/dist/cjs/operations/mrt/cache.js +65 -0
- package/dist/cjs/operations/mrt/cache.js.map +1 -0
- package/dist/cjs/operations/mrt/deployment.d.ts +157 -0
- package/dist/cjs/operations/mrt/deployment.js +109 -0
- package/dist/cjs/operations/mrt/deployment.js.map +1 -0
- package/dist/cjs/operations/mrt/env.d.ts +141 -0
- package/dist/cjs/operations/mrt/env.js +119 -0
- package/dist/cjs/operations/mrt/env.js.map +1 -1
- package/dist/cjs/operations/mrt/index.d.ts +24 -4
- package/dist/cjs/operations/mrt/index.js +23 -3
- package/dist/cjs/operations/mrt/index.js.map +1 -1
- package/dist/cjs/operations/mrt/member.d.ts +281 -0
- package/dist/cjs/operations/mrt/member.js +244 -0
- package/dist/cjs/operations/mrt/member.js.map +1 -0
- package/dist/cjs/operations/mrt/notification.d.ts +252 -0
- package/dist/cjs/operations/mrt/notification.js +206 -0
- package/dist/cjs/operations/mrt/notification.js.map +1 -0
- package/dist/cjs/operations/mrt/organization.d.ts +80 -0
- package/dist/cjs/operations/mrt/organization.js +53 -0
- package/dist/cjs/operations/mrt/organization.js.map +1 -0
- package/dist/cjs/operations/mrt/project.d.ts +261 -0
- package/dist/cjs/operations/mrt/project.js +232 -0
- package/dist/cjs/operations/mrt/project.js.map +1 -0
- package/dist/cjs/operations/mrt/push.d.ts +122 -8
- package/dist/cjs/operations/mrt/push.js +83 -10
- package/dist/cjs/operations/mrt/push.js.map +1 -1
- package/dist/cjs/operations/mrt/redirect.d.ts +337 -0
- package/dist/cjs/operations/mrt/redirect.js +256 -0
- package/dist/cjs/operations/mrt/redirect.js.map +1 -0
- package/dist/cjs/operations/mrt/user.d.ts +135 -0
- package/dist/cjs/operations/mrt/user.js +153 -0
- package/dist/cjs/operations/mrt/user.js.map +1 -0
- package/dist/esm/cli/mrt-command.d.ts +2 -1
- package/dist/esm/cli/mrt-command.js +3 -2
- package/dist/esm/cli/mrt-command.js.map +1 -1
- package/dist/esm/clients/cdn-zones.d.ts +154 -0
- package/dist/esm/clients/cdn-zones.generated.d.ts +8330 -0
- package/dist/esm/clients/cdn-zones.generated.js +6 -0
- package/dist/esm/clients/cdn-zones.generated.js.map +1 -0
- package/dist/esm/clients/cdn-zones.js +100 -0
- package/dist/esm/clients/cdn-zones.js.map +1 -0
- package/dist/esm/clients/error-utils.d.ts +35 -0
- package/dist/esm/clients/error-utils.js +69 -0
- package/dist/esm/clients/error-utils.js.map +1 -0
- package/dist/esm/clients/index.d.ts +5 -0
- package/dist/esm/clients/index.js +3 -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-b2c.d.ts +114 -0
- package/dist/esm/clients/mrt-b2c.generated.d.ts +176 -0
- package/dist/esm/clients/mrt-b2c.generated.js +6 -0
- package/dist/esm/clients/mrt-b2c.generated.js.map +1 -0
- package/dist/esm/clients/mrt-b2c.js +86 -0
- package/dist/esm/clients/mrt-b2c.js.map +1 -0
- package/dist/esm/config/dw-json.d.ts +4 -0
- package/dist/esm/config/dw-json.js.map +1 -1
- package/dist/esm/config/mapping.js +1 -0
- package/dist/esm/config/mapping.js.map +1 -1
- package/dist/esm/config/resolver.js +3 -0
- package/dist/esm/config/resolver.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operations/code/deploy.js +9 -3
- package/dist/esm/operations/code/deploy.js.map +1 -1
- package/dist/esm/operations/mrt/access-control.d.ts +192 -0
- package/dist/esm/operations/mrt/access-control.js +152 -0
- package/dist/esm/operations/mrt/access-control.js.map +1 -0
- package/dist/esm/operations/mrt/b2c-config.d.ts +201 -0
- package/dist/esm/operations/mrt/b2c-config.js +195 -0
- package/dist/esm/operations/mrt/b2c-config.js.map +1 -0
- package/dist/esm/operations/mrt/cache.d.ts +80 -0
- package/dist/esm/operations/mrt/cache.js +65 -0
- package/dist/esm/operations/mrt/cache.js.map +1 -0
- package/dist/esm/operations/mrt/deployment.d.ts +157 -0
- package/dist/esm/operations/mrt/deployment.js +109 -0
- package/dist/esm/operations/mrt/deployment.js.map +1 -0
- package/dist/esm/operations/mrt/env.d.ts +141 -0
- package/dist/esm/operations/mrt/env.js +119 -0
- package/dist/esm/operations/mrt/env.js.map +1 -1
- package/dist/esm/operations/mrt/index.d.ts +24 -4
- package/dist/esm/operations/mrt/index.js +23 -3
- package/dist/esm/operations/mrt/index.js.map +1 -1
- package/dist/esm/operations/mrt/member.d.ts +281 -0
- package/dist/esm/operations/mrt/member.js +244 -0
- package/dist/esm/operations/mrt/member.js.map +1 -0
- package/dist/esm/operations/mrt/notification.d.ts +252 -0
- package/dist/esm/operations/mrt/notification.js +206 -0
- package/dist/esm/operations/mrt/notification.js.map +1 -0
- package/dist/esm/operations/mrt/organization.d.ts +80 -0
- package/dist/esm/operations/mrt/organization.js +53 -0
- package/dist/esm/operations/mrt/organization.js.map +1 -0
- package/dist/esm/operations/mrt/project.d.ts +261 -0
- package/dist/esm/operations/mrt/project.js +232 -0
- package/dist/esm/operations/mrt/project.js.map +1 -0
- package/dist/esm/operations/mrt/push.d.ts +122 -8
- package/dist/esm/operations/mrt/push.js +83 -10
- package/dist/esm/operations/mrt/push.js.map +1 -1
- package/dist/esm/operations/mrt/redirect.d.ts +337 -0
- package/dist/esm/operations/mrt/redirect.js +256 -0
- package/dist/esm/operations/mrt/redirect.js.map +1 -0
- package/dist/esm/operations/mrt/user.d.ts +135 -0
- package/dist/esm/operations/mrt/user.js +153 -0
- package/dist/esm/operations/mrt/user.js.map +1 -0
- package/package.json +2 -2
- package/specs/cdn-zones-v1.yaml +9324 -0
- package/specs/mrt-b2c.json +384 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project operations for Managed Runtime.
|
|
3
|
+
*
|
|
4
|
+
* Handles CRUD operations for MRT projects.
|
|
5
|
+
*
|
|
6
|
+
* @module operations/mrt/project
|
|
7
|
+
*/
|
|
8
|
+
import type { AuthStrategy } from '../../auth/types.js';
|
|
9
|
+
import type { components } from '../../clients/mrt.js';
|
|
10
|
+
/**
|
|
11
|
+
* MRT project type for create/read operations.
|
|
12
|
+
*/
|
|
13
|
+
export type MrtProject = components['schemas']['APIProjectV2Create'];
|
|
14
|
+
/**
|
|
15
|
+
* MRT project type for update operations.
|
|
16
|
+
*/
|
|
17
|
+
export type MrtProjectUpdate = components['schemas']['APIProjectV2Update'];
|
|
18
|
+
/**
|
|
19
|
+
* Patched project for partial updates.
|
|
20
|
+
*/
|
|
21
|
+
export type PatchedMrtProject = components['schemas']['PatchedAPIProjectV2Update'];
|
|
22
|
+
/**
|
|
23
|
+
* SSR region enum.
|
|
24
|
+
*/
|
|
25
|
+
export type SsrRegion = components['schemas']['SsrRegionEnum'];
|
|
26
|
+
/**
|
|
27
|
+
* Options for listing MRT projects.
|
|
28
|
+
*/
|
|
29
|
+
export interface ListProjectsOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Filter by organization slug.
|
|
32
|
+
*/
|
|
33
|
+
organization?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum number of results to return.
|
|
36
|
+
*/
|
|
37
|
+
limit?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Offset for pagination.
|
|
40
|
+
*/
|
|
41
|
+
offset?: number;
|
|
42
|
+
/**
|
|
43
|
+
* MRT API origin URL.
|
|
44
|
+
* @default "https://cloud.mobify.com"
|
|
45
|
+
*/
|
|
46
|
+
origin?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Result of listing projects.
|
|
50
|
+
*/
|
|
51
|
+
export interface ListProjectsResult {
|
|
52
|
+
/**
|
|
53
|
+
* Total count of projects.
|
|
54
|
+
*/
|
|
55
|
+
count: number;
|
|
56
|
+
/**
|
|
57
|
+
* URL for next page of results.
|
|
58
|
+
*/
|
|
59
|
+
next: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* URL for previous page of results.
|
|
62
|
+
*/
|
|
63
|
+
previous: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Array of projects.
|
|
66
|
+
*/
|
|
67
|
+
projects: MrtProject[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Lists projects accessible to the authenticated user.
|
|
71
|
+
*
|
|
72
|
+
* @param options - List options including organization filter and pagination
|
|
73
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
74
|
+
* @returns Paginated list of projects
|
|
75
|
+
* @throws Error if request fails
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
80
|
+
* import { listProjects } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
81
|
+
*
|
|
82
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
83
|
+
*
|
|
84
|
+
* // List all projects
|
|
85
|
+
* const result = await listProjects({}, auth);
|
|
86
|
+
*
|
|
87
|
+
* // List projects for a specific organization
|
|
88
|
+
* const orgProjects = await listProjects({ organization: 'my-org' }, auth);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function listProjects(options: ListProjectsOptions, auth: AuthStrategy): Promise<ListProjectsResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Options for creating an MRT project.
|
|
94
|
+
*/
|
|
95
|
+
export interface CreateProjectOptions {
|
|
96
|
+
/**
|
|
97
|
+
* User-friendly name for the project.
|
|
98
|
+
*/
|
|
99
|
+
name: string;
|
|
100
|
+
/**
|
|
101
|
+
* Project slug/identifier (auto-generated if not provided).
|
|
102
|
+
*/
|
|
103
|
+
slug?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Organization slug to create the project in.
|
|
106
|
+
*/
|
|
107
|
+
organization: string;
|
|
108
|
+
/**
|
|
109
|
+
* Project URL.
|
|
110
|
+
*/
|
|
111
|
+
url?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Default AWS region for new targets.
|
|
114
|
+
*/
|
|
115
|
+
ssrRegion?: SsrRegion;
|
|
116
|
+
/**
|
|
117
|
+
* MRT API origin URL.
|
|
118
|
+
* @default "https://cloud.mobify.com"
|
|
119
|
+
*/
|
|
120
|
+
origin?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Creates a new MRT project.
|
|
124
|
+
*
|
|
125
|
+
* @param options - Project creation options
|
|
126
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
127
|
+
* @returns The created project
|
|
128
|
+
* @throws Error if creation fails
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
133
|
+
* import { createProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
134
|
+
*
|
|
135
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
136
|
+
*
|
|
137
|
+
* const project = await createProject({
|
|
138
|
+
* name: 'My Storefront',
|
|
139
|
+
* organization: 'my-org',
|
|
140
|
+
* ssrRegion: 'us-east-1'
|
|
141
|
+
* }, auth);
|
|
142
|
+
*
|
|
143
|
+
* console.log(`Created project: ${project.slug}`);
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function createProject(options: CreateProjectOptions, auth: AuthStrategy): Promise<MrtProject>;
|
|
147
|
+
/**
|
|
148
|
+
* Options for getting an MRT project.
|
|
149
|
+
*/
|
|
150
|
+
export interface GetProjectOptions {
|
|
151
|
+
/**
|
|
152
|
+
* Project slug to retrieve.
|
|
153
|
+
*/
|
|
154
|
+
projectSlug: string;
|
|
155
|
+
/**
|
|
156
|
+
* MRT API origin URL.
|
|
157
|
+
* @default "https://cloud.mobify.com"
|
|
158
|
+
*/
|
|
159
|
+
origin?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets a project by slug.
|
|
163
|
+
*
|
|
164
|
+
* @param options - Get options
|
|
165
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
166
|
+
* @returns The project
|
|
167
|
+
* @throws Error if request fails
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
172
|
+
* import { getProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
173
|
+
*
|
|
174
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
175
|
+
*
|
|
176
|
+
* const project = await getProject({ projectSlug: 'my-storefront' }, auth);
|
|
177
|
+
* console.log(`Project: ${project.name}`);
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export declare function getProject(options: GetProjectOptions, auth: AuthStrategy): Promise<MrtProjectUpdate>;
|
|
181
|
+
/**
|
|
182
|
+
* Options for updating an MRT project.
|
|
183
|
+
*/
|
|
184
|
+
export interface UpdateProjectOptions {
|
|
185
|
+
/**
|
|
186
|
+
* Project slug to update.
|
|
187
|
+
*/
|
|
188
|
+
projectSlug: string;
|
|
189
|
+
/**
|
|
190
|
+
* New name for the project.
|
|
191
|
+
*/
|
|
192
|
+
name?: string;
|
|
193
|
+
/**
|
|
194
|
+
* New URL for the project.
|
|
195
|
+
*/
|
|
196
|
+
url?: string;
|
|
197
|
+
/**
|
|
198
|
+
* New default AWS region for new targets.
|
|
199
|
+
*/
|
|
200
|
+
ssrRegion?: SsrRegion;
|
|
201
|
+
/**
|
|
202
|
+
* MRT API origin URL.
|
|
203
|
+
* @default "https://cloud.mobify.com"
|
|
204
|
+
*/
|
|
205
|
+
origin?: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Updates an MRT project.
|
|
209
|
+
*
|
|
210
|
+
* @param options - Update options
|
|
211
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
212
|
+
* @returns The updated project
|
|
213
|
+
* @throws Error if update fails
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
218
|
+
* import { updateProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
219
|
+
*
|
|
220
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
221
|
+
*
|
|
222
|
+
* const updated = await updateProject({
|
|
223
|
+
* projectSlug: 'my-storefront',
|
|
224
|
+
* name: 'My Updated Storefront'
|
|
225
|
+
* }, auth);
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
export declare function updateProject(options: UpdateProjectOptions, auth: AuthStrategy): Promise<MrtProjectUpdate>;
|
|
229
|
+
/**
|
|
230
|
+
* Options for deleting an MRT project.
|
|
231
|
+
*/
|
|
232
|
+
export interface DeleteProjectOptions {
|
|
233
|
+
/**
|
|
234
|
+
* Project slug to delete.
|
|
235
|
+
*/
|
|
236
|
+
projectSlug: string;
|
|
237
|
+
/**
|
|
238
|
+
* MRT API origin URL.
|
|
239
|
+
* @default "https://cloud.mobify.com"
|
|
240
|
+
*/
|
|
241
|
+
origin?: string;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Deletes an MRT project.
|
|
245
|
+
*
|
|
246
|
+
* @param options - Delete options
|
|
247
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
248
|
+
* @throws Error if deletion fails
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
253
|
+
* import { deleteProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
254
|
+
*
|
|
255
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
256
|
+
*
|
|
257
|
+
* await deleteProject({ projectSlug: 'my-old-project' }, auth);
|
|
258
|
+
* console.log('Project deleted');
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export declare function deleteProject(options: DeleteProjectOptions, auth: AuthStrategy): Promise<void>;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { createMrtClient, DEFAULT_MRT_ORIGIN } from '../../clients/mrt.js';
|
|
2
|
+
import { getLogger } from '../../logging/logger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Lists projects accessible to the authenticated user.
|
|
5
|
+
*
|
|
6
|
+
* @param options - List options including organization filter and pagination
|
|
7
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
8
|
+
* @returns Paginated list of projects
|
|
9
|
+
* @throws Error if request fails
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
14
|
+
* import { listProjects } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
15
|
+
*
|
|
16
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
17
|
+
*
|
|
18
|
+
* // List all projects
|
|
19
|
+
* const result = await listProjects({}, auth);
|
|
20
|
+
*
|
|
21
|
+
* // List projects for a specific organization
|
|
22
|
+
* const orgProjects = await listProjects({ organization: 'my-org' }, auth);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export async function listProjects(options, auth) {
|
|
26
|
+
const logger = getLogger();
|
|
27
|
+
const { organization, limit, offset, origin } = options;
|
|
28
|
+
logger.debug({ organization, limit, offset }, '[MRT] Listing projects');
|
|
29
|
+
const client = createMrtClient({ origin: origin || DEFAULT_MRT_ORIGIN }, auth);
|
|
30
|
+
const { data, error } = await client.GET('/api/projects/', {
|
|
31
|
+
params: {
|
|
32
|
+
query: {
|
|
33
|
+
organization,
|
|
34
|
+
limit,
|
|
35
|
+
offset,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
if (error) {
|
|
40
|
+
const errorMessage = typeof error === 'object' && error !== null && 'message' in error
|
|
41
|
+
? String(error.message)
|
|
42
|
+
: JSON.stringify(error);
|
|
43
|
+
throw new Error(`Failed to list projects: ${errorMessage}`);
|
|
44
|
+
}
|
|
45
|
+
logger.debug({ count: data.count }, '[MRT] Projects listed');
|
|
46
|
+
return {
|
|
47
|
+
count: data.count ?? 0,
|
|
48
|
+
next: data.next ?? null,
|
|
49
|
+
previous: data.previous ?? null,
|
|
50
|
+
projects: data.results ?? [],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new MRT project.
|
|
55
|
+
*
|
|
56
|
+
* @param options - Project creation options
|
|
57
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
58
|
+
* @returns The created project
|
|
59
|
+
* @throws Error if creation fails
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
64
|
+
* import { createProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
65
|
+
*
|
|
66
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
67
|
+
*
|
|
68
|
+
* const project = await createProject({
|
|
69
|
+
* name: 'My Storefront',
|
|
70
|
+
* organization: 'my-org',
|
|
71
|
+
* ssrRegion: 'us-east-1'
|
|
72
|
+
* }, auth);
|
|
73
|
+
*
|
|
74
|
+
* console.log(`Created project: ${project.slug}`);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export async function createProject(options, auth) {
|
|
78
|
+
const logger = getLogger();
|
|
79
|
+
const { name, slug, organization, url, ssrRegion, origin } = options;
|
|
80
|
+
logger.debug({ name, organization }, '[MRT] Creating project');
|
|
81
|
+
const client = createMrtClient({ origin: origin || DEFAULT_MRT_ORIGIN }, auth);
|
|
82
|
+
const body = {
|
|
83
|
+
name,
|
|
84
|
+
organization,
|
|
85
|
+
};
|
|
86
|
+
if (slug) {
|
|
87
|
+
body.slug = slug;
|
|
88
|
+
}
|
|
89
|
+
if (url) {
|
|
90
|
+
body.url = url;
|
|
91
|
+
}
|
|
92
|
+
if (ssrRegion) {
|
|
93
|
+
body.ssr_region = ssrRegion;
|
|
94
|
+
}
|
|
95
|
+
const { data, error } = await client.POST('/api/projects/', {
|
|
96
|
+
body,
|
|
97
|
+
});
|
|
98
|
+
if (error) {
|
|
99
|
+
const errorMessage = typeof error === 'object' && error !== null && 'message' in error
|
|
100
|
+
? String(error.message)
|
|
101
|
+
: JSON.stringify(error);
|
|
102
|
+
throw new Error(`Failed to create project: ${errorMessage}`);
|
|
103
|
+
}
|
|
104
|
+
logger.debug({ slug: data.slug }, '[MRT] Project created');
|
|
105
|
+
return data;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Gets a project by slug.
|
|
109
|
+
*
|
|
110
|
+
* @param options - Get options
|
|
111
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
112
|
+
* @returns The project
|
|
113
|
+
* @throws Error if request fails
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
118
|
+
* import { getProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
119
|
+
*
|
|
120
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
121
|
+
*
|
|
122
|
+
* const project = await getProject({ projectSlug: 'my-storefront' }, auth);
|
|
123
|
+
* console.log(`Project: ${project.name}`);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export async function getProject(options, auth) {
|
|
127
|
+
const logger = getLogger();
|
|
128
|
+
const { projectSlug, origin } = options;
|
|
129
|
+
logger.debug({ projectSlug }, '[MRT] Getting project');
|
|
130
|
+
const client = createMrtClient({ origin: origin || DEFAULT_MRT_ORIGIN }, auth);
|
|
131
|
+
const { data, error } = await client.GET('/api/projects/{project_slug}/', {
|
|
132
|
+
params: {
|
|
133
|
+
path: { project_slug: projectSlug },
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
if (error) {
|
|
137
|
+
const errorMessage = typeof error === 'object' && error !== null && 'message' in error
|
|
138
|
+
? String(error.message)
|
|
139
|
+
: JSON.stringify(error);
|
|
140
|
+
throw new Error(`Failed to get project: ${errorMessage}`);
|
|
141
|
+
}
|
|
142
|
+
logger.debug({ slug: data.slug }, '[MRT] Project retrieved');
|
|
143
|
+
return data;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Updates an MRT project.
|
|
147
|
+
*
|
|
148
|
+
* @param options - Update options
|
|
149
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
150
|
+
* @returns The updated project
|
|
151
|
+
* @throws Error if update fails
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
156
|
+
* import { updateProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
157
|
+
*
|
|
158
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
159
|
+
*
|
|
160
|
+
* const updated = await updateProject({
|
|
161
|
+
* projectSlug: 'my-storefront',
|
|
162
|
+
* name: 'My Updated Storefront'
|
|
163
|
+
* }, auth);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export async function updateProject(options, auth) {
|
|
167
|
+
const logger = getLogger();
|
|
168
|
+
const { projectSlug, name, url, ssrRegion, origin } = options;
|
|
169
|
+
logger.debug({ projectSlug }, '[MRT] Updating project');
|
|
170
|
+
const client = createMrtClient({ origin: origin || DEFAULT_MRT_ORIGIN }, auth);
|
|
171
|
+
const body = {};
|
|
172
|
+
if (name !== undefined) {
|
|
173
|
+
body.name = name;
|
|
174
|
+
}
|
|
175
|
+
if (url !== undefined) {
|
|
176
|
+
body.url = url;
|
|
177
|
+
}
|
|
178
|
+
if (ssrRegion !== undefined) {
|
|
179
|
+
body.ssr_region = ssrRegion;
|
|
180
|
+
}
|
|
181
|
+
const { data, error } = await client.PATCH('/api/projects/{project_slug}/', {
|
|
182
|
+
params: {
|
|
183
|
+
path: { project_slug: projectSlug },
|
|
184
|
+
},
|
|
185
|
+
body,
|
|
186
|
+
});
|
|
187
|
+
if (error) {
|
|
188
|
+
const errorMessage = typeof error === 'object' && error !== null && 'message' in error
|
|
189
|
+
? String(error.message)
|
|
190
|
+
: JSON.stringify(error);
|
|
191
|
+
throw new Error(`Failed to update project: ${errorMessage}`);
|
|
192
|
+
}
|
|
193
|
+
logger.debug({ slug: data.slug }, '[MRT] Project updated');
|
|
194
|
+
return data;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Deletes an MRT project.
|
|
198
|
+
*
|
|
199
|
+
* @param options - Delete options
|
|
200
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
201
|
+
* @throws Error if deletion fails
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
206
|
+
* import { deleteProject } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
207
|
+
*
|
|
208
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
209
|
+
*
|
|
210
|
+
* await deleteProject({ projectSlug: 'my-old-project' }, auth);
|
|
211
|
+
* console.log('Project deleted');
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
export async function deleteProject(options, auth) {
|
|
215
|
+
const logger = getLogger();
|
|
216
|
+
const { projectSlug, origin } = options;
|
|
217
|
+
logger.debug({ projectSlug }, '[MRT] Deleting project');
|
|
218
|
+
const client = createMrtClient({ origin: origin || DEFAULT_MRT_ORIGIN }, auth);
|
|
219
|
+
const { error } = await client.DELETE('/api/projects/{project_slug}/', {
|
|
220
|
+
params: {
|
|
221
|
+
path: { project_slug: projectSlug },
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
if (error) {
|
|
225
|
+
const errorMessage = typeof error === 'object' && error !== null && 'message' in error
|
|
226
|
+
? String(error.message)
|
|
227
|
+
: JSON.stringify(error);
|
|
228
|
+
throw new Error(`Failed to delete project: ${errorMessage}`);
|
|
229
|
+
}
|
|
230
|
+
logger.debug({ projectSlug }, '[MRT] Project deleted');
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../src/operations/mrt/project.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAyElD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAA4B,EAAE,IAAkB;IACjF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,EAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAC,GAAG,OAAO,CAAC;IAEtD,MAAM,CAAC,KAAK,CAAC,EAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAC,EAAE,wBAAwB,CAAC,CAAC;IAEtE,M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AAC,EAAE,wBAAwB,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,eAAe,CAAC,EAAC,MAAM,EAAE,MAAM,IAAI,kBAAkB,EAAC,EAAE,IAAI,CAAC,CAAC;IAE7E,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,+BAA+B,EAAE;QACnE,MAAM,EAAE;YACN,IAAI,EAAE,EAAC,YAAY,EAAE,WAAW,EAAC;SAClC;KACF,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,YAAY,GAChB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,IAAI,KAAK;YAC/D,CAAC,CAAC,MAAM,CAAE,KAA4B,CAAC,OAAO,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,6BAA6B,YAAY,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,EAAC,WAAW,EAAC,EAAE,uBAAuB,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -96,14 +96,128 @@ export declare function pushBundle(options: PushOptions, auth: AuthStrategy): Pr
|
|
|
96
96
|
*/
|
|
97
97
|
export declare function uploadBundle(client: MrtClient, projectSlug: string, bundle: Bundle, target?: string): Promise<PushResult>;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* @param client - MRT client instance
|
|
102
|
-
* @param projectSlug - Project to list bundles for
|
|
103
|
-
* @param options - Pagination options
|
|
104
|
-
* @returns List of bundles
|
|
99
|
+
* Bundle list item from API.
|
|
105
100
|
*/
|
|
106
|
-
export
|
|
101
|
+
export type MrtBundle = components['schemas']['BundleList'];
|
|
102
|
+
/**
|
|
103
|
+
* Options for listing bundles.
|
|
104
|
+
*/
|
|
105
|
+
export interface ListBundlesOptions {
|
|
106
|
+
/**
|
|
107
|
+
* The project slug.
|
|
108
|
+
*/
|
|
109
|
+
projectSlug: string;
|
|
110
|
+
/**
|
|
111
|
+
* Maximum number of results to return.
|
|
112
|
+
*/
|
|
107
113
|
limit?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Offset for pagination.
|
|
116
|
+
*/
|
|
108
117
|
offset?: number;
|
|
109
|
-
|
|
118
|
+
/**
|
|
119
|
+
* MRT API origin URL.
|
|
120
|
+
* @default "https://cloud.mobify.com"
|
|
121
|
+
*/
|
|
122
|
+
origin?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Result of listing bundles.
|
|
126
|
+
*/
|
|
127
|
+
export interface ListBundlesResult {
|
|
128
|
+
/**
|
|
129
|
+
* Total count of bundles.
|
|
130
|
+
*/
|
|
131
|
+
count: number;
|
|
132
|
+
/**
|
|
133
|
+
* URL for next page of results.
|
|
134
|
+
*/
|
|
135
|
+
next: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* URL for previous page of results.
|
|
138
|
+
*/
|
|
139
|
+
previous: string | null;
|
|
140
|
+
/**
|
|
141
|
+
* Array of bundles.
|
|
142
|
+
*/
|
|
143
|
+
bundles: MrtBundle[];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Lists bundles for an MRT project.
|
|
147
|
+
*
|
|
148
|
+
* @param options - List options including project slug
|
|
149
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
150
|
+
* @returns Paginated list of bundles
|
|
151
|
+
* @throws Error if request fails
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
156
|
+
* import { listBundles } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
157
|
+
*
|
|
158
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
159
|
+
*
|
|
160
|
+
* const result = await listBundles({
|
|
161
|
+
* projectSlug: 'my-storefront'
|
|
162
|
+
* }, auth);
|
|
163
|
+
*
|
|
164
|
+
* for (const bundle of result.bundles) {
|
|
165
|
+
* console.log(`Bundle ${bundle.id}: ${bundle.message}`);
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare function listBundles(options: ListBundlesOptions, auth: AuthStrategy): Promise<ListBundlesResult>;
|
|
170
|
+
/**
|
|
171
|
+
* Options for downloading a bundle.
|
|
172
|
+
*/
|
|
173
|
+
export interface DownloadBundleOptions {
|
|
174
|
+
/**
|
|
175
|
+
* The project slug.
|
|
176
|
+
*/
|
|
177
|
+
projectSlug: string;
|
|
178
|
+
/**
|
|
179
|
+
* The bundle ID to download.
|
|
180
|
+
*/
|
|
181
|
+
bundleId: number;
|
|
182
|
+
/**
|
|
183
|
+
* MRT API origin URL.
|
|
184
|
+
* @default "https://cloud.mobify.com"
|
|
185
|
+
*/
|
|
186
|
+
origin?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Result of getting a bundle download URL.
|
|
190
|
+
*/
|
|
191
|
+
export interface DownloadBundleResult {
|
|
192
|
+
/**
|
|
193
|
+
* Presigned URL for downloading the bundle archive.
|
|
194
|
+
* Valid for one hour.
|
|
195
|
+
*/
|
|
196
|
+
downloadUrl: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Gets a presigned URL to download a bundle archive.
|
|
200
|
+
*
|
|
201
|
+
* The returned URL is valid for one hour.
|
|
202
|
+
*
|
|
203
|
+
* @param options - Download options
|
|
204
|
+
* @param auth - Authentication strategy (ApiKeyStrategy)
|
|
205
|
+
* @returns Download URL result
|
|
206
|
+
* @throws Error if request fails
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
|
|
211
|
+
* import { downloadBundle } from '@salesforce/b2c-tooling-sdk/operations/mrt';
|
|
212
|
+
*
|
|
213
|
+
* const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');
|
|
214
|
+
*
|
|
215
|
+
* const result = await downloadBundle({
|
|
216
|
+
* projectSlug: 'my-storefront',
|
|
217
|
+
* bundleId: 12345
|
|
218
|
+
* }, auth);
|
|
219
|
+
*
|
|
220
|
+
* console.log(`Download URL: ${result.downloadUrl}`);
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare function downloadBundle(options: DownloadBundleOptions, auth: AuthStrategy): Promise<DownloadBundleResult>;
|