UNPKG

@saleor/app-sdk

Version:
64 lines (60 loc) 1.75 kB
import { AuthData, APL } from '../index.mjs'; type SaleorCloudAPLConfig = { resourceUrl: string; token: string; experimental?: { cacheManager?: Map<string, AuthData>; }; pageLimit?: number; }; type CloudAPLAuthDataShape = { saleor_api_url: string; token: string; jwks: string; saleor_app_id: string; domain: string; }; type GetAllAplResponseShape = { count: number; next: string | null; previous: string | null; results: CloudAPLAuthDataShape[]; }; /** * * Saleor Cloud APL - handle auth data management via REST API. * * Required configuration options: * - `resourceUrl` URL to the REST API * - `token` Authorization token assigned to your deployment * */ declare class SaleorCloudAPL implements APL { private readonly resourceUrl; private headers; private tracer; private cacheManager?; private readonly pageLimit; constructor(config: SaleorCloudAPLConfig); private getUrlForDomain; private getUrlWithLimit; private setToCacheIfExists; private deleteFromCacheIfExists; private getFromCacheIfExists; get(saleorApiUrl: string): Promise<AuthData | undefined>; set(authData: AuthData): Promise<undefined>; delete(saleorApiUrl: string): Promise<void>; getAll(): Promise<AuthData[]>; } declare class SaleorCloudAplError extends Error { code: string; constructor(code: string, message: string); } declare const CloudAplError: { FAILED_TO_REACH_API: string; RESPONSE_BODY_INVALID: string; RESPONSE_NON_200: string; ERROR_SAVING_DATA: string; ERROR_DELETING_DATA: string; }; export { CloudAplError, type GetAllAplResponseShape, SaleorCloudAPL, type SaleorCloudAPLConfig, SaleorCloudAplError };