/** * Operation Metadata Registry * * This module provides metadata for SDK operations extracted from Swagger/OpenAPI specifications. * The metadata includes: * - `readonly`: Whether the operation is safe to retry (from x-readonly-method) * - `category`: API category for the operation (from x-category) * - `rateLimitKey`: Key used for rate limiting configuration * * **Use Cases:** * - Retry logic: Only retry operations marked as readonly=true * - Request routing: Route requests based on category to correct API domain * - Monitoring: Track operations by category for analytics * * @packageDocumentation * @module config/operation-metadata */ /** * Metadata for a single SDK operation * * @example * ```typescript * import { operationMetadata, type OperationMetadata } from 'daytona-wildberries-typescript-sdk'; * * const pingMeta = operationMetadata['general.ping']; * if (pingMeta.readonly) { * // Safe to retry on transient failures * } * ``` */ export interface OperationMetadata { /** * Whether the operation is readonly (safe to retry) * * Operations marked as readonly=true are idempotent and safe to retry * on transient failures (network errors, timeouts, 5xx errors). * * Operations with readonly=false may have side effects (create, update, delete) * and should NOT be automatically retried. */ readonly: boolean; /** * API category for the operation * * Categories map to different API domains: * - 'all': Can be used with any API domain (e.g., /ping) * - 'content': https://content-api.wildberries.ru * - 'marketplace': https://marketplace-api.wildberries.ru * - 'discountsandprices': https://discounts-prices-api.wildberries.ru * - 'commonapi': https://common-api.wildberries.ru * - 'usermanagement': https://user-management-api.wildberries.ru */ category: string; /** * Rate limit key for the operation * * This key is used to look up rate limit configuration in the rate limits registry. * Format: '{module}.{operationName}' */ rateLimitKey: string; } /** * Registry of operation metadata for all SDK operations * * Keys follow the pattern: '{module}.{methodName}' * * @example * ```typescript * import { operationMetadata, isOperationReadonly, getOperationCategory } from 'daytona-wildberries-typescript-sdk'; * * // Direct access * const meta = operationMetadata['products.getParentAll']; * console.log(meta.readonly); // true * console.log(meta.category); // 'content' * * // Helper functions * if (isOperationReadonly('products.getParentAll')) { * // Safe to retry * } * * const category = getOperationCategory('products.getParentAll'); * // Returns 'content' * ``` */ export declare const operationMetadata: Record; /** * Check if an operation is readonly (safe to retry) * * @param operationKey - Operation key in format '{module}.{methodName}' * @returns true if the operation is readonly, false otherwise * * @example * ```typescript * import { isOperationReadonly } from 'daytona-wildberries-typescript-sdk'; * * if (isOperationReadonly('products.getParentAll')) { * // Safe to retry on transient failures * } * * if (!isOperationReadonly('products.createCardsUpload')) { * // Should NOT auto-retry - may cause duplicate cards * } * ``` */ export declare function isOperationReadonly(operationKey: string): boolean; /** * Get the API category for an operation * * @param operationKey - Operation key in format '{module}.{methodName}' * @returns The category string, or undefined if operation not found * * @example * ```typescript * import { getOperationCategory } from 'daytona-wildberries-typescript-sdk'; * * const category = getOperationCategory('products.getParentAll'); * // Returns 'content' * * // Map category to API domain * const domains: Record = { * 'content': 'https://content-api.wildberries.ru', * 'marketplace': 'https://marketplace-api.wildberries.ru', * 'discountsandprices': 'https://discounts-prices-api.wildberries.ru', * }; * const domain = domains[category!]; * ``` */ export declare function getOperationCategory(operationKey: string): string | undefined; /** * Get the rate limit key for an operation * * @param operationKey - Operation key in format '{module}.{methodName}' * @returns The rate limit key, or undefined if operation not found * * @example * ```typescript * import { getOperationRateLimitKey, productsRateLimits } from 'daytona-wildberries-typescript-sdk'; * * const rateLimitKey = getOperationRateLimitKey('products.getParentAll'); * // Returns 'products.contentObjectParentAll' * * const config = productsRateLimits[rateLimitKey!]; * console.log(config.requestsPerMinute); // 100 * ``` */ export declare function getOperationRateLimitKey(operationKey: string): string | undefined; /** * Get full metadata for an operation * * @param operationKey - Operation key in format '{module}.{methodName}' * @returns The full OperationMetadata object, or undefined if not found * * @example * ```typescript * import { getOperationMetadata } from 'daytona-wildberries-typescript-sdk'; * * const meta = getOperationMetadata('products.createCardsUpload'); * if (meta) { * console.log('Readonly:', meta.readonly); // false * console.log('Category:', meta.category); // 'content' * console.log('Rate limit key:', meta.rateLimitKey); // 'products.postContentCardsUpload' * } * ``` */ export declare function getOperationMetadata(operationKey: string): OperationMetadata | undefined; /** * Get all operations for a specific category * * @param category - API category (e.g., 'content', 'marketplace', 'discountsandprices') * @returns Array of operation keys matching the category * * @example * ```typescript * import { getOperationsByCategory } from 'daytona-wildberries-typescript-sdk'; * * const contentOps = getOperationsByCategory('content'); * // Returns: ['products.getParentAll', 'products.getObjectAll', ...] * * const marketplaceOps = getOperationsByCategory('marketplace'); * // Returns: ['products.getStocks', 'products.updateStock', ...] * ``` */ export declare function getOperationsByCategory(category: string): string[]; /** * Get all readonly operations * * @returns Array of operation keys that are safe to retry * * @example * ```typescript * import { getReadonlyOperations } from 'daytona-wildberries-typescript-sdk'; * * const safeToRetry = getReadonlyOperations(); * // Returns: ['general.ping', 'general.news', 'products.getParentAll', ...] * ``` */ export declare function getReadonlyOperations(): string[]; /** * Get all write operations (not readonly) * * @returns Array of operation keys that have side effects * * @example * ```typescript * import { getWriteOperations } from 'daytona-wildberries-typescript-sdk'; * * const writeOps = getWriteOperations(); * // Returns: ['products.createContentTag', 'products.createCardsUpload', ...] * * // These operations should NOT be automatically retried * ``` */ export declare function getWriteOperations(): string[]; //# sourceMappingURL=operation-metadata.d.ts.map