@contentstack/cli-variants 2.0.0-beta.2 → 2.0.0-beta.3
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/lib/export/audiences.js +1 -1
- package/lib/export/experiences.js +1 -1
- package/lib/types/export-config.d.ts +6 -1
- package/lib/utils/variant-api-adapter.js +10 -10
- package/package.json +1 -1
- package/src/export/audiences.ts +1 -1
- package/src/export/experiences.ts +1 -1
- package/src/types/export-config.ts +7 -1
- package/src/utils/variant-api-adapter.ts +10 -10
package/lib/export/audiences.js
CHANGED
|
@@ -51,7 +51,7 @@ class ExportAudiences extends utils_1.PersonalizationAdapter {
|
|
|
51
51
|
}));
|
|
52
52
|
if (!((_a = this.audiences) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
53
53
|
cli_utilities_1.log.debug('No audiences found, completing export', this.exportConfig.context);
|
|
54
|
-
cli_utilities_1.log.info('No
|
|
54
|
+
cli_utilities_1.log.info('No audiences found for the given project.', this.exportConfig.context);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
let progress;
|
|
@@ -86,7 +86,7 @@ class ExportExperiences extends utils_1.PersonalizationAdapter {
|
|
|
86
86
|
}));
|
|
87
87
|
if (!experiences || (experiences === null || experiences === void 0 ? void 0 : experiences.length) < 1) {
|
|
88
88
|
cli_utilities_1.log.debug('No experiences found, completing export', this.exportConfig.context);
|
|
89
|
-
cli_utilities_1.log.info('No
|
|
89
|
+
cli_utilities_1.log.info('No experiences found for the given project.', this.exportConfig.context);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
let progress;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Therefore, we are duplicating the following types from the export.
|
|
5
5
|
*/
|
|
6
6
|
import { AnyProperty, Context } from './utils';
|
|
7
|
-
export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | 'personalize';
|
|
7
|
+
export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | 'personalize' | 'composable-studio';
|
|
8
8
|
export type branch = {
|
|
9
9
|
uid: string;
|
|
10
10
|
source: string;
|
|
@@ -158,6 +158,11 @@ export interface DefaultConfig {
|
|
|
158
158
|
fileName: string;
|
|
159
159
|
dependencies?: Modules[];
|
|
160
160
|
};
|
|
161
|
+
'composable-studio': {
|
|
162
|
+
dirName: string;
|
|
163
|
+
fileName: string;
|
|
164
|
+
apiBaseUrl: string;
|
|
165
|
+
};
|
|
161
166
|
masterLocale: {
|
|
162
167
|
dirName: string;
|
|
163
168
|
fileName: string;
|
|
@@ -46,11 +46,11 @@ class VariantHttpClient extends adapter_helper_1.AdapterHelper {
|
|
|
46
46
|
const token = cli_utilities_1.authenticationHandler.accessToken;
|
|
47
47
|
cli_utilities_1.log.debug(`Authentication type: ${cli_utilities_1.authenticationHandler.isOauthEnabled ? 'OAuth' : 'Token'}`, (_b = this.exportConfig) === null || _b === void 0 ? void 0 : _b.context);
|
|
48
48
|
if (cli_utilities_1.authenticationHandler.isOauthEnabled) {
|
|
49
|
-
cli_utilities_1.log.debug('Setting OAuth authorization header', (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
49
|
+
cli_utilities_1.log.debug('Setting OAuth authorization header...', (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
50
50
|
this.apiClient.headers({ authorization: token });
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
cli_utilities_1.log.debug('Setting authtoken header', (_d = this.exportConfig) === null || _d === void 0 ? void 0 : _d.context);
|
|
53
|
+
cli_utilities_1.log.debug('Setting authtoken header...', (_d = this.exportConfig) === null || _d === void 0 ? void 0 : _d.context);
|
|
54
54
|
this.apiClient.headers({ authtoken: token });
|
|
55
55
|
}
|
|
56
56
|
});
|
|
@@ -83,7 +83,7 @@ class VariantHttpClient extends adapter_helper_1.AdapterHelper {
|
|
|
83
83
|
cli_utilities_1.log.debug(`Fetching variant entries for content type: ${content_type_uid}, entry: ${entry_uid}, locale: ${locale}`, (_a = this.exportConfig) === null || _a === void 0 ? void 0 : _a.context);
|
|
84
84
|
cli_utilities_1.log.debug(`Query parameters - skip: ${skip}, limit: ${limit}, include_variant: ${include_variant}, include_count: ${include_count}, include_publish_details: ${include_publish_details}`, (_b = this.exportConfig) === null || _b === void 0 ? void 0 : _b.context);
|
|
85
85
|
if (variantConfig.serveMockData && callback) {
|
|
86
|
-
cli_utilities_1.log.debug('Using mock data for variant entries', (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
86
|
+
cli_utilities_1.log.debug('Using mock data for variant entries...', (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
87
87
|
let data = [];
|
|
88
88
|
if ((0, fs_1.existsSync)(variantConfig.mockDataPath)) {
|
|
89
89
|
cli_utilities_1.log.debug(`Loading mock data from: ${variantConfig.mockDataPath}`, (_d = this.exportConfig) === null || _d === void 0 ? void 0 : _d.context);
|
|
@@ -131,11 +131,11 @@ class VariantHttpClient extends adapter_helper_1.AdapterHelper {
|
|
|
131
131
|
cli_utilities_1.log.debug(`Received ${(_h = response.entries) === null || _h === void 0 ? void 0 : _h.length} variant entries out of total ${response.count}`, (_j = this.exportConfig) === null || _j === void 0 ? void 0 : _j.context);
|
|
132
132
|
}
|
|
133
133
|
if (callback) {
|
|
134
|
-
cli_utilities_1.log.debug('Executing callback with variant entries', (_k = this.exportConfig) === null || _k === void 0 ? void 0 : _k.context);
|
|
134
|
+
cli_utilities_1.log.debug('Executing callback with variant entries...', (_k = this.exportConfig) === null || _k === void 0 ? void 0 : _k.context);
|
|
135
135
|
callback(response.entries);
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
|
-
cli_utilities_1.log.debug('Adding variant entries to collection', (_l = this.exportConfig) === null || _l === void 0 ? void 0 : _l.context);
|
|
138
|
+
cli_utilities_1.log.debug('Adding variant entries to collection...', (_l = this.exportConfig) === null || _l === void 0 ? void 0 : _l.context);
|
|
139
139
|
entries = entries.concat(response.entries);
|
|
140
140
|
}
|
|
141
141
|
if (getAllData && skip + limit < response.count) {
|
|
@@ -154,7 +154,7 @@ class VariantHttpClient extends adapter_helper_1.AdapterHelper {
|
|
|
154
154
|
return yield this.variantEntries(options, entries);
|
|
155
155
|
}
|
|
156
156
|
if (returnResult) {
|
|
157
|
-
cli_utilities_1.log.debug('Returning variant entries result', (_p = this.exportConfig) === null || _p === void 0 ? void 0 : _p.context);
|
|
157
|
+
cli_utilities_1.log.debug('Returning variant entries result...', (_p = this.exportConfig) === null || _p === void 0 ? void 0 : _p.context);
|
|
158
158
|
return { entries };
|
|
159
159
|
}
|
|
160
160
|
});
|
|
@@ -264,7 +264,7 @@ class VariantHttpClient extends adapter_helper_1.AdapterHelper {
|
|
|
264
264
|
const { status, data } = res;
|
|
265
265
|
cli_utilities_1.log.debug(`API response status: ${status}`, (_a = this.exportConfig) === null || _a === void 0 ? void 0 : _a.context);
|
|
266
266
|
if (status >= 200 && status < 300) {
|
|
267
|
-
cli_utilities_1.log.debug('API request successful', (_b = this.exportConfig) === null || _b === void 0 ? void 0 : _b.context);
|
|
267
|
+
cli_utilities_1.log.debug('API request successful.', (_b = this.exportConfig) === null || _b === void 0 ? void 0 : _b.context);
|
|
268
268
|
return data;
|
|
269
269
|
}
|
|
270
270
|
cli_utilities_1.log.debug(`API request failed with status: ${status}`, (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
@@ -324,17 +324,17 @@ class VariantAdapter {
|
|
|
324
324
|
this.currentModuleName = '';
|
|
325
325
|
cli_utilities_1.log.debug('Initializing VariantAdapter...', (_a = this.exportConfig) === null || _a === void 0 ? void 0 : _a.context);
|
|
326
326
|
if (config.httpClient) {
|
|
327
|
-
cli_utilities_1.log.debug('Using HTTP client variant instance', (_b = this.exportConfig) === null || _b === void 0 ? void 0 : _b.context);
|
|
327
|
+
cli_utilities_1.log.debug('Using HTTP client variant instance.', (_b = this.exportConfig) === null || _b === void 0 ? void 0 : _b.context);
|
|
328
328
|
const { httpClient, Adapter } = config, restConfig = __rest(config, ["httpClient", "Adapter"]);
|
|
329
329
|
this.variantInstance = new Adapter(restConfig, options);
|
|
330
330
|
}
|
|
331
331
|
else {
|
|
332
|
-
cli_utilities_1.log.debug('Using SDK variant instance', (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
332
|
+
cli_utilities_1.log.debug('Using SDK variant instance.', (_c = this.exportConfig) === null || _c === void 0 ? void 0 : _c.context);
|
|
333
333
|
const { Adapter } = config, restConfig = __rest(config, ["Adapter"]);
|
|
334
334
|
this.variantInstance = new Adapter(restConfig);
|
|
335
335
|
}
|
|
336
336
|
this.messages = messages_1.default;
|
|
337
|
-
cli_utilities_1.log.debug('VariantAdapter initialized successfully', (_d = this.exportConfig) === null || _d === void 0 ? void 0 : _d.context);
|
|
337
|
+
cli_utilities_1.log.debug('VariantAdapter initialized successfully.', (_d = this.exportConfig) === null || _d === void 0 ? void 0 : _d.context);
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
340
340
|
* Set parent progress manager for sub-module integration
|
package/package.json
CHANGED
package/src/export/audiences.ts
CHANGED
|
@@ -52,7 +52,7 @@ export default class ExportAudiences extends PersonalizationAdapter<ExportConfig
|
|
|
52
52
|
|
|
53
53
|
if (!this.audiences?.length) {
|
|
54
54
|
log.debug('No audiences found, completing export', this.exportConfig.context);
|
|
55
|
-
log.info('No
|
|
55
|
+
log.info('No audiences found for the given project.', this.exportConfig.context);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ export default class ExportExperiences extends PersonalizationAdapter<ExportConf
|
|
|
61
61
|
|
|
62
62
|
if (!experiences || experiences?.length < 1) {
|
|
63
63
|
log.debug('No experiences found, completing export', this.exportConfig.context);
|
|
64
|
-
log.info('No
|
|
64
|
+
log.info('No experiences found for the given project.', this.exportConfig.context);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -20,7 +20,8 @@ export type Modules =
|
|
|
20
20
|
| 'labels'
|
|
21
21
|
| 'marketplace-apps'
|
|
22
22
|
| 'taxonomies'
|
|
23
|
-
| 'personalize'
|
|
23
|
+
| 'personalize'
|
|
24
|
+
| 'composable-studio';
|
|
24
25
|
|
|
25
26
|
export type branch = {
|
|
26
27
|
uid: string;
|
|
@@ -182,6 +183,11 @@ export interface DefaultConfig {
|
|
|
182
183
|
fileName: string;
|
|
183
184
|
dependencies?: Modules[];
|
|
184
185
|
};
|
|
186
|
+
'composable-studio': {
|
|
187
|
+
dirName: string;
|
|
188
|
+
fileName: string;
|
|
189
|
+
apiBaseUrl: string;
|
|
190
|
+
};
|
|
185
191
|
masterLocale: {
|
|
186
192
|
dirName: string;
|
|
187
193
|
fileName: string;
|
|
@@ -53,10 +53,10 @@ export class VariantHttpClient<C> extends AdapterHelper<C, HttpClient> implement
|
|
|
53
53
|
this.exportConfig?.context,
|
|
54
54
|
);
|
|
55
55
|
if (authenticationHandler.isOauthEnabled) {
|
|
56
|
-
log.debug('Setting OAuth authorization header', this.exportConfig?.context);
|
|
56
|
+
log.debug('Setting OAuth authorization header...', this.exportConfig?.context);
|
|
57
57
|
this.apiClient.headers({ authorization: token });
|
|
58
58
|
} else {
|
|
59
|
-
log.debug('Setting authtoken header', this.exportConfig?.context);
|
|
59
|
+
log.debug('Setting authtoken header...', this.exportConfig?.context);
|
|
60
60
|
this.apiClient.headers({ authtoken: token });
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -109,7 +109,7 @@ export class VariantHttpClient<C> extends AdapterHelper<C, HttpClient> implement
|
|
|
109
109
|
);
|
|
110
110
|
|
|
111
111
|
if (variantConfig.serveMockData && callback) {
|
|
112
|
-
log.debug('Using mock data for variant entries', this.exportConfig?.context);
|
|
112
|
+
log.debug('Using mock data for variant entries...', this.exportConfig?.context);
|
|
113
113
|
let data = [] as Record<string, any>[];
|
|
114
114
|
|
|
115
115
|
if (existsSync(variantConfig.mockDataPath)) {
|
|
@@ -174,10 +174,10 @@ export class VariantHttpClient<C> extends AdapterHelper<C, HttpClient> implement
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (callback) {
|
|
177
|
-
log.debug('Executing callback with variant entries', this.exportConfig?.context);
|
|
177
|
+
log.debug('Executing callback with variant entries...', this.exportConfig?.context);
|
|
178
178
|
callback(response.entries);
|
|
179
179
|
} else {
|
|
180
|
-
log.debug('Adding variant entries to collection', this.exportConfig?.context);
|
|
180
|
+
log.debug('Adding variant entries to collection...', this.exportConfig?.context);
|
|
181
181
|
entries = entries.concat(response.entries);
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -200,7 +200,7 @@ export class VariantHttpClient<C> extends AdapterHelper<C, HttpClient> implement
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
if (returnResult) {
|
|
203
|
-
log.debug('Returning variant entries result', this.exportConfig?.context );
|
|
203
|
+
log.debug('Returning variant entries result...', this.exportConfig?.context );
|
|
204
204
|
return { entries };
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -329,7 +329,7 @@ export class VariantHttpClient<C> extends AdapterHelper<C, HttpClient> implement
|
|
|
329
329
|
log.debug(`API response status: ${status}`, this.exportConfig?.context);
|
|
330
330
|
|
|
331
331
|
if (status >= 200 && status < 300) {
|
|
332
|
-
log.debug('API request successful', this.exportConfig?.context);
|
|
332
|
+
log.debug('API request successful.', this.exportConfig?.context);
|
|
333
333
|
return data;
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -406,17 +406,17 @@ export class VariantAdapter<T> {
|
|
|
406
406
|
log.debug('Initializing VariantAdapter...', this.exportConfig?.context);
|
|
407
407
|
|
|
408
408
|
if (config.httpClient) {
|
|
409
|
-
log.debug('Using HTTP client variant instance', this.exportConfig?.context);
|
|
409
|
+
log.debug('Using HTTP client variant instance.', this.exportConfig?.context);
|
|
410
410
|
const { httpClient, Adapter, ...restConfig } = config;
|
|
411
411
|
this.variantInstance = new Adapter(restConfig, options);
|
|
412
412
|
} else {
|
|
413
|
-
log.debug('Using SDK variant instance', this.exportConfig?.context);
|
|
413
|
+
log.debug('Using SDK variant instance.', this.exportConfig?.context);
|
|
414
414
|
const { Adapter, ...restConfig } = config;
|
|
415
415
|
this.variantInstance = new Adapter(restConfig);
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
this.messages = messages;
|
|
419
|
-
log.debug('VariantAdapter initialized successfully', this.exportConfig?.context);
|
|
419
|
+
log.debug('VariantAdapter initialized successfully.', this.exportConfig?.context);
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
/**
|