@forge/cli
14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/service/identity/identity-client.js~
out/service/identity/identity-client.jsModified+4−9
Index: package/out/service/identity/identity-client.js
===================================================================
--- package/out/service/identity/identity-client.js
+++ package/out/service/identity/identity-client.js
@@ -1,11 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentityClient = exports.getIdentityBaseUrl = void 0;
const cli_shared_1 = require("@forge/cli-shared");
-const dedupeById = (items) => [
- ...new Map(items.map((item) => [item.id, item])).values()
-];
const IDENTITY_BASE_URLS = {
DEV: 'https://api.dev.atlassian.com/identity',
STG: 'https://api.stg.atlassian.com/identity',
PROD: 'https://api.atlassian.com/identity',
@@ -32,21 +29,19 @@
return (this.userIdPromise ??= this.getUserId());
}
async getAllOrgs() {
const userId = await this.resolveUserId();
- const orgs = await this.fetchAll((cursor) => `${this.baseUrl}/v1/users/${encodeURIComponent(userId)}/orgs${this.query(cursor)}`, (body) => {
- const { organizations, links } = body;
- return { items: organizations ?? [], nextCursor: links?.next };
+ return this.fetchAll((cursor) => `${this.baseUrl}/v1/users/${encodeURIComponent(userId)}/orgs${this.query(cursor)}`, (body) => {
+ const { organizations, paging } = body;
+ return { items: organizations ?? [], nextCursor: paging?.nextCursor };
});
- return dedupeById(orgs);
}
async getAllUnits(orgId) {
const userId = await this.resolveUserId();
- const units = await this.fetchAll((cursor) => `${this.baseUrl}/v1/users/${encodeURIComponent(userId)}/orgs/${encodeURIComponent(orgId)}/units${this.query(cursor)}`, (body) => {
+ return this.fetchAll((cursor) => `${this.baseUrl}/v1/users/${encodeURIComponent(userId)}/orgs/${encodeURIComponent(orgId)}/units${this.query(cursor)}`, (body) => {
const { units, paging } = body;
return { items: units ?? [], nextCursor: paging?.nextCursor };
});
- return dedupeById(units);
}
query(cursor) {
if (!cursor) {
return '';