@contentstack/cli-cm-export-to-csv 2.0.0-beta.1 → 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.
@@ -0,0 +1,256 @@
1
+ "use strict";
2
+ /**
3
+ * Interactive prompt utilities.
4
+ * Migrated from: packages/contentstack-export-to-csv/src/util/index.js
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.startupQuestions = startupQuestions;
41
+ exports.chooseOrganization = chooseOrganization;
42
+ exports.chooseStack = chooseStack;
43
+ exports.chooseBranch = chooseBranch;
44
+ exports.chooseContentType = chooseContentType;
45
+ exports.chooseInMemContentTypes = chooseInMemContentTypes;
46
+ exports.chooseLanguage = chooseLanguage;
47
+ exports.chooseFallbackOptions = chooseFallbackOptions;
48
+ exports.promptContinueExport = promptContinueExport;
49
+ const prompts_1 = require("@inquirer/prompts");
50
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
51
+ const messages_1 = require("../messages");
52
+ const error_handler_1 = require("./error-handler");
53
+ const api_client_1 = require("./api-client");
54
+ // ============================================================================
55
+ // Startup Questions
56
+ // ============================================================================
57
+ /**
58
+ * Display startup questions to choose an action.
59
+ */
60
+ async function startupQuestions() {
61
+ const action = await (0, prompts_1.select)({
62
+ message: 'Choose Action',
63
+ choices: [
64
+ { value: messages_1.messages.ACTION_EXPORT_ENTRIES },
65
+ { value: messages_1.messages.ACTION_EXPORT_USERS },
66
+ { value: messages_1.messages.ACTION_EXPORT_TEAMS },
67
+ { value: messages_1.messages.ACTION_EXPORT_TAXONOMIES },
68
+ { value: 'Exit' },
69
+ ],
70
+ });
71
+ if (action === 'Exit')
72
+ (0, error_handler_1.exitProgram)();
73
+ return action;
74
+ }
75
+ // ============================================================================
76
+ // Organization Prompts
77
+ // ============================================================================
78
+ /**
79
+ * Prompt user to choose an organization.
80
+ */
81
+ async function chooseOrganization(managementAPIClient, action) {
82
+ let organizations;
83
+ if (action === messages_1.messages.ACTION_EXPORT_USERS || action === messages_1.messages.ACTION_EXPORT_TEAMS || action === 'teams') {
84
+ organizations = await (0, api_client_1.getOrganizationsWhereUserIsAdmin)(managementAPIClient);
85
+ }
86
+ else {
87
+ organizations = await (0, api_client_1.getOrganizations)(managementAPIClient);
88
+ }
89
+ const choices = [
90
+ ...Object.keys(organizations).map((name) => ({ value: name })),
91
+ { value: messages_1.messages.ACTION_CANCEL },
92
+ ];
93
+ const chosenOrg = await (0, prompts_1.select)({
94
+ message: 'Choose an Organization',
95
+ choices,
96
+ loop: false,
97
+ });
98
+ if (chosenOrg === messages_1.messages.ACTION_CANCEL)
99
+ (0, error_handler_1.exitProgram)();
100
+ return { name: chosenOrg, uid: organizations[chosenOrg] };
101
+ }
102
+ // ============================================================================
103
+ // Stack Prompts
104
+ // ============================================================================
105
+ /**
106
+ * Prompt user to choose a stack.
107
+ */
108
+ async function chooseStack(managementAPIClient, orgUid, stackApiKey) {
109
+ const stacks = await (0, api_client_1.getStacks)(managementAPIClient, orgUid);
110
+ if (stackApiKey) {
111
+ const stackName = Object.keys(stacks).find((key) => stacks[key] === stackApiKey);
112
+ if (stackName) {
113
+ return { name: stackName, apiKey: stackApiKey };
114
+ }
115
+ else {
116
+ throw new Error('Could not find stack');
117
+ }
118
+ }
119
+ const choices = [
120
+ ...Object.keys(stacks).map((name) => ({ value: name })),
121
+ { value: messages_1.messages.ACTION_CANCEL },
122
+ ];
123
+ const chosenStack = await (0, prompts_1.select)({
124
+ message: 'Choose a Stack',
125
+ choices,
126
+ });
127
+ if (chosenStack === messages_1.messages.ACTION_CANCEL)
128
+ (0, error_handler_1.exitProgram)();
129
+ return { name: chosenStack, apiKey: stacks[chosenStack] };
130
+ }
131
+ // ============================================================================
132
+ // Branch Prompts
133
+ // ============================================================================
134
+ /**
135
+ * Prompt user to choose a branch.
136
+ */
137
+ async function chooseBranch(branchList) {
138
+ try {
139
+ const branch = await (0, prompts_1.select)({
140
+ message: 'Choose a Branch',
141
+ choices: branchList.map((b) => ({ value: b.uid })),
142
+ });
143
+ return { branch };
144
+ }
145
+ catch (err) {
146
+ cli_utilities_1.cliux.error(err);
147
+ throw err;
148
+ }
149
+ }
150
+ // ============================================================================
151
+ // Content Type Prompts
152
+ // ============================================================================
153
+ /**
154
+ * Prompt user to choose content types (basic checkbox).
155
+ */
156
+ async function chooseContentType(stackAPIClient, skip) {
157
+ const { getContentTypes } = await Promise.resolve().then(() => __importStar(require('./api-client')));
158
+ const contentTypes = await getContentTypes(stackAPIClient, skip);
159
+ const contentTypesList = Object.values(contentTypes);
160
+ const chosenContentTypes = await (0, prompts_1.checkbox)({
161
+ message: 'Choose Content Type (Press Space to select the content types)',
162
+ choices: contentTypesList.map((ct) => ({ value: ct, name: ct })),
163
+ loop: false,
164
+ });
165
+ return chosenContentTypes;
166
+ }
167
+ /**
168
+ * Prompt user to choose content types (searchable multi-select).
169
+ *
170
+ * Note: inquirer-checkbox-plus-prompt is incompatible with inquirer v9+
171
+ * (registerPrompt was removed). Replaced with checkbox() from @inquirer/prompts
172
+ * which has built-in real-time filtering — users type to search, Space to select.
173
+ */
174
+ async function chooseInMemContentTypes(contentTypesList) {
175
+ let chosenContentTypes = [];
176
+ while (chosenContentTypes.length === 0) {
177
+ chosenContentTypes = await (0, prompts_1.checkbox)({
178
+ message: 'Choose Content Type (Type to filter, Space to select)',
179
+ choices: contentTypesList.map((ct) => ({ value: ct, name: ct })),
180
+ loop: false,
181
+ });
182
+ // if any term to filter by doesn't exist, exclude
183
+ if (chosenContentTypes.length === 0) {
184
+ cli_utilities_1.cliux.print('Please select atleast one content type.', { color: 'yellow' });
185
+ }
186
+ }
187
+ return chosenContentTypes;
188
+ }
189
+ // ============================================================================
190
+ // Language Prompts
191
+ // ============================================================================
192
+ /**
193
+ * Prompt user to choose a language/locale.
194
+ */
195
+ async function chooseLanguage(stackAPIClient) {
196
+ const languages = await (0, api_client_1.getLanguages)(stackAPIClient);
197
+ const choices = [
198
+ ...Object.keys(languages).map((name) => ({ value: name })),
199
+ { value: messages_1.messages.ACTION_CANCEL },
200
+ ];
201
+ const chosenLanguage = await (0, prompts_1.select)({
202
+ message: 'Choose Language',
203
+ choices,
204
+ });
205
+ if (chosenLanguage === messages_1.messages.ACTION_CANCEL)
206
+ (0, error_handler_1.exitProgram)();
207
+ return { name: chosenLanguage, code: languages[chosenLanguage] };
208
+ }
209
+ // ============================================================================
210
+ // Fallback Options Prompts
211
+ // ============================================================================
212
+ /**
213
+ * Prompt user for fallback options.
214
+ */
215
+ async function chooseFallbackOptions(stackAPIClient) {
216
+ try {
217
+ const includeFallback = await (0, prompts_1.confirm)({
218
+ message: 'Include fallback locale data when exporting taxonomies?',
219
+ default: false,
220
+ });
221
+ let fallbackLocale = null;
222
+ if (includeFallback) {
223
+ // Get available languages for fallback locale selection
224
+ const languages = await (0, api_client_1.getLanguages)(stackAPIClient);
225
+ const selectedFallbackLocale = await (0, prompts_1.select)({
226
+ message: 'Choose fallback locale',
227
+ choices: Object.keys(languages).map((name) => ({ value: name })),
228
+ });
229
+ fallbackLocale = languages[selectedFallbackLocale];
230
+ }
231
+ return { includeFallback, fallbackLocale };
232
+ }
233
+ catch (error) {
234
+ throw error;
235
+ }
236
+ }
237
+ // ============================================================================
238
+ // Team Export Prompts
239
+ // ============================================================================
240
+ /**
241
+ * Prompt to continue exporting without certain fields.
242
+ */
243
+ async function promptContinueExport() {
244
+ try {
245
+ const chooseExport = await (0, prompts_1.select)({
246
+ message: 'Access denied: Please confirm if you still want to continue exporting the data without the { Stack Name, Stack Uid, Role Name } fields.',
247
+ choices: [{ value: 'yes' }, { value: 'no' }],
248
+ loop: false,
249
+ });
250
+ return chooseExport === 'yes';
251
+ }
252
+ catch (error) {
253
+ cli_utilities_1.cliux.print(error, { color: 'red' });
254
+ process.exit(1);
255
+ }
256
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Team export utilities.
3
+ * Migrated from: packages/contentstack-export-to-csv/src/util/index.js
4
+ *
5
+ * These are composite functions that use multiple utilities together
6
+ * for team export functionality.
7
+ */
8
+ import type { ManagementClient, OrganizationChoice, CleanedTeam, StackRoleMapping, StackRoleMappingCsvRow } from '../types';
9
+ /**
10
+ * Export teams data for an organization.
11
+ */
12
+ export declare function exportTeams(managementAPIClient: ManagementClient, organization: OrganizationChoice, teamUid: string | undefined, delimiter: string): Promise<void>;
13
+ /**
14
+ * Get individual team user details and write to file.
15
+ */
16
+ export declare function getTeamsDetail(allTeamsData: CleanedTeam[], organization: OrganizationChoice, teamUid: string | undefined, delimiter: string): Promise<void>;
17
+ /**
18
+ * Export role mappings of teams to CSV.
19
+ */
20
+ export declare function exportRoleMappings(managementAPIClient: ManagementClient, allTeamsData: CleanedTeam[], teamUid: string | undefined, delimiter: string): Promise<void>;
21
+ /**
22
+ * Map team stacks with stack role and return array of objects.
23
+ */
24
+ export declare function mapRoleWithTeams(managementAPIClient: ManagementClient, stackRoleMapping: StackRoleMapping, teamName: string, teamUid: string): Promise<StackRoleMappingCsvRow[]>;
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /**
3
+ * Team export utilities.
4
+ * Migrated from: packages/contentstack-export-to-csv/src/util/index.js
5
+ *
6
+ * These are composite functions that use multiple utilities together
7
+ * for team export functionality.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.exportTeams = exportTeams;
11
+ exports.getTeamsDetail = getTeamsDetail;
12
+ exports.exportRoleMappings = exportRoleMappings;
13
+ exports.mapRoleWithTeams = mapRoleWithTeams;
14
+ const tslib_1 = require("tslib");
15
+ const find_1 = tslib_1.__importDefault(require("lodash/find"));
16
+ const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
17
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
18
+ const config_1 = tslib_1.__importDefault(require("../config"));
19
+ const csv_writer_1 = require("./csv-writer");
20
+ const data_transform_1 = require("./data-transform");
21
+ const api_client_1 = require("./api-client");
22
+ const interactive_1 = require("./interactive");
23
+ /**
24
+ * Export teams data for an organization.
25
+ */
26
+ async function exportTeams(managementAPIClient, organization, teamUid, delimiter) {
27
+ const logContext = { module: 'teams-export', orgUid: organization.uid, teamUid };
28
+ cli_utilities_1.log.debug('Starting teams export', logContext);
29
+ cli_utilities_1.cliux.print(`info: Exporting the ${teamUid && (organization === null || organization === void 0 ? void 0 : organization.name)
30
+ ? `team with uid ${teamUid} in Organisation ${organization === null || organization === void 0 ? void 0 : organization.name} `
31
+ : `teams of Organisation ` + (organization === null || organization === void 0 ? void 0 : organization.name)}`, { color: 'blue' });
32
+ cli_utilities_1.cliux.loader('Fetching teams...');
33
+ const allTeamsData = await (0, api_client_1.exportOrgTeams)(managementAPIClient, organization);
34
+ cli_utilities_1.cliux.loader();
35
+ if (!(allTeamsData === null || allTeamsData === void 0 ? void 0 : allTeamsData.length)) {
36
+ cli_utilities_1.log.info('No teams found', logContext);
37
+ cli_utilities_1.cliux.print(`info: The organization ${organization === null || organization === void 0 ? void 0 : organization.name} does not have any teams associated with it. Please verify and provide the correct organization name.`);
38
+ return;
39
+ }
40
+ cli_utilities_1.log.debug(`Found ${allTeamsData.length} teams`, logContext);
41
+ const modifiedTeam = (0, cloneDeep_1.default)(allTeamsData).map((team) => {
42
+ const csvRow = {
43
+ uid: team.uid,
44
+ name: team.name,
45
+ description: team.description,
46
+ organizationRole: team.organizationRole,
47
+ Total_Members: team.Total_Members,
48
+ };
49
+ return csvRow;
50
+ });
51
+ const fileName = `${(0, data_transform_1.kebabize)(organization.name.replace(config_1.default.organizationNameRegex, ''))}_teams_export.csv`;
52
+ cli_utilities_1.log.info(`Writing teams to ${fileName}`, logContext);
53
+ (0, csv_writer_1.write)(null, modifiedTeam, fileName, ' organization Team details', delimiter);
54
+ // Exporting teams user data or a single team user data
55
+ cli_utilities_1.cliux.print(`info: Exporting the teams user data for ${teamUid ? `team ` + teamUid : `organisation ` + (organization === null || organization === void 0 ? void 0 : organization.name)}`, { color: 'blue' });
56
+ await getTeamsDetail(allTeamsData, organization, teamUid, delimiter);
57
+ cli_utilities_1.cliux.print(`info: Exporting the stack role details for ${teamUid ? `team ` + teamUid : `organisation ` + (organization === null || organization === void 0 ? void 0 : organization.name)}`, { color: 'blue' });
58
+ // Exporting the stack Role data for all the teams or exporting stack role data for a single team
59
+ await exportRoleMappings(managementAPIClient, allTeamsData, teamUid, delimiter);
60
+ cli_utilities_1.log.success('Teams export completed', logContext);
61
+ }
62
+ /**
63
+ * Get individual team user details and write to file.
64
+ */
65
+ async function getTeamsDetail(allTeamsData, organization, teamUid, delimiter) {
66
+ const logContext = { module: 'teams-export', action: 'team-users', teamUid };
67
+ cli_utilities_1.log.debug('Exporting team user details', logContext);
68
+ if (!teamUid) {
69
+ const userData = (0, data_transform_1.getTeamsUserDetails)(allTeamsData);
70
+ const fileName = `${(0, data_transform_1.kebabize)(organization.name.replace(config_1.default.organizationNameRegex, ''))}_team_User_Details_export.csv`;
71
+ cli_utilities_1.log.info(`Writing ${userData.length} team users to ${fileName}`, logContext);
72
+ (0, csv_writer_1.write)(null, userData, fileName, 'Team User details', delimiter);
73
+ }
74
+ else {
75
+ const team = allTeamsData.filter((t) => t.uid === teamUid)[0];
76
+ if (!team) {
77
+ cli_utilities_1.log.debug('Team not found', Object.assign(Object.assign({}, logContext), { teamUid }));
78
+ cli_utilities_1.cliux.print(`Team with UID ${teamUid} not found.`, { color: 'red' });
79
+ return;
80
+ }
81
+ const teamUsers = (team.users || []).map((user) => (Object.assign(Object.assign({}, user), { 'team-name': team.name, 'team-uid': team.uid })));
82
+ // Remove unwanted properties
83
+ teamUsers.forEach((user) => {
84
+ delete user.active;
85
+ delete user.orgInvitationStatus;
86
+ });
87
+ const fileName = `${(0, data_transform_1.kebabize)(organization.name.replace(config_1.default.organizationNameRegex, ''))}_team_${teamUid}_User_Details_export.csv`;
88
+ cli_utilities_1.log.info(`Writing ${teamUsers.length} users for team ${teamUid} to ${fileName}`, logContext);
89
+ (0, csv_writer_1.write)(null, teamUsers, fileName, 'Team User details', delimiter);
90
+ }
91
+ }
92
+ /**
93
+ * Export role mappings of teams to CSV.
94
+ */
95
+ async function exportRoleMappings(managementAPIClient, allTeamsData, teamUid, delimiter) {
96
+ var _a;
97
+ const logContext = { module: 'teams-export', action: 'role-mappings', teamUid };
98
+ cli_utilities_1.log.debug('Exporting role mappings', logContext);
99
+ const stackRoleWithTeamData = [];
100
+ let flag = false;
101
+ const stackNotAdmin = [];
102
+ cli_utilities_1.cliux.loader('Fetching stack role mappings...');
103
+ if (teamUid) {
104
+ const team = (0, find_1.default)(allTeamsData, function (teamObject) {
105
+ return (teamObject === null || teamObject === void 0 ? void 0 : teamObject.uid) === teamUid;
106
+ });
107
+ for (const stack of (team === null || team === void 0 ? void 0 : team.stackRoleMapping) || []) {
108
+ const roleData = await mapRoleWithTeams(managementAPIClient, stack, (team === null || team === void 0 ? void 0 : team.name) || '', (team === null || team === void 0 ? void 0 : team.uid) || '');
109
+ stackRoleWithTeamData.push(...roleData);
110
+ if (roleData[0]['Stack Name'] === '') {
111
+ flag = true;
112
+ stackNotAdmin.push(stack.stackApiKey);
113
+ }
114
+ }
115
+ }
116
+ else {
117
+ for (const team of allTeamsData !== null && allTeamsData !== void 0 ? allTeamsData : []) {
118
+ for (const stack of (_a = team === null || team === void 0 ? void 0 : team.stackRoleMapping) !== null && _a !== void 0 ? _a : []) {
119
+ const roleData = await mapRoleWithTeams(managementAPIClient, stack, team === null || team === void 0 ? void 0 : team.name, team === null || team === void 0 ? void 0 : team.uid);
120
+ stackRoleWithTeamData.push(...roleData);
121
+ if (roleData[0]['Stack Name'] === '') {
122
+ flag = true;
123
+ stackNotAdmin.push(stack.stackApiKey);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ cli_utilities_1.cliux.loader();
129
+ if (stackNotAdmin === null || stackNotAdmin === void 0 ? void 0 : stackNotAdmin.length) {
130
+ cli_utilities_1.log.debug('Admin access denied to some stacks', Object.assign(Object.assign({}, logContext), { stacks: stackNotAdmin }));
131
+ cli_utilities_1.cliux.print(`warning: Admin access denied to the following stacks using the provided API keys. Please get in touch with the stack owner to request access.`, { color: 'yellow' });
132
+ cli_utilities_1.cliux.print(`${stackNotAdmin.join(' , ')}`, { color: 'yellow' });
133
+ }
134
+ if (flag) {
135
+ const shouldContinue = await (0, interactive_1.promptContinueExport)();
136
+ if (!shouldContinue) {
137
+ cli_utilities_1.log.debug('User chose not to continue export', logContext);
138
+ process.exit(1);
139
+ }
140
+ }
141
+ const fileName = `${(0, data_transform_1.kebabize)('Stack_Role_Mapping'.replace(config_1.default.organizationNameRegex, ''))}${teamUid ? `_${teamUid}` : ''}.csv`;
142
+ cli_utilities_1.log.info(`Writing ${stackRoleWithTeamData.length} role mappings to ${fileName}`, logContext);
143
+ (0, csv_writer_1.write)(null, stackRoleWithTeamData, fileName, 'Team Stack Role details', delimiter);
144
+ }
145
+ /**
146
+ * Map team stacks with stack role and return array of objects.
147
+ */
148
+ async function mapRoleWithTeams(managementAPIClient, stackRoleMapping, teamName, teamUid) {
149
+ var _a;
150
+ const rolesResponse = await (0, api_client_1.getRoleData)(managementAPIClient, stackRoleMapping.stackApiKey);
151
+ const stackRole = {};
152
+ (_a = rolesResponse.items) === null || _a === void 0 ? void 0 : _a.forEach((role) => {
153
+ var _a;
154
+ if (!Object.prototype.hasOwnProperty.call(stackRole, role === null || role === void 0 ? void 0 : role.uid)) {
155
+ stackRole[role === null || role === void 0 ? void 0 : role.uid] = role === null || role === void 0 ? void 0 : role.name;
156
+ if ((_a = role === null || role === void 0 ? void 0 : role.stack) === null || _a === void 0 ? void 0 : _a.api_key) {
157
+ stackRole[role.stack.api_key] = { name: role.stack.name, uid: role.stack.uid };
158
+ }
159
+ }
160
+ });
161
+ const stackInfo = stackRole[stackRoleMapping === null || stackRoleMapping === void 0 ? void 0 : stackRoleMapping.stackApiKey];
162
+ const stackRoleMapOfTeam = stackRoleMapping === null || stackRoleMapping === void 0 ? void 0 : stackRoleMapping.roles.map((role) => {
163
+ return {
164
+ 'Team Name': teamName,
165
+ 'Team Uid': teamUid,
166
+ 'Stack Name': (stackInfo === null || stackInfo === void 0 ? void 0 : stackInfo.name) || '',
167
+ 'Stack Uid': (stackInfo === null || stackInfo === void 0 ? void 0 : stackInfo.uid) || '',
168
+ 'Role Name': stackRole[role] || '',
169
+ 'Role Uid': role || '',
170
+ };
171
+ });
172
+ return stackRoleMapOfTeam;
173
+ }
@@ -0,0 +1,171 @@
1
+ {
2
+ "commands": {
3
+ "cm:export-to-csv": {
4
+ "aliases": [
5
+ "cm:export-to-csv"
6
+ ],
7
+ "args": {},
8
+ "description": "Export entries, taxonomies, terms or organization users to csv using this command",
9
+ "examples": [
10
+ "$ <%= config.bin %> <%= command.id %>",
11
+ "",
12
+ "Exporting entries to CSV",
13
+ "$ <%= config.bin %> <%= command.id %> --action entries --locale <locale> --alias <management-token-alias> --content-type <content-type>",
14
+ "",
15
+ "Exporting entries to CSV with stack name and branch",
16
+ "$ <%= config.bin %> <%= command.id %> --action entries --locale <locale> --alias <management-token-alias> --content-type <content-type> --stack-name <stack-name> --branch <branch-name>",
17
+ "",
18
+ "Exporting organization users to CSV",
19
+ "$ <%= config.bin %> <%= command.id %> --action users --org <org-uid>",
20
+ "",
21
+ "Exporting organization teams to CSV",
22
+ "$ <%= config.bin %> <%= command.id %> --action teams --org <org-uid>",
23
+ "",
24
+ "Exporting teams with specific team UID",
25
+ "$ <%= config.bin %> <%= command.id %> --action teams --org <org-uid> --team-uid <team-uid>",
26
+ "",
27
+ "Exporting taxonomies to CSV",
28
+ "$ <%= config.bin %> <%= command.id %> --action taxonomies --alias <management-token-alias>",
29
+ "",
30
+ "Exporting specific taxonomy with locale",
31
+ "$ <%= config.bin %> <%= command.id %> --action taxonomies --alias <management-token-alias> --taxonomy-uid <taxonomy-uid> --locale <locale>",
32
+ "",
33
+ "Exporting taxonomies with fallback locale",
34
+ "$ <%= config.bin %> <%= command.id %> --action taxonomies --alias <management-token-alias> --locale <locale> --include-fallback --fallback-locale <fallback-locale>"
35
+ ],
36
+ "flags": {
37
+ "action": {
38
+ "description": "Option to export data (entries, users, teams, taxonomies). <options: entries|users|teams|taxonomies>",
39
+ "name": "action",
40
+ "required": false,
41
+ "hasDynamicHelp": false,
42
+ "multiple": false,
43
+ "options": [
44
+ "entries",
45
+ "users",
46
+ "teams",
47
+ "taxonomies"
48
+ ],
49
+ "type": "option"
50
+ },
51
+ "alias": {
52
+ "char": "a",
53
+ "description": "Alias of the management token.",
54
+ "name": "alias",
55
+ "hasDynamicHelp": false,
56
+ "multiple": false,
57
+ "type": "option"
58
+ },
59
+ "org": {
60
+ "description": "Provide organization UID to clone org users.",
61
+ "name": "org",
62
+ "required": false,
63
+ "hasDynamicHelp": false,
64
+ "multiple": false,
65
+ "type": "option"
66
+ },
67
+ "stack-name": {
68
+ "char": "n",
69
+ "description": "Name of the stack that needs to be created as CSV filename.",
70
+ "name": "stack-name",
71
+ "required": false,
72
+ "hasDynamicHelp": false,
73
+ "multiple": false,
74
+ "type": "option"
75
+ },
76
+ "stack-api-key": {
77
+ "char": "k",
78
+ "description": "API Key of the source stack.",
79
+ "name": "stack-api-key",
80
+ "required": false,
81
+ "hasDynamicHelp": false,
82
+ "multiple": false,
83
+ "type": "option"
84
+ },
85
+ "org-name": {
86
+ "description": "Name of the organization that needs to be created as CSV filename.",
87
+ "name": "org-name",
88
+ "required": false,
89
+ "hasDynamicHelp": false,
90
+ "multiple": false,
91
+ "type": "option"
92
+ },
93
+ "locale": {
94
+ "description": "Locale of entries that will be exported.",
95
+ "name": "locale",
96
+ "required": false,
97
+ "hasDynamicHelp": false,
98
+ "multiple": false,
99
+ "type": "option"
100
+ },
101
+ "content-type": {
102
+ "description": "Content type of entries that will be exported.",
103
+ "name": "content-type",
104
+ "required": false,
105
+ "hasDynamicHelp": false,
106
+ "multiple": false,
107
+ "type": "option"
108
+ },
109
+ "branch": {
110
+ "description": "Branch from which entries will be exported.",
111
+ "name": "branch",
112
+ "required": false,
113
+ "hasDynamicHelp": false,
114
+ "multiple": false,
115
+ "type": "option"
116
+ },
117
+ "team-uid": {
118
+ "description": "Provide the UID of a specific team in an organization.",
119
+ "name": "team-uid",
120
+ "hasDynamicHelp": false,
121
+ "multiple": false,
122
+ "type": "option"
123
+ },
124
+ "taxonomy-uid": {
125
+ "description": "Provide the taxonomy UID of the related terms you want to export.",
126
+ "name": "taxonomy-uid",
127
+ "hasDynamicHelp": false,
128
+ "multiple": false,
129
+ "type": "option"
130
+ },
131
+ "include-fallback": {
132
+ "description": "[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.",
133
+ "name": "include-fallback",
134
+ "allowNo": false,
135
+ "type": "boolean"
136
+ },
137
+ "fallback-locale": {
138
+ "description": "[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.",
139
+ "name": "fallback-locale",
140
+ "required": false,
141
+ "hasDynamicHelp": false,
142
+ "multiple": false,
143
+ "type": "option"
144
+ },
145
+ "delimiter": {
146
+ "description": "[optional] Provide a delimiter to separate individual data fields within the CSV file. For example: cm:export-to-csv --delimiter '|'",
147
+ "name": "delimiter",
148
+ "default": ",",
149
+ "hasDynamicHelp": false,
150
+ "multiple": false,
151
+ "type": "option"
152
+ }
153
+ },
154
+ "hasDynamicHelp": false,
155
+ "hiddenAliases": [],
156
+ "id": "cm:export-to-csv",
157
+ "pluginAlias": "@contentstack/cli-cm-export-to-csv",
158
+ "pluginName": "@contentstack/cli-cm-export-to-csv",
159
+ "pluginType": "core",
160
+ "strict": true,
161
+ "isESM": false,
162
+ "relativePath": [
163
+ "lib",
164
+ "commands",
165
+ "cm",
166
+ "export-to-csv.js"
167
+ ]
168
+ }
169
+ },
170
+ "version": "2.0.0-beta.3"
171
+ }
package/package.json CHANGED
@@ -1,17 +1,15 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export-to-csv",
3
3
  "description": "Export entries, taxonomies, terms, or organization users to CSV",
4
- "version": "2.0.0-beta.1",
4
+ "version": "2.0.0-beta.3",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "~2.0.0-beta",
9
- "@contentstack/cli-utilities": "~2.0.0-beta.1",
8
+ "@contentstack/cli-command": "~2.0.0-beta.3",
9
+ "@contentstack/cli-utilities": "~2.0.0-beta.3",
10
10
  "@oclif/core": "^4.8.0",
11
11
  "@oclif/plugin-help": "^6.2.32",
12
- "fast-csv": "^4.3.6",
13
- "inquirer": "8.2.7",
14
- "inquirer-checkbox-plus-prompt": "1.4.2"
12
+ "fast-csv": "^4.3.6"
15
13
  },
16
14
  "devDependencies": {
17
15
  "@oclif/test": "^4.1.13",
@@ -63,7 +61,7 @@
63
61
  },
64
62
  "repository": "https://github.com/contentstack/cli",
65
63
  "scripts": {
66
- "build": "npm run clean && npm run compile",
64
+ "build": "pnpm compile && oclif manifest && oclif readme",
67
65
  "clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo oclif.manifest.json",
68
66
  "compile": "tsc -b tsconfig.json",
69
67
  "lint": "eslint src/**/*.ts",