Skip to content

Multi-session support #5914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Multi-session support #5914

wants to merge 10 commits into from

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented May 30, 2025

WHY are these changes introduced?

Fixes #4431

Related to https://shopifypartners.slack.com/archives/CKQTKDZV2/p1747036239447309

Hack Days project: https://hackdays.shopify.io/projects/21041

WHAT is this pull request doing?

CLI.multi-session.demo.mp4
  • Adds a new shopify auth login command that allows to create multiple sessions
  • The command includes a --alias flag to customize the session names
  • If no alias is provided, it will use the user ID by default
  • When running commands that use Partners or App Management API, it will replace the user id with the email/org
  • shopify auth logout clears all the sessions
  • Existing sessions will not be migrated. When upgrading to this version, they will be cleared and forced to log in again.

How to test your changes?

  • npm i -g @shopify/cli@0.0.0-snapshot-20250530110231
  • shopify auth login multiple times
  • Any command
  • shopify auth logout

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@gonzaloriestra
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/cli@0.0.0-snapshot-20250530110231

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Copy link
Contributor

github-actions bot commented May 30, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.09% (+0.09% 🔼)
12526/16040
🟡 Branches
72.28% (+0.13% 🔼)
6078/8409
🟡 Functions
78.33% (+0.06% 🔼)
3283/4191
🟡 Lines
78.52% (+0.08% 🔼)
11848/15090
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / session-prompt.ts
100% 91.67% 100% 100%
🟢
... / login.ts
100% 100% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / partner-account-info.ts
70.59% (-29.41% 🔻)
33.33% (-66.67% 🔻)
75% (-25% 🔻)
70.59% (-29.41% 🔻)
🔴
... / app-management-client.ts
44.37% (-0.15% 🔻)
40.77% 42.42%
43.21% (-0.15% 🔻)
🔴
... / partners-client.ts
25.97% (-0.17% 🔻)
31.58% 16.95%
25.68% (-0.17% 🔻)
🟢
... / conf-store.ts
100%
84.44% (-6.03% 🔻)
100% 100%
🟢
... / session.ts
92.98% (-4.98% 🔻)
95.65% (-4.35% 🔻)
77.78% (-7.94% 🔻)
92.86% (-5.1% 🔻)

Test suite run success

2899 tests passing in 1265 suites.

Report generated by 🧪jest coverage report action from 6b1ee00

Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

packages/cli-kit/dist/public/node/session-prompt.d.ts
/**
 * Prompts the user to select from existing sessions or log in with a new account.
 *
 * This function:
 * 1. Fetches existing sessions from storage using `store.fetch()`
 * 2. Shows a prompt with all available sessions by their display labels
 * 3. Includes an option to "Log in with a new account"
 * 4. If an existing session is chosen, calls `setCurrentSessionId(userId)`
 * 5. If new login is chosen, calls `ensureAuthenticatedUser()`.
 *
 * @param alias - Optional alias to use for the new session if created.
 * @example
 * ```typescript
 * import {promptSessionSelect} from '@shopify/cli-kit/node/session-prompt'
 *
 * const result = await promptSessionSelect()
 * console.log(`Using session for user: ${result.userId}`)
 * ```
 *
 * @returns Promise that resolves with the user ID of the selected or newly created session.
 */
export declare function promptSessionSelect(alias?: string): Promise<{
    userId: string;
}>;

Existing type declarations

packages/cli-kit/dist/private/node/conf-store.d.ts
@@ -20,6 +20,7 @@ interface Cache {
 }
 export interface ConfSchema {
     sessionStore: string;
+    currentSessionId?: string;
     cache?: Cache;
 }
 /**
@@ -27,17 +28,33 @@ export interface ConfSchema {
  *
  * @returns Session.
  */
-export declare function getSession(config?: LocalStorage<ConfSchema>): string | undefined;
+export declare function getSessions(config?: LocalStorage<ConfSchema>): string | undefined;
 /**
  * Set session.
  *
  * @param session - Session.
  */
-export declare function setSession(session: string, config?: LocalStorage<ConfSchema>): void;
+export declare function setSessions(session: string, config?: LocalStorage<ConfSchema>): void;
 /**
  * Remove session.
  */
