astrogators-shared-ui 0.10.4 → 0.11.0

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/dist/index.js CHANGED
@@ -833,6 +833,10 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
833
833
  className: $.visuallyHidden,
834
834
  children: "Loading..."
835
835
  })
836
- });
836
+ }), he = async (e) => {
837
+ if (e.length === 0) return {};
838
+ let t = [...new Set(e)], n = await R.get(`/api/v1/users/lookup?ids=${t.join(",")}`);
839
+ return Object.fromEntries(n.users.map((e) => [e.id, e.username]));
840
+ };
837
841
  //#endregion
838
- export { ce as AllyCodeDropdown, L as ApiClient, oe as AuthProvider, fe as Badge, m as Button, de as Card, u as Container, ue as Footer, v as Input, me as Loader, pe as Modal, le as NavBar, g as Select, f as TopBar, R as apiClient, I as authedFetch, ae as clearAllyCodes, O as clearTokens, M as configureAuthRefresh, K as formatAllyCode, x as getAccessToken, V as getAllyCodesFromStorage, w as getRefreshToken, re as getSelectedAllyCode, te as initializeApiClient, ee as isAuthenticated, N as refreshAccessToken, C as removeAccessToken, H as removeAllyCodeFromStorage, E as removeRefreshToken, ne as saveAllyCodeToStorage, S as setAccessToken, T as setRefreshToken, ie as setSelectedAllyCode, D as setTokens, se as unformatAllyCode, U as updateAllyCodeLastUsed, G as useAuth };
842
+ export { ce as AllyCodeDropdown, L as ApiClient, oe as AuthProvider, fe as Badge, m as Button, de as Card, u as Container, ue as Footer, v as Input, me as Loader, pe as Modal, le as NavBar, g as Select, f as TopBar, R as apiClient, I as authedFetch, ae as clearAllyCodes, O as clearTokens, M as configureAuthRefresh, he as fetchUsernames, K as formatAllyCode, x as getAccessToken, V as getAllyCodesFromStorage, w as getRefreshToken, re as getSelectedAllyCode, te as initializeApiClient, ee as isAuthenticated, N as refreshAccessToken, C as removeAccessToken, H as removeAllyCodeFromStorage, E as removeRefreshToken, ne as saveAllyCodeToStorage, S as setAccessToken, T as setRefreshToken, ie as setSelectedAllyCode, D as setTokens, se as unformatAllyCode, U as updateAllyCodeLastUsed, G as useAuth };
@@ -14,6 +14,7 @@ export { authedFetch, refreshAccessToken, configureAuthRefresh, } from './servic
14
14
  export type { AuthRefreshConfig } from './services/tokenRefresh';
15
15
  export { getAccessToken, setAccessToken, removeAccessToken, getRefreshToken, setRefreshToken, removeRefreshToken, setTokens, clearTokens, isAuthenticated, } from './services/auth';
16
16
  export { getAllyCodesFromStorage, saveAllyCodeToStorage, removeAllyCodeFromStorage, updateAllyCodeLastUsed, getSelectedAllyCode, setSelectedAllyCode, clearAllyCodes, } from './services/allyCodeStorage';
17
+ export { fetchUsernames } from './services/users';
17
18
  export type { StoredAllyCode } from './services/allyCodeStorage';
18
19
  export { formatAllyCode, unformatAllyCode } from './utils/formatAllyCode';
19
20
  export type { User, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, RefreshTokenRequest, RefreshTokenResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, VerifyEmailRequest, VerifyEmailResponse, ResendVerificationRequest, ResendVerificationResponse, AllyCode, AllyCodeCreate, AllyCodeListResponse, AllyCodeMigrationPrompt, ApiResponse, ApiError, PaginatedResponse, ModStat, ParsedMod, ModListResponse, EvaluationScores, ModEvaluation, EvaluationRequest, EvaluationResponse, } from './types';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Batch user-id -> username lookup.
3
+ *
4
+ * Backs "shared by X" / "authored by X" display in any consumer that only
5
+ * has a bare owner_user_id (mod-ledger's Evaluation, navicharts' StarChart —
6
+ * neither service stores a display name locally, since users live in
7
+ * astrogators-table's separate database). Hits astrogators-table's
8
+ * GET /users/lookup directly via the shared `apiClient` — every consumer
9
+ * already points it at astrogators-table via AuthProvider's `apiBaseUrl`,
10
+ * so no per-app backend proxying is needed for this.
11
+ */
12
+ /**
13
+ * Resolve a batch of user ids to usernames in one request.
14
+ *
15
+ * Dedupes ids client-side. Any id the backend doesn't recognize is simply
16
+ * absent from the returned map — callers should treat a missing entry the
17
+ * same way they already treat a null/unknown username.
18
+ */
19
+ export declare const fetchUsernames: (ids: number[]) => Promise<Record<number, string>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrogators-shared-ui",
3
- "version": "0.10.4",
3
+ "version": "0.11.0",
4
4
  "description": "Shared UI components and utilities for Astrogator's Table applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",