@dyrected/core 2.19.0 → 2.20.1

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/server.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, e as DatabaseAdapter, b as AuthenticatedUser, b$ as DyrectedAIContext, ax as AIThread, at as AIMessage, cZ as RAGSearchResult, aw as AIRateLimitStore, av as AIRateLimitResult } from './app-CXF4MdJc.cjs';
2
- export { dN as CollectionTokenPayload, dO as DEFAULT_SESSION_EXPIRY, dP as DyrectedObservabilityRuntime, dQ as RequestBodyCapture, dR as RequestTraceContext, dS as ResolvedObservabilityConfig, dT as attachRequestMetrics, dU as bindObservabilityRuntime, dV as buildRequestLogger, dW as captureRequestBody, dX as createDyrectedApp, dY as createObservabilityRuntime, dZ as createRequestSpan, d_ as decodeCollectionToken, d$ as endRequestSpan, e0 as getConfigLogger, e1 as getObservabilityRuntime, e2 as getRequestLogger, e3 as redactBody, e4 as redactHeaders, e5 as renderPrometheusMetrics, e6 as resolveObservabilityConfig, e7 as resolveSessionTokenExpiry, e8 as shouldSampleRequest, e9 as signCollectionToken, ea as verifyCollectionToken } from './app-CXF4MdJc.cjs';
1
+ import { O as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, c4 as EmailTemplateArgs, c5 as EmailTemplateResult, cY as OutboundEmail, e as DatabaseAdapter, b as AuthenticatedUser, c0 as DyrectedAIContext, ax as AIThread, at as AIMessage, d1 as RAGSearchResult, aw as AIRateLimitStore, av as AIRateLimitResult } from './app-YGoigpOH.cjs';
2
+ export { dR as CollectionTokenPayload, dS as DEFAULT_INVITE_EXPIRY, dT as DEFAULT_RESET_PASSWORD_EXPIRY, dU as DEFAULT_SESSION_EXPIRY, dV as DyrectedObservabilityRuntime, dW as RequestBodyCapture, dX as RequestTraceContext, dY as ResolvedObservabilityConfig, dZ as attachRequestMetrics, d_ as bindObservabilityRuntime, d$ as buildRequestLogger, e0 as captureRequestBody, e1 as createDyrectedApp, e2 as createObservabilityRuntime, e3 as createRequestSpan, e4 as decodeCollectionToken, e5 as endRequestSpan, e6 as getConfigLogger, e7 as getObservabilityRuntime, e8 as getRequestLogger, e9 as redactBody, ea as redactHeaders, eb as renderPrometheusMetrics, ec as resolveInviteTokenExpiry, ed as resolveObservabilityConfig, ee as resolveResetPasswordTokenExpiry, ef as resolveSessionTokenExpiry, eg as shouldSampleRequest, eh as signCollectionToken, ei as verifyCollectionToken } from './app-YGoigpOH.cjs';
3
3
  import * as hono from 'hono';
4
4
  import { Hono, Context, Next } from 'hono';
5
5
  import * as hono_utils_http_status from 'hono/utils/http-status';
@@ -132,6 +132,10 @@ declare class AuthController {
132
132
  error: true;
133
133
  message: string;
134
134
  }, 400, "json">) | (Response & hono.TypedResponse<{
135
+ emailError?: string | undefined;
136
+ emailSent: boolean;
137
+ token?: string | undefined;
138
+ resetUrl?: string | undefined;
135
139
  success: true;
136
140
  message: string;
137
141
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
@@ -141,6 +145,10 @@ declare class AuthController {
141
145
  error: true;
142
146
  message: string;
143
147
  }, 400, "json">) | (Response & hono.TypedResponse<{
148
+ error: true;
149
+ code: string;
150
+ message: string;
151
+ }, 403, "json">) | (Response & hono.TypedResponse<{
144
152
  success: true;
145
153
  message: string;
146
154
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
@@ -154,12 +162,15 @@ declare class AuthController {
154
162
  message: string;
155
163
  }, 400, "json">) | (Response & hono.TypedResponse<{
156
164
  error: true;
165
+ code: string;
157
166
  message: string;
158
167
  }, 409, "json">) | (Response & hono.TypedResponse<{
168
+ emailError?: string | undefined;
159
169
  success: true;
160
170
  message: string;
161
171
  token: string;
162
172
  inviteUrl: string;
173
+ emailSent: boolean;
163
174
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
164
175
  acceptInvite(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
165
176
  message: string;
@@ -168,6 +179,11 @@ declare class AuthController {
168
179
  message: string;
169
180
  }, 400, "json">) | (Response & hono.TypedResponse<{
170
181
  error: true;
182
+ code: string;
183
+ message: string;
184
+ }, 403, "json">) | (Response & hono.TypedResponse<{
185
+ error: true;
186
+ code: string;
171
187
  message: string;
172
188
  }, 409, "json">) | (Response & hono.TypedResponse<{
173
189
  token: string;
@@ -177,6 +193,21 @@ declare class AuthController {
177
193
  collection: string;
178
194
  };
179
195
  }, 201, "json">)>;
196
+ verifyToken(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
197
+ message: string;
198
+ }, 500, "json">) | (Response & hono.TypedResponse<{
199
+ valid: false;
200
+ code: string;
201
+ message: string;
202
+ }, 400, "json">) | (Response & hono.TypedResponse<{
203
+ valid: false;
204
+ code: string;
205
+ message: string;
206
+ }, 200, "json">) | (Response & hono.TypedResponse<{
207
+ valid: true;
208
+ email: any;
209
+ collection: string;
210
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
180
211
  }
181
212
 
182
213
  declare class CollectionController {
@@ -512,10 +543,14 @@ declare function revokeAllAuthSessions(config: DyrectedConfig, args: {
512
543
  * Returns a `salt:hash` string safe to store in the database.
513
544
  */
514
545
  declare function hashPassword(plain: string): Promise<string>;
546
+ /**
547
+ * Check whether a stored password string represents a valid salt:hash format.
548
+ */
549
+ declare function hasUsablePassword(stored: unknown): boolean;
515
550
  /**
516
551
  * Verify a plain-text password against a stored `salt:hash` string.
517
552
  */
518
- declare function verifyPassword(plain: string, stored: string): Promise<boolean>;
553
+ declare function verifyPassword(plain: string, stored: string | null | undefined): Promise<boolean>;
519
554
 
520
555
  declare const DEFAULT_MAX_LOGIN_ATTEMPTS = 5;
521
556
  declare const DEFAULT_LOCK_TIME_MS: number;
@@ -527,38 +562,53 @@ type ResolvedAuthLockoutConfig = {
527
562
  declare function resolveAuthLockoutConfig(collection: CollectionConfig): ResolvedAuthLockoutConfig;
528
563
  declare function getLockedUntilMs(value: unknown): number | null;
529
564
 
530
- declare function sendEmail(config: DyrectedConfig, payload: {
531
- to: string;
532
- subject: string;
533
- html: string;
534
- }): Promise<void>;
535
- declare function buildWelcomeEmail(config: DyrectedConfig, args: {
565
+ declare function sendEmail(config: DyrectedConfig, payload: OutboundEmail): Promise<{
566
+ success: boolean;
567
+ previewUrl?: string;
568
+ }>;
569
+ /**
570
+ * Interpolate simple {{key}} or {{object.nestedKey}} placeholders inside template strings.
571
+ *
572
+ * @param escapeMode
573
+ * - `"html"` (default): HTML-escapes every substituted value, preventing injection when
574
+ * the output string is rendered as HTML in an email body or subject.
575
+ * - `"none"`: Returns raw values as-is. Only use when the caller has already validated
576
+ * or controlled every value in `args` (e.g. internal mock-data in the test endpoint).
577
+ */
578
+ declare function interpolateVariables(str: string, args: Record<string, unknown>, escapeMode?: "html" | "none"): string;
579
+ declare function getDbEmailTemplateOverride(db: any, collectionSlug: string | undefined, purpose: string, args: Record<string, unknown>): Promise<EmailTemplateResult | null>;
580
+ /**
581
+ * Adapt an EmailTemplateResult into an OutboundEmail payload for dispatching to config.email.send.
582
+ */
583
+ declare function toOutboundEmail(to: string, result: EmailTemplateResult, metadata?: {
584
+ from?: string;
585
+ collection?: string;
586
+ purpose?: "invite" | "resetPassword" | "welcome" | "passwordChanged" | string;
587
+ user?: Record<string, unknown>;
588
+ }): OutboundEmail;
589
+ declare function buildWelcomeEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
536
590
  email: string;
537
- }): {
538
- subject: string;
539
- html: string;
540
- };
541
- declare function buildInviteEmail(config: DyrectedConfig, args: {
591
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
592
+ declare function buildInviteEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
542
593
  token: string;
543
594
  invitedByEmail?: string;
544
595
  url?: string;
545
- }): {
546
- subject: string;
547
- html: string;
548
- };
549
- declare function buildResetPasswordEmail(config: DyrectedConfig, args: {
596
+ data?: Record<string, unknown>;
597
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
598
+ declare function buildResetPasswordEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
550
599
  token: string;
551
600
  url?: string;
552
- }): {
553
- subject: string;
554
- html: string;
555
- };
556
- declare function buildPasswordChangedEmail(config: DyrectedConfig, args: {
601
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
602
+ declare function buildPasswordChangedEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
557
603
  email: string;
558
- }): {
559
- subject: string;
560
- html: string;
561
- };
604
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
605
+ declare function resolveEmailTemplate<T extends Record<string, unknown>>(params: {
606
+ config: DyrectedConfig;
607
+ collection?: CollectionConfig;
608
+ purpose: "invite" | "resetPassword" | "welcome" | "passwordChanged";
609
+ args: EmailTemplateArgs<T>;
610
+ db?: any;
611
+ }): Promise<EmailTemplateResult>;
562
612
 
563
613
  declare function getAIModel(config?: DyrectedConfig): LanguageModel;
564
614
  declare function formatAIErrorMessage(error: any): string;
@@ -781,4 +831,4 @@ declare class InMemoryRateLimitStore implements AIRateLimitStore {
781
831
  }
782
832
  declare function aiRateLimit(config?: DyrectedConfig): (c: Context<DyrectedContext>, next: Next) => Promise<void>;
783
833
 
784
- export { AIAgent, type AIAgentOptions, AIController, AUTH_SESSIONS_COLLECTION, AuthController, type AuthSessionRecord, type ChunkOptions, type ChunkResult, CollectionController, DEFAULT_LOCK_TIME_MS, DEFAULT_MAX_LOGIN_ATTEMPTS, type DeleteDocumentChunksOptions, DyrectedContext, EmbeddingService, GlobalController, InMemoryRateLimitStore, type IndexDocumentOptions, MediaController, PreviewController, type RAGSearchOptions, RAGService, type ReindexAllOptions, type ReindexCollectionOptions, type ResolvedAuthLockoutConfig, aiRateLimit, buildDyrectedSystemPrompt, buildInviteEmail, buildPasswordChangedEmail, buildResetPasswordEmail, buildWelcomeEmail, chunkText, cosineSimilarity, createDyrectedAITools, estimateTokens, extractTextFromDoc, formatAIErrorMessage, getAIModel, getAuthSession, getEmbeddingModel, getLockedUntilMs, hasEmbeddingApiKey, hashContent, hashPassword, isAuthSessionActive, issueAuthSessionToken, normalizeFieldValue, registerRoutes, resolveAuthLockoutConfig, revokeAllAuthSessions, revokeAuthSession, sendEmail, serializeActionsForApi, serializeDetailForApi, serializeViewForApi, touchAuthSession, validatePayloadAgainstFields, verifyPassword };
834
+ export { AIAgent, type AIAgentOptions, AIController, AUTH_SESSIONS_COLLECTION, AuthController, type AuthSessionRecord, type ChunkOptions, type ChunkResult, CollectionController, DEFAULT_LOCK_TIME_MS, DEFAULT_MAX_LOGIN_ATTEMPTS, type DeleteDocumentChunksOptions, DyrectedContext, EmbeddingService, GlobalController, InMemoryRateLimitStore, type IndexDocumentOptions, MediaController, PreviewController, type RAGSearchOptions, RAGService, type ReindexAllOptions, type ReindexCollectionOptions, type ResolvedAuthLockoutConfig, aiRateLimit, buildDyrectedSystemPrompt, buildInviteEmail, buildPasswordChangedEmail, buildResetPasswordEmail, buildWelcomeEmail, chunkText, cosineSimilarity, createDyrectedAITools, estimateTokens, extractTextFromDoc, formatAIErrorMessage, getAIModel, getAuthSession, getDbEmailTemplateOverride, getEmbeddingModel, getLockedUntilMs, hasEmbeddingApiKey, hasUsablePassword, hashContent, hashPassword, interpolateVariables, isAuthSessionActive, issueAuthSessionToken, normalizeFieldValue, registerRoutes, resolveAuthLockoutConfig, resolveEmailTemplate, revokeAllAuthSessions, revokeAuthSession, sendEmail, serializeActionsForApi, serializeDetailForApi, serializeViewForApi, toOutboundEmail, touchAuthSession, validatePayloadAgainstFields, verifyPassword };
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, e as DatabaseAdapter, b as AuthenticatedUser, b$ as DyrectedAIContext, ax as AIThread, at as AIMessage, cZ as RAGSearchResult, aw as AIRateLimitStore, av as AIRateLimitResult } from './app-CXF4MdJc.js';
2
- export { dN as CollectionTokenPayload, dO as DEFAULT_SESSION_EXPIRY, dP as DyrectedObservabilityRuntime, dQ as RequestBodyCapture, dR as RequestTraceContext, dS as ResolvedObservabilityConfig, dT as attachRequestMetrics, dU as bindObservabilityRuntime, dV as buildRequestLogger, dW as captureRequestBody, dX as createDyrectedApp, dY as createObservabilityRuntime, dZ as createRequestSpan, d_ as decodeCollectionToken, d$ as endRequestSpan, e0 as getConfigLogger, e1 as getObservabilityRuntime, e2 as getRequestLogger, e3 as redactBody, e4 as redactHeaders, e5 as renderPrometheusMetrics, e6 as resolveObservabilityConfig, e7 as resolveSessionTokenExpiry, e8 as shouldSampleRequest, e9 as signCollectionToken, ea as verifyCollectionToken } from './app-CXF4MdJc.js';
1
+ import { O as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, c4 as EmailTemplateArgs, c5 as EmailTemplateResult, cY as OutboundEmail, e as DatabaseAdapter, b as AuthenticatedUser, c0 as DyrectedAIContext, ax as AIThread, at as AIMessage, d1 as RAGSearchResult, aw as AIRateLimitStore, av as AIRateLimitResult } from './app-YGoigpOH.js';
2
+ export { dR as CollectionTokenPayload, dS as DEFAULT_INVITE_EXPIRY, dT as DEFAULT_RESET_PASSWORD_EXPIRY, dU as DEFAULT_SESSION_EXPIRY, dV as DyrectedObservabilityRuntime, dW as RequestBodyCapture, dX as RequestTraceContext, dY as ResolvedObservabilityConfig, dZ as attachRequestMetrics, d_ as bindObservabilityRuntime, d$ as buildRequestLogger, e0 as captureRequestBody, e1 as createDyrectedApp, e2 as createObservabilityRuntime, e3 as createRequestSpan, e4 as decodeCollectionToken, e5 as endRequestSpan, e6 as getConfigLogger, e7 as getObservabilityRuntime, e8 as getRequestLogger, e9 as redactBody, ea as redactHeaders, eb as renderPrometheusMetrics, ec as resolveInviteTokenExpiry, ed as resolveObservabilityConfig, ee as resolveResetPasswordTokenExpiry, ef as resolveSessionTokenExpiry, eg as shouldSampleRequest, eh as signCollectionToken, ei as verifyCollectionToken } from './app-YGoigpOH.js';
3
3
  import * as hono from 'hono';
4
4
  import { Hono, Context, Next } from 'hono';
5
5
  import * as hono_utils_http_status from 'hono/utils/http-status';
@@ -132,6 +132,10 @@ declare class AuthController {
132
132
  error: true;
133
133
  message: string;
134
134
  }, 400, "json">) | (Response & hono.TypedResponse<{
135
+ emailError?: string | undefined;
136
+ emailSent: boolean;
137
+ token?: string | undefined;
138
+ resetUrl?: string | undefined;
135
139
  success: true;
136
140
  message: string;
137
141
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
@@ -141,6 +145,10 @@ declare class AuthController {
141
145
  error: true;
142
146
  message: string;
143
147
  }, 400, "json">) | (Response & hono.TypedResponse<{
148
+ error: true;
149
+ code: string;
150
+ message: string;
151
+ }, 403, "json">) | (Response & hono.TypedResponse<{
144
152
  success: true;
145
153
  message: string;
146
154
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
@@ -154,12 +162,15 @@ declare class AuthController {
154
162
  message: string;
155
163
  }, 400, "json">) | (Response & hono.TypedResponse<{
156
164
  error: true;
165
+ code: string;
157
166
  message: string;
158
167
  }, 409, "json">) | (Response & hono.TypedResponse<{
168
+ emailError?: string | undefined;
159
169
  success: true;
160
170
  message: string;
161
171
  token: string;
162
172
  inviteUrl: string;
173
+ emailSent: boolean;
163
174
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
164
175
  acceptInvite(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
165
176
  message: string;
@@ -168,6 +179,11 @@ declare class AuthController {
168
179
  message: string;
169
180
  }, 400, "json">) | (Response & hono.TypedResponse<{
170
181
  error: true;
182
+ code: string;
183
+ message: string;
184
+ }, 403, "json">) | (Response & hono.TypedResponse<{
185
+ error: true;
186
+ code: string;
171
187
  message: string;
172
188
  }, 409, "json">) | (Response & hono.TypedResponse<{
173
189
  token: string;
@@ -177,6 +193,21 @@ declare class AuthController {
177
193
  collection: string;
178
194
  };
179
195
  }, 201, "json">)>;
196
+ verifyToken(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
197
+ message: string;
198
+ }, 500, "json">) | (Response & hono.TypedResponse<{
199
+ valid: false;
200
+ code: string;
201
+ message: string;
202
+ }, 400, "json">) | (Response & hono.TypedResponse<{
203
+ valid: false;
204
+ code: string;
205
+ message: string;
206
+ }, 200, "json">) | (Response & hono.TypedResponse<{
207
+ valid: true;
208
+ email: any;
209
+ collection: string;
210
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
180
211
  }
181
212
 
182
213
  declare class CollectionController {
@@ -512,10 +543,14 @@ declare function revokeAllAuthSessions(config: DyrectedConfig, args: {
512
543
  * Returns a `salt:hash` string safe to store in the database.
513
544
  */
514
545
  declare function hashPassword(plain: string): Promise<string>;
546
+ /**
547
+ * Check whether a stored password string represents a valid salt:hash format.
548
+ */
549
+ declare function hasUsablePassword(stored: unknown): boolean;
515
550
  /**
516
551
  * Verify a plain-text password against a stored `salt:hash` string.
517
552
  */
518
- declare function verifyPassword(plain: string, stored: string): Promise<boolean>;
553
+ declare function verifyPassword(plain: string, stored: string | null | undefined): Promise<boolean>;
519
554
 
520
555
  declare const DEFAULT_MAX_LOGIN_ATTEMPTS = 5;
521
556
  declare const DEFAULT_LOCK_TIME_MS: number;
@@ -527,38 +562,53 @@ type ResolvedAuthLockoutConfig = {
527
562
  declare function resolveAuthLockoutConfig(collection: CollectionConfig): ResolvedAuthLockoutConfig;
528
563
  declare function getLockedUntilMs(value: unknown): number | null;
529
564
 
530
- declare function sendEmail(config: DyrectedConfig, payload: {
531
- to: string;
532
- subject: string;
533
- html: string;
534
- }): Promise<void>;
535
- declare function buildWelcomeEmail(config: DyrectedConfig, args: {
565
+ declare function sendEmail(config: DyrectedConfig, payload: OutboundEmail): Promise<{
566
+ success: boolean;
567
+ previewUrl?: string;
568
+ }>;
569
+ /**
570
+ * Interpolate simple {{key}} or {{object.nestedKey}} placeholders inside template strings.
571
+ *
572
+ * @param escapeMode
573
+ * - `"html"` (default): HTML-escapes every substituted value, preventing injection when
574
+ * the output string is rendered as HTML in an email body or subject.
575
+ * - `"none"`: Returns raw values as-is. Only use when the caller has already validated
576
+ * or controlled every value in `args` (e.g. internal mock-data in the test endpoint).
577
+ */
578
+ declare function interpolateVariables(str: string, args: Record<string, unknown>, escapeMode?: "html" | "none"): string;
579
+ declare function getDbEmailTemplateOverride(db: any, collectionSlug: string | undefined, purpose: string, args: Record<string, unknown>): Promise<EmailTemplateResult | null>;
580
+ /**
581
+ * Adapt an EmailTemplateResult into an OutboundEmail payload for dispatching to config.email.send.
582
+ */
583
+ declare function toOutboundEmail(to: string, result: EmailTemplateResult, metadata?: {
584
+ from?: string;
585
+ collection?: string;
586
+ purpose?: "invite" | "resetPassword" | "welcome" | "passwordChanged" | string;
587
+ user?: Record<string, unknown>;
588
+ }): OutboundEmail;
589
+ declare function buildWelcomeEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
536
590
  email: string;
537
- }): {
538
- subject: string;
539
- html: string;
540
- };
541
- declare function buildInviteEmail(config: DyrectedConfig, args: {
591
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
592
+ declare function buildInviteEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
542
593
  token: string;
543
594
  invitedByEmail?: string;
544
595
  url?: string;
545
- }): {
546
- subject: string;
547
- html: string;
548
- };
549
- declare function buildResetPasswordEmail(config: DyrectedConfig, args: {
596
+ data?: Record<string, unknown>;
597
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
598
+ declare function buildResetPasswordEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
550
599
  token: string;
551
600
  url?: string;
552
- }): {
553
- subject: string;
554
- html: string;
555
- };
556
- declare function buildPasswordChangedEmail(config: DyrectedConfig, args: {
601
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
602
+ declare function buildPasswordChangedEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
557
603
  email: string;
558
- }): {
559
- subject: string;
560
- html: string;
561
- };
604
+ }>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
605
+ declare function resolveEmailTemplate<T extends Record<string, unknown>>(params: {
606
+ config: DyrectedConfig;
607
+ collection?: CollectionConfig;
608
+ purpose: "invite" | "resetPassword" | "welcome" | "passwordChanged";
609
+ args: EmailTemplateArgs<T>;
610
+ db?: any;
611
+ }): Promise<EmailTemplateResult>;
562
612
 
563
613
  declare function getAIModel(config?: DyrectedConfig): LanguageModel;
564
614
  declare function formatAIErrorMessage(error: any): string;
@@ -781,4 +831,4 @@ declare class InMemoryRateLimitStore implements AIRateLimitStore {
781
831
  }
782
832
  declare function aiRateLimit(config?: DyrectedConfig): (c: Context<DyrectedContext>, next: Next) => Promise<void>;
783
833
 
784
- export { AIAgent, type AIAgentOptions, AIController, AUTH_SESSIONS_COLLECTION, AuthController, type AuthSessionRecord, type ChunkOptions, type ChunkResult, CollectionController, DEFAULT_LOCK_TIME_MS, DEFAULT_MAX_LOGIN_ATTEMPTS, type DeleteDocumentChunksOptions, DyrectedContext, EmbeddingService, GlobalController, InMemoryRateLimitStore, type IndexDocumentOptions, MediaController, PreviewController, type RAGSearchOptions, RAGService, type ReindexAllOptions, type ReindexCollectionOptions, type ResolvedAuthLockoutConfig, aiRateLimit, buildDyrectedSystemPrompt, buildInviteEmail, buildPasswordChangedEmail, buildResetPasswordEmail, buildWelcomeEmail, chunkText, cosineSimilarity, createDyrectedAITools, estimateTokens, extractTextFromDoc, formatAIErrorMessage, getAIModel, getAuthSession, getEmbeddingModel, getLockedUntilMs, hasEmbeddingApiKey, hashContent, hashPassword, isAuthSessionActive, issueAuthSessionToken, normalizeFieldValue, registerRoutes, resolveAuthLockoutConfig, revokeAllAuthSessions, revokeAuthSession, sendEmail, serializeActionsForApi, serializeDetailForApi, serializeViewForApi, touchAuthSession, validatePayloadAgainstFields, verifyPassword };
834
+ export { AIAgent, type AIAgentOptions, AIController, AUTH_SESSIONS_COLLECTION, AuthController, type AuthSessionRecord, type ChunkOptions, type ChunkResult, CollectionController, DEFAULT_LOCK_TIME_MS, DEFAULT_MAX_LOGIN_ATTEMPTS, type DeleteDocumentChunksOptions, DyrectedContext, EmbeddingService, GlobalController, InMemoryRateLimitStore, type IndexDocumentOptions, MediaController, PreviewController, type RAGSearchOptions, RAGService, type ReindexAllOptions, type ReindexCollectionOptions, type ResolvedAuthLockoutConfig, aiRateLimit, buildDyrectedSystemPrompt, buildInviteEmail, buildPasswordChangedEmail, buildResetPasswordEmail, buildWelcomeEmail, chunkText, cosineSimilarity, createDyrectedAITools, estimateTokens, extractTextFromDoc, formatAIErrorMessage, getAIModel, getAuthSession, getDbEmailTemplateOverride, getEmbeddingModel, getLockedUntilMs, hasEmbeddingApiKey, hasUsablePassword, hashContent, hashPassword, interpolateVariables, isAuthSessionActive, issueAuthSessionToken, normalizeFieldValue, registerRoutes, resolveAuthLockoutConfig, resolveEmailTemplate, revokeAllAuthSessions, revokeAuthSession, sendEmail, serializeActionsForApi, serializeDetailForApi, serializeViewForApi, toOutboundEmail, touchAuthSession, validatePayloadAgainstFields, verifyPassword };