-export declare function removeSession(config?: LocalStorage<ConfSchema>): void;
+export declare function removeSessions(config?: LocalStorage<ConfSchema>): void;
+/**
+ * Get current session ID.
+ *
+ * @returns Current session ID.
+ */
+export declare function getCurrentSessionId(config?: LocalStorage<ConfSchema>): string | undefined;
+/**
+ * Set current session ID.
+ *
+ * @param sessionId - Session ID.
+ */
+export declare function setCurrentSessionId(sessionId: string, config?: LocalStorage<ConfSchema>): void;
+/**
+ * Remove current session ID.
+ */
+export declare function removeCurrentSessionId(config?: LocalStorage<ConfSchema>): void;
 type CacheValueForKey<TKey extends keyof Cache> = NonNullable<Cache[TKey]>['value'];
 /**
  * Fetch from cache, or run the provided function to get the value, and cache it
packages/cli-kit/dist/private/node/session.d.ts
@@ -67,7 +67,7 @@ type AuthMethod = 'partners_token' | 'device_auth' | 'theme_access_token' | 'cus
  *
  * This function performs the following steps:
  * 1. Checks for a cached user ID in memory (obtained in the current run).
- * 2. Attempts to fetch it from the secure store (from a previous auth session).
+ * 2. Attempts to fetch it from the local storage (from a previous auth session).
  * 3. Checks if a custom token was used (either as a theme password or partners token).
  * 4. If a custom token is present in the environment, generates a UUID and uses it as userId.
  * 5. If after all this we don't have a userId, then reports as 'unknown'.
@@ -90,16 +90,19 @@ export declare function setLastSeenUserIdAfterAuth(id: string): void;
  */
 export declare function getLastSeenAuthMethod(): Promise<AuthMethod>;
 export declare function setLastSeenAuthMethod(method: AuthMethod): void;
+export interface EnsureAuthenticatedAdditionalOptions {
+    noPrompt?: boolean;
+    forceRefresh?: boolean;
+    forceNewSession?: boolean;
+    alias?: string;
+}
 /**
  * This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.
  *
  * @param applications - An object containing the applications we need to be authenticated with.
  * @param _env - Optional environment variables to use.
- * @param forceRefresh - Optional flag to force a refresh of the token.
+ * @param options - Optional extra options to use.
  * @returns An instance with the access tokens organized by application.
  */
-export declare function ensureAuthenticated(applications: OAuthApplications, _env?: NodeJS.ProcessEnv, { forceRefresh, noPrompt }?: {
-    forceRefresh?: boolean;
-    noPrompt?: boolean;
-}): Promise<OAuthSession>;
+export declare function ensureAuthenticated(applications: OAuthApplications, _env?: NodeJS.ProcessEnv, { forceRefresh, noPrompt, forceNewSession, alias }?: EnsureAuthenticatedAdditionalOptions): Promise<OAuthSession>;
 export {};
\ No newline at end of file
packages/cli-kit/dist/public/node/session.d.ts
@@ -1,4 +1,4 @@
-import { AdminAPIScope, AppManagementAPIScope, BusinessPlatformScope, PartnersAPIScope, StorefrontRendererScope } from '../../private/node/session.js';
+import { AdminAPIScope, AppManagementAPIScope, BusinessPlatformScope, EnsureAuthenticatedAdditionalOptions, PartnersAPIScope, StorefrontRendererScope } from '../../private/node/session.js';
 /**
  * Session Object to access the Admin API, includes the token and the store FQDN.
  */
@@ -6,10 +6,16 @@ export interface AdminSession {
     token: string;
     storeFqdn: string;
 }
-interface EnsureAuthenticatedAdditionalOptions {
-    noPrompt?: boolean;
-    forceRefresh?: boolean;
-}
+/**
+ * Ensure that we have a valid session with no particular scopes.
+ *
+ * @param env - Optional environment variables to use.
+ * @param options - Optional extra options to use.
+ * @returns The user ID.
+ */
+export declare function ensureAuthenticatedUser(env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedAdditionalOptions): Promise<{
+    userId: string;
+}>;
 /**
  * Ensure that we have a valid session to access the Partners API.
  * If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token
@@ -82,4 +88,12 @@ export declare function ensureAuthenticatedBusinessPlatform(scopes?: BusinessPla
  * @returns A promise that resolves when the logout is complete.
  */
 export declare function logout(): Promise<void>;
