@juspay/neurolink 9.1.1 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +54 -7
- package/dist/agent/directTools.d.ts +3 -3
- package/dist/cli/commands/config.d.ts +6 -6
- package/dist/image-gen/ImageGenService.d.ts +143 -0
- package/dist/image-gen/ImageGenService.js +345 -0
- package/dist/image-gen/imageGenTools.d.ts +126 -0
- package/dist/image-gen/imageGenTools.js +304 -0
- package/dist/image-gen/index.d.ts +46 -0
- package/dist/image-gen/index.js +48 -0
- package/dist/image-gen/types.d.ts +237 -0
- package/dist/image-gen/types.js +24 -0
- package/dist/lib/agent/directTools.d.ts +3 -3
- package/dist/lib/image-gen/ImageGenService.d.ts +143 -0
- package/dist/lib/image-gen/ImageGenService.js +346 -0
- package/dist/lib/image-gen/imageGenTools.d.ts +126 -0
- package/dist/lib/image-gen/imageGenTools.js +305 -0
- package/dist/lib/image-gen/index.d.ts +46 -0
- package/dist/lib/image-gen/index.js +49 -0
- package/dist/lib/image-gen/types.d.ts +237 -0
- package/dist/lib/image-gen/types.js +25 -0
- package/dist/lib/processors/base/BaseFileProcessor.d.ts +273 -0
- package/dist/lib/processors/base/BaseFileProcessor.js +614 -0
- package/dist/lib/processors/base/index.d.ts +14 -0
- package/dist/lib/processors/base/index.js +20 -0
- package/dist/lib/processors/base/types.d.ts +593 -0
- package/dist/lib/processors/base/types.js +77 -0
- package/dist/lib/processors/cli/fileProcessorCli.d.ts +163 -0
- package/dist/lib/processors/cli/fileProcessorCli.js +389 -0
- package/dist/lib/processors/cli/index.d.ts +37 -0
- package/dist/lib/processors/cli/index.js +50 -0
- package/dist/lib/processors/code/ConfigProcessor.d.ts +171 -0
- package/dist/lib/processors/code/ConfigProcessor.js +401 -0
- package/dist/lib/processors/code/SourceCodeProcessor.d.ts +174 -0
- package/dist/lib/processors/code/SourceCodeProcessor.js +305 -0
- package/dist/lib/processors/code/index.d.ts +44 -0
- package/dist/lib/processors/code/index.js +61 -0
- package/dist/lib/processors/config/fileTypes.d.ts +283 -0
- package/dist/lib/processors/config/fileTypes.js +521 -0
- package/dist/lib/processors/config/index.d.ts +32 -0
- package/dist/lib/processors/config/index.js +93 -0
- package/dist/lib/processors/config/languageMap.d.ts +66 -0
- package/dist/lib/processors/config/languageMap.js +411 -0
- package/dist/lib/processors/config/mimeTypes.d.ts +376 -0
- package/dist/lib/processors/config/mimeTypes.js +339 -0
- package/dist/lib/processors/config/sizeLimits.d.ts +194 -0
- package/dist/lib/processors/config/sizeLimits.js +247 -0
- package/dist/lib/processors/data/JsonProcessor.d.ts +122 -0
- package/dist/lib/processors/data/JsonProcessor.js +204 -0
- package/dist/lib/processors/data/XmlProcessor.d.ts +160 -0
- package/dist/lib/processors/data/XmlProcessor.js +284 -0
- package/dist/lib/processors/data/YamlProcessor.d.ts +163 -0
- package/dist/lib/processors/data/YamlProcessor.js +295 -0
- package/dist/lib/processors/data/index.d.ts +49 -0
- package/dist/lib/processors/data/index.js +77 -0
- package/dist/lib/processors/document/ExcelProcessor.d.ts +238 -0
- package/dist/lib/processors/document/ExcelProcessor.js +520 -0
- package/dist/lib/processors/document/OpenDocumentProcessor.d.ts +69 -0
- package/dist/lib/processors/document/OpenDocumentProcessor.js +211 -0
- package/dist/lib/processors/document/RtfProcessor.d.ts +152 -0
- package/dist/lib/processors/document/RtfProcessor.js +362 -0
- package/dist/lib/processors/document/WordProcessor.d.ts +168 -0
- package/dist/lib/processors/document/WordProcessor.js +354 -0
- package/dist/lib/processors/document/index.d.ts +54 -0
- package/dist/lib/processors/document/index.js +91 -0
- package/dist/lib/processors/errors/FileErrorCode.d.ts +98 -0
- package/dist/lib/processors/errors/FileErrorCode.js +256 -0
- package/dist/lib/processors/errors/errorHelpers.d.ts +151 -0
- package/dist/lib/processors/errors/errorHelpers.js +379 -0
- package/dist/lib/processors/errors/errorSerializer.d.ts +139 -0
- package/dist/lib/processors/errors/errorSerializer.js +508 -0
- package/dist/lib/processors/errors/index.d.ts +46 -0
- package/dist/lib/processors/errors/index.js +50 -0
- package/dist/lib/processors/index.d.ts +76 -0
- package/dist/lib/processors/index.js +113 -0
- package/dist/lib/processors/integration/FileProcessorIntegration.d.ts +244 -0
- package/dist/lib/processors/integration/FileProcessorIntegration.js +273 -0
- package/dist/lib/processors/integration/index.d.ts +42 -0
- package/dist/lib/processors/integration/index.js +45 -0
- package/dist/lib/processors/markup/HtmlProcessor.d.ts +169 -0
- package/dist/lib/processors/markup/HtmlProcessor.js +250 -0
- package/dist/lib/processors/markup/MarkdownProcessor.d.ts +165 -0
- package/dist/lib/processors/markup/MarkdownProcessor.js +245 -0
- package/dist/lib/processors/markup/SvgProcessor.d.ts +156 -0
- package/dist/lib/processors/markup/SvgProcessor.js +241 -0
- package/dist/lib/processors/markup/TextProcessor.d.ts +135 -0
- package/dist/lib/processors/markup/TextProcessor.js +189 -0
- package/dist/lib/processors/markup/index.d.ts +66 -0
- package/dist/lib/processors/markup/index.js +103 -0
- package/dist/lib/processors/registry/ProcessorRegistry.d.ts +334 -0
- package/dist/lib/processors/registry/ProcessorRegistry.js +609 -0
- package/dist/lib/processors/registry/index.d.ts +12 -0
- package/dist/lib/processors/registry/index.js +17 -0
- package/dist/lib/processors/registry/types.d.ts +53 -0
- package/dist/lib/processors/registry/types.js +11 -0
- package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
- package/dist/lib/server/utils/validation.d.ts +6 -6
- package/dist/lib/types/fileTypes.d.ts +1 -1
- package/dist/lib/types/index.d.ts +25 -24
- package/dist/lib/types/index.js +21 -20
- package/dist/lib/types/modelTypes.d.ts +18 -18
- package/dist/lib/types/pptTypes.d.ts +14 -2
- package/dist/lib/types/pptTypes.js +16 -0
- package/dist/lib/utils/async/delay.d.ts +40 -0
- package/dist/lib/utils/async/delay.js +43 -0
- package/dist/lib/utils/async/index.d.ts +23 -0
- package/dist/lib/utils/async/index.js +24 -0
- package/dist/lib/utils/async/retry.d.ts +141 -0
- package/dist/lib/utils/async/retry.js +172 -0
- package/dist/lib/utils/async/withTimeout.d.ts +73 -0
- package/dist/lib/utils/async/withTimeout.js +97 -0
- package/dist/lib/utils/fileDetector.d.ts +7 -1
- package/dist/lib/utils/fileDetector.js +91 -18
- package/dist/lib/utils/json/extract.d.ts +103 -0
- package/dist/lib/utils/json/extract.js +249 -0
- package/dist/lib/utils/json/index.d.ts +36 -0
- package/dist/lib/utils/json/index.js +37 -0
- package/dist/lib/utils/json/safeParse.d.ts +137 -0
- package/dist/lib/utils/json/safeParse.js +191 -0
- package/dist/lib/utils/messageBuilder.d.ts +2 -2
- package/dist/lib/utils/messageBuilder.js +15 -7
- package/dist/lib/utils/sanitizers/filename.d.ts +137 -0
- package/dist/lib/utils/sanitizers/filename.js +366 -0
- package/dist/lib/utils/sanitizers/html.d.ts +170 -0
- package/dist/lib/utils/sanitizers/html.js +326 -0
- package/dist/lib/utils/sanitizers/index.d.ts +26 -0
- package/dist/lib/utils/sanitizers/index.js +30 -0
- package/dist/lib/utils/sanitizers/svg.d.ts +81 -0
- package/dist/lib/utils/sanitizers/svg.js +483 -0
- package/dist/processors/base/BaseFileProcessor.d.ts +273 -0
- package/dist/processors/base/BaseFileProcessor.js +613 -0
- package/dist/processors/base/index.d.ts +14 -0
- package/dist/processors/base/index.js +19 -0
- package/dist/processors/base/types.d.ts +593 -0
- package/dist/processors/base/types.js +76 -0
- package/dist/processors/cli/fileProcessorCli.d.ts +163 -0
- package/dist/processors/cli/fileProcessorCli.js +388 -0
- package/dist/processors/cli/index.d.ts +37 -0
- package/dist/processors/cli/index.js +49 -0
- package/dist/processors/code/ConfigProcessor.d.ts +171 -0
- package/dist/processors/code/ConfigProcessor.js +400 -0
- package/dist/processors/code/SourceCodeProcessor.d.ts +174 -0
- package/dist/processors/code/SourceCodeProcessor.js +304 -0
- package/dist/processors/code/index.d.ts +44 -0
- package/dist/processors/code/index.js +60 -0
- package/dist/processors/config/fileTypes.d.ts +283 -0
- package/dist/processors/config/fileTypes.js +520 -0
- package/dist/processors/config/index.d.ts +32 -0
- package/dist/processors/config/index.js +92 -0
- package/dist/processors/config/languageMap.d.ts +66 -0
- package/dist/processors/config/languageMap.js +410 -0
- package/dist/processors/config/mimeTypes.d.ts +376 -0
- package/dist/processors/config/mimeTypes.js +338 -0
- package/dist/processors/config/sizeLimits.d.ts +194 -0
- package/dist/processors/config/sizeLimits.js +246 -0
- package/dist/processors/data/JsonProcessor.d.ts +122 -0
- package/dist/processors/data/JsonProcessor.js +203 -0
- package/dist/processors/data/XmlProcessor.d.ts +160 -0
- package/dist/processors/data/XmlProcessor.js +283 -0
- package/dist/processors/data/YamlProcessor.d.ts +163 -0
- package/dist/processors/data/YamlProcessor.js +294 -0
- package/dist/processors/data/index.d.ts +49 -0
- package/dist/processors/data/index.js +76 -0
- package/dist/processors/document/ExcelProcessor.d.ts +238 -0
- package/dist/processors/document/ExcelProcessor.js +519 -0
- package/dist/processors/document/OpenDocumentProcessor.d.ts +69 -0
- package/dist/processors/document/OpenDocumentProcessor.js +210 -0
- package/dist/processors/document/RtfProcessor.d.ts +152 -0
- package/dist/processors/document/RtfProcessor.js +361 -0
- package/dist/processors/document/WordProcessor.d.ts +168 -0
- package/dist/processors/document/WordProcessor.js +353 -0
- package/dist/processors/document/index.d.ts +54 -0
- package/dist/processors/document/index.js +90 -0
- package/dist/processors/errors/FileErrorCode.d.ts +98 -0
- package/dist/processors/errors/FileErrorCode.js +255 -0
- package/dist/processors/errors/errorHelpers.d.ts +151 -0
- package/dist/processors/errors/errorHelpers.js +378 -0
- package/dist/processors/errors/errorSerializer.d.ts +139 -0
- package/dist/processors/errors/errorSerializer.js +507 -0
- package/dist/processors/errors/index.d.ts +46 -0
- package/dist/processors/errors/index.js +49 -0
- package/dist/processors/index.d.ts +76 -0
- package/dist/processors/index.js +112 -0
- package/dist/processors/integration/FileProcessorIntegration.d.ts +244 -0
- package/dist/processors/integration/FileProcessorIntegration.js +272 -0
- package/dist/processors/integration/index.d.ts +42 -0
- package/dist/processors/integration/index.js +44 -0
- package/dist/processors/markup/HtmlProcessor.d.ts +169 -0
- package/dist/processors/markup/HtmlProcessor.js +249 -0
- package/dist/processors/markup/MarkdownProcessor.d.ts +165 -0
- package/dist/processors/markup/MarkdownProcessor.js +244 -0
- package/dist/processors/markup/SvgProcessor.d.ts +156 -0
- package/dist/processors/markup/SvgProcessor.js +240 -0
- package/dist/processors/markup/TextProcessor.d.ts +135 -0
- package/dist/processors/markup/TextProcessor.js +188 -0
- package/dist/processors/markup/index.d.ts +66 -0
- package/dist/processors/markup/index.js +102 -0
- package/dist/processors/registry/ProcessorRegistry.d.ts +334 -0
- package/dist/processors/registry/ProcessorRegistry.js +608 -0
- package/dist/processors/registry/index.d.ts +12 -0
- package/dist/processors/registry/index.js +16 -0
- package/dist/processors/registry/types.d.ts +53 -0
- package/dist/processors/registry/types.js +10 -0
- package/dist/server/utils/validation.d.ts +6 -6
- package/dist/types/fileTypes.d.ts +1 -1
- package/dist/types/index.d.ts +25 -24
- package/dist/types/index.js +21 -20
- package/dist/types/modelTypes.d.ts +10 -10
- package/dist/types/pptTypes.d.ts +14 -2
- package/dist/types/pptTypes.js +16 -0
- package/dist/utils/async/delay.d.ts +40 -0
- package/dist/utils/async/delay.js +42 -0
- package/dist/utils/async/index.d.ts +23 -0
- package/dist/utils/async/index.js +23 -0
- package/dist/utils/async/retry.d.ts +141 -0
- package/dist/utils/async/retry.js +171 -0
- package/dist/utils/async/withTimeout.d.ts +73 -0
- package/dist/utils/async/withTimeout.js +96 -0
- package/dist/utils/fileDetector.d.ts +7 -1
- package/dist/utils/fileDetector.js +91 -18
- package/dist/utils/json/extract.d.ts +103 -0
- package/dist/utils/json/extract.js +248 -0
- package/dist/utils/json/index.d.ts +36 -0
- package/dist/utils/json/index.js +36 -0
- package/dist/utils/json/safeParse.d.ts +137 -0
- package/dist/utils/json/safeParse.js +190 -0
- package/dist/utils/messageBuilder.d.ts +2 -2
- package/dist/utils/messageBuilder.js +15 -7
- package/dist/utils/sanitizers/filename.d.ts +137 -0
- package/dist/utils/sanitizers/filename.js +365 -0
- package/dist/utils/sanitizers/html.d.ts +170 -0
- package/dist/utils/sanitizers/html.js +325 -0
- package/dist/utils/sanitizers/index.d.ts +26 -0
- package/dist/utils/sanitizers/index.js +29 -0
- package/dist/utils/sanitizers/svg.d.ts +81 -0
- package/dist/utils/sanitizers/svg.js +482 -0
- package/package.json +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processor Registry Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Contains only types unique to the registry module.
|
|
5
|
+
* All shared types (ProcessorMatch, RegistryOptions, etc.) are defined
|
|
6
|
+
* in the single source of truth: processors/base/types.ts
|
|
7
|
+
*
|
|
8
|
+
* @module processors/registry/types
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -38,11 +38,11 @@ export declare const AgentExecuteRequestSchema: z.ZodObject<{
|
|
|
38
38
|
provider?: string | undefined;
|
|
39
39
|
model?: string | undefined;
|
|
40
40
|
userId?: string | undefined;
|
|
41
|
+
stream?: boolean | undefined;
|
|
41
42
|
tools?: string[] | undefined;
|
|
42
43
|
sessionId?: string | undefined;
|
|
43
44
|
temperature?: number | undefined;
|
|
44
45
|
maxTokens?: number | undefined;
|
|
45
|
-
stream?: boolean | undefined;
|
|
46
46
|
systemPrompt?: string | undefined;
|
|
47
47
|
}, {
|
|
48
48
|
input: string | {
|
|
@@ -53,11 +53,11 @@ export declare const AgentExecuteRequestSchema: z.ZodObject<{
|
|
|
53
53
|
provider?: string | undefined;
|
|
54
54
|
model?: string | undefined;
|
|
55
55
|
userId?: string | undefined;
|
|
56
|
+
stream?: boolean | undefined;
|
|
56
57
|
tools?: string[] | undefined;
|
|
57
58
|
sessionId?: string | undefined;
|
|
58
59
|
temperature?: number | undefined;
|
|
59
60
|
maxTokens?: number | undefined;
|
|
60
|
-
stream?: boolean | undefined;
|
|
61
61
|
systemPrompt?: string | undefined;
|
|
62
62
|
}>;
|
|
63
63
|
/**
|
|
@@ -148,12 +148,12 @@ export declare const SessionsListQuerySchema: z.ZodObject<{
|
|
|
148
148
|
offset: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
|
|
149
149
|
}, "strip", z.ZodTypeAny, {
|
|
150
150
|
userId?: string | undefined;
|
|
151
|
-
limit?: number | undefined;
|
|
152
151
|
offset?: number | undefined;
|
|
152
|
+
limit?: number | undefined;
|
|
153
153
|
}, {
|
|
154
154
|
userId?: string | undefined;
|
|
155
|
-
limit?: string | undefined;
|
|
156
155
|
offset?: string | undefined;
|
|
156
|
+
limit?: string | undefined;
|
|
157
157
|
}>;
|
|
158
158
|
/**
|
|
159
159
|
* Session messages query schema (for pagination)
|
|
@@ -162,11 +162,11 @@ export declare const SessionMessagesQuerySchema: z.ZodObject<{
|
|
|
162
162
|
limit: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
|
|
163
163
|
offset: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
|
|
164
164
|
}, "strip", z.ZodTypeAny, {
|
|
165
|
-
limit?: number | undefined;
|
|
166
165
|
offset?: number | undefined;
|
|
166
|
+
limit?: number | undefined;
|
|
167
167
|
}, {
|
|
168
|
-
limit?: string | undefined;
|
|
169
168
|
offset?: string | undefined;
|
|
169
|
+
limit?: string | undefined;
|
|
170
170
|
}>;
|
|
171
171
|
/**
|
|
172
172
|
* Standardized error response format
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Supported file types for multimodal input
|
|
6
6
|
*/
|
|
7
|
-
export type FileType = "csv" | "image" | "pdf" | "audio" | "text" | "docx" | "pptx" | "xlsx" | "unknown";
|
|
7
|
+
export type FileType = "csv" | "image" | "pdf" | "audio" | "text" | "svg" | "docx" | "pptx" | "xlsx" | "unknown";
|
|
8
8
|
/**
|
|
9
9
|
* Office document types
|
|
10
10
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized type exports for NeuroLink
|
|
3
3
|
*/
|
|
4
|
-
export * from "./common.js";
|
|
5
4
|
export { AIProviderName } from "../constants/enums.js";
|
|
6
|
-
export type { ZodUnknownSchema, ValidationSchema, OptionalValidationSchema, StandardRecord, OptionalStandardRecord, } from "./typeAliases.js";
|
|
7
|
-
export * from "./tools.js";
|
|
8
|
-
export * from "./providers.js";
|
|
9
5
|
export * from "./cli.js";
|
|
6
|
+
export * from "./common.js";
|
|
7
|
+
export type { AnalyticsConfig, BackupInfo, BackupMetadata, CacheConfig, ConfigUpdateOptions, ConfigValidationResult, FallbackConfig, NeuroLinkConfig, PerformanceConfig, RetryConfig, ToolConfig, } from "./configTypes.js";
|
|
8
|
+
export type { ExternalMCPConfigValidation, ExternalMCPManagerConfig, ExternalMCPOperationResult, ExternalMCPServerEvents, ExternalMCPServerHealth, ExternalMCPServerInstance, ExternalMCPServerStatus, ExternalMCPToolContext, ExternalMCPToolInfo, ExternalMCPToolResult, } from "./externalMcp.js";
|
|
9
|
+
export type { AuthorizationUrlResult, CircuitBreakerConfig, CircuitBreakerEvents, CircuitBreakerState, CircuitBreakerStats, DiscoveredMcp, ExternalToolExecutionOptions, FlexibleValidationResult, HTTPRetryConfig, MCPClientResult, MCPConnectedServer, MCPDiscoveredServer, MCPExecutableTool, MCPOAuthConfig, MCPServerCategory, MCPServerConfig, MCPServerConnectionStatus, MCPServerMetadata, MCPServerRegistryEntry, MCPServerStatus, MCPToolInfo, MCPToolMetadata, MCPTransportType, McpMetadata, McpRegistry, NeuroLinkExecutionContext, NeuroLinkMCPServer, NeuroLinkMCPTool, OAuthClientInformation, OAuthTokens, RateLimitConfig, TokenBucketRateLimitConfig, TokenExchangeRequest, TokenStorage, ToolDiscoveryResult, ToolRegistryEvents, ToolValidationResult, } from "./mcpTypes.js";
|
|
10
|
+
export type { ModelCapability, ModelFilter, ModelPricing, ModelResolutionContext, ModelStats, ModelUseCase, } from "./providers.js";
|
|
11
|
+
export * from "./providers.js";
|
|
10
12
|
export * from "./taskClassificationTypes.js";
|
|
11
|
-
export
|
|
12
|
-
export type {
|
|
13
|
-
export type {
|
|
14
|
-
export
|
|
15
|
-
export type {
|
|
16
|
-
export type {
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
ToolCallResults, ToolCalls, StreamOptions, StreamingOptions, StreamResult, EnhancedStreamProvider, } from "./streamTypes.js";
|
|
21
|
-
export type { TokenUsage, ErrorInfo as AnalyticsErrorInfo, // Renamed to avoid conflict with common.js ErrorInfo
|
|
22
|
-
AnalyticsData, StreamAnalyticsData, PerformanceMetrics, } from "./analytics.js";
|
|
13
|
+
export * from "./tools.js";
|
|
14
|
+
export type { OptionalStandardRecord, OptionalValidationSchema, StandardRecord, ValidationSchema, ZodUnknownSchema, } from "./typeAliases.js";
|
|
15
|
+
export type { BatchProcessingSummary, ExcelWorksheet, FailedFileInfo, FileInfo, FileProcessingError, FileProcessingResult as ProcessorFileResult, FileProcessorConfig, FileWarning, JsonTypeGuard, OperationResult, ProcessedConfig, ProcessedExcel, ProcessedFileBase, ProcessedFileInfo, ProcessedHtml, ProcessedJson, ProcessedMarkdown, ProcessedOpenDocument, ProcessedRtf, ProcessedSourceCode, ProcessedSvg, ProcessedText, ProcessedWord, ProcessedYaml, ProcessOptions, ProcessorInfo, ProcessorMatch, ProcessorPriorityKey, ProcessorPriorityValue, RegistryOptions, RegistryProcessResult, RetryConfig as ProcessorRetryConfig, SkippedFileInfo, UnsupportedFileError, } from "../processors/base/types.js";
|
|
16
|
+
export { PROCESSOR_PRIORITIES } from "../processors/base/types.js";
|
|
17
|
+
export type { ActionAWSConfig, ActionCommentResult, ActionEvaluation, ActionExecutionResult, ActionGoogleCloudConfig, ActionInputs, ActionInputValidation, ActionMultimodalInputs, ActionOutput, ActionProviderKeys, ActionThinkingConfig, ActionTokenUsage, CliAnalytics, CliEvaluation, CliResponse, CliTokenUsage, ProviderKeyMapping, } from "./actionTypes.js";
|
|
18
|
+
export type { AnalyticsData, ErrorInfo as AnalyticsErrorInfo, // Renamed to avoid conflict with common.js ErrorInfo
|
|
19
|
+
PerformanceMetrics, StreamAnalyticsData, TokenUsage, } from "./analytics.js";
|
|
20
|
+
export * from "./content.js";
|
|
21
|
+
export type { DomainConfig, DomainConfigOptions, DomainEvaluationCriteria, DomainTemplate, DomainType, DomainValidationRule, } from "./domainTypes.js";
|
|
23
22
|
export * from "./evaluation.js";
|
|
24
|
-
export * from "./modelTypes.js";
|
|
25
|
-
export * from "./serviceTypes.js";
|
|
26
23
|
export * from "./evaluationProviders.js";
|
|
27
|
-
export * from "./sdkTypes.js";
|
|
28
|
-
export * from "./utilities.js";
|
|
29
|
-
export * from "./middlewareTypes.js";
|
|
30
24
|
export * from "./fileTypes.js";
|
|
31
|
-
export
|
|
32
|
-
|
|
25
|
+
export type { EnhancedGenerateResult, EnhancedProvider, FactoryEnhancedProvider, GenerateOptions, GenerateResult as GenerateApiResult, // Renamed to avoid conflict with cli.js GenerateResult
|
|
26
|
+
TextGenerationOptions, TextGenerationResult, UnifiedGenerationOptions, } from "./generateTypes.js";
|
|
33
27
|
export * from "./hitlTypes.js";
|
|
34
|
-
export
|
|
28
|
+
export * from "./middlewareTypes.js";
|
|
29
|
+
export * from "./modelTypes.js";
|
|
30
|
+
export * from "./sdkTypes.js";
|
|
31
|
+
export * from "./serviceTypes.js";
|
|
32
|
+
export type { EnhancedStreamProvider, ProgressCallback, StreamingMetadata, StreamingOptions, StreamingProgressData, StreamOptions, StreamResult, ToolCall as StreamToolCall, // Renamed to avoid conflict with tools.js ToolCall
|
|
33
|
+
ToolCallResults, ToolCalls, ToolResult as StreamToolResult, } from "./streamTypes.js";
|
|
34
|
+
export * from "./ttsTypes.js";
|
|
35
|
+
export * from "./utilities.js";
|
package/dist/types/index.js
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized type exports for NeuroLink
|
|
3
3
|
*/
|
|
4
|
-
// Common utility types
|
|
5
|
-
export * from "./common.js";
|
|
6
4
|
// Constants and enums
|
|
7
5
|
export { AIProviderName } from "../constants/enums.js";
|
|
8
|
-
// Tool system types
|
|
9
|
-
export * from "./tools.js";
|
|
10
|
-
// Provider types
|
|
11
|
-
export * from "./providers.js";
|
|
12
6
|
// CLI types
|
|
13
7
|
export * from "./cli.js";
|
|
8
|
+
// Common utility types
|
|
9
|
+
export * from "./common.js";
|
|
10
|
+
// Provider types
|
|
11
|
+
export * from "./providers.js";
|
|
14
12
|
// Task classification types
|
|
15
13
|
export * from "./taskClassificationTypes.js";
|
|
14
|
+
// Tool system types
|
|
15
|
+
export * from "./tools.js";
|
|
16
|
+
export { PROCESSOR_PRIORITIES } from "../processors/base/types.js";
|
|
17
|
+
// Content types for multimodal support (includes multimodal re-exports for backward compatibility)
|
|
18
|
+
export * from "./content.js";
|
|
16
19
|
// Evaluation types - NEW
|
|
17
20
|
export * from "./evaluation.js";
|
|
18
|
-
// Model types - NEW
|
|
19
|
-
export * from "./modelTypes.js";
|
|
20
|
-
// Service types - NEW
|
|
21
|
-
export * from "./serviceTypes.js";
|
|
22
21
|
// Evaluation provider types - NEW
|
|
23
22
|
export * from "./evaluationProviders.js";
|
|
23
|
+
// File detection and processing types
|
|
24
|
+
export * from "./fileTypes.js";
|
|
25
|
+
// HITL (Human-in-the-Loop) types
|
|
26
|
+
export * from "./hitlTypes.js";
|
|
27
|
+
// Middleware Types - Middleware system types
|
|
28
|
+
export * from "./middlewareTypes.js";
|
|
29
|
+
// Model types - NEW
|
|
30
|
+
export * from "./modelTypes.js";
|
|
24
31
|
// SDK Types - Core types for external developers
|
|
25
32
|
// Note: sdkTypes.ts uses selective re-exports internally, so we use wildcard here
|
|
26
33
|
// The conflicts were from generateTypes and analytics which are now handled above
|
|
27
34
|
export * from "./sdkTypes.js";
|
|
28
|
-
//
|
|
29
|
-
export * from "./
|
|
30
|
-
// Middleware Types - Middleware system types
|
|
31
|
-
export * from "./middlewareTypes.js";
|
|
32
|
-
// File detection and processing types
|
|
33
|
-
export * from "./fileTypes.js";
|
|
34
|
-
// Content types for multimodal support (includes multimodal re-exports for backward compatibility)
|
|
35
|
-
export * from "./content.js";
|
|
35
|
+
// Service types - NEW
|
|
36
|
+
export * from "./serviceTypes.js";
|
|
36
37
|
// TTS (Text-to-Speech) types
|
|
37
38
|
export * from "./ttsTypes.js";
|
|
38
|
-
//
|
|
39
|
-
export * from "./
|
|
39
|
+
// Utilities Types - Utility module types (selective export to avoid conflicts)
|
|
40
|
+
export * from "./utilities.js";
|
|
@@ -79,11 +79,11 @@ export declare const ModelConfigSchema: z.ZodObject<{
|
|
|
79
79
|
input: z.ZodNumber;
|
|
80
80
|
output: z.ZodNumber;
|
|
81
81
|
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
input: number;
|
|
83
82
|
output: number;
|
|
84
|
-
}, {
|
|
85
83
|
input: number;
|
|
84
|
+
}, {
|
|
86
85
|
output: number;
|
|
86
|
+
input: number;
|
|
87
87
|
}>;
|
|
88
88
|
contextWindow: z.ZodNumber;
|
|
89
89
|
releaseDate: z.ZodString;
|
|
@@ -93,8 +93,8 @@ export declare const ModelConfigSchema: z.ZodObject<{
|
|
|
93
93
|
displayName: string;
|
|
94
94
|
deprecated: boolean;
|
|
95
95
|
pricing: {
|
|
96
|
-
input: number;
|
|
97
96
|
output: number;
|
|
97
|
+
input: number;
|
|
98
98
|
};
|
|
99
99
|
contextWindow: number;
|
|
100
100
|
releaseDate: string;
|
|
@@ -104,8 +104,8 @@ export declare const ModelConfigSchema: z.ZodObject<{
|
|
|
104
104
|
displayName: string;
|
|
105
105
|
deprecated: boolean;
|
|
106
106
|
pricing: {
|
|
107
|
-
input: number;
|
|
108
107
|
output: number;
|
|
108
|
+
input: number;
|
|
109
109
|
};
|
|
110
110
|
contextWindow: number;
|
|
111
111
|
releaseDate: string;
|
|
@@ -125,11 +125,11 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
125
125
|
input: z.ZodNumber;
|
|
126
126
|
output: z.ZodNumber;
|
|
127
127
|
}, "strip", z.ZodTypeAny, {
|
|
128
|
-
input: number;
|
|
129
128
|
output: number;
|
|
130
|
-
}, {
|
|
131
129
|
input: number;
|
|
130
|
+
}, {
|
|
132
131
|
output: number;
|
|
132
|
+
input: number;
|
|
133
133
|
}>;
|
|
134
134
|
contextWindow: z.ZodNumber;
|
|
135
135
|
releaseDate: z.ZodString;
|
|
@@ -139,8 +139,8 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
139
139
|
displayName: string;
|
|
140
140
|
deprecated: boolean;
|
|
141
141
|
pricing: {
|
|
142
|
-
input: number;
|
|
143
142
|
output: number;
|
|
143
|
+
input: number;
|
|
144
144
|
};
|
|
145
145
|
contextWindow: number;
|
|
146
146
|
releaseDate: string;
|
|
@@ -150,8 +150,8 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
150
150
|
displayName: string;
|
|
151
151
|
deprecated: boolean;
|
|
152
152
|
pricing: {
|
|
153
|
-
input: number;
|
|
154
153
|
output: number;
|
|
154
|
+
input: number;
|
|
155
155
|
};
|
|
156
156
|
contextWindow: number;
|
|
157
157
|
releaseDate: string;
|
|
@@ -167,8 +167,8 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
167
167
|
displayName: string;
|
|
168
168
|
deprecated: boolean;
|
|
169
169
|
pricing: {
|
|
170
|
-
input: number;
|
|
171
170
|
output: number;
|
|
171
|
+
input: number;
|
|
172
172
|
};
|
|
173
173
|
contextWindow: number;
|
|
174
174
|
releaseDate: string;
|
|
@@ -184,8 +184,8 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
184
184
|
displayName: string;
|
|
185
185
|
deprecated: boolean;
|
|
186
186
|
pricing: {
|
|
187
|
-
input: number;
|
|
188
187
|
output: number;
|
|
188
|
+
input: number;
|
|
189
189
|
};
|
|
190
190
|
contextWindow: number;
|
|
191
191
|
releaseDate: string;
|
package/dist/types/pptTypes.d.ts
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* - CompleteSlide / PPTGenerationContext: Generation context types
|
|
11
11
|
* - PPTError: Error handling (follows VideoError pattern)
|
|
12
12
|
*/
|
|
13
|
-
import type {
|
|
13
|
+
import type { NeuroLink } from "../neurolink.js";
|
|
14
14
|
import { NeuroLinkError } from "../utils/errorHandling.js";
|
|
15
|
+
import type { ImageWithAltText } from "./content.js";
|
|
15
16
|
import type { AIProvider } from "./providers.js";
|
|
16
|
-
import type { NeuroLink } from "../neurolink.js";
|
|
17
17
|
export type ThemeOption = "modern" | "corporate" | "creative" | "minimal" | "dark";
|
|
18
18
|
export type AudienceOption = "business" | "students" | "technical" | "general";
|
|
19
19
|
export type ToneOption = "professional" | "casual" | "educational" | "persuasive";
|
|
@@ -681,11 +681,23 @@ export type CompleteSlide = {
|
|
|
681
681
|
};
|
|
682
682
|
generationTime: number;
|
|
683
683
|
};
|
|
684
|
+
/** Minimum number of slides allowed */
|
|
685
|
+
export declare const MIN_SLIDES = 5;
|
|
686
|
+
/** Maximum number of slides allowed */
|
|
687
|
+
export declare const MAX_SLIDES = 50;
|
|
684
688
|
/** Slide dimensions in inches by aspect ratio */
|
|
685
689
|
export declare const SLIDE_DIMENSIONS: Record<AspectRatioOption, {
|
|
686
690
|
width: number;
|
|
687
691
|
height: number;
|
|
688
692
|
}>;
|
|
693
|
+
/**
|
|
694
|
+
* Validate a hex color string (6 hex characters, no # prefix).
|
|
695
|
+
*/
|
|
696
|
+
export declare function isValidHexColor(color: string): boolean;
|
|
697
|
+
/**
|
|
698
|
+
* Normalize a hex color by stripping leading # if present.
|
|
699
|
+
*/
|
|
700
|
+
export declare function normalizeHexColor(color: string): string;
|
|
689
701
|
/**
|
|
690
702
|
* Text properties for addText method
|
|
691
703
|
* Represents individual text items with formatting options
|
package/dist/types/pptTypes.js
CHANGED
|
@@ -59,8 +59,24 @@ export class PPTError extends NeuroLinkError {
|
|
|
59
59
|
// ============================================================================
|
|
60
60
|
// VALIDATION CONSTANTS
|
|
61
61
|
// ============================================================================
|
|
62
|
+
/** Minimum number of slides allowed */
|
|
63
|
+
export const MIN_SLIDES = 5;
|
|
64
|
+
/** Maximum number of slides allowed */
|
|
65
|
+
export const MAX_SLIDES = 50;
|
|
62
66
|
/** Slide dimensions in inches by aspect ratio */
|
|
63
67
|
export const SLIDE_DIMENSIONS = {
|
|
64
68
|
"16:9": { width: 10, height: 5.625 },
|
|
65
69
|
"4:3": { width: 10, height: 7.5 },
|
|
66
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Validate a hex color string (6 hex characters, no # prefix).
|
|
73
|
+
*/
|
|
74
|
+
export function isValidHexColor(color) {
|
|
75
|
+
return /^[0-9A-Fa-f]{6}$/.test(color);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Normalize a hex color by stripping leading # if present.
|
|
79
|
+
*/
|
|
80
|
+
export function normalizeHexColor(color) {
|
|
81
|
+
return color.startsWith("#") ? color.slice(1) : color;
|
|
82
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delay Utilities
|
|
3
|
+
*
|
|
4
|
+
* Promise-based delay/sleep functions for async flow control.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Delay execution for a specified number of milliseconds.
|
|
8
|
+
*
|
|
9
|
+
* This is the canonical implementation for promise-based delays.
|
|
10
|
+
*
|
|
11
|
+
* @param ms - Duration to wait in milliseconds
|
|
12
|
+
* @returns Promise that resolves after the specified delay
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* await delay(1000); // Wait 1 second
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Use in a loop for polling
|
|
22
|
+
* while (condition) {
|
|
23
|
+
* await checkStatus();
|
|
24
|
+
* await delay(500);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function delay(ms: number): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Alias for delay - provided for code clarity in sleep-like contexts.
|
|
31
|
+
*
|
|
32
|
+
* @param ms - Duration to sleep in milliseconds
|
|
33
|
+
* @returns Promise that resolves after the specified duration
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* await sleep(2000); // Sleep for 2 seconds
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const sleep: typeof delay;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delay Utilities
|
|
3
|
+
*
|
|
4
|
+
* Promise-based delay/sleep functions for async flow control.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Delay execution for a specified number of milliseconds.
|
|
8
|
+
*
|
|
9
|
+
* This is the canonical implementation for promise-based delays.
|
|
10
|
+
*
|
|
11
|
+
* @param ms - Duration to wait in milliseconds
|
|
12
|
+
* @returns Promise that resolves after the specified delay
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* await delay(1000); // Wait 1 second
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Use in a loop for polling
|
|
22
|
+
* while (condition) {
|
|
23
|
+
* await checkStatus();
|
|
24
|
+
* await delay(500);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function delay(ms) {
|
|
29
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Alias for delay - provided for code clarity in sleep-like contexts.
|
|
33
|
+
*
|
|
34
|
+
* @param ms - Duration to sleep in milliseconds
|
|
35
|
+
* @returns Promise that resolves after the specified duration
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* await sleep(2000); // Sleep for 2 seconds
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const sleep = delay;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized async/promise utilities for NeuroLink.
|
|
5
|
+
* Provides common patterns like delays, timeouts, and retry logic.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { delay, withTimeout, retry } from './utils/async/index.js';
|
|
10
|
+
*
|
|
11
|
+
* // Simple delay
|
|
12
|
+
* await delay(1000);
|
|
13
|
+
*
|
|
14
|
+
* // Timeout protection
|
|
15
|
+
* const result = await withTimeout(fetchData(), 5000);
|
|
16
|
+
*
|
|
17
|
+
* // Retry with backoff
|
|
18
|
+
* const data = await retry(() => unreliableAPI(), { maxRetries: 3 });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export { delay, sleep } from "./delay.js";
|
|
22
|
+
export { calculateBackoff, createRetry, DEFAULT_RETRY_OPTIONS, RetryExhaustedError, type RetryOptions, retry, } from "./retry.js";
|
|
23
|
+
export { TimeoutError, withTimeout, withTimeoutFn } from "./withTimeout.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized async/promise utilities for NeuroLink.
|
|
5
|
+
* Provides common patterns like delays, timeouts, and retry logic.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { delay, withTimeout, retry } from './utils/async/index.js';
|
|
10
|
+
*
|
|
11
|
+
* // Simple delay
|
|
12
|
+
* await delay(1000);
|
|
13
|
+
*
|
|
14
|
+
* // Timeout protection
|
|
15
|
+
* const result = await withTimeout(fetchData(), 5000);
|
|
16
|
+
*
|
|
17
|
+
* // Retry with backoff
|
|
18
|
+
* const data = await retry(() => unreliableAPI(), { maxRetries: 3 });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export { delay, sleep } from "./delay.js";
|
|
22
|
+
export { calculateBackoff, createRetry, DEFAULT_RETRY_OPTIONS, RetryExhaustedError, retry, } from "./retry.js";
|
|
23
|
+
export { TimeoutError, withTimeout, withTimeoutFn } from "./withTimeout.js";
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides retry logic with exponential backoff for resilient async operations.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for retry operations.
|
|
8
|
+
*/
|
|
9
|
+
export interface RetryOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Maximum number of retry attempts (not including the initial attempt).
|
|
12
|
+
* @default 3
|
|
13
|
+
*/
|
|
14
|
+
maxRetries: number;
|
|
15
|
+
/**
|
|
16
|
+
* Initial delay between retries in milliseconds.
|
|
17
|
+
* @default 1000
|
|
18
|
+
*/
|
|
19
|
+
baseDelayMs: number;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum delay cap in milliseconds.
|
|
22
|
+
* @default 30000
|
|
23
|
+
*/
|
|
24
|
+
maxDelayMs: number;
|
|
25
|
+
/**
|
|
26
|
+
* Multiplier for exponential backoff.
|
|
27
|
+
* @default 2
|
|
28
|
+
*/
|
|
29
|
+
backoffMultiplier?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Function to determine if a retry should be attempted.
|
|
32
|
+
* Return false to stop retrying immediately.
|
|
33
|
+
*/
|
|
34
|
+
shouldRetry?: (error: Error, attempt: number) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Callback invoked before each retry attempt.
|
|
37
|
+
* Useful for logging or metrics.
|
|
38
|
+
*/
|
|
39
|
+
onRetry?: (error: Error, attempt: number, delayMs: number) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Default retry configuration.
|
|
43
|
+
*/
|
|
44
|
+
export declare const DEFAULT_RETRY_OPTIONS: RetryOptions;
|
|
45
|
+
/**
|
|
46
|
+
* Calculate exponential backoff delay with optional jitter.
|
|
47
|
+
*
|
|
48
|
+
* Uses the formula: min(baseDelay * 2^(attempt-1) + jitter, maxDelay)
|
|
49
|
+
*
|
|
50
|
+
* @param attempt - Current attempt number (1-based)
|
|
51
|
+
* @param baseDelayMs - Base delay in milliseconds
|
|
52
|
+
* @param maxDelayMs - Maximum delay cap in milliseconds
|
|
53
|
+
* @param addJitter - Whether to add random jitter (default: true)
|
|
54
|
+
* @returns Calculated delay in milliseconds
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Without jitter
|
|
59
|
+
* calculateBackoff(1, 1000, 30000, false); // 1000ms
|
|
60
|
+
* calculateBackoff(2, 1000, 30000, false); // 2000ms
|
|
61
|
+
* calculateBackoff(3, 1000, 30000, false); // 4000ms
|
|
62
|
+
*
|
|
63
|
+
* // With jitter (adds up to 10% random delay)
|
|
64
|
+
* calculateBackoff(3, 1000, 30000, true); // ~4000-4400ms
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function calculateBackoff(attempt: number, baseDelayMs: number, maxDelayMs: number, addJitter?: boolean): number;
|
|
68
|
+
/**
|
|
69
|
+
* Error thrown when all retry attempts are exhausted.
|
|
70
|
+
*/
|
|
71
|
+
export declare class RetryExhaustedError extends Error {
|
|
72
|
+
readonly attempts: number;
|
|
73
|
+
readonly lastError: Error;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a new RetryExhaustedError.
|
|
76
|
+
*
|
|
77
|
+
* @param message - Error message
|
|
78
|
+
* @param attempts - Total number of attempts made
|
|
79
|
+
* @param lastError - The last error that caused the final failure
|
|
80
|
+
*/
|
|
81
|
+
constructor(message: string, attempts: number, lastError: Error);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Retry an async function with exponential backoff.
|
|
85
|
+
*
|
|
86
|
+
* Executes the provided function and retries on failure according to
|
|
87
|
+
* the specified options. Uses exponential backoff between retries.
|
|
88
|
+
*
|
|
89
|
+
* @param fn - Async function to execute
|
|
90
|
+
* @param options - Retry configuration (merged with defaults)
|
|
91
|
+
* @returns Promise that resolves with the function result
|
|
92
|
+
* @throws The last error if all retries are exhausted
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Basic usage with defaults
|
|
97
|
+
* const data = await retry(() => fetchFromAPI());
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* // With custom options
|
|
103
|
+
* const data = await retry(
|
|
104
|
+
* () => fetchFromAPI(),
|
|
105
|
+
* {
|
|
106
|
+
* maxRetries: 5,
|
|
107
|
+
* baseDelayMs: 500,
|
|
108
|
+
* maxDelayMs: 10000,
|
|
109
|
+
* onRetry: (err, attempt, delay) => {
|
|
110
|
+
* console.log(`Retry ${attempt} after ${delay}ms: ${err.message}`);
|
|
111
|
+
* },
|
|
112
|
+
* shouldRetry: (err) => {
|
|
113
|
+
* // Only retry on network errors
|
|
114
|
+
* return err.name === 'NetworkError';
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
* );
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function retry<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
|
|
121
|
+
/**
|
|
122
|
+
* Create a retry wrapper with pre-configured options.
|
|
123
|
+
*
|
|
124
|
+
* Useful for creating reusable retry strategies.
|
|
125
|
+
*
|
|
126
|
+
* @param defaultOptions - Default retry options for the wrapper
|
|
127
|
+
* @returns A retry function with the specified defaults
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const apiRetry = createRetry({
|
|
132
|
+
* maxRetries: 5,
|
|
133
|
+
* baseDelayMs: 100,
|
|
134
|
+
* onRetry: (err, attempt) => logger.warn(`API retry ${attempt}`)
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // Use the configured retry
|
|
138
|
+
* const data = await apiRetry(() => fetchFromAPI());
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function createRetry(defaultOptions: Partial<RetryOptions>): <T>(fn: () => Promise<T>, overrideOptions?: Partial<RetryOptions>) => Promise<T>;
|