@contentstack/cli-cm-export-to-csv 1.10.2 → 1.11.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.
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Messages and strings used in the export-to-csv command.
3
+ */
4
+ export declare const messages: {
5
+ readonly COMMAND_DESCRIPTION: "Export entries, taxonomies, terms, or organization users to CSV using this command";
6
+ readonly FLAG_ACTION: "Option to export data (entries, users, teams, taxonomies). <options: entries|users|teams|taxonomies>";
7
+ readonly FLAG_ALIAS: "Alias of the management token";
8
+ readonly FLAG_ORG: "Provide organization UID to clone org users";
9
+ readonly FLAG_STACK_NAME: "Name of the stack that needs to be created as CSV filename";
10
+ readonly FLAG_STACK_API_KEY: "Provide the stack API key of the source stack";
11
+ readonly FLAG_ORG_NAME: "Name of the organization that needs to be created as CSV filename";
12
+ readonly FLAG_LOCALE: "Locale of entries that will be exported";
13
+ readonly FLAG_CONTENT_TYPE: "Content type of entries that will be exported";
14
+ readonly FLAG_BRANCH: "Branch from which entries will be exported";
15
+ readonly FLAG_TEAM_UID: "Provide the UID of a specific team in an organization";
16
+ readonly FLAG_TAXONOMY_UID: "Provide the taxonomy UID of the related terms you want to export";
17
+ readonly FLAG_INCLUDE_FALLBACK: "[Optional] Include fallback locale data when exporting taxonomies. When enabled, if a taxonomy term doesn't exist in the specified locale, it will fallback to the hierarchy defined in the branch settings.";
18
+ readonly FLAG_FALLBACK_LOCALE: "[Optional] Specify a specific fallback locale for taxonomy export. This locale will be used when a taxonomy term doesn't exist in the primary locale. Takes priority over branch fallback hierarchy when both are specified.";
19
+ readonly FLAG_DELIMITER: "[Optional] Provide a delimiter to separate individual data fields within the CSV file. For example: cm:export-to-csv --delimiter '|'";
20
+ readonly ACTION_EXPORT_ENTRIES: "Export entries to a .CSV file";
21
+ readonly ACTION_EXPORT_USERS: "Export organization users' data to a .CSV file";
22
+ readonly ACTION_EXPORT_TEAMS: "Export organization teams' data to a .CSV file";
23
+ readonly ACTION_EXPORT_TAXONOMIES: "Export taxonomies to a .CSV file";
24
+ readonly ACTION_CANCEL: "Cancel and Exit";
25
+ readonly ERROR_NOT_LOGGED_IN: "You need to either login or provide a management token to execute this command";
26
+ readonly ERROR_LOGIN_REQUIRED: "You need to login to execute this command. See: auth:login --help";
27
+ readonly ERROR_API_FAILED: "Something went wrong! Please try again";
28
+ readonly ERROR_CONTENT_TYPE_NOT_FOUND: "The Content Type {contentType} was not found. Please try again.";
29
+ readonly ERROR_NO_CONTENT_TYPES: "No content types found for the given stack";
30
+ readonly ERROR_SELECT_CONTENT_TYPE: "Please select at least one content type";
31
+ readonly ERROR_ORG_NOT_FOUND: "Org UID not found";
32
+ readonly ERROR_MANAGEMENT_TOKEN_NOT_FOUND: "The provided management token alias was not found in your config";
33
+ readonly ERROR_MANAGEMENT_TOKEN_INVALID: "Management token or stack API key is invalid";
34
+ readonly ERROR_ADMIN_ACCESS_DENIED: "Unable to export data. Make sure you're an admin or owner of this organization";
35
+ readonly INFO_NO_TAXONOMIES: "No taxonomies found!";
36
+ readonly INFO_WRITING_FILE: "Writing {type} to file: \"{path}\"";
37
+ readonly INFO_EXPORTING_TEAMS: "Exporting the teams of Organisation {orgName}";
38
+ readonly INFO_EXPORTING_TEAM: "Exporting the team with uid {teamUid} in Organisation {orgName}";
39
+ readonly INFO_EXPORTING_TEAM_USERS: "Exporting the teams user data for {target}";
40
+ readonly INFO_EXPORTING_STACK_ROLES: "Exporting the stack role details for {target}";
41
+ readonly INFO_NO_TEAMS: "The organization {orgName} does not have any teams associated with it. Please verify and provide the correct organization name.";
42
+ readonly WARNING_STACK_ACCESS_DENIED: "Admin access denied to the following stacks using the provided API keys. Please get in touch with the stack owner to request access.";
43
+ readonly PROMPT_CHOOSE_ACTION: "Choose Action";
44
+ readonly PROMPT_CHOOSE_ORG: "Choose an Organization";
45
+ readonly PROMPT_CHOOSE_STACK: "Choose a Stack";
46
+ readonly PROMPT_CHOOSE_BRANCH: "Choose a Branch";
47
+ readonly PROMPT_CHOOSE_CONTENT_TYPE: "Choose Content Type (Press Space to select the content types)";
48
+ readonly PROMPT_CHOOSE_LANGUAGE: "Choose Language";
49
+ readonly PROMPT_CONTINUE_EXPORT: "Access denied: Please confirm if you still want to continue exporting the data without the { Stack Name, Stack Uid, Role Name } fields.";
50
+ };
51
+ /**
52
+ * Template string replacer utility.
53
+ * @param message - Message with placeholders like {key}
54
+ * @param params - Object with key-value pairs to replace
55
+ */
56
+ export declare function formatMessage(message: string, params: Record<string, string>): string;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * Messages and strings used in the export-to-csv command.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.messages = void 0;
7
+ exports.formatMessage = formatMessage;
8
+ exports.messages = {
9
+ // Command description
10
+ COMMAND_DESCRIPTION: 'Export entries, taxonomies, terms, or organization users to CSV using this command',
11
+ // Flag descriptions
12
+ FLAG_ACTION: 'Option to export data (entries, users, teams, taxonomies). <options: entries|users|teams|taxonomies>',
13
+ FLAG_ALIAS: 'Alias of the management token',
14
+ FLAG_ORG: 'Provide organization UID to clone org users',
15
+ FLAG_STACK_NAME: 'Name of the stack that needs to be created as CSV filename',
16
+ FLAG_STACK_API_KEY: 'Provide the stack API key of the source stack',
17
+ FLAG_ORG_NAME: 'Name of the organization that needs to be created as CSV filename',
18
+ FLAG_LOCALE: 'Locale of entries that will be exported',
19
+ FLAG_CONTENT_TYPE: 'Content type of entries that will be exported',
20
+ FLAG_BRANCH: 'Branch from which entries will be exported',
21
+ FLAG_TEAM_UID: 'Provide the UID of a specific team in an organization',
22
+ FLAG_TAXONOMY_UID: 'Provide the taxonomy UID of the related terms you want to export',
23
+ FLAG_INCLUDE_FALLBACK: "[Optional] Include fallback locale data when exporting taxonomies. When enabled, if a taxonomy term doesn't exist in the specified locale, it will fallback to the hierarchy defined in the branch settings.",
24
+ FLAG_FALLBACK_LOCALE: "[Optional] Specify a specific fallback locale for taxonomy export. This locale will be used when a taxonomy term doesn't exist in the primary locale. Takes priority over branch fallback hierarchy when both are specified.",
25
+ FLAG_DELIMITER: "[Optional] Provide a delimiter to separate individual data fields within the CSV file. For example: cm:export-to-csv --delimiter '|'",
26
+ // Action choices for interactive prompts
27
+ ACTION_EXPORT_ENTRIES: 'Export entries to a .CSV file',
28
+ ACTION_EXPORT_USERS: "Export organization users' data to a .CSV file",
29
+ ACTION_EXPORT_TEAMS: "Export organization teams' data to a .CSV file",
30
+ ACTION_EXPORT_TAXONOMIES: 'Export taxonomies to a .CSV file',
31
+ ACTION_CANCEL: 'Cancel and Exit',
32
+ // Error messages
33
+ ERROR_NOT_LOGGED_IN: 'You need to either login or provide a management token to execute this command',
34
+ ERROR_LOGIN_REQUIRED: 'You need to login to execute this command. See: auth:login --help',
35
+ ERROR_API_FAILED: 'Something went wrong! Please try again',
36
+ ERROR_CONTENT_TYPE_NOT_FOUND: 'The Content Type {contentType} was not found. Please try again.',
37
+ ERROR_NO_CONTENT_TYPES: 'No content types found for the given stack',
38
+ ERROR_SELECT_CONTENT_TYPE: 'Please select at least one content type',
39
+ ERROR_ORG_NOT_FOUND: 'Org UID not found',
40
+ ERROR_MANAGEMENT_TOKEN_NOT_FOUND: 'The provided management token alias was not found in your config',
41
+ ERROR_MANAGEMENT_TOKEN_INVALID: 'Management token or stack API key is invalid',
42
+ ERROR_ADMIN_ACCESS_DENIED: "Unable to export data. Make sure you're an admin or owner of this organization",
43
+ // Info messages
44
+ INFO_NO_TAXONOMIES: 'No taxonomies found!',
45
+ INFO_WRITING_FILE: 'Writing {type} to file: "{path}"',
46
+ INFO_EXPORTING_TEAMS: 'Exporting the teams of Organisation {orgName}',
47
+ INFO_EXPORTING_TEAM: 'Exporting the team with uid {teamUid} in Organisation {orgName}',
48
+ INFO_EXPORTING_TEAM_USERS: 'Exporting the teams user data for {target}',
49
+ INFO_EXPORTING_STACK_ROLES: 'Exporting the stack role details for {target}',
50
+ INFO_NO_TEAMS: 'The organization {orgName} does not have any teams associated with it. Please verify and provide the correct organization name.',
51
+ // Warning messages
52
+ WARNING_STACK_ACCESS_DENIED: 'Admin access denied to the following stacks using the provided API keys. Please get in touch with the stack owner to request access.',
53
+ // Prompt messages
54
+ PROMPT_CHOOSE_ACTION: 'Choose Action',
55
+ PROMPT_CHOOSE_ORG: 'Choose an Organization',
56
+ PROMPT_CHOOSE_STACK: 'Choose a Stack',
57
+ PROMPT_CHOOSE_BRANCH: 'Choose a Branch',
58
+ PROMPT_CHOOSE_CONTENT_TYPE: 'Choose Content Type (Press Space to select the content types)',
59
+ PROMPT_CHOOSE_LANGUAGE: 'Choose Language',
60
+ PROMPT_CONTINUE_EXPORT: 'Access denied: Please confirm if you still want to continue exporting the data without the { Stack Name, Stack Uid, Role Name } fields.',
61
+ };
62
+ /**
63
+ * Template string replacer utility.
64
+ * @param message - Message with placeholders like {key}
65
+ * @param params - Object with key-value pairs to replace
66
+ */
67
+ function formatMessage(message, params) {
68
+ let result = message;
69
+ for (const [key, value] of Object.entries(params)) {
70
+ result = result.replace(new RegExp(`\\{${key}\\}`, 'g'), value);
71
+ }
72
+ return result;
73
+ }