-export {};
\ No newline at end of file
+/**
+ * Updates the session alias with a more human-readable display name if available.
+ * Only updates if the current alias is empty.
+ *
+ * @param userId - The user ID of the session to update.
+ * @param alias - The alias to update the session with.
+ * @returns Promise that resolves when the alias update is complete.
+ */
+export declare function updateSessionAliasIfEmpty(userId: string, alias: string | undefined): Promise<void>;
\ No newline at end of file
packages/cli-kit/dist/private/node/session/schema.d.ts
@@ -8,18 +8,21 @@ declare const IdentityTokenSchema: zod.ZodObject<{
     expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
     scopes: zod.ZodArray<zod.ZodString, "many">;
     userId: zod.ZodString;
+    alias: zod.ZodOptional<zod.ZodString>;
 }, "strip", zod.ZodTypeAny, {
     accessToken: string;
     refreshToken: string;
     scopes: string[];
     expiresAt: Date;
     userId: string;
+    alias?: string | undefined;
 }, {
     accessToken: string;
     refreshToken: string;
     scopes: string[];
     userId: string;
     expiresAt?: unknown;
+    alias?: string | undefined;
 }>;
 /**
  * The schema represents an application token.
@@ -28,14 +31,121 @@ declare const ApplicationTokenSchema: zod.ZodObject<{
     accessToken: zod.ZodString;
     expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
     scopes: zod.ZodArray<zod.ZodString, "many">;
+    storeFqdn: zod.ZodOptional<zod.ZodString>;
 }, "strip", zod.ZodTypeAny, {
     accessToken: string;
     scopes: string[];
     expiresAt: Date;
+    storeFqdn?: string | undefined;
 }, {
     accessToken: string;
     scopes: string[];
     expiresAt?: unknown;
+    storeFqdn?: string | undefined;
+}>;
+declare const SessionSchema: zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
 }>;
 /**
  * This schema represents the format of the session
@@ -45,71 +155,692 @@ declare const ApplicationTokenSchema: zod.ZodObject<{
  * @example
  * 
  */
