@contentstack/cli-cm-export-query 1.0.0-beta.4 → 1.0.0-beta.5
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.
|
@@ -12,7 +12,7 @@ const logger_1 = require("./logger");
|
|
|
12
12
|
*/
|
|
13
13
|
const setupBranches = async (config, stackAPIClient) => {
|
|
14
14
|
if (typeof config !== 'object') {
|
|
15
|
-
throw new Error('
|
|
15
|
+
throw new Error('The branch configuration is invalid.');
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
18
|
if (config.branchAlias) {
|
|
@@ -33,7 +33,7 @@ const setupBranches = async (config, stackAPIClient) => {
|
|
|
33
33
|
(0, logger_1.log)(config, `Branch '${config.branchName}' found`, 'success');
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
throw new Error(`No branch found
|
|
36
|
+
throw new Error(`No branch found named ${config.branchName}.`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
@@ -25,17 +25,17 @@ async function setupQueryExportConfig(flags) {
|
|
|
25
25
|
exportQueryConfig.managementToken = token;
|
|
26
26
|
exportQueryConfig.stackApiKey = apiKey;
|
|
27
27
|
if (!exportQueryConfig.managementToken) {
|
|
28
|
-
throw new Error(`No management token found
|
|
28
|
+
throw new Error(`No management token found for alias ${flags.alias}.`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
if (!exportQueryConfig.managementToken) {
|
|
32
32
|
if (!(0, cli_utilities_1.isAuthenticated)()) {
|
|
33
|
-
throw new Error('
|
|
33
|
+
throw new Error('Log in or provide an alias for the management token.');
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
exportQueryConfig.stackApiKey = flags['stack-api-key'] || (await (0, common_helper_1.askAPIKey)());
|
|
37
37
|
if (typeof exportQueryConfig.stackApiKey !== 'string') {
|
|
38
|
-
throw new Error('
|
|
38
|
+
throw new Error('The API key is invalid.');
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ class ContentTypeDependenciesHandler {
|
|
|
46
46
|
(0, logger_1.log)(this.exportQueryConfig, `Dependencies separated - Global Fields: ${dependencies.globalFields.size}, Extensions: ${dependencies.extensions.size}, Taxonomies: ${dependencies.taxonomies.size}, Marketplace Apps: ${dependencies.marketplaceApps.size}`, 'info');
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
|
49
|
-
(0, logger_1.log)(this.exportQueryConfig, `
|
|
49
|
+
(0, logger_1.log)(this.exportQueryConfig, `Failed to separate extensions and Marketplace apps: ${error.message}`, 'error');
|
|
50
50
|
// Keep original extensions if separation fails
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -87,7 +87,7 @@ class ContentTypeDependenciesHandler {
|
|
|
87
87
|
return { extensions: regularExtensions, marketplaceApps };
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
|
-
(0, logger_1.log)(this.exportQueryConfig, `
|
|
90
|
+
(0, logger_1.log)(this.exportQueryConfig, `Failed to fetch extensions and Marketplace apps: ${error.message}`, 'error');
|
|
91
91
|
return { extensions: extensionUIDs, marketplaceApps: [] };
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -26,7 +26,7 @@ class QueryParser {
|
|
|
26
26
|
return JSON.parse(content);
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
|
-
throw new cli_utilities_1.CLIError(`Failed to parse query file: ${error.message}`);
|
|
29
|
+
throw new cli_utilities_1.CLIError(`Failed to parse the query file: ${error.message}`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
parseFromString(queryString) {
|
|
@@ -39,14 +39,14 @@ class QueryParser {
|
|
|
39
39
|
}
|
|
40
40
|
validate(query) {
|
|
41
41
|
if (!query || typeof query !== 'object') {
|
|
42
|
-
throw new cli_utilities_1.CLIError('
|
|
42
|
+
throw new cli_utilities_1.CLIError('The query must be a valid JSON object.');
|
|
43
43
|
}
|
|
44
44
|
if (!query.modules || typeof query.modules !== 'object') {
|
|
45
|
-
throw new cli_utilities_1.CLIError('
|
|
45
|
+
throw new cli_utilities_1.CLIError('The query must contain a "modules" object.');
|
|
46
46
|
}
|
|
47
47
|
const modules = Object.keys(query.modules);
|
|
48
48
|
if (modules.length === 0) {
|
|
49
|
-
throw new cli_utilities_1.CLIError('
|
|
49
|
+
throw new cli_utilities_1.CLIError('The query must contain at least one module.');
|
|
50
50
|
}
|
|
51
51
|
// Validate supported modules
|
|
52
52
|
const queryableModules = this.config.modules.queryable;
|
|
@@ -37,7 +37,7 @@ class AssetReferenceHandler {
|
|
|
37
37
|
return result;
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
|
-
(0, logger_1.log)(this.exportQueryConfig, `
|
|
40
|
+
(0, logger_1.log)(this.exportQueryConfig, `Failed to extract assets: ${error.message}`, 'error');
|
|
41
41
|
return [];
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -66,7 +66,7 @@ class AssetReferenceHandler {
|
|
|
66
66
|
return entriesCount;
|
|
67
67
|
}
|
|
68
68
|
catch (error) {
|
|
69
|
-
(0, logger_1.log)(this.exportQueryConfig, `
|
|
69
|
+
(0, logger_1.log)(this.exportQueryConfig, `Failed to process file ${filePath}: ${error.message}`, 'warn');
|
|
70
70
|
return 0;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -123,7 +123,7 @@ class AssetReferenceHandler {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
catch (error) {
|
|
126
|
-
(0, logger_1.log)(this.exportQueryConfig, `
|
|
126
|
+
(0, logger_1.log)(this.exportQueryConfig, `Failed to read directory ${dir}: ${error.message}`, 'warn');
|
|
127
127
|
}
|
|
128
128
|
return jsonFiles;
|
|
129
129
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-export-query",
|
|
3
3
|
"description": "Contentstack CLI plugin to export content from stack",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.5",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|