import type { CcRequestConfigPartial } from '../../../types/request.types.js'; import type { CcApiClient } from '../cc-api-client.js'; import type { ResourceId } from '../types/cc-api.types.js'; import type { AddonIdType, ResourceIdIndex, Store } from '../types/resource-id-resolver.types.js'; /** * Utility class to resolve and translate between different types of resource IDs in the Clever Cloud API. * Maintains a cached index of ID mappings using a configurable storage backend. * * This resolver handles: * - Owner ID resolution for applications, addons, addon providers, and OAuth consumers * - Addon ID resolution between different ID formats (real IDs and addon IDs) * * @example * const client = new CcApiClient(config); * const store = new LocalStorageStore('resource-mappings'); * const resolver = new ResourceIdResolver(client, store); * * // Resolve owner ID for an application * const ownerId = await resolver.resolveOwnerId({ applicationId: 'app_123' }); * * // Resolve addon ID to its real ID * const realId = await resolver.resolveAddonId('addon_123', 'ADDON_REAL_ID'); */ export declare class ResourceIdResolver { #private; /** * Creates a new ResourceIdResolver instance * * @param client - API client to use for fetching resource information * @param indexStore - Storage backend for caching resource mappings * @param getRequestSignal - Gets the signal a caller aborts with, from its request configuration. The * client passes one that falls back to its default signal. Defaults to the signal of the configuration. */ constructor(client: CcApiClient, indexStore: Store, getRequestSignal?: (requestConfig: CcRequestConfigPartial | undefined) => AbortSignal | undefined); /** * Resolves the owner ID (organization ID) for a given resource. * The resource can be an application, addon, addon provider, or OAuth consumer. * * @param resourceId - The resource identifier to resolve * @param requestConfig - Optional request configuration * @returns The owner ID for the resource * @throws {CcClientError} If the resource doesn't exist or is inaccessible * * @example * // Resolve owner for an application * const ownerId = await resolver.resolveOwnerId({ applicationId: 'app_123' }); * * // Resolve owner for an addon * const ownerId = await resolver.resolveOwnerId({ addonId: 'addon_123' }); */ resolveOwnerId(resourceId: ResourceId, requestConfig?: CcRequestConfigPartial): Promise; /** * Resolves an addon ID to either its real ID or addon ID format. * Addons can be identified by two types of IDs, and this method translates between them. * * @param addonId - The addon ID to resolve * @param requiredAddonIdType - The desired ID format ('ADDON_ID' or 'ADDON_REAL_ID') * @param requestConfig - Optional request configuration * @returns The resolved addon ID in the requested format * @throws {CcClientError} If the addon doesn't exist or is inaccessible * * @example * // Convert addon ID to real ID * const realId = await resolver.resolveAddonId('addon_123', 'ADDON_REAL_ID'); * * // Convert real ID to addon ID * const addonId = await resolver.resolveAddonId('real_123', 'ADDON_ID'); */ resolveAddonId(addonId: string, requiredAddonIdType: AddonIdType, requestConfig?: CcRequestConfigPartial): Promise; } //# sourceMappingURL=resource-id-resolver.d.ts.map