@digilogiclabs/platform-core 1.20.3 → 1.23.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/dist/{ConsoleEmail-CO0OM4UT.d.ts → ConsoleEmail-CgSIvRdj.d.mts} +5 -46
- package/dist/{ConsoleEmail-DDB28vyS.d.mts → ConsoleEmail-iJO7Cb_v.d.ts} +5 -46
- package/dist/{IAI-D8wA_i8N.d.mts → IAI-B7pp322X.d.mts} +1 -170
- package/dist/{IAI-D8wA_i8N.d.ts → IAI-B7pp322X.d.ts} +1 -170
- package/dist/ICache-BWSuTuhz.d.mts +66 -0
- package/dist/ICache-BWSuTuhz.d.ts +66 -0
- package/dist/IEmail-CsOcaQcb.d.mts +45 -0
- package/dist/IEmail-CsOcaQcb.d.ts +45 -0
- package/dist/ILogger-DLDBZaH4.d.mts +105 -0
- package/dist/ILogger-DLDBZaH4.d.ts +105 -0
- package/dist/{agents-DGciJI27.d.mts → agents-C7FPA8y9.d.mts} +3 -1
- package/dist/{agents-Cc65YUoW.d.ts → agents-qyQ3BtXy.d.ts} +3 -1
- package/dist/agents.d.mts +4 -2
- package/dist/agents.d.ts +4 -2
- package/dist/auth.d.mts +386 -1
- package/dist/auth.d.ts +386 -1
- package/dist/auth.js +451 -0
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +434 -0
- package/dist/auth.mjs.map +1 -1
- package/dist/circuit-breaker-CP6kw0P5.d.ts +351 -0
- package/dist/circuit-breaker-CsQivd57.d.mts +351 -0
- package/dist/email-templates.d.mts +106 -1
- package/dist/email-templates.d.ts +106 -1
- package/dist/email-templates.js +608 -0
- package/dist/email-templates.js.map +1 -1
- package/dist/email-templates.mjs +596 -0
- package/dist/email-templates.mjs.map +1 -1
- package/dist/index.d.mts +14 -355
- package/dist/index.d.ts +14 -355
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/dist/migrate.js +0 -0
- package/dist/testing.d.mts +6 -3
- package/dist/testing.d.ts +6 -3
- package/package.json +11 -11
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { I as ICache
|
|
1
|
+
import { I as ICache } from './ICache-BWSuTuhz.mjs';
|
|
2
|
+
import { I as IEmail, E as EmailMessage, a as EmailResult } from './IEmail-CsOcaQcb.mjs';
|
|
3
|
+
import { I as ILogger } from './ILogger-DLDBZaH4.mjs';
|
|
4
|
+
import { I as ITracing, a as IAI } from './IAI-B7pp322X.mjs';
|
|
2
5
|
import { z } from 'zod';
|
|
3
6
|
|
|
4
7
|
/**
|
|
@@ -106,50 +109,6 @@ interface IStorage {
|
|
|
106
109
|
healthCheck(): Promise<boolean>;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
/**
|
|
110
|
-
* Email abstraction interface
|
|
111
|
-
* Provides a vendor-agnostic way to send emails
|
|
112
|
-
*/
|
|
113
|
-
interface EmailAddress {
|
|
114
|
-
email: string;
|
|
115
|
-
name?: string;
|
|
116
|
-
}
|
|
117
|
-
interface EmailAttachment {
|
|
118
|
-
filename: string;
|
|
119
|
-
content: Buffer | string;
|
|
120
|
-
contentType?: string;
|
|
121
|
-
}
|
|
122
|
-
interface EmailMessage {
|
|
123
|
-
to: EmailAddress | EmailAddress[];
|
|
124
|
-
from?: EmailAddress;
|
|
125
|
-
replyTo?: EmailAddress;
|
|
126
|
-
subject: string;
|
|
127
|
-
text?: string;
|
|
128
|
-
html?: string;
|
|
129
|
-
attachments?: EmailAttachment[];
|
|
130
|
-
headers?: Record<string, string>;
|
|
131
|
-
tags?: string[];
|
|
132
|
-
}
|
|
133
|
-
interface EmailResult {
|
|
134
|
-
id: string;
|
|
135
|
-
success: boolean;
|
|
136
|
-
error?: Error;
|
|
137
|
-
}
|
|
138
|
-
interface IEmail {
|
|
139
|
-
/**
|
|
140
|
-
* Send an email
|
|
141
|
-
*/
|
|
142
|
-
send(message: EmailMessage): Promise<EmailResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Send multiple emails (batch)
|
|
145
|
-
*/
|
|
146
|
-
sendBatch(messages: EmailMessage[]): Promise<EmailResult[]>;
|
|
147
|
-
/**
|
|
148
|
-
* Check email service connectivity
|
|
149
|
-
*/
|
|
150
|
-
healthCheck(): Promise<boolean>;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
112
|
/**
|
|
154
113
|
* Queue abstraction interface
|
|
155
114
|
* Provides a vendor-agnostic way to work with job queues
|
|
@@ -2146,4 +2105,4 @@ declare class ConsoleEmail implements IEmail {
|
|
|
2146
2105
|
private formatAddresses;
|
|
2147
2106
|
}
|
|
2148
2107
|
|
|
2149
|
-
export { type
|
|
2108
|
+
export { type JobEvent as $, type RAGDocument as A, type IngestionOptions as B, ConsoleEmail as C, type DeterministicEncryptedField as D, EnvSecrets as E, type BulkIngestionResult as F, type IngestionResult as G, type DocumentStatus as H, type IPlatform as I, type Job as J, type KeyRotationResult as K, type RAGChunk as L, MemoryDatabase as M, NoopMetrics as N, type RAGSearchQuery as O, type PlatformHealthStatus as P, type QueryResult as Q, type RepeatOptions as R, type StorageFile as S, type RAGSearchResponse as T, type UploadOptions as U, type RAGSearchResult as V, type ContextAssemblyConfig as W, type AssembledContext as X, type RAGPipeline as Y, type JobResult as Z, type JobContext as _, MemoryCache as a, type SecurityConfig as a$, type QueueStats as a0, type BackoffOptions as a1, type MetricTags as a2, type HistogramStats as a3, type TimingStats as a4, type Secret as a5, type SecretMetadata as a6, type GetSecretOptions as a7, type SetSecretOptions as a8, type RotateSecretOptions as a9, EmailConfigSchema as aA, QueueConfigSchema as aB, AIConfigSchema as aC, RAGConfigSchema as aD, CryptoConfigSchema as aE, SecurityConfigSchema as aF, RetryConfigSchema as aG, CircuitBreakerConfigSchema as aH, TimeoutConfigSchema as aI, BulkheadConfigSchema as aJ, ResilienceConfigSchema as aK, LoggingConfigSchema as aL, MetricsConfigSchema as aM, TracingConfigSchema as aN, ObservabilityConfigSchema as aO, MiddlewareConfigSchema as aP, PlatformConfigSchema as aQ, type PlatformConfig as aR, type DatabaseConfig as aS, type CacheConfig as aT, type StorageConfig as aU, type EmailConfig as aV, type QueueConfig as aW, type ResilienceConfig as aX, type ObservabilityConfig as aY, type MiddlewareConfig as aZ, type CryptoConfig as a_, type RotationResult as aa, MemoryRAG as ab, ChunkingPresets as ac, type ChunkingStrategy as ad, type ChunkingConfig as ae, type SearchMode as af, type RAGFilter as ag, type RAGPipelineStep as ah, type CryptoKeyStatus as ai, type CryptoAlgorithm as aj, createPlatformAsync as ak, createScopedMetrics as al, calculateBackoff as am, generateJobId as an, DatabaseProviderSchema as ao, CacheProviderSchema as ap, StorageProviderSchema as aq, EmailProviderSchema as ar, QueueProviderSchema as as, TracingProviderSchema as at, LogLevelSchema as au, AIProviderSchema as av, RAGProviderSchema as aw, DatabaseConfigSchema as ax, CacheConfigSchema as ay, StorageConfigSchema as az, MemoryStorage as b, loadConfig as b0, validateConfig as b1, safeValidateConfig as b2, getDefaultConfig as b3, MemoryEmail as c, MemoryQueue as d, type IDatabase as e, MemorySecrets as f, createPlatform as g, MemoryMetrics as h, type IQueryBuilder as i, type IStorage as j, type IQueue as k, type IMetrics as l, type ISecrets as m, type JobOptions as n, type MetricsSummary as o, type ICrypto as p, type EncryptOptions as q, type EncryptedField as r, type CryptoKeyMetadata as s, type JobState as t, type JobEventType as u, type JobEventHandler as v, type IRAG as w, type RAGConfig as x, type CreateCollectionOptions as y, type RAGCollection as z };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { I as ICache
|
|
1
|
+
import { I as ICache } from './ICache-BWSuTuhz.js';
|
|
2
|
+
import { I as IEmail, E as EmailMessage, a as EmailResult } from './IEmail-CsOcaQcb.js';
|
|
3
|
+
import { I as ILogger } from './ILogger-DLDBZaH4.js';
|
|
4
|
+
import { I as ITracing, a as IAI } from './IAI-B7pp322X.js';
|
|
2
5
|
import { z } from 'zod';
|
|
3
6
|
|
|
4
7
|
/**
|
|
@@ -106,50 +109,6 @@ interface IStorage {
|
|
|
106
109
|
healthCheck(): Promise<boolean>;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
/**
|
|
110
|
-
* Email abstraction interface
|
|
111
|
-
* Provides a vendor-agnostic way to send emails
|
|
112
|
-
*/
|
|
113
|
-
interface EmailAddress {
|
|
114
|
-
email: string;
|
|
115
|
-
name?: string;
|
|
116
|
-
}
|
|
117
|
-
interface EmailAttachment {
|
|
118
|
-
filename: string;
|
|
119
|
-
content: Buffer | string;
|
|
120
|
-
contentType?: string;
|
|
121
|
-
}
|
|
122
|
-
interface EmailMessage {
|
|
123
|
-
to: EmailAddress | EmailAddress[];
|
|
124
|
-
from?: EmailAddress;
|
|
125
|
-
replyTo?: EmailAddress;
|
|
126
|
-
subject: string;
|
|
127
|
-
text?: string;
|
|
128
|
-
html?: string;
|
|
129
|
-
attachments?: EmailAttachment[];
|
|
130
|
-
headers?: Record<string, string>;
|
|
131
|
-
tags?: string[];
|
|
132
|
-
}
|
|
133
|
-
interface EmailResult {
|
|
134
|
-
id: string;
|
|
135
|
-
success: boolean;
|
|
136
|
-
error?: Error;
|
|
137
|
-
}
|
|
138
|
-
interface IEmail {
|
|
139
|
-
/**
|
|
140
|
-
* Send an email
|
|
141
|
-
*/
|
|
142
|
-
send(message: EmailMessage): Promise<EmailResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Send multiple emails (batch)
|
|
145
|
-
*/
|
|
146
|
-
sendBatch(messages: EmailMessage[]): Promise<EmailResult[]>;
|
|
147
|
-
/**
|
|
148
|
-
* Check email service connectivity
|
|
149
|
-
*/
|
|
150
|
-
healthCheck(): Promise<boolean>;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
112
|
/**
|
|
154
113
|
* Queue abstraction interface
|
|
155
114
|
* Provides a vendor-agnostic way to work with job queues
|
|
@@ -2146,4 +2105,4 @@ declare class ConsoleEmail implements IEmail {
|
|
|
2146
2105
|
private formatAddresses;
|
|
2147
2106
|
}
|
|
2148
2107
|
|
|
2149
|
-
export { type
|
|
2108
|
+
export { type JobEvent as $, type RAGDocument as A, type IngestionOptions as B, ConsoleEmail as C, type DeterministicEncryptedField as D, EnvSecrets as E, type BulkIngestionResult as F, type IngestionResult as G, type DocumentStatus as H, type IPlatform as I, type Job as J, type KeyRotationResult as K, type RAGChunk as L, MemoryDatabase as M, NoopMetrics as N, type RAGSearchQuery as O, type PlatformHealthStatus as P, type QueryResult as Q, type RepeatOptions as R, type StorageFile as S, type RAGSearchResponse as T, type UploadOptions as U, type RAGSearchResult as V, type ContextAssemblyConfig as W, type AssembledContext as X, type RAGPipeline as Y, type JobResult as Z, type JobContext as _, MemoryCache as a, type SecurityConfig as a$, type QueueStats as a0, type BackoffOptions as a1, type MetricTags as a2, type HistogramStats as a3, type TimingStats as a4, type Secret as a5, type SecretMetadata as a6, type GetSecretOptions as a7, type SetSecretOptions as a8, type RotateSecretOptions as a9, EmailConfigSchema as aA, QueueConfigSchema as aB, AIConfigSchema as aC, RAGConfigSchema as aD, CryptoConfigSchema as aE, SecurityConfigSchema as aF, RetryConfigSchema as aG, CircuitBreakerConfigSchema as aH, TimeoutConfigSchema as aI, BulkheadConfigSchema as aJ, ResilienceConfigSchema as aK, LoggingConfigSchema as aL, MetricsConfigSchema as aM, TracingConfigSchema as aN, ObservabilityConfigSchema as aO, MiddlewareConfigSchema as aP, PlatformConfigSchema as aQ, type PlatformConfig as aR, type DatabaseConfig as aS, type CacheConfig as aT, type StorageConfig as aU, type EmailConfig as aV, type QueueConfig as aW, type ResilienceConfig as aX, type ObservabilityConfig as aY, type MiddlewareConfig as aZ, type CryptoConfig as a_, type RotationResult as aa, MemoryRAG as ab, ChunkingPresets as ac, type ChunkingStrategy as ad, type ChunkingConfig as ae, type SearchMode as af, type RAGFilter as ag, type RAGPipelineStep as ah, type CryptoKeyStatus as ai, type CryptoAlgorithm as aj, createPlatformAsync as ak, createScopedMetrics as al, calculateBackoff as am, generateJobId as an, DatabaseProviderSchema as ao, CacheProviderSchema as ap, StorageProviderSchema as aq, EmailProviderSchema as ar, QueueProviderSchema as as, TracingProviderSchema as at, LogLevelSchema as au, AIProviderSchema as av, RAGProviderSchema as aw, DatabaseConfigSchema as ax, CacheConfigSchema as ay, StorageConfigSchema as az, MemoryStorage as b, loadConfig as b0, validateConfig as b1, safeValidateConfig as b2, getDefaultConfig as b3, MemoryEmail as c, MemoryQueue as d, type IDatabase as e, MemorySecrets as f, createPlatform as g, MemoryMetrics as h, type IQueryBuilder as i, type IStorage as j, type IQueue as k, type IMetrics as l, type ISecrets as m, type JobOptions as n, type MetricsSummary as o, type ICrypto as p, type EncryptOptions as q, type EncryptedField as r, type CryptoKeyMetadata as s, type JobState as t, type JobEventType as u, type JobEventHandler as v, type IRAG as w, type RAGConfig as x, type CreateCollectionOptions as y, type RAGCollection as z };
|
|
@@ -1,172 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache abstraction interface
|
|
3
|
-
* Provides a vendor-agnostic way to interact with key-value caches
|
|
4
|
-
*/
|
|
5
|
-
interface ICacheOptions {
|
|
6
|
-
/** Time to live in seconds */
|
|
7
|
-
ttl?: number;
|
|
8
|
-
/** Cache key prefix */
|
|
9
|
-
prefix?: string;
|
|
10
|
-
}
|
|
11
|
-
interface ICache {
|
|
12
|
-
/**
|
|
13
|
-
* Get a value from cache
|
|
14
|
-
*/
|
|
15
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Set a value in cache
|
|
18
|
-
*/
|
|
19
|
-
set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Delete a value from cache
|
|
22
|
-
*/
|
|
23
|
-
delete(key: string): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Check if key exists
|
|
26
|
-
*/
|
|
27
|
-
exists(key: string): Promise<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* Delete all keys matching pattern
|
|
30
|
-
*/
|
|
31
|
-
deletePattern(pattern: string): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Get multiple values
|
|
34
|
-
*/
|
|
35
|
-
mget<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Set multiple values
|
|
38
|
-
*/
|
|
39
|
-
mset<T = unknown>(entries: Array<{
|
|
40
|
-
key: string;
|
|
41
|
-
value: T;
|
|
42
|
-
ttl?: number;
|
|
43
|
-
}>): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Increment a numeric value
|
|
46
|
-
*/
|
|
47
|
-
incr(key: string, by?: number): Promise<number>;
|
|
48
|
-
/**
|
|
49
|
-
* Publish a message to a channel
|
|
50
|
-
*/
|
|
51
|
-
publish(channel: string, message: string): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Subscribe to a channel
|
|
54
|
-
*/
|
|
55
|
-
subscribe(channel: string, callback: (message: string) => void): Promise<() => void>;
|
|
56
|
-
/**
|
|
57
|
-
* Check cache connectivity
|
|
58
|
-
*/
|
|
59
|
-
healthCheck(): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Close cache connection
|
|
62
|
-
*/
|
|
63
|
-
close(): Promise<void>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Logger Interface
|
|
68
|
-
* Standardizes logging across the platform
|
|
69
|
-
*/
|
|
70
|
-
/**
|
|
71
|
-
* Log levels in order of severity
|
|
72
|
-
*/
|
|
73
|
-
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
74
|
-
/**
|
|
75
|
-
* Metadata that can be attached to log entries
|
|
76
|
-
*/
|
|
77
|
-
interface LogMeta {
|
|
78
|
-
/** Error object if logging an error */
|
|
79
|
-
error?: Error;
|
|
80
|
-
/** Duration in milliseconds (for timing operations) */
|
|
81
|
-
duration?: number;
|
|
82
|
-
/** Request ID for tracing */
|
|
83
|
-
requestId?: string;
|
|
84
|
-
/** User ID if applicable */
|
|
85
|
-
userId?: string;
|
|
86
|
-
/** Any additional key-value pairs */
|
|
87
|
-
[key: string]: unknown;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* A structured log entry
|
|
91
|
-
*/
|
|
92
|
-
interface LogEntry {
|
|
93
|
-
/** Log level */
|
|
94
|
-
level: LogLevel;
|
|
95
|
-
/** Log message */
|
|
96
|
-
message: string;
|
|
97
|
-
/** When the log was created */
|
|
98
|
-
timestamp: Date;
|
|
99
|
-
/** Optional metadata */
|
|
100
|
-
meta?: LogMeta;
|
|
101
|
-
/** Logger context (e.g., service name) */
|
|
102
|
-
context?: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Logger interface for structured logging
|
|
106
|
-
*/
|
|
107
|
-
interface ILogger {
|
|
108
|
-
/**
|
|
109
|
-
* Log a debug message (for development/troubleshooting)
|
|
110
|
-
*/
|
|
111
|
-
debug(message: string, meta?: LogMeta): void;
|
|
112
|
-
/**
|
|
113
|
-
* Log an informational message
|
|
114
|
-
*/
|
|
115
|
-
info(message: string, meta?: LogMeta): void;
|
|
116
|
-
/**
|
|
117
|
-
* Log a warning message
|
|
118
|
-
*/
|
|
119
|
-
warn(message: string, meta?: LogMeta): void;
|
|
120
|
-
/**
|
|
121
|
-
* Log an error message
|
|
122
|
-
*/
|
|
123
|
-
error(message: string, meta?: LogMeta): void;
|
|
124
|
-
/**
|
|
125
|
-
* Create a child logger with additional context
|
|
126
|
-
* @param context Additional context to include in all logs from this child
|
|
127
|
-
*/
|
|
128
|
-
child(context: Record<string, unknown>): ILogger;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Configuration options for loggers
|
|
132
|
-
*/
|
|
133
|
-
interface LoggerConfig {
|
|
134
|
-
/** Minimum level to log */
|
|
135
|
-
level?: LogLevel;
|
|
136
|
-
/** Whether to pretty print (for development) */
|
|
137
|
-
pretty?: boolean;
|
|
138
|
-
/** Service name to include in logs */
|
|
139
|
-
service?: string;
|
|
140
|
-
/** Environment name */
|
|
141
|
-
environment?: string;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Console logger implementation (for development)
|
|
145
|
-
*/
|
|
146
|
-
declare class ConsoleLogger implements ILogger {
|
|
147
|
-
private context;
|
|
148
|
-
private level;
|
|
149
|
-
private static levelPriority;
|
|
150
|
-
constructor(config?: LoggerConfig);
|
|
151
|
-
private shouldLog;
|
|
152
|
-
private log;
|
|
153
|
-
debug(message: string, meta?: LogMeta): void;
|
|
154
|
-
info(message: string, meta?: LogMeta): void;
|
|
155
|
-
warn(message: string, meta?: LogMeta): void;
|
|
156
|
-
error(message: string, meta?: LogMeta): void;
|
|
157
|
-
child(context: Record<string, unknown>): ILogger;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* No-op logger for testing or when logging is disabled
|
|
161
|
-
*/
|
|
162
|
-
declare class NoopLogger implements ILogger {
|
|
163
|
-
debug(): void;
|
|
164
|
-
info(): void;
|
|
165
|
-
warn(): void;
|
|
166
|
-
error(): void;
|
|
167
|
-
child(): ILogger;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
1
|
/**
|
|
171
2
|
* Distributed Tracing Interface
|
|
172
3
|
*
|
|
@@ -715,4 +546,4 @@ declare class MemoryAI implements IAI {
|
|
|
715
546
|
private cosineSimilarity;
|
|
716
547
|
}
|
|
717
548
|
|
|
718
|
-
export { type AIConfig as A, type
|
|
549
|
+
export { type AIConfig as A, type ISpan as B, type SpanOptions as C, type SpanStatus as D, type SpanKind as E, type SpanStatusCode as F, type SpanEvent as G, type ITracing as I, MemoryAI as M, NoopTracing as N, type RoutingStrategy as R, type SpanContext as S, type TracingConfig as T, type IAI as a, type AIChatRequest as b, type AIChatResponse as c, type AIStreamChunk as d, type AIStreamCallback as e, type AICompletionRequest as f, type AICompletionResponse as g, type AIEmbeddingRequest as h, type AIEmbeddingResponse as i, type AIModelConfig as j, type AIModelType as k, type AIProvider as l, createAIError as m, isAIError as n, AIErrorMessages as o, type AIRole as p, type AIMessage as q, type AIToolCall as r, type AITool as s, type AIChatChoice as t, type AIFinishReason as u, type AIUsageInfo as v, type AIRouterConfig as w, type AIErrorCode as x, type AIError as y, MemoryTracing as z };
|
|
@@ -1,172 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache abstraction interface
|
|
3
|
-
* Provides a vendor-agnostic way to interact with key-value caches
|
|
4
|
-
*/
|
|
5
|
-
interface ICacheOptions {
|
|
6
|
-
/** Time to live in seconds */
|
|
7
|
-
ttl?: number;
|
|
8
|
-
/** Cache key prefix */
|
|
9
|
-
prefix?: string;
|
|
10
|
-
}
|
|
11
|
-
interface ICache {
|
|
12
|
-
/**
|
|
13
|
-
* Get a value from cache
|
|
14
|
-
*/
|
|
15
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Set a value in cache
|
|
18
|
-
*/
|
|
19
|
-
set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Delete a value from cache
|
|
22
|
-
*/
|
|
23
|
-
delete(key: string): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Check if key exists
|
|
26
|
-
*/
|
|
27
|
-
exists(key: string): Promise<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* Delete all keys matching pattern
|
|
30
|
-
*/
|
|
31
|
-
deletePattern(pattern: string): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Get multiple values
|
|
34
|
-
*/
|
|
35
|
-
mget<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Set multiple values
|
|
38
|
-
*/
|
|
39
|
-
mset<T = unknown>(entries: Array<{
|
|
40
|
-
key: string;
|
|
41
|
-
value: T;
|
|
42
|
-
ttl?: number;
|
|
43
|
-
}>): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Increment a numeric value
|
|
46
|
-
*/
|
|
47
|
-
incr(key: string, by?: number): Promise<number>;
|
|
48
|
-
/**
|
|
49
|
-
* Publish a message to a channel
|
|
50
|
-
*/
|
|
51
|
-
publish(channel: string, message: string): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Subscribe to a channel
|
|
54
|
-
*/
|
|
55
|
-
subscribe(channel: string, callback: (message: string) => void): Promise<() => void>;
|
|
56
|
-
/**
|
|
57
|
-
* Check cache connectivity
|
|
58
|
-
*/
|
|
59
|
-
healthCheck(): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Close cache connection
|
|
62
|
-
*/
|
|
63
|
-
close(): Promise<void>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Logger Interface
|
|
68
|
-
* Standardizes logging across the platform
|
|
69
|
-
*/
|
|
70
|
-
/**
|
|
71
|
-
* Log levels in order of severity
|
|
72
|
-
*/
|
|
73
|
-
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
74
|
-
/**
|
|
75
|
-
* Metadata that can be attached to log entries
|
|
76
|
-
*/
|
|
77
|
-
interface LogMeta {
|
|
78
|
-
/** Error object if logging an error */
|
|
79
|
-
error?: Error;
|
|
80
|
-
/** Duration in milliseconds (for timing operations) */
|
|
81
|
-
duration?: number;
|
|
82
|
-
/** Request ID for tracing */
|
|
83
|
-
requestId?: string;
|
|
84
|
-
/** User ID if applicable */
|
|
85
|
-
userId?: string;
|
|
86
|
-
/** Any additional key-value pairs */
|
|
87
|
-
[key: string]: unknown;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* A structured log entry
|
|
91
|
-
*/
|
|
92
|
-
interface LogEntry {
|
|
93
|
-
/** Log level */
|
|
94
|
-
level: LogLevel;
|
|
95
|
-
/** Log message */
|
|
96
|
-
message: string;
|
|
97
|
-
/** When the log was created */
|
|
98
|
-
timestamp: Date;
|
|
99
|
-
/** Optional metadata */
|
|
100
|
-
meta?: LogMeta;
|
|
101
|
-
/** Logger context (e.g., service name) */
|
|
102
|
-
context?: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Logger interface for structured logging
|
|
106
|
-
*/
|
|
107
|
-
interface ILogger {
|
|
108
|
-
/**
|
|
109
|
-
* Log a debug message (for development/troubleshooting)
|
|
110
|
-
*/
|
|
111
|
-
debug(message: string, meta?: LogMeta): void;
|
|
112
|
-
/**
|
|
113
|
-
* Log an informational message
|
|
114
|
-
*/
|
|
115
|
-
info(message: string, meta?: LogMeta): void;
|
|
116
|
-
/**
|
|
117
|
-
* Log a warning message
|
|
118
|
-
*/
|
|
119
|
-
warn(message: string, meta?: LogMeta): void;
|
|
120
|
-
/**
|
|
121
|
-
* Log an error message
|
|
122
|
-
*/
|
|
123
|
-
error(message: string, meta?: LogMeta): void;
|
|
124
|
-
/**
|
|
125
|
-
* Create a child logger with additional context
|
|
126
|
-
* @param context Additional context to include in all logs from this child
|
|
127
|
-
*/
|
|
128
|
-
child(context: Record<string, unknown>): ILogger;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Configuration options for loggers
|
|
132
|
-
*/
|
|
133
|
-
interface LoggerConfig {
|
|
134
|
-
/** Minimum level to log */
|
|
135
|
-
level?: LogLevel;
|
|
136
|
-
/** Whether to pretty print (for development) */
|
|
137
|
-
pretty?: boolean;
|
|
138
|
-
/** Service name to include in logs */
|
|
139
|
-
service?: string;
|
|
140
|
-
/** Environment name */
|
|
141
|
-
environment?: string;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Console logger implementation (for development)
|
|
145
|
-
*/
|
|
146
|
-
declare class ConsoleLogger implements ILogger {
|
|
147
|
-
private context;
|
|
148
|
-
private level;
|
|
149
|
-
private static levelPriority;
|
|
150
|
-
constructor(config?: LoggerConfig);
|
|
151
|
-
private shouldLog;
|
|
152
|
-
private log;
|
|
153
|
-
debug(message: string, meta?: LogMeta): void;
|
|
154
|
-
info(message: string, meta?: LogMeta): void;
|
|
155
|
-
warn(message: string, meta?: LogMeta): void;
|
|
156
|
-
error(message: string, meta?: LogMeta): void;
|
|
157
|
-
child(context: Record<string, unknown>): ILogger;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* No-op logger for testing or when logging is disabled
|
|
161
|
-
*/
|
|
162
|
-
declare class NoopLogger implements ILogger {
|
|
163
|
-
debug(): void;
|
|
164
|
-
info(): void;
|
|
165
|
-
warn(): void;
|
|
166
|
-
error(): void;
|
|
167
|
-
child(): ILogger;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
1
|
/**
|
|
171
2
|
* Distributed Tracing Interface
|
|
172
3
|
*
|
|
@@ -715,4 +546,4 @@ declare class MemoryAI implements IAI {
|
|
|
715
546
|
private cosineSimilarity;
|
|
716
547
|
}
|
|
717
548
|
|
|
718
|
-
export { type AIConfig as A, type
|
|
549
|
+
export { type AIConfig as A, type ISpan as B, type SpanOptions as C, type SpanStatus as D, type SpanKind as E, type SpanStatusCode as F, type SpanEvent as G, type ITracing as I, MemoryAI as M, NoopTracing as N, type RoutingStrategy as R, type SpanContext as S, type TracingConfig as T, type IAI as a, type AIChatRequest as b, type AIChatResponse as c, type AIStreamChunk as d, type AIStreamCallback as e, type AICompletionRequest as f, type AICompletionResponse as g, type AIEmbeddingRequest as h, type AIEmbeddingResponse as i, type AIModelConfig as j, type AIModelType as k, type AIProvider as l, createAIError as m, isAIError as n, AIErrorMessages as o, type AIRole as p, type AIMessage as q, type AIToolCall as r, type AITool as s, type AIChatChoice as t, type AIFinishReason as u, type AIUsageInfo as v, type AIRouterConfig as w, type AIErrorCode as x, type AIError as y, MemoryTracing as z };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache abstraction interface
|
|
3
|
+
* Provides a vendor-agnostic way to interact with key-value caches
|
|
4
|
+
*/
|
|
5
|
+
interface ICacheOptions {
|
|
6
|
+
/** Time to live in seconds */
|
|
7
|
+
ttl?: number;
|
|
8
|
+
/** Cache key prefix */
|
|
9
|
+
prefix?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ICache {
|
|
12
|
+
/**
|
|
13
|
+
* Get a value from cache
|
|
14
|
+
*/
|
|
15
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Set a value in cache
|
|
18
|
+
*/
|
|
19
|
+
set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Delete a value from cache
|
|
22
|
+
*/
|
|
23
|
+
delete(key: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if key exists
|
|
26
|
+
*/
|
|
27
|
+
exists(key: string): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete all keys matching pattern
|
|
30
|
+
*/
|
|
31
|
+
deletePattern(pattern: string): Promise<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Get multiple values
|
|
34
|
+
*/
|
|
35
|
+
mget<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Set multiple values
|
|
38
|
+
*/
|
|
39
|
+
mset<T = unknown>(entries: Array<{
|
|
40
|
+
key: string;
|
|
41
|
+
value: T;
|
|
42
|
+
ttl?: number;
|
|
43
|
+
}>): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Increment a numeric value
|
|
46
|
+
*/
|
|
47
|
+
incr(key: string, by?: number): Promise<number>;
|
|
48
|
+
/**
|
|
49
|
+
* Publish a message to a channel
|
|
50
|
+
*/
|
|
51
|
+
publish(channel: string, message: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe to a channel
|
|
54
|
+
*/
|
|
55
|
+
subscribe(channel: string, callback: (message: string) => void): Promise<() => void>;
|
|
56
|
+
/**
|
|
57
|
+
* Check cache connectivity
|
|
58
|
+
*/
|
|
59
|
+
healthCheck(): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Close cache connection
|
|
62
|
+
*/
|
|
63
|
+
close(): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type { ICache as I, ICacheOptions as a };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache abstraction interface
|
|
3
|
+
* Provides a vendor-agnostic way to interact with key-value caches
|
|
4
|
+
*/
|
|
5
|
+
interface ICacheOptions {
|
|
6
|
+
/** Time to live in seconds */
|
|
7
|
+
ttl?: number;
|
|
8
|
+
/** Cache key prefix */
|
|
9
|
+
prefix?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ICache {
|
|
12
|
+
/**
|
|
13
|
+
* Get a value from cache
|
|
14
|
+
*/
|
|
15
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Set a value in cache
|
|
18
|
+
*/
|
|
19
|
+
set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Delete a value from cache
|
|
22
|
+
*/
|
|
23
|
+
delete(key: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if key exists
|
|
26
|
+
*/
|
|
27
|
+
exists(key: string): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete all keys matching pattern
|
|
30
|
+
*/
|
|
31
|
+
deletePattern(pattern: string): Promise<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Get multiple values
|
|
34
|
+
*/
|
|
35
|
+
mget<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Set multiple values
|
|
38
|
+
*/
|
|
39
|
+
mset<T = unknown>(entries: Array<{
|
|
40
|
+
key: string;
|
|
41
|
+
value: T;
|
|
42
|
+
ttl?: number;
|
|
43
|
+
}>): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Increment a numeric value
|
|
46
|
+
*/
|
|
47
|
+
incr(key: string, by?: number): Promise<number>;
|
|
48
|
+
/**
|
|
49
|
+
* Publish a message to a channel
|
|
50
|
+
*/
|
|
51
|
+
publish(channel: string, message: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe to a channel
|
|
54
|
+
*/
|
|
55
|
+
subscribe(channel: string, callback: (message: string) => void): Promise<() => void>;
|
|
56
|
+
/**
|
|
57
|
+
* Check cache connectivity
|
|
58
|
+
*/
|
|
59
|
+
healthCheck(): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Close cache connection
|
|
62
|
+
*/
|
|
63
|
+
close(): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type { ICache as I, ICacheOptions as a };
|