@epic-web/workshop-utils 6.47.9 → 6.47.11

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.
@@ -431,6 +431,11 @@ export declare function getAuthInfo({ productHost, }?: {
431
431
  };
432
432
  name?: string | null | undefined;
433
433
  } | null | undefined>;
434
+ /**
435
+ * Get all product hosts the user is logged into locally.
436
+ * Returns an array of normalized product hosts (e.g., 'www.epicweb.dev').
437
+ */
438
+ export declare function getLoggedInProductHosts(): Promise<string[]>;
434
439
  export declare function requireAuthInfo({ request, redirectTo, }: {
435
440
  request: Request;
436
441
  redirectTo?: string | null;
package/dist/db.server.js CHANGED
@@ -192,6 +192,30 @@ export async function getAuthInfo({ productHost, } = {}) {
192
192
  }
193
193
  return null;
194
194
  }
195
+ /**
196
+ * Get all product hosts the user is logged into locally.
197
+ * Returns an array of normalized product hosts (e.g., 'www.epicweb.dev').
198
+ */
199
+ export async function getLoggedInProductHosts() {
200
+ const data = await readDb();
201
+ const loggedInHosts = [];
202
+ // Get hosts from the new authInfos record
203
+ if (data?.authInfos && typeof data.authInfos === 'object') {
204
+ for (const [host, authInfo] of Object.entries(data.authInfos)) {
205
+ if (authInfo) {
206
+ loggedInHosts.push(host);
207
+ }
208
+ }
209
+ }
210
+ // Back-compat: if legacy authInfo exists, include the current workshop's host
211
+ if (data?.authInfo && !loggedInHosts.length) {
212
+ const currentHost = tryGetWorkshopProductHost();
213
+ if (currentHost && !loggedInHosts.includes(currentHost)) {
214
+ loggedInHosts.push(currentHost);
215
+ }
216
+ }
217
+ return loggedInHosts;
218
+ }
195
219
  export async function requireAuthInfo({ request, redirectTo, }) {
196
220
  const authInfo = await getAuthInfo();
197
221
  if (!authInfo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-utils",
3
- "version": "6.47.9",
3
+ "version": "6.47.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },