@digilogiclabs/platform-core 1.20.3 → 1.21.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.
Files changed (36) hide show
  1. package/dist/{ConsoleEmail-CO0OM4UT.d.ts → ConsoleEmail-BbdpINKx.d.ts} +4 -46
  2. package/dist/{ConsoleEmail-DDB28vyS.d.mts → ConsoleEmail-DpxhsG9C.d.mts} +4 -46
  3. package/dist/{IAI-D8wA_i8N.d.mts → IAI-CWd11dzL.d.mts} +1 -105
  4. package/dist/{IAI-D8wA_i8N.d.ts → IAI-CWd11dzL.d.ts} +1 -105
  5. package/dist/IEmail-CsOcaQcb.d.mts +45 -0
  6. package/dist/IEmail-CsOcaQcb.d.ts +45 -0
  7. package/dist/ILogger-DLDBZaH4.d.mts +105 -0
  8. package/dist/ILogger-DLDBZaH4.d.ts +105 -0
  9. package/dist/{agents-Cc65YUoW.d.ts → agents-C42rGwRl.d.ts} +2 -1
  10. package/dist/{agents-DGciJI27.d.mts → agents-CES-Aq1K.d.mts} +2 -1
  11. package/dist/agents.d.mts +3 -2
  12. package/dist/agents.d.ts +3 -2
  13. package/dist/auth.d.mts +238 -1
  14. package/dist/auth.d.ts +238 -1
  15. package/dist/auth.js +198 -0
  16. package/dist/auth.js.map +1 -1
  17. package/dist/auth.mjs +183 -0
  18. package/dist/auth.mjs.map +1 -1
  19. package/dist/circuit-breaker-CP6kw0P5.d.ts +351 -0
  20. package/dist/circuit-breaker-CsQivd57.d.mts +351 -0
  21. package/dist/email-templates.d.mts +106 -1
  22. package/dist/email-templates.d.ts +106 -1
  23. package/dist/email-templates.js +608 -0
  24. package/dist/email-templates.js.map +1 -1
  25. package/dist/email-templates.mjs +596 -0
  26. package/dist/email-templates.mjs.map +1 -1
  27. package/dist/index.d.mts +12 -355
  28. package/dist/index.d.ts +12 -355
  29. package/dist/index.js +10 -7
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +10 -7
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/migrate.js +0 -0
  34. package/dist/testing.d.mts +5 -3
  35. package/dist/testing.d.ts +5 -3
  36. package/package.json +11 -11
package/dist/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
- import { m as IMetrics, I as IPlatform, P as PlatformHealthStatus, q as MetricsSummary, r as ICrypto, s as EncryptOptions, t as EncryptedField, D as DeterministicEncryptedField, K as KeyRotationResult, u as CryptoKeyMetadata, e as IDatabase, i as IQueryBuilder, Q as QueryResult, j as IStorage, U as UploadOptions, S as StorageFile, k as IEmail, p as EmailMessage, v as EmailResult, l as IQueue, o as JobOptions, J as Job, R as RepeatOptions, w as JobState, x as JobEventType, y as JobEventHandler, z as IRAG, A as RAGConfig, B as CreateCollectionOptions, F as RAGCollection, G as RAGDocument, H as IngestionOptions, L as BulkIngestionResult, O as IngestionResult, T as DocumentStatus, V as RAGChunk, W as RAGSearchQuery, X as RAGSearchResponse, Y as RAGSearchResult, Z as ContextAssemblyConfig, _ as AssembledContext, $ as RAGPipeline } from './ConsoleEmail-CO0OM4UT.js';
2
- export { aH as AIConfigSchema, aA as AIProviderSchema, a4 as BackoffOptions, aO as BulkheadConfigSchema, aY as CacheConfig, aD as CacheConfigSchema, au as CacheProviderSchema, ah as ChunkingConfig, af as ChunkingPresets, ag as ChunkingStrategy, aM as CircuitBreakerConfigSchema, C as ConsoleEmail, am as CryptoAlgorithm, b3 as CryptoConfig, aJ as CryptoConfigSchema, al as CryptoKeyStatus, aX as DatabaseConfig, aC as DatabaseConfigSchema, at as DatabaseProviderSchema, ap as EmailAddress, aq as EmailAttachment, a_ as EmailConfig, aF as EmailConfigSchema, aw as EmailProviderSchema, E as EnvSecrets, aa as GetSecretOptions, a6 as HistogramStats, n as ISecrets, a1 as JobContext, a2 as JobEvent, a0 as JobResult, az as LogLevelSchema, aQ as LoggingConfigSchema, a as MemoryCache, M as MemoryDatabase, c as MemoryEmail, h as MemoryMetrics, d as MemoryQueue, ae as MemoryRAG, f as MemorySecrets, b as MemoryStorage, a5 as MetricTags, aR as MetricsConfigSchema, b2 as MiddlewareConfig, aU as MiddlewareConfigSchema, N as NoopMetrics, b1 as ObservabilityConfig, aT as ObservabilityConfigSchema, aW as PlatformConfig, aV as PlatformConfigSchema, a$ as QueueConfig, aG as QueueConfigSchema, ax as QueueProviderSchema, a3 as QueueStats, aI as RAGConfigSchema, aj as RAGFilter, ak as RAGPipelineStep, aB as RAGProviderSchema, b0 as ResilienceConfig, aP as ResilienceConfigSchema, aL as RetryConfigSchema, ac as RotateSecretOptions, ad as RotationResult, ai as SearchMode, a8 as Secret, a9 as SecretMetadata, b4 as SecurityConfig, aK as SecurityConfigSchema, ab as SetSecretOptions, aZ as StorageConfig, aE as StorageConfigSchema, av as StorageProviderSchema, aN as TimeoutConfigSchema, a7 as TimingStats, aS as TracingConfigSchema, ay as TracingProviderSchema, ar as calculateBackoff, g as createPlatform, an as createPlatformAsync, ao as createScopedMetrics, as as generateJobId, b8 as getDefaultConfig, b5 as loadConfig, b7 as safeValidateConfig, b6 as validateConfig } from './ConsoleEmail-CO0OM4UT.js';
3
- import { a as ILogger, I as ICache, c as IAI, A as AIConfig, d as AIChatRequest, e as AIChatResponse, f as AIStreamChunk, g as AIStreamCallback, h as AICompletionRequest, i as AICompletionResponse, j as AIEmbeddingRequest, k as AIEmbeddingResponse, l as AIModelConfig, m as AIModelType, n as AIProvider } from './IAI-D8wA_i8N.js';
4
- export { z as AIChatChoice, G as AIError, F as AIErrorCode, u as AIErrorMessages, B as AIFinishReason, w as AIMessage, v as AIRole, E as AIRouterConfig, y as AITool, x as AIToolCall, D as AIUsageInfo, C as ConsoleLogger, o as ICacheOptions, K as ISpan, b as ITracing, q as LogEntry, L as LogLevel, p as LogMeta, r as LoggerConfig, M as MemoryAI, H as MemoryTracing, N as NoopLogger, J as NoopTracing, R as RoutingStrategy, S as SpanContext, V as SpanEvent, Q as SpanKind, O as SpanOptions, P as SpanStatus, U as SpanStatusCode, T as TracingConfig, s as createAIError, t as isAIError } from './IAI-D8wA_i8N.js';
1
+ import { l as IMetrics, I as IPlatform, P as PlatformHealthStatus, o as MetricsSummary, p as ICrypto, q as EncryptOptions, r as EncryptedField, D as DeterministicEncryptedField, K as KeyRotationResult, s as CryptoKeyMetadata, e as IDatabase, i as IQueryBuilder, Q as QueryResult, j as IStorage, U as UploadOptions, S as StorageFile, k as IQueue, n as JobOptions, J as Job, R as RepeatOptions, t as JobState, u as JobEventType, v as JobEventHandler, w as IRAG, x as RAGConfig, y as CreateCollectionOptions, z as RAGCollection, A as RAGDocument, B as IngestionOptions, F as BulkIngestionResult, G as IngestionResult, H as DocumentStatus, L as RAGChunk, O as RAGSearchQuery, T as RAGSearchResponse, V as RAGSearchResult, W as ContextAssemblyConfig, X as AssembledContext, Y as RAGPipeline } from './ConsoleEmail-BbdpINKx.js';
2
+ export { aC as AIConfigSchema, av as AIProviderSchema, a1 as BackoffOptions, aJ as BulkheadConfigSchema, aT as CacheConfig, ay as CacheConfigSchema, ap as CacheProviderSchema, ae as ChunkingConfig, ac as ChunkingPresets, ad as ChunkingStrategy, aH as CircuitBreakerConfigSchema, C as ConsoleEmail, aj as CryptoAlgorithm, a_ as CryptoConfig, aE as CryptoConfigSchema, ai as CryptoKeyStatus, aS as DatabaseConfig, ax as DatabaseConfigSchema, ao as DatabaseProviderSchema, aV as EmailConfig, aA as EmailConfigSchema, ar as EmailProviderSchema, E as EnvSecrets, a7 as GetSecretOptions, a3 as HistogramStats, m as ISecrets, _ as JobContext, $ as JobEvent, Z as JobResult, au as LogLevelSchema, aL as LoggingConfigSchema, a as MemoryCache, M as MemoryDatabase, c as MemoryEmail, h as MemoryMetrics, d as MemoryQueue, ab as MemoryRAG, f as MemorySecrets, b as MemoryStorage, a2 as MetricTags, aM as MetricsConfigSchema, aZ as MiddlewareConfig, aP as MiddlewareConfigSchema, N as NoopMetrics, aY as ObservabilityConfig, aO as ObservabilityConfigSchema, aR as PlatformConfig, aQ as PlatformConfigSchema, aW as QueueConfig, aB as QueueConfigSchema, as as QueueProviderSchema, a0 as QueueStats, aD as RAGConfigSchema, ag as RAGFilter, ah as RAGPipelineStep, aw as RAGProviderSchema, aX as ResilienceConfig, aK as ResilienceConfigSchema, aG as RetryConfigSchema, a9 as RotateSecretOptions, aa as RotationResult, af as SearchMode, a5 as Secret, a6 as SecretMetadata, a$ as SecurityConfig, aF as SecurityConfigSchema, a8 as SetSecretOptions, aU as StorageConfig, az as StorageConfigSchema, aq as StorageProviderSchema, aI as TimeoutConfigSchema, a4 as TimingStats, aN as TracingConfigSchema, at as TracingProviderSchema, am as calculateBackoff, g as createPlatform, ak as createPlatformAsync, al as createScopedMetrics, an as generateJobId, b3 as getDefaultConfig, b0 as loadConfig, b2 as safeValidateConfig, b1 as validateConfig } from './ConsoleEmail-BbdpINKx.js';
3
+ import { I as ICache, b as IAI, A as AIConfig, c as AIChatRequest, d as AIChatResponse, e as AIStreamChunk, f as AIStreamCallback, g as AICompletionRequest, h as AICompletionResponse, i as AIEmbeddingRequest, j as AIEmbeddingResponse, k as AIModelConfig, l as AIModelType, m as AIProvider } from './IAI-CWd11dzL.js';
4
+ export { v as AIChatChoice, B as AIError, z as AIErrorCode, q as AIErrorMessages, w as AIFinishReason, s as AIMessage, r as AIRole, y as AIRouterConfig, u as AITool, t as AIToolCall, x as AIUsageInfo, n as ICacheOptions, D as ISpan, a as ITracing, M as MemoryAI, C as MemoryTracing, N as NoopTracing, R as RoutingStrategy, S as SpanContext, J as SpanEvent, G as SpanKind, E as SpanOptions, F as SpanStatus, H as SpanStatusCode, T as TracingConfig, o as createAIError, p as isAIError } from './IAI-CWd11dzL.js';
5
+ import { I as IEmail, E as EmailMessage, a as EmailResult } from './IEmail-CsOcaQcb.js';
6
+ export { b as EmailAddress, c as EmailAttachment } from './IEmail-CsOcaQcb.js';
7
+ import { I as ILogger } from './ILogger-DLDBZaH4.js';
8
+ export { C as ConsoleLogger, b as LogEntry, L as LogLevel, a as LogMeta, c as LoggerConfig, N as NoopLogger } from './ILogger-DLDBZaH4.js';
5
9
  export { w as IMigrationDatabase, I as IMigrator, q as Migration, r as MigrationRecord, t as MigrationResult, u as MigrationStatus, M as Migrator, v as MigratorConfig, S as SQL, o as createBetaInvitesTable, n as createBetaSettingsTable, p as createBetaTestersTable, f as createDomainVerificationsTable, c as createMigration, b as createSsoOidcConfigsTable, m as createSsoSessionsTable, k as createTenantInvitationsTable, j as createTenantMembersTable, l as createTenantUsageTable, i as createTenantsTable, h as createVerifiedDomainsTable, d as defineMigration, e as enterpriseMigrations, g as generateVersion, a as getEnterpriseMigrations, s as sqlMigration } from './index-DzQ0Js5Z.js';
6
- import { I as IAIUsage, A as AIUsageConfig, U as UsageRecord, a as UsageQuery, b as UsageQueryResult, Q as Quota, c as QuotaType, d as UsageCategory, e as QuotaStatus, B as Budget, f as BudgetStatus, g as UsageInterval, h as UsageSummary, i as UsageTrend, C as CostBreakdown, j as UsageInvoice, k as AlertType, l as UsageAlert } from './agents-Cc65YUoW.js';
7
- export { G as AgentBudget, q as AgentCumulativeUsage, s as AgentIterationCallback, r as AgentIterationEvent, u as AgentLoopOptions, v as AgentLoopResult, t as AgentStopReason, o as AgentTool, p as AgentToolResult, y as AgentTracer, x as AgentTracerOptions, F as AgentUsageRecordParams, H as AgentUsageTracker, E as AgentUsageTrackerOptions, D as DEFAULT_AGENT_LOOP_OPTIONS, M as MemoryAIUsage, O as OllamaAdapter, n as OllamaAdapterConfig, T as ToolExecutor, K as TracedAIOptions, m as UsageInvoiceItem, z as createAgentTracer, J as createAgentUsageTracker, L as createTracedAI, w as runAgentLoop } from './agents-Cc65YUoW.js';
10
+ import { I as IAIUsage, A as AIUsageConfig, U as UsageRecord, a as UsageQuery, b as UsageQueryResult, Q as Quota, c as QuotaType, d as UsageCategory, e as QuotaStatus, B as Budget, f as BudgetStatus, g as UsageInterval, h as UsageSummary, i as UsageTrend, C as CostBreakdown, j as UsageInvoice, k as AlertType, l as UsageAlert } from './agents-C42rGwRl.js';
11
+ export { G as AgentBudget, q as AgentCumulativeUsage, s as AgentIterationCallback, r as AgentIterationEvent, u as AgentLoopOptions, v as AgentLoopResult, t as AgentStopReason, o as AgentTool, p as AgentToolResult, y as AgentTracer, x as AgentTracerOptions, F as AgentUsageRecordParams, H as AgentUsageTracker, E as AgentUsageTrackerOptions, D as DEFAULT_AGENT_LOOP_OPTIONS, M as MemoryAIUsage, O as OllamaAdapter, n as OllamaAdapterConfig, T as ToolExecutor, K as TracedAIOptions, m as UsageInvoiceItem, z as createAgentTracer, J as createAgentUsageTracker, L as createTracedAI, w as runAgentLoop } from './agents-C42rGwRl.js';
8
12
  import { aS as IBeta, aT as BetaConfig, aU as BetaSettings, aV as UpdateBetaSettingsOptions, aW as CreateBetaCodesOptions, aX as BetaInviteCode, aY as ListBetaCodesOptions, aZ as BetaValidationResult, a_ as BetaConsumeResult, a$ as BetaTester, b0 as BetaStats, b1 as BetaCodeUsageReport } from './env-BJWliXSO.js';
9
13
  export { al as AllowlistConfig, A as ApiError, d as ApiErrorCode, f as ApiErrorCodeType, h as ApiPaginatedResponse, Q as ApiSecurityConfig, V as ApiSecurityContext, g as ApiSuccessResponse, aD as AuditRequest, H as AuthCookiesConfig, N as AuthMethod, aL as BetaClientConfig, b6 as BetaCodeStatus, C as CommonApiErrors, ar as CommonRateLimits, ac as DateRangeInput, a6 as DateRangeSchema, ag as DeploymentStage, aa as EmailInput, $ as EmailSchema, E as EnvValidationConfig, p as EnvValidationResult, ai as FlagDefinition, aj as FlagDefinitions, ah as FlagValue, r as KEYCLOAK_DEFAULT_ROLES, F as KeycloakCallbacksConfig, K as KeycloakConfig, G as KeycloakJwtFields, q as KeycloakTokenSet, ae as LoginInput, a8 as LoginSchema, b2 as MemoryBeta, ay as OpsAuditActor, aA as OpsAuditEvent, aC as OpsAuditLoggerOptions, aB as OpsAuditRecord, az as OpsAuditResource, b7 as PG_ERROR_MAP, ab as PaginationInput, a5 as PaginationSchema, a0 as PasswordSchema, a3 as PersonNameSchema, a2 as PhoneSchema, aq as RateLimitCheckResult, b as RateLimitOptions, P as RateLimitPreset, a as RateLimitRule, R as RateLimitStore, J as RedirectCallbackConfig, ak as ResolvedFlags, O as RouteAuditConfig, ad as SearchQueryInput, a7 as SearchQuerySchema, U as SecuritySession, af as SignupInput, a9 as SignupSchema, a1 as SlugSchema, aF as StandardAuditActionType, aE as StandardAuditActions, S as StandardRateLimitPresets, T as TokenRefreshResult, _ as WrapperPresets, ao as buildAllowlist, I as buildAuthCookies, Z as buildErrorBody, M as buildKeycloakCallbacks, e as buildPagination, Y as buildRateLimitHeaders, aw as buildRateLimitResponseHeaders, L as buildRedirectCallback, y as buildTokenRefreshParams, n as checkEnvVars, at as checkRateLimit, c as classifyError, aR as clearStoredBetaCode, aJ as createAuditActor, aK as createAuditLogger, aM as createBetaClient, an as createFeatureFlags, as as createMemoryRateLimitStore, a4 as createSafeTextSchema, am as detectStage, aG as extractAuditIp, aI as extractAuditRequestId, aH as extractAuditUserAgent, X as extractClientIp, aN as fetchBetaSettings, b3 as generateBetaCode, b5 as generateBetaId, l as getBoolEnv, B as getEndSessionEndpoint, o as getEnvSummary, m as getIntEnv, k as getOptionalEnv, au as getRateLimitStatus, j as getRequiredEnv, aQ as getStoredBetaCode, z as getTokenEndpoint, w as hasAllRoles, u as hasAnyRole, t as hasRole, ap as isAllowlisted, i as isApiError, x as isTokenExpired, b4 as normalizeBetaCode, s as parseKeycloakRoles, D as refreshKeycloakToken, av as resetRateLimitForKey, ax as resolveIdentifier, W as resolveRateLimitIdentifier, aP as storeBetaCode, aO as validateBetaCode, v as validateEnvVars } from './env-BJWliXSO.js';
14
+ export { i as CircuitBreaker, C as CircuitBreakerOptions, k as CircuitBreakerRegistry, h as CircuitBreakerStats, g as CircuitOpenError, e as CircuitState, f as DEFAULT_CIRCUIT_BREAKER_OPTIONS, D as DEFAULT_RETRY_OPTIONS, d as RetryConfigs, R as RetryOptions, c as RetryPredicates, a as RetryResult, j as createCircuitBreaker, r as retryable, w as withRetry, b as withRetryResult } from './circuit-breaker-CP6kw0P5.js';
10
15
  export { H as HTML_TAG_PATTERN, k as URL_DOMAIN_PATTERN, U as URL_PROTOCOL_PATTERN, c as constantTimeEqual, b as containsHtml, a as containsUrls, i as defangUrl, e as escapeHtml, h as getCorrelationId, g as sanitizeApiError, j as sanitizeForEmail, s as stripHtml, d as stripNullBytes, f as stripNullBytesDeep } from './security-DMUNYqQI.js';
11
16
  export { NextHeaderEntry, SecurityHeaderPresets, SecurityHeadersConfig, generateSecurityHeaders } from './security-headers.js';
12
17
  import { SupabaseClient } from '@supabase/supabase-js';
@@ -8976,354 +8981,6 @@ declare function createHookRegistry(logger?: ILogger): HookRegistry;
8976
8981
  */
8977
8982
  declare function composeHookRegistries(...registries: HookRegistry[]): HookRegistry;
8978
8983
 