-export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
-    /**
-     * It contains the identity token. Before usint it, we exchange it
-     * to get a token that we can use with different applications. The exchanged
-     * tokens for the applications are stored under applications.
-     */
+export declare const SessionsSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{}, "strip", zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
+}>, zod.objectOutputType<{}, zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
+}>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
+}>, "strip">>, zod.objectOutputType<{}, zod.ZodObject<{}, "strip", zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
+}>, zod.objectOutputType<{}, zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
+}>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+    identity: zod.ZodObject<{
+        accessToken: zod.ZodString;
+        refreshToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    }, {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    }>;
+    applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, zod.objectOutputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
+        accessToken: zod.ZodString;
+        expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
+        scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
+    }, "strip", zod.ZodTypeAny, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        storeFqdn?: string | undefined;
+    }, {
+        accessToken: string;
+        scopes: string[];
+        expiresAt?: unknown;
+        storeFqdn?: string | undefined;
+    }>, "strip">>;
+}, "strip", zod.ZodTypeAny, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        expiresAt: Date;
+        userId: string;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt: Date;
+            storeFqdn?: string | undefined;
+        };
+    };
+}, {
+    identity: {
+        accessToken: string;
+        refreshToken: string;
+        scopes: string[];
+        userId: string;
+        expiresAt?: unknown;
+        alias?: string | undefined;
+    };
+    applications: {} & {
+        [k: string]: {
+            accessToken: string;
+            scopes: string[];
+            expiresAt?: unknown;
+            storeFqdn?: string | undefined;
+        };
+    };
+}>, "strip">>, "strip">, zod.objectInputType<{}, zod.ZodObject<{}, "strip", zod.ZodObject<{
     identity: zod.ZodObject<{
         accessToken: zod.ZodString;
         refreshToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
         userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         refreshToken: string;
         scopes: string[];
         expiresAt: Date;
         userId: string;
+        alias?: string | undefined;
     }, {
         accessToken: string;
         refreshToken: string;
         scopes: string[];
         userId: string;
         expiresAt?: unknown;
+        alias?: string | undefined;
     }>;
-    /**
-     * It contains exchanged tokens for the applications the CLI
-     * authenticates with. Tokens are scoped under the fqdn of the applications.
-     */
     applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, zod.objectOutputType<{}, zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, "strip">>;
 }, "strip", zod.ZodTypeAny, {
     identity: {
@@ -118,12 +849,14 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
         scopes: string[];
         expiresAt: Date;
         userId: string;
+        alias?: string | undefined;
     };
     applications: {} & {
         [k: string]: {
             accessToken: string;
             scopes: string[];
             expiresAt: Date;
+            storeFqdn?: string | undefined;
         };
     };
 }, {
@@ -133,79 +866,84 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
         scopes: string[];
         userId: string;
         expiresAt?: unknown;
+        alias?: string | undefined;
     };
     applications: {} & {
         [k: string]: {
             accessToken: string;
             scopes: string[];
             expiresAt?: unknown;
+            storeFqdn?: string | undefined;
         };
     };
 }>, zod.objectOutputType<{}, zod.ZodObject<{
-    /**
-     * It contains the identity token. Before usint it, we exchange it
-     * to get a token that we can use with different applications. The exchanged
-     * tokens for the applications are stored under applications.
-     */
     identity: zod.ZodObject<{
         accessToken: zod.ZodString;
         refreshToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
         userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         refreshToken: string;
         scopes: string[];
         expiresAt: Date;
         userId: string;
+        alias?: string | undefined;
     }, {
         accessToken: string;
         refreshToken: string;
         scopes: string[];
         userId: string;
         expiresAt?: unknown;
+        alias?: string | undefined;
     }>;
-    /**
-     * It contains exchanged tokens for the applications the CLI
-     * authenticates with. Tokens are scoped under the fqdn of the applications.
-     */
     applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, zod.objectOutputType<{}, zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, "strip">>;
 }, "strip", zod.ZodTypeAny, {
     identity: {
@@ -214,12 +952,14 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
         scopes: string[];
         expiresAt: Date;
         userId: string;
+        alias?: string | undefined;
     };
     applications: {} & {
         [k: string]: {
             accessToken: string;
             scopes: string[];
             expiresAt: Date;
+            storeFqdn?: string | undefined;
         };
     };
 }, {
@@ -229,79 +969,84 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
         scopes: string[];
         userId: string;
         expiresAt?: unknown;
+        alias?: string | undefined;
     };
     applications: {} & {
         [k: string]: {
             accessToken: string;
             scopes: string[];
             expiresAt?: unknown;
+            storeFqdn?: string | undefined;
         };
     };
 }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
-    /**
-     * It contains the identity token. Before usint it, we exchange it
-     * to get a token that we can use with different applications. The exchanged
-     * tokens for the applications are stored under applications.
-     */
     identity: zod.ZodObject<{
         accessToken: zod.ZodString;
         refreshToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
         userId: zod.ZodString;
+        alias: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         refreshToken: string;
         scopes: string[];
         expiresAt: Date;
         userId: string;
+        alias?: string | undefined;
     }, {
         accessToken: string;
         refreshToken: string;
         scopes: string[];
         userId: string;
         expiresAt?: unknown;
+        alias?: string | undefined;
     }>;
-    /**
-     * It contains exchanged tokens for the applications the CLI
-     * authenticates with. Tokens are scoped under the fqdn of the applications.
-     */
     applications: zod.ZodObject<{}, "strip", zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, zod.objectOutputType<{}, zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, "strip">, zod.objectInputType<{}, zod.ZodObject<{
         accessToken: zod.ZodString;
         expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
         scopes: zod.ZodArray<zod.ZodString, "many">;
+        storeFqdn: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         accessToken: string;
         scopes: string[];
         expiresAt: Date;
+        storeFqdn?: string | undefined;
     }, {
         accessToken: string;
         scopes: string[];
         expiresAt?: unknown;
+        storeFqdn?: string | undefined;
     }>, "strip">>;
 }, "strip", zod.ZodTypeAny, {
     identity: {
@@ -310,12 +1055,14 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
         scopes: string[];
         expiresAt: Date;
         userId: string;
+        alias?: string | undefined;
     };
     applications: {} & {
         [k: string]: {
             accessToken: string;
             scopes: string[];
             expiresAt: Date;
+            storeFqdn?: string | undefined;
         };
     };
 }, {
@@ -325,15 +1072,18 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
         scopes: string[];
         userId: string;
         expiresAt?: unknown;
+        alias?: string | undefined;
     };
     applications: {} & {
         [k: string]: {
             accessToken: string;
             scopes: string[];
             expiresAt?: unknown;
+            storeFqdn?: string | undefined;
         };
     };
