@contentstack/cli-cm-export-to-csv 2.0.0-beta.7 → 2.0.0-beta.8

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.
@@ -115,20 +115,11 @@ function getOrgUsers(managementAPIClient, orgUid) {
115
115
  if (!organization) {
116
116
  return reject(new Error('Org UID not found.'));
117
117
  }
118
- if (organization.is_owner === true) {
119
- return managementAPIClient
120
- .organization(organization.uid)
121
- .getInvitations()
122
- .then((data) => {
123
- resolve(data);
124
- })
125
- .catch(reject);
126
- }
127
- if (!organization.getInvitations && !(0, find_1.default)(organization.org_roles, 'admin')) {
118
+ if (!organization.is_owner && !(0, find_1.default)(organization.org_roles, 'admin')) {
128
119
  return reject(new Error(messages_1.messages.ERROR_ADMIN_ACCESS_DENIED));
129
120
  }
130
121
  try {
131
- const users = await getUsers(managementAPIClient, { uid: organization.uid }, { skip: 0, page: 1, limit: 100 });
122
+ const users = await getUsers(managementAPIClient, { uid: organization.uid }, { skip: 0, page: 1, limit: config_1.default.limit });
132
123
  return resolve({ items: users || [] });
133
124
  }
134
125
  catch (error) {
@@ -142,20 +133,22 @@ function getOrgUsers(managementAPIClient, orgUid) {
142
133
  * Get users with pagination.
143
134
  */
144
135
  async function getUsers(managementAPIClient, organization, params, result = []) {
136
+ var _a;
145
137
  try {
146
138
  const users = await managementAPIClient.organization(organization.uid).getInvitations(params);
147
- if (!users.items || (users.items && !users.items.length)) {
139
+ if (!users.items || users.items.length < params.limit) {
140
+ if ((_a = users.items) === null || _a === void 0 ? void 0 : _a.length) {
141
+ result = result.concat(users.items);
142
+ }
148
143
  return result;
149
144
  }
150
- else {
151
- result = result.concat(users.items);
152
- params.skip = params.page * params.limit;
153
- params.page++;
154
- await (0, error_handler_1.wait)(200);
155
- return getUsers(managementAPIClient, organization, params, result);
156
- }
145
+ result = result.concat(users.items);
146
+ params.skip = params.page * params.limit;
147
+ params.page++;
148
+ await (0, error_handler_1.wait)(200);
149
+ return getUsers(managementAPIClient, organization, params, result);
157
150
  }
158
- catch (_a) {
151
+ catch (_b) {
159
152
  return result;
160
153
  }
161
154
  }
@@ -167,5 +167,5 @@
167
167
  ]
168
168
  }
169
169
  },
170
- "version": "2.0.0-beta.7"
170
+ "version": "2.0.0-beta.8"
171
171
  }
package/package.json CHANGED
@@ -1,13 +1,14 @@
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.7",
4
+ "version": "2.0.0-beta.8",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "~2.0.0-beta.7",
9
- "@contentstack/cli-utilities": "~2.0.0-beta.8",
10
- "@oclif/core": "^4.8.0",
8
+ "@contentstack/cli-command": "~2.0.0-beta.8",
9
+ "@contentstack/cli-utilities": "~2.0.0-beta.9",
10
+ "@oclif/core": "^4.11.4",
11
+ "@inquirer/prompts": "^7.0.0",
11
12
  "fast-csv": "^4.3.6"
12
13
  },
13
14
  "devDependencies": {
@@ -22,7 +23,7 @@
22
23
  "eslint-config-oclif-typescript": "^3.1.14",
23
24
  "mocha": "^10.8.2",
24
25
  "nyc": "^15.1.0",
25
- "oclif": "^4.17.46",
26
+ "oclif": "^4.23.8",
26
27
  "sinon": "^21.0.1",
27
28
  "ts-node": "^10.9.2",
28
29
  "typescript": "^5.8.3"