@contentstack/cli-cm-export-to-csv 1.12.3 → 1.12.4
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/utils/api-client.js +13 -20
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/lib/utils/api-client.js
CHANGED
|
@@ -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
|
|
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:
|
|
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 ||
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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 (
|
|
151
|
+
catch (_b) {
|
|
159
152
|
return result;
|
|
160
153
|
}
|
|
161
154
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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": "1.12.
|
|
4
|
+
"version": "1.12.4",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|