@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
31 lines (30 loc) • 1.14 kB
TypeScript
import type { Sessions } from './schema.js';
/**
* Serializes the session as a JSON and stores it in the system.
* @param session - the session to store.
*/
export declare function store(sessions: Sessions): Promise<void>;
/**
* 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<Sessions | undefined>;
/**
* Removes a session from the system.
*/
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>;
/**
* Finds a session by its alias.
*
* @param alias - The alias to search for
* @returns The user ID if found, otherwise undefined
*/
export declare function findSessionByAlias(alias: string): Promise<string | undefined>;