-}>, "strip">>;
+}>, "strip">>, "strip">>;
+export type Sessions = zod.infer<typeof SessionsSchema>;
 export type Session = zod.infer<typeof SessionSchema>;
 export type IdentityToken = zod.infer<typeof IdentityTokenSchema>;
 export type ApplicationToken = zod.infer<typeof ApplicationTokenSchema>;
packages/cli-kit/dist/private/node/session/store.d.ts
@@ -1,20 +1,30 @@
-import type { Session } from './schema.js';
+import type { Sessions } from './schema.js';
 /**
- * Serializes the session as a JSON and stores it securely in the system.
- * If the secure store is not available, the session is stored in the local config.
+ * Serializes the session as a JSON and stores it in the system.
  * @param session - the session to store.
  */
-export declare function store(session: Session): Promise<void>;
+export declare function store(sessions: Sessions): Promise<void>;
 /**
- * Fetches the session from the secure store and returns it.
- * If the secure store is not available, the session is fetched from the local config.
- * If the format of the session is invalid, the method will discard it.
- * In the future might add some logic for supporting migrating the schema
- * of already-persisted sessions.
- * @returns Returns a promise that resolves with the session if it exists and is valid.
+ * Fetches the sessions from the local storage and returns it.
+ * If the format of the object is invalid, the method will discard it.
+ * @returns Returns a promise that resolves with the sessions object if it exists and is valid.
  */
-export declare function fetch(): Promise<Session | undefined>;
+export declare function fetch(): Promise<Sessions | undefined>;
 /**
  * Removes a session from the system.
  */
-export declare function remove(): Promise<void>;
\ No newline at end of file
+export declare function remove(): Promise<void>;
+/**
+ * Gets the session alias for a given user ID.
+ *
+ * @param userId - The user ID of the session to get the alias for.
+ * @returns The alias for the session if it exists, otherwise undefined.
+ */
+export declare function getSessionAlias(userId: string): Promise<string | undefined>;
+/**
+ * Updates the session alias with a more human-readable display name if available.
+ *
+ * @param userId - The user ID of the session to update
+ * @param alias - The alias to update the session with
+ */
+export declare function updateSessionAlias(userId: string, alias: string): Promise<void>;
\ No newline at end of file
packages/cli-kit/dist/private/node/session/validate.d.ts
@@ -1,4 +1,4 @@
-import { ApplicationToken, IdentityToken } from './schema.js';
+import { Session } from './schema.js';
 import { OAuthApplications } from '../session.js';
 type ValidationResult = 'needs_refresh' | 'needs_full_auth' | 'ok';
 /**
@@ -8,10 +8,5 @@ type ValidationResult = 'needs_refresh' | 'needs_full_auth' | 'ok';
  * @param session - current session with identity and application tokens
  * @returns 'ok' if the session is valid, 'needs_full_auth' if we need to re-authenticate, 'needs_refresh' if we need to refresh the session
  */
-export declare function validateSession(scopes: string[], applications: OAuthApplications, session: {
-    identity: IdentityToken;
-    applications: {
-        [x: string]: ApplicationToken;
-    };
-}): Promise<ValidationResult>;
+export declare function validateSession(scopes: string[], applications: OAuthApplications, session: Session | undefined): Promise<ValidationResult>;
 export {};
\ No newline at end of file

@gonzaloriestra gonzaloriestra marked this pull request as ready for review May 30, 2025 13:20
@gonzaloriestra gonzaloriestra requested review from a team as code owners May 30, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Shopify Plus Multiple Stores + Shopify Partners Multi access
1 participant