@forge/cli

14.2.015.0.0-next.23
out/service/identity/identity-client.js
~out/service/identity/identity-client.jsModified
+3−2
Index: package/out/service/identity/identity-client.js
===================================================================
--- package/out/service/identity/identity-client.js
+++ package/out/service/identity/identity-client.js
@@ -4,8 +4,9 @@
 const cli_shared_1 = require("@forge/cli-shared");
 const dedupeById = (items) => [
     ...new Map(items.map((item) => [item.id, item])).values()
 ];
+const sortByName = (items) => [...items].sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }) || a.id.localeCompare(b.id));
 const IDENTITY_BASE_URLS = {
     DEV: 'https://api.dev.atlassian.com/identity',
     STG: 'https://api.stg.atlassian.com/identity',
     PROD: 'https://api.atlassian.com/identity',
@@ -36,17 +37,17 @@
         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 dedupeById(orgs);
+        return sortByName(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) => {
             const { units, paging } = body;
             return { items: units ?? [], nextCursor: paging?.nextCursor };
         });
-        return dedupeById(units);
+        return sortByName(dedupeById(units));
     }
     query(cursor) {
         if (!cursor) {
             return '';