8979
- /**
8980
- * Retry Pattern Implementation
8981
- *
8982
- * Provides configurable retry logic with exponential backoff and jitter.
8983
- */
8984
-
8985
- /**
8986
- * Options for retry behavior
8987
- */
8988
- interface RetryOptions {
8989
- /**
8990
- * Maximum number of retry attempts
8991
- * @default 3
8992
- */
8993
- maxAttempts: number;
8994
- /**
8995
- * Initial delay between retries in milliseconds
8996
- * @default 100
8997
- */
8998
- baseDelay: number;
8999
- /**
9000
- * Maximum delay between retries in milliseconds
9001
- * @default 10000
9002
- */
9003
- maxDelay: number;
9004
- /**
9005
- * Multiplier for exponential backoff
9006
- * @default 2
9007
- */
9008
- backoffMultiplier: number;
9009
- /**
9010
- * Whether to add random jitter to delays
9011
- * @default true
9012
- */
9013
- jitter: boolean;
9014
- /**
9015
- * Maximum jitter in milliseconds
9016
- * @default 100
9017
- */
9018
- maxJitter: number;
9019
- /**
9020
- * Function to determine if error is retryable
9021
- * @default All errors are retryable
9022
- */
9023
- retryIf?: (error: Error) => boolean;
9024
- /**
9025
- * Function to determine if error is non-retryable
9026
- * Takes precedence over retryIf
9027
- */
9028
- abortIf?: (error: Error) => boolean;
9029
- /**
9030
- * Callback on each retry attempt
9031
- */
9032
- onRetry?: (error: Error, attempt: number, delay: number) => void;
9033
- /**
9034
- * Logger for retry operations
9035
- */
9036
- logger?: ILogger;
9037
- }
9038
- /**
9039
- * Default retry options
9040
- */
9041
- declare const DEFAULT_RETRY_OPTIONS: RetryOptions;
9042
- /**
9043
- * Result of a retry operation
9044
- */
9045
- interface RetryResult<T> {
9046
- /** Whether the operation succeeded */
9047
- success: boolean;
9048
- /** The result if successful */
9049
- result?: T;
9050
- /** The final error if all attempts failed */
9051
- error?: Error;
9052
- /** Number of attempts made */
9053
- attempts: number;
9054
- /** Total time spent in milliseconds */
9055
- totalTime: number;
9056
- }
9057
- /**
9058
- * Execute a function with retry logic
9059
- */
9060
- declare function withRetry<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
9061
- /**
9062
- * Execute with retry and return detailed result
9063
- */
9064
- declare function withRetryResult<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<RetryResult<T>>;
9065
- /**
9066
- * Create a retryable version of a function
9067
- */
9068
- declare function retryable<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, options?: Partial<RetryOptions>): (...args: TArgs) => Promise<TResult>;
9069
- /**
9070
- * Common retry predicates
9071
- */
9072
- declare const RetryPredicates: {
9073
- /**
9074
- * Retry on network errors
9075
- */
9076
- networkErrors: (error: Error) => boolean;
9077
- /**
9078
- * Retry on HTTP 5xx errors
9079
- */
9080
- serverErrors: (error: Error) => boolean;
9081
- /**
9082
- * Retry on HTTP 429 (rate limit) errors
9083
- */
9084
- rateLimitErrors: (error: Error) => boolean;
9085
- /**
9086
- * Retry on database deadlock errors
9087
- */
9088
- deadlockErrors: (error: Error) => boolean;
9089
- /**
9090
- * Never retry on authentication errors
9091
- */
9092
- authenticationErrors: (error: Error) => boolean;
9093
- /**
9094
- * Never retry on validation errors
9095
- */
9096
- validationErrors: (error: Error) => boolean;
9097
- };
9098
- /**
9099
- * Common retry configurations
9100
- */
9101
- declare const RetryConfigs: {
9102
- /**
9103
- * Fast retry for quick failures
9104
- */
9105
- fast: Partial<RetryOptions>;
9106
- /**
9107
- * Standard retry configuration
9108
- */
9109
- standard: Partial<RetryOptions>;
9110
- /**
9111
- * Aggressive retry for critical operations
9112
- */
9113
- aggressive: Partial<RetryOptions>;
9114
- /**
9115
- * Conservative retry for rate-limited APIs
9116
- */
9117
- rateLimited: Partial<RetryOptions>;
9118
- /**
9119
- * Database retry configuration
9120
- */
9121
- database: Partial<RetryOptions>;
9122
- };
9123
-
9124
- /**
9125
- * Circuit Breaker Pattern Implementation
9126
- *
9127
- * Prevents cascading failures by temporarily blocking calls to a failing service.
9128
- */
9129
-
9130
- /**
9131
- * Circuit breaker states
9132
- */
9133
- type CircuitState = "closed" | "open" | "half-open";
9134
- /**
9135
- * Options for circuit breaker behavior
9136
- */
9137
- interface CircuitBreakerOptions {
9138
- /**
9139
- * Name of the circuit (for logging)
9140
- */
9141
- name: string;
9142
- /**
9143
- * Number of failures before opening the circuit
9144
- * @default 5
9145
- */
9146
- failureThreshold: number;
9147
- /**
9148
- * Time in milliseconds before attempting to close the circuit
9149
- * @default 30000
9150
- */
9151
- resetTimeout: number;
9152
- /**
9153
- * Number of successful requests needed in half-open state to close the circuit
9154
- * @default 3
9155
- */
9156
- successThreshold: number;
9157
- /**
9158
- * Time window in milliseconds for counting failures
9159
- * @default 60000
9160
- */
9161
- failureWindow: number;
9162
- /**
9163
- * Function to determine if error should trip the circuit
9164
- * @default All errors trip the circuit
9165
- */
9166
- shouldTrip?: (error: Error) => boolean;
9167
- /**
9168
- * Callback when circuit state changes
9169
- */
9170
- onStateChange?: (from: CircuitState, to: CircuitState) => void;
9171
- /**
9172
- * Callback when circuit opens
9173
- */
9174
- onOpen?: (failures: number, lastError: Error) => void;
9175
- /**
9176
- * Callback when circuit closes
9177
- */
9178
- onClose?: () => void;
9179
- /**
9180
- * Callback when request is rejected due to open circuit
9181
- */
9182
- onReject?: (state: CircuitState) => void;
9183
- /**
9184
- * Logger for circuit breaker events
9185
- */
9186
- logger?: ILogger;
9187
- }
9188
- /**
9189
- * Default circuit breaker options
9190
- */
9191
- declare const DEFAULT_CIRCUIT_BREAKER_OPTIONS: Omit<CircuitBreakerOptions, "name">;
9192
- /**
9193
- * Error thrown when circuit is open
9194
- */
9195
- declare class CircuitOpenError extends Error {
9196
- readonly name = "CircuitOpenError";
9197
- readonly circuitName: string;
9198
- readonly state: CircuitState;
9199
- readonly nextAttemptAt: Date;
9200
- constructor(circuitName: string, state: CircuitState, resetTimeout: number);
9201
- }
9202
- /**
9203
- * Circuit breaker statistics
9204
- */
9205
- interface CircuitBreakerStats {
9206
- state: CircuitState;
9207
- failures: number;
9208
- successes: number;
9209
- lastFailure?: Date;
9210
- lastSuccess?: Date;
9211
- lastStateChange?: Date;
9212
- totalRequests: number;
9213
- rejectedRequests: number;
9214
- }
9215
- /**
9216
- * Circuit breaker implementation
9217
- */
9218
- declare class CircuitBreaker {
9219
- private state;
9220
- private failures;
9221
- private successes;
9222
- private failureTimestamps;
9223
- private lastFailure?;
9224
- private lastSuccess?;
9225
- private lastStateChange?;
9226
- private lastOpenedAt?;
9227
- private totalRequests;
9228
- private rejectedRequests;
9229
- private lastError?;
9230
- private readonly options;
9231
- private readonly logger;
9232
- constructor(options: CircuitBreakerOptions);
9233
- /**
9234
- * Execute a function with circuit breaker protection
9235
- */
9236
- execute<T>(fn: () => Promise<T>): Promise<T>;
9237
- /**
9238
- * Check if circuit allows execution
9239
- */
9240
- canExecute(): boolean;
9241
- /**
9242
- * Record a successful execution
9243
- */
9244
- private onSuccess;
9245
- /**
9246
- * Record a failed execution
9247
- */
9248
- private onFailure;
9249
- /**
9250
- * Transition to a new state
9251
- */
9252
- private transitionTo;
9253
- /**
9254
- * Check if reset timeout has passed
9255
- */
9256
- private shouldAttemptReset;
9257
- /**
9258
- * Get remaining time until reset attempt
9259
- */
9260
- private getRemainingTimeout;
9261
- /**
9262
- * Get current circuit state
9263
- */
9264
- getState(): CircuitState;
9265
- /**
9266
- * Get circuit breaker statistics
9267
- */
9268
- getStats(): CircuitBreakerStats;
9269
- /**
9270
- * Manually reset the circuit to closed state
9271
- */
9272
- reset(): void;
9273
- /**
9274
- * Manually trip the circuit to open state
9275
- */
9276
- trip(): void;
9277
- /**
9278
- * Check if circuit is open
9279
- */
9280
- isOpen(): boolean;
9281
- /**
9282
- * Check if circuit is closed
9283
- */
9284
- isClosed(): boolean;
9285
- /**
9286
- * Check if circuit is half-open
9287
- */
9288
- isHalfOpen(): boolean;
9289
- }
9290
- /**
9291
- * Create a circuit breaker
9292
- */
9293
- declare function createCircuitBreaker(options: CircuitBreakerOptions): CircuitBreaker;
9294
- /**
9295
- * Circuit breaker registry for managing multiple circuits
9296
- */
9297
- declare class CircuitBreakerRegistry {
9298
- private circuits;
9299
- private readonly logger;
9300
- private readonly defaultOptions;
9301
- constructor(options?: {
9302
- logger?: ILogger;
9303
- defaults?: Partial<CircuitBreakerOptions>;
9304
- });
9305
- /**
9306
- * Get or create a circuit breaker
9307
- */
9308
- get(name: string, options?: Partial<CircuitBreakerOptions>): CircuitBreaker;
9309
- /**
9310
- * Execute with a named circuit breaker
9311
- */
9312
- execute<T>(name: string, fn: () => Promise<T>, options?: Partial<CircuitBreakerOptions>): Promise<T>;
9313
- /**
9314
- * Get all circuit statistics
9315
- */
9316
- getAllStats(): Record<string, CircuitBreakerStats>;
9317
- /**
9318
- * Reset all circuits
9319
- */
9320
- resetAll(): void;
9321
- /**
9322
- * Clear all circuits
9323
- */
9324
- clear(): void;
9325
- }
9326
-
9327
8984
  /**
9328
8985
  * Timeout Pattern Implementation
9329
8986
  *
@@ -12716,4 +12373,4 @@ declare function getSharedRedis(): Redis$2 | null;
12716
12373
  */
12717
12374
  declare function closeSharedRedis(): Promise<void>;
12718
12375
 
12719
- export { AIChatRequest, AIChatResponse, AICompletionRequest, AICompletionResponse, AIConfig, AIEmbeddingRequest, AIEmbeddingResponse, AIModelConfig, AIModelType, AIProvider, AIStreamCallback, AIStreamChunk, AIUsageConfig, type AccountCapabilities, type AccountLink, type AccountType, type Address, AlertType, AnthropicAdapter, type AnthropicAdapterConfig, type ApiAuthentication, type ApiChangelog, type ApiDocumentation, type ApiEndpoint, type ApiExample, type ApiKey, type ApiKeyStatus, type ApiKeyType, type ApiKeyValidationResult, type ApiParameter, type ApiResponse, type ApiSchema, type ApiSchemaProperty, type ApiUsageStats, type ApiUsageTimeSeries, type AppLogContext, type AppLogger, type AppLoggerOptions, AssembledContext, type AuditActor, type AuditCategory, type AuditEvent, AuditEvents, type AuditEvidence, type AuditLogConfig, type AuditOutcome, type AuditQuery, type AuditQueryResult, type AuditRetentionPolicy, type AuditStats, type AuditTarget, type AuthConfig, type AuthError, type AuthErrorCode, AuthErrorMessages, type AuthEventType, type AuthResult, type AuthSession, type AuthStateChangeCallback, type AuthStorage, type AuthUser, type Balance, type BalanceAmount, type BankAccountDetails, type BatchNotificationOptions, BetaCodeUsageReport, BetaConfig, BetaConsumeResult, BetaInviteCode, BetaSettings, BetaStats, BetaTester, BetaValidationResult, type BillingConfig, type BillingDetails, type BillingPeriod, type Breadcrumb, Budget, BudgetStatus, BulkIngestionResult, Bulkhead, type BulkheadOptions, BulkheadRegistry, BulkheadRejectedError, type BulkheadStats, type BullMQConfig, BullMQQueue, type BusinessProfile, type CancelationReason, type CaptureOptions, type CapturePaymentIntentOptions, type CardBrand, type CardDetails, type ChainExecutionResult, CircuitBreaker, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type CommandStatus, type ComplianceConfig, type ComplianceReport, type ConfirmPaymentIntentOptions, type ConnectedAccount, type ConnectedAccountStatus, type ConsentPreferences, type ConsentPurpose, type ConsentRecord, type ConsentStatus, ContextAssemblyConfig, type ControlFramework, type ControlStatus, type CorrelationData, CostBreakdown, type Coupon, type CreateAccountLinkOptions, type CreateApiKeyOptions, CreateBetaCodesOptions, CreateCollectionOptions, type CreateConnectedAccountOptions, type CreateCustomerOptions, type CreateDsarOptions, type CreatePaymentIntentOptions, type CreatePayoutOptions, type CreateRefundOptions, type CreateSandboxOptions, type CreateScheduleOptions, type CreateTenantOptions, type CreateTransferOptions, type CreateWebhookOptions, type CreditBalance, type CreditTransaction, type CreditType, type CronExpression, CronPresets, CryptoKeyMetadata, type Currency, type Customer, DEFAULT_BULKHEAD_OPTIONS, DEFAULT_CIRCUIT_BREAKER_OPTIONS, DEFAULT_RETRY_OPTIONS, type DataBreachRecord, type DataCategory, type DataInventoryItem, type DataMap, type DataSensitivity, type DataSubjectRequest, type DataType, DatabaseAIUsage, type DatabaseAIUsageConfig, DatabaseAuditLog, type DatabaseAuditLogConfig, DatabaseBilling, type DatabaseBillingConfig, DatabaseCompliance, DatabaseErrorReporter, type DatabaseErrorReporterConfig, DatabaseNotification, type DatabaseNotificationConfig, DatabasePromptStore, type DatabasePromptStoreConfig, DefaultTimeouts, type DeleteAccountOptions, type DeleteHookContext, type DeliveryAttempt, type DeliveryQuery, type DeliveryStatus, type DetailedHealthResponse, DeterministicEncryptedField, type DevPortalConfig, type DeveloperMetrics, type Device, type DeviceAuthMethod, type DeviceCommand, type DeviceConfig, type DeviceConnectionState, type DeviceCredentials, type DeviceGroup, type DeviceGroupQuery, type DeviceLocation, type DeviceQuery, type DeviceQueryResult, type DeviceShadow, type DeviceStatus, type DirectoryAttributeMapping, type DirectoryConfig, DocumentStatus, type DsarAttachment, type DsarNote, type DsarStatus, type DsarType, type DunningActionType, type DunningAttempt, type DunningConfig, type EmailHookContext, EmailMessage, EmailResult, EncryptOptions, EncryptedField, type EnrollMfaOptions, type EnrollMfaResult, type ErrorContext, type ErrorHookContext, type ErrorLevel, type ErrorReport, type ErrorReporterConfig, type EvidenceType, type ExperimentMetrics, type FallbackOptions, type FallbackResult, FallbackStrategies, type FirmwareStatus, type FirmwareUpdate, type FirmwareVersion, type GeneratedSdk, GenericOIDCAuthSSO, type GenericOIDCConfig, GoogleAIAdapter, type GoogleAIAdapterConfig, type HealthCheckResult, type HealthEndpoints, type HealthEndpointsOptions, type HealthStatus, type HookRegistry, type HttpMethod, HttpWebhook, type HttpWebhookConfig, IAI, IAIUsage, type IAuditLog, type IAuth, type IAuthSSO, IBeta, type IBilling, ICache, type ICompliance, ICrypto, IDatabase, type IDevPortal, type IDevice, IEmail, type IErrorReporter, type IHealth, type IHealthCheckable, ILogger, IMetrics, type INotification, type IPayment, IPlatform, type IPromptStore, IQueryBuilder, IQueue, IRAG, type IScheduler, IStorage, type ITenant, type IWebhook, type InboundWebhookConfig, type InboundWebhookContext, IngestionOptions, IngestionResult, type InsertHookContext, type InviteMemberOptions, type Invoice, type InvoiceLineItem, type InvoiceQuery, type InvoiceStatus, Job, JobEventHandler, JobEventType, type JobHookContext, JobOptions, JobState, KeyRotationResult, ListBetaCodesOptions, type ListTenantsOptions, type LivenessResponse, MemoryAuditLog, type MemoryAuditLogConfig, MemoryAuth, MemoryAuthSSO, MemoryBilling, MemoryCompliance, MemoryCrypto, MemoryDevPortal, MemoryDevice, MemoryErrorReporter, type MemoryErrorReporterConfig, MemoryNotification, type MemoryNotificationConfig, MemoryPayment, MemoryPromptStore, MemoryRateLimiterStorage, MemoryScheduler, type MemorySchedulerConfig, MemoryTenant, MemoryWebhook, type MemoryWebhookConfig, type Meter, type MetricsEndpoint, type MetricsEndpointOptions, MetricsSummary, type MfaChallenge, type MfaFactor, type MfaFactorType, type Middleware, type MiddlewareChain, type MiddlewareChainOptions, type MiddlewareContext, NodeCrypto, type NodeCryptoConfig, type NotificationAction, type NotificationCategory, type NotificationChannel, type NotificationConfig, type NotificationData, type NotificationPreferences, type NotificationPriority, type NotificationQuery, type NotificationResult, type NotificationStats, type NotificationStatus, type NotificationTarget, NotificationTemplates, type OAuthOptions, type OAuthProvider, type OAuthResult, type OidcAuthRequest, type OidcAuthResponse, type OidcClaimMapping, type OidcIdpConfig, OpenAIAdapter, type OpenAIAdapterConfig, type ParameterLocation, type PaymentConfig, type PaymentError, type PaymentErrorCode, PaymentErrorMessages, type PaymentEventType, type PaymentIntent, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentWebhookEvent, type Payout, type PayoutStatus, type PiaMitigation, type PiaRisk, type PiaStatus, PineconeRAG, type PineconeRAGConfig, type PlatformHealthResult, PlatformHealthStatus, type PlatformHooks, PostgresBeta, type PostgresBetaConfig, type PostgresConfig, PostgresDatabase, PostgresTenant, type PostgresTenantConfig, type Price, type PricingModel, type PricingTier, type PrivacyImpactAssessment, type Product, type Prompt, type PromptChain, type PromptChainStep, type PromptExperiment, type PromptQuery, type PromptQueryResult, type PromptStatus, type PromptStoreConfig, type PromptType, type PromptUsageRecord, type PromptUsageStats, type PromptVariable, type PromptVariant, type PromptVersion, type ProvisioningConfig, type ProvisioningRequest, type ProvisioningResult, type ProvisioningStatus, type PushSubscription, type QueryHookContext, QueryResult, QueueScheduler, type QueueSchedulerConfig, Quota, QuotaStatus, QuotaType, RAGChunk, RAGCollection, RAGConfig, RAGDocument, RAGPipeline, RAGSearchQuery, RAGSearchResponse, RAGSearchResult, type RateLimitAlgorithm, RateLimitError, type RateLimitInfo, RateLimitPresets, type RateLimiterStorage, type ReadinessResponse, type RecordConsentOptions, RedisCache, type RedisClientOptions, type RedisConfig, type Refund, type RefundReason, type RefundStatus, type RenderOptions, type RenderedPrompt, RepeatOptions, ResendEmail, type ResetPasswordOptions, type RetentionAction, type RetentionExecution, type RetentionPolicy, RetryConfigs, type RetryOptions, RetryPredicates, type RetryResult, type RevenueMetrics, type RiskLevel, S3Storage, type SamlAssertion, type SamlAttributeMapping, type SamlAuthRequest, type SamlAuthResponse, type SamlIdpConfig, type SamlNameIdFormat, type SamlSpConfig, type Sandbox, type SandboxConfig, type SandboxLimits, type SandboxStatus, type SandboxUsage, type ScheduleContext, type ScheduleExecution, type ScheduleHandler, type ScheduleQuery, type ScheduleState, type ScheduleUpdateOptions, type ScheduledJob, type SchedulerConfig, type SchedulerStats, type ScimConfig, type ScimUser, type SdkConfig, type SdkFile, type SdkLanguage, type SendCommandOptions, type SendNotificationOptions, type ServiceHealth, type ShadowDelta, type ShadowMetadata, type ShadowUpdate, type SignInWithEmailOptions, type SignInWithMagicLinkOptions, type SignInWithPhoneOptions, type SignUpWithEmailOptions, type SignatureAlgorithm, type SlidingWindowRateLimitOptions, type SmtpConfig, SmtpEmail, type SsoSession, type StartupResponse, StorageFile, type StoredAuditEvent, type StoredNotification, StripePayment, type StripePaymentConfig, type Subscription, type SubscriptionDiscount, type SubscriptionItem, type SubscriptionMetrics, type SubscriptionQuery, type SubscriptionStatus, SupabaseAuth, type SupabaseAuthConfig, SupabaseDatabase, SupabaseStorage, type SupabaseStorageConfig, type TaxBreakdown, type TelemetryMessage, type TelemetryQuery, type TelemetryResult, type Tenant, type TenantBranding, type TenantContext, type TenantDatabaseConfig, type TenantInvitation, type TenantIsolationModel, type TenantMember, type TenantMemberStatus, type TenantQuotas, type TenantResolutionOptions, type TenantResolutionStrategy, type TenantRole, type TenantSecuritySettings, type TenantSettings, type TenantStatus, type TenantUsage, TimeoutError, type TimeoutOptions, type TokenBucketOptions, type TosAcceptance, type Transfer, type TransferStatus, type Unsubscribe, UpdateBetaSettingsOptions, type UpdateCustomerOptions, type UpdateHookContext, type UpdatePasswordOptions, type UpdatePaymentIntentOptions, type UpdateScheduleOptions, type UpdateStatus, type UpdateTenantOptions, type UpdateUserOptions, type UpdateWebhookOptions, type UploadHookContext, UploadOptions, UpstashCache, UsageAlert, UsageCategory, type UsageEvent, UsageInterval, UsageInvoice, UsageQuery, UsageQueryResult, UsageRecord, UsageSummary, type UsageSummaryRecord, UsageTrend, type VerificationResult, type VerifyMfaOptions, type VerifyPhoneOtpOptions, type VerifyWebhookOptions, WeaviateRAG, type WeaviateRAGConfig, type WebhookConfig, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, WebhookEventTypes, type WebhookQuery, type WebhookState, type WebhookStats, type WebhookTestEndpoint, type WebhookTestEvent, calculateRetryDelay, closeSharedRedis, composeHookRegistries, correlationContext, createAnthropicAdapter, createAppLogger, createAuthError, createBulkhead, createCacheMiddleware, createCachedFallback, createCircuitBreaker, createDefaultPreferences, createErrorReport, createExpressHealthHandlers, createExpressMetricsHandler, createGoogleAIAdapter, createHealthEndpoints, createHealthServer, createHookRegistry, createIpKeyGenerator, createJobContext, createLoggingMiddleware, createMetricsEndpoint, createMetricsMiddleware, createMetricsServer, createMiddlewareChain, createMiddlewareContext, createObservabilityServer, createOpenAIAdapter, createPaymentError, createPineconeRAG, createRateLimitMiddleware, createRedisClient, createRequestContext, createRequestIdMiddleware, createSlowQueryMiddleware, createTenantMiddleware, createTimeoutMiddleware, createUserKeyGenerator, createWeaviateRAG, describeCron, filterChannelsByPreferences, formatAmount, generateAuditId, generateChecksum, generateDeliveryId, generateErrorId, generateEventId, generateFingerprint, generateNotificationId, generatePaymentId, generateScheduleId, generateSecureToken, generateWebhookId, generateWebhookSecret, getContext, getLogMeta, getNextCronRun, getRequestId, getSharedRedis, getTenantId, getTraceId, getUserId, isAuthError, isInContext, isInQuietHours, isPaymentError, isValidCron, matchAction, matchEventType, raceTimeout, retryable, runWithContext, runWithContextAsync, timedHealthCheck, toHealthCheckResult, withCorrelation, withCorrelationAsync, withFallback, withFallbackChain, withFallbackResult, withRetry, withRetryResult, withTimeout, withTimeoutWrapper };
12376
+ export { AIChatRequest, AIChatResponse, AICompletionRequest, AICompletionResponse, AIConfig, AIEmbeddingRequest, AIEmbeddingResponse, AIModelConfig, AIModelType, AIProvider, AIStreamCallback, AIStreamChunk, AIUsageConfig, type AccountCapabilities, type AccountLink, type AccountType, type Address, AlertType, AnthropicAdapter, type AnthropicAdapterConfig, type ApiAuthentication, type ApiChangelog, type ApiDocumentation, type ApiEndpoint, type ApiExample, type ApiKey, type ApiKeyStatus, type ApiKeyType, type ApiKeyValidationResult, type ApiParameter, type ApiResponse, type ApiSchema, type ApiSchemaProperty, type ApiUsageStats, type ApiUsageTimeSeries, type AppLogContext, type AppLogger, type AppLoggerOptions, AssembledContext, type AuditActor, type AuditCategory, type AuditEvent, AuditEvents, type AuditEvidence, type AuditLogConfig, type AuditOutcome, type AuditQuery, type AuditQueryResult, type AuditRetentionPolicy, type AuditStats, type AuditTarget, type AuthConfig, type AuthError, type AuthErrorCode, AuthErrorMessages, type AuthEventType, type AuthResult, type AuthSession, type AuthStateChangeCallback, type AuthStorage, type AuthUser, type Balance, type BalanceAmount, type BankAccountDetails, type BatchNotificationOptions, BetaCodeUsageReport, BetaConfig, BetaConsumeResult, BetaInviteCode, BetaSettings, BetaStats, BetaTester, BetaValidationResult, type BillingConfig, type BillingDetails, type BillingPeriod, type Breadcrumb, Budget, BudgetStatus, BulkIngestionResult, Bulkhead, type BulkheadOptions, BulkheadRegistry, BulkheadRejectedError, type BulkheadStats, type BullMQConfig, BullMQQueue, type BusinessProfile, type CancelationReason, type CaptureOptions, type CapturePaymentIntentOptions, type CardBrand, type CardDetails, type ChainExecutionResult, type CommandStatus, type ComplianceConfig, type ComplianceReport, type ConfirmPaymentIntentOptions, type ConnectedAccount, type ConnectedAccountStatus, type ConsentPreferences, type ConsentPurpose, type ConsentRecord, type ConsentStatus, ContextAssemblyConfig, type ControlFramework, type ControlStatus, type CorrelationData, CostBreakdown, type Coupon, type CreateAccountLinkOptions, type CreateApiKeyOptions, CreateBetaCodesOptions, CreateCollectionOptions, type CreateConnectedAccountOptions, type CreateCustomerOptions, type CreateDsarOptions, type CreatePaymentIntentOptions, type CreatePayoutOptions, type CreateRefundOptions, type CreateSandboxOptions, type CreateScheduleOptions, type CreateTenantOptions, type CreateTransferOptions, type CreateWebhookOptions, type CreditBalance, type CreditTransaction, type CreditType, type CronExpression, CronPresets, CryptoKeyMetadata, type Currency, type Customer, DEFAULT_BULKHEAD_OPTIONS, type DataBreachRecord, type DataCategory, type DataInventoryItem, type DataMap, type DataSensitivity, type DataSubjectRequest, type DataType, DatabaseAIUsage, type DatabaseAIUsageConfig, DatabaseAuditLog, type DatabaseAuditLogConfig, DatabaseBilling, type DatabaseBillingConfig, DatabaseCompliance, DatabaseErrorReporter, type DatabaseErrorReporterConfig, DatabaseNotification, type DatabaseNotificationConfig, DatabasePromptStore, type DatabasePromptStoreConfig, DefaultTimeouts, type DeleteAccountOptions, type DeleteHookContext, type DeliveryAttempt, type DeliveryQuery, type DeliveryStatus, type DetailedHealthResponse, DeterministicEncryptedField, type DevPortalConfig, type DeveloperMetrics, type Device, type DeviceAuthMethod, type DeviceCommand, type DeviceConfig, type DeviceConnectionState, type DeviceCredentials, type DeviceGroup, type DeviceGroupQuery, type DeviceLocation, type DeviceQuery, type DeviceQueryResult, type DeviceShadow, type DeviceStatus, type DirectoryAttributeMapping, type DirectoryConfig, DocumentStatus, type DsarAttachment, type DsarNote, type DsarStatus, type DsarType, type DunningActionType, type DunningAttempt, type DunningConfig, type EmailHookContext, EmailMessage, EmailResult, EncryptOptions, EncryptedField, type EnrollMfaOptions, type EnrollMfaResult, type ErrorContext, type ErrorHookContext, type ErrorLevel, type ErrorReport, type ErrorReporterConfig, type EvidenceType, type ExperimentMetrics, type FallbackOptions, type FallbackResult, FallbackStrategies, type FirmwareStatus, type FirmwareUpdate, type FirmwareVersion, type GeneratedSdk, GenericOIDCAuthSSO, type GenericOIDCConfig, GoogleAIAdapter, type GoogleAIAdapterConfig, type HealthCheckResult, type HealthEndpoints, type HealthEndpointsOptions, type HealthStatus, type HookRegistry, type HttpMethod, HttpWebhook, type HttpWebhookConfig, IAI, IAIUsage, type IAuditLog, type IAuth, type IAuthSSO, IBeta, type IBilling, ICache, type ICompliance, ICrypto, IDatabase, type IDevPortal, type IDevice, IEmail, type IErrorReporter, type IHealth, type IHealthCheckable, ILogger, IMetrics, type INotification, type IPayment, IPlatform, type IPromptStore, IQueryBuilder, IQueue, IRAG, type IScheduler, IStorage, type ITenant, type IWebhook, type InboundWebhookConfig, type InboundWebhookContext, IngestionOptions, IngestionResult, type InsertHookContext, type InviteMemberOptions, type Invoice, type InvoiceLineItem, type InvoiceQuery, type InvoiceStatus, Job, JobEventHandler, JobEventType, type JobHookContext, JobOptions, JobState, KeyRotationResult, ListBetaCodesOptions, type ListTenantsOptions, type LivenessResponse, MemoryAuditLog, type MemoryAuditLogConfig, MemoryAuth, MemoryAuthSSO, MemoryBilling, MemoryCompliance, MemoryCrypto, MemoryDevPortal, MemoryDevice, MemoryErrorReporter, type MemoryErrorReporterConfig, MemoryNotification, type MemoryNotificationConfig, MemoryPayment, MemoryPromptStore, MemoryRateLimiterStorage, MemoryScheduler, type MemorySchedulerConfig, MemoryTenant, MemoryWebhook, type MemoryWebhookConfig, type Meter, type MetricsEndpoint, type MetricsEndpointOptions, MetricsSummary, type MfaChallenge, type MfaFactor, type MfaFactorType, type Middleware, type MiddlewareChain, type MiddlewareChainOptions, type MiddlewareContext, NodeCrypto, type NodeCryptoConfig, type NotificationAction, type NotificationCategory, type NotificationChannel, type NotificationConfig, type NotificationData, type NotificationPreferences, type NotificationPriority, type NotificationQuery, type NotificationResult, type NotificationStats, type NotificationStatus, type NotificationTarget, NotificationTemplates, type OAuthOptions, type OAuthProvider, type OAuthResult, type OidcAuthRequest, type OidcAuthResponse, type OidcClaimMapping, type OidcIdpConfig, OpenAIAdapter, type OpenAIAdapterConfig, type ParameterLocation, type PaymentConfig, type PaymentError, type PaymentErrorCode, PaymentErrorMessages, type PaymentEventType, type PaymentIntent, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentWebhookEvent, type Payout, type PayoutStatus, type PiaMitigation, type PiaRisk, type PiaStatus, PineconeRAG, type PineconeRAGConfig, type PlatformHealthResult, PlatformHealthStatus, type PlatformHooks, PostgresBeta, type PostgresBetaConfig, type PostgresConfig, PostgresDatabase, PostgresTenant, type PostgresTenantConfig, type Price, type PricingModel, type PricingTier, type PrivacyImpactAssessment, type Product, type Prompt, type PromptChain, type PromptChainStep, type PromptExperiment, type PromptQuery, type PromptQueryResult, type PromptStatus, type PromptStoreConfig, type PromptType, type PromptUsageRecord, type PromptUsageStats, type PromptVariable, type PromptVariant, type PromptVersion, type ProvisioningConfig, type ProvisioningRequest, type ProvisioningResult, type ProvisioningStatus, type PushSubscription, type QueryHookContext, QueryResult, QueueScheduler, type QueueSchedulerConfig, Quota, QuotaStatus, QuotaType, RAGChunk, RAGCollection, RAGConfig, RAGDocument, RAGPipeline, RAGSearchQuery, RAGSearchResponse, RAGSearchResult, type RateLimitAlgorithm, RateLimitError, type RateLimitInfo, RateLimitPresets, type RateLimiterStorage, type ReadinessResponse, type RecordConsentOptions, RedisCache, type RedisClientOptions, type RedisConfig, type Refund, type RefundReason, type RefundStatus, type RenderOptions, type RenderedPrompt, RepeatOptions, ResendEmail, type ResetPasswordOptions, type RetentionAction, type RetentionExecution, type RetentionPolicy, type RevenueMetrics, type RiskLevel, S3Storage, type SamlAssertion, type SamlAttributeMapping, type SamlAuthRequest, type SamlAuthResponse, type SamlIdpConfig, type SamlNameIdFormat, type SamlSpConfig, type Sandbox, type SandboxConfig, type SandboxLimits, type SandboxStatus, type SandboxUsage, type ScheduleContext, type ScheduleExecution, type ScheduleHandler, type ScheduleQuery, type ScheduleState, type ScheduleUpdateOptions, type ScheduledJob, type SchedulerConfig, type SchedulerStats, type ScimConfig, type ScimUser, type SdkConfig, type SdkFile, type SdkLanguage, type SendCommandOptions, type SendNotificationOptions, type ServiceHealth, type ShadowDelta, type ShadowMetadata, type ShadowUpdate, type SignInWithEmailOptions, type SignInWithMagicLinkOptions, type SignInWithPhoneOptions, type SignUpWithEmailOptions, type SignatureAlgorithm, type SlidingWindowRateLimitOptions, type SmtpConfig, SmtpEmail, type SsoSession, type StartupResponse, StorageFile, type StoredAuditEvent, type StoredNotification, StripePayment, type StripePaymentConfig, type Subscription, type SubscriptionDiscount, type SubscriptionItem, type SubscriptionMetrics, type SubscriptionQuery, type SubscriptionStatus, SupabaseAuth, type SupabaseAuthConfig, SupabaseDatabase, SupabaseStorage, type SupabaseStorageConfig, type TaxBreakdown, type TelemetryMessage, type TelemetryQuery, type TelemetryResult, type Tenant, type TenantBranding, type TenantContext, type TenantDatabaseConfig, type TenantInvitation, type TenantIsolationModel, type TenantMember, type TenantMemberStatus, type TenantQuotas, type TenantResolutionOptions, type TenantResolutionStrategy, type TenantRole, type TenantSecuritySettings, type TenantSettings, type TenantStatus, type TenantUsage, TimeoutError, type TimeoutOptions, type TokenBucketOptions, type TosAcceptance, type Transfer, type TransferStatus, type Unsubscribe, UpdateBetaSettingsOptions, type UpdateCustomerOptions, type UpdateHookContext, type UpdatePasswordOptions, type UpdatePaymentIntentOptions, type UpdateScheduleOptions, type UpdateStatus, type UpdateTenantOptions, type UpdateUserOptions, type UpdateWebhookOptions, type UploadHookContext, UploadOptions, UpstashCache, UsageAlert, UsageCategory, type UsageEvent, UsageInterval, UsageInvoice, UsageQuery, UsageQueryResult, UsageRecord, UsageSummary, type UsageSummaryRecord, UsageTrend, type VerificationResult, type VerifyMfaOptions, type VerifyPhoneOtpOptions, type VerifyWebhookOptions, WeaviateRAG, type WeaviateRAGConfig, type WebhookConfig, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, WebhookEventTypes, type WebhookQuery, type WebhookState, type WebhookStats, type WebhookTestEndpoint, type WebhookTestEvent, calculateRetryDelay, closeSharedRedis, composeHookRegistries, correlationContext, createAnthropicAdapter, createAppLogger, createAuthError, createBulkhead, createCacheMiddleware, createCachedFallback, createDefaultPreferences, createErrorReport, createExpressHealthHandlers, createExpressMetricsHandler, createGoogleAIAdapter, createHealthEndpoints, createHealthServer, createHookRegistry, createIpKeyGenerator, createJobContext, createLoggingMiddleware, createMetricsEndpoint, createMetricsMiddleware, createMetricsServer, createMiddlewareChain, createMiddlewareContext, createObservabilityServer, createOpenAIAdapter, createPaymentError, createPineconeRAG, createRateLimitMiddleware, createRedisClient, createRequestContext, createRequestIdMiddleware, createSlowQueryMiddleware, createTenantMiddleware, createTimeoutMiddleware, createUserKeyGenerator, createWeaviateRAG, describeCron, filterChannelsByPreferences, formatAmount, generateAuditId, generateChecksum, generateDeliveryId, generateErrorId, generateEventId, generateFingerprint, generateNotificationId, generatePaymentId, generateScheduleId, generateSecureToken, generateWebhookId, generateWebhookSecret, getContext, getLogMeta, getNextCronRun, getRequestId, getSharedRedis, getTenantId, getTraceId, getUserId, isAuthError, isInContext, isInQuietHours, isPaymentError, isValidCron, matchAction, matchEventType, raceTimeout, runWithContext, runWithContextAsync, timedHealthCheck, toHealthCheckResult, withCorrelation, withCorrelationAsync, withFallback, withFallbackChain, withFallbackResult, withTimeout, withTimeoutWrapper };
package/dist/index.js CHANGED
@@ -16633,7 +16633,7 @@ function validateTlsSecurity(config) {
16633
16633
  async function createPlatformAsync(config) {
16634
16634
  const finalConfig = config ? deepMerge(loadConfig(), config) : loadConfig();
16635
16635
  validateTlsSecurity(finalConfig);
16636
- const [db, cache, storage, email, queue, tracing, crypto2] = await Promise.all(
16636
+ const [db, cache, storage, email, queue, tracing, crypto3] = await Promise.all(
16637
16637
  [
16638
16638
  createDatabaseAdapter(finalConfig),
16639
16639
  createCacheAdapter(finalConfig),
@@ -16659,7 +16659,7 @@ async function createPlatformAsync(config) {
16659
16659
  tracing,
16660
16660
  ai,
16661
16661
  rag,
16662
- crypto2
16662
+ crypto3
16663
16663
  );
16664
16664
  }
16665
16665
  function createPlatform(config) {
@@ -16680,7 +16680,7 @@ function createPlatform(config) {
16680
16680
  const tracing = finalConfig.observability.tracing.provider === "memory" ? new MemoryTracing() : new NoopTracing();
16681
16681
  const ai = finalConfig.ai.enabled ? new MemoryAI() : null;
16682
16682
  const rag = finalConfig.rag.enabled ? new MemoryRAG() : null;
16683
- const crypto2 = finalConfig.crypto.enabled ? new MemoryCrypto() : null;
16683
+ const crypto3 = finalConfig.crypto.enabled ? new MemoryCrypto() : null;
16684
16684
  return createPlatformFromAdapters(
16685
16685
  db,
16686
16686
  cache,
@@ -16692,10 +16692,10 @@ function createPlatform(config) {
16692
16692
  tracing,
16693
16693
  ai,
16694
16694
  rag,
16695
- crypto2
16695
+ crypto3
16696
16696
  );
16697
16697
  }
16698
- function createPlatformFromAdapters(db, cache, storage, email, queue, logger, metrics, tracing, ai, rag, crypto2) {
16698
+ function createPlatformFromAdapters(db, cache, storage, email, queue, logger, metrics, tracing, ai, rag, crypto3) {
16699
16699
  const platform = {
16700
16700
  db,
16701
16701
  cache,
@@ -16749,8 +16749,8 @@ function createPlatformFromAdapters(db, cache, storage, email, queue, logger, me
16749
16749
  if (rag) {
16750
16750
  platform.rag = rag;
16751
16751
  }
16752
- if (crypto2) {
16753
- platform.crypto = crypto2;
16752
+ if (crypto3) {
16753
+ platform.crypto = crypto3;
16754
16754
  }
16755
16755
  return platform;
16756
16756
  }
@@ -19917,6 +19917,9 @@ function clearStoredBetaCode(config = {}) {
19917
19917
  }
19918
19918
  }
19919
19919
 
19920
+ // src/auth/tokens.ts
19921
+ var import_node_crypto = __toESM(require("crypto"));
19922
+
19920
19923
  // src/env.ts
19921
19924
  function getRequiredEnv(key) {
19922
19925
  const value = process.env[key];