import { CachedAppInfo } from './local-storage.js'; import { AppConfiguration, AppInterface } from '../models/app/app.js'; import { Identifiers, UuidOnlyIdentifiers } from '../models/app/identifiers.js'; import { OrganizationApp } from '../models/organization.js'; import { ExtensionInstance } from '../models/extensions/extension-instance.js'; import { ExtensionRegistration } from '../api/graphql/all_app_extension_registrations.js'; import { DeveloperPlatformClient } from '../utilities/developer-platform-client.js'; export declare const InvalidApiKeyErrorMessage: (apiKey: string) => { message: import("@shopify/cli-kit/node/output").TokenizedString; tryMessage: import("@shopify/cli-kit/node/output").TokenizedString; }; export interface DevContextOptions { directory: string; apiKey?: string; storeFqdn?: string; reset: boolean; } interface DevContextOutput { remoteApp: Omit & { apiSecret?: string; }; remoteAppUpdated: boolean; storeFqdn: string; storeId: string; updateURLs: boolean | undefined; localApp: AppInterface; } /** * Make sure there is a valid context to execute `generate extension` * * We just need a valid app API key to access the Specifications API. * - If the API key is provided via flag, we use it. * - Else, if there is an API key in the current config or cache, we use it. * - Else, we prompt the user to select/create an app. * * The selection is then cached as the "dev" app for the current directory. */ export declare function ensureGenerateContext(options: { apiKey?: string; directory: string; reset: boolean; developerPlatformClient: DeveloperPlatformClient; configName?: string; }): Promise; /** * Make sure there is a valid context to execute `dev` * That means we have a valid organization, app and dev store selected. * * If there are app/store from flags, we check if they are valid. If they are not, throw an error. * If there is info in the cache or current configuration, check if it is still valid and return it. * If there is no info (or is invalid): * - Show prompts to select an org, app and dev store * - The info will be updated in the cache or current configuration * * @param options - Current dev context options * @returns The selected org, app and dev store */ export declare function ensureDevContext(options: DevContextOptions, developerPlatformClient: DeveloperPlatformClient): Promise; interface AppFromIdOptions { apiKey: string; organizationId?: string; developerPlatformClient: DeveloperPlatformClient; } export declare const appFromId: ({ apiKey, organizationId, developerPlatformClient, }: AppFromIdOptions) => Promise; export interface ReleaseContextOptions { app: AppInterface; apiKey?: string; reset: boolean; force: boolean; developerPlatformClient?: DeveloperPlatformClient; } interface ReleaseContextOutput { developerPlatformClient: DeveloperPlatformClient; app: AppInterface; remoteApp: OrganizationApp; } interface DeployContextOutput { app: AppInterface; remoteApp: Omit; identifiers: Identifiers; release: boolean; } export declare function ensureThemeExtensionDevContext(extension: ExtensionInstance, apiKey: string, developerPlatformClient: DeveloperPlatformClient): Promise; export interface DeployContextOptions { app: AppInterface; apiKey?: string; reset: boolean; force: boolean; noRelease: boolean; commitReference?: string; developerPlatformClient: DeveloperPlatformClient; } /** * Make sure there is a valid context to execute `deploy` * That means we have a valid session, organization and app. * * If there is an API key via flag, configuration or env file, we check if it is valid. Otherwise, throw an error. * If there is no API key (or is invalid), show prompts to select an org and app. * Finally, the info is updated in the env file. * * @param options - Current dev context options * @param developerPlatformClient - The client to access the platform API * @returns The selected org, app and dev store */ export declare function ensureDeployContext(options: DeployContextOptions): Promise; export interface DraftExtensionsPushOptions { directory: string; apiKey?: string; reset: boolean; config?: string; enableDeveloperPreview: boolean; developerPlatformClient?: DeveloperPlatformClient; } export declare function ensureDraftExtensionsPushContext(draftExtensionsPushOptions: DraftExtensionsPushOptions): Promise<{ app: AppInterface; developerPlatformClient: DeveloperPlatformClient; remoteExtensionIds: { [x: string]: string; }; remoteApp: OrganizationApp; }>; /** * Make sure there is a valid context to execute `release` * That means we have a valid session, organization and app. * * If there is an API key via flag, configuration or env file, we check if it is valid. Otherwise, throw an error. * If there is no API key (or is invalid), show prompts to select an org and app. * Finally, the info is updated in the env file. * * @param options - Current dev context options * @returns The selected org, app and dev store */ export declare function ensureReleaseContext(options: ReleaseContextOptions): Promise; interface VersionListContextOptions { app: AppInterface; apiKey?: string; reset: false; developerPlatformClient?: DeveloperPlatformClient; } interface VersionsListContextOutput { developerPlatformClient: DeveloperPlatformClient; remoteApp: OrganizationApp; } /** * Make sure there is a valid context to execute `versions list` * * If there is an API key via flag, configuration or env file, we check if it is valid. Otherwise, throw an error. * If there is no API key (or is invalid), show prompts to select an org and app. * * @param options - Current dev context options * @returns The Developer Platform client and the app */ export declare function ensureVersionsListContext(options: VersionListContextOptions): Promise; export declare function fetchOrCreateOrganizationApp(app: AppInterface, developerPlatformClient: DeveloperPlatformClient, directory?: string): Promise; export declare function fetchAppAndIdentifiers(options: { app: AppInterface; reset: boolean; apiKey?: string; }, developerPlatformClient: DeveloperPlatformClient, reuseFromDev?: boolean): Promise<[OrganizationApp, Partial]>; export interface AppContext { configuration: AppConfiguration; cachedInfo?: CachedAppInfo; remoteApp?: OrganizationApp; } /** * Retrieve app info from the cache or the current configuration. * * @param reset - Whether to reset the cache or not. * @param directory - The directory containing the app. * @param developerPlatformClient - The client to access the platform API */ export declare function getAppContext({ reset, directory, developerPlatformClient, configName, promptLinkingApp, }: { reset: boolean; directory: string; developerPlatformClient: DeveloperPlatformClient; configName?: string; promptLinkingApp?: boolean; }): Promise; /** * Fetch all orgs the user belongs to and show a prompt to select one of them * @param developerPlatformClient - The client to access the platform API * @returns The selected organization ID */ export declare function selectOrg(developerPlatformClient: DeveloperPlatformClient): Promise; interface CurrentlyUsedConfigInfoOptions { org: string; appName: string; devStore?: string; updateURLs?: string; configFile?: string; appDotEnv?: string; includeConfigOnDeploy?: boolean; resetMessage?: (string | { command: string; })[]; } export declare function renderCurrentlyUsedConfigInfo({ org, appName, devStore, updateURLs, configFile, appDotEnv, resetMessage, includeConfigOnDeploy, }: CurrentlyUsedConfigInfoOptions): void; export declare function logMetadataForLoadedContext(app: { organizationId: string; apiKey: string; }): Promise; export declare function enableDeveloperPreview({ apiKey, developerPlatformClient, }: { apiKey: string; developerPlatformClient: DeveloperPlatformClient; }): Promise; export declare function disableDeveloperPreview({ apiKey, developerPlatformClient, }: { apiKey: string; developerPlatformClient: DeveloperPlatformClient; }): Promise; export declare function developerPreviewUpdate({ apiKey, developerPlatformClient, enabled, }: { apiKey: string; developerPlatformClient: DeveloperPlatformClient; enabled: boolean; }): Promise; export {};