@dyrected/core 2.18.1 → 2.20.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/{app-x7J5BIqK.d.cts → app-v23fNf58.d.cts} +267 -33
- package/dist/{app-x7J5BIqK.d.ts → app-v23fNf58.d.ts} +267 -33
- package/dist/index.cjs +3030 -2047
- package/dist/index.d.cts +301 -8
- package/dist/index.d.ts +301 -8
- package/dist/index.js +2995 -2047
- package/dist/server.cjs +8513 -5959
- package/dist/server.d.cts +99 -29
- package/dist/server.d.ts +99 -29
- package/dist/server.js +8456 -5911
- package/package.json +1 -1
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,
|
|
2
|
-
export {
|
|
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-v23fNf58.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-v23fNf58.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 {
|
|
@@ -232,6 +263,26 @@ declare class CollectionController {
|
|
|
232
263
|
changePassword(c: Context<DyrectedContext>): Promise<any>;
|
|
233
264
|
delete(c: Context<DyrectedContext>): Promise<any>;
|
|
234
265
|
deleteMany(c: Context<DyrectedContext>): Promise<any>;
|
|
266
|
+
listTrash(c: Context<DyrectedContext>): Promise<any>;
|
|
267
|
+
getTrashEntry(c: Context<DyrectedContext>): Promise<any>;
|
|
268
|
+
restore(c: Context<DyrectedContext>): Promise<any>;
|
|
269
|
+
restoreMany(c: Context<DyrectedContext>): Promise<any>;
|
|
270
|
+
keep(c: Context<DyrectedContext>): Promise<any>;
|
|
271
|
+
purgeTrashEntry(c: Context<DyrectedContext>): Promise<any>;
|
|
272
|
+
emptyTrash(c: Context<DyrectedContext>): Promise<any>;
|
|
273
|
+
static listAllTrash(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
274
|
+
message: string;
|
|
275
|
+
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
276
|
+
docs: {
|
|
277
|
+
snapshot: any;
|
|
278
|
+
}[];
|
|
279
|
+
total: number;
|
|
280
|
+
limit: number;
|
|
281
|
+
page: number;
|
|
282
|
+
totalPages: number;
|
|
283
|
+
hasNextPage: boolean;
|
|
284
|
+
hasPrevPage: boolean;
|
|
285
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">)>;
|
|
235
286
|
seed(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
|
|
236
287
|
message: string;
|
|
237
288
|
}, hono_utils_http_status.ContentfulStatusCode, "json">>;
|
|
@@ -492,10 +543,14 @@ declare function revokeAllAuthSessions(config: DyrectedConfig, args: {
|
|
|
492
543
|
* Returns a `salt:hash` string safe to store in the database.
|
|
493
544
|
*/
|
|
494
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;
|
|
495
550
|
/**
|
|
496
551
|
* Verify a plain-text password against a stored `salt:hash` string.
|
|
497
552
|
*/
|
|
498
|
-
declare function verifyPassword(plain: string, stored: string): Promise<boolean>;
|
|
553
|
+
declare function verifyPassword(plain: string, stored: string | null | undefined): Promise<boolean>;
|
|
499
554
|
|
|
500
555
|
declare const DEFAULT_MAX_LOGIN_ATTEMPTS = 5;
|
|
501
556
|
declare const DEFAULT_LOCK_TIME_MS: number;
|
|
@@ -507,38 +562,53 @@ type ResolvedAuthLockoutConfig = {
|
|
|
507
562
|
declare function resolveAuthLockoutConfig(collection: CollectionConfig): ResolvedAuthLockoutConfig;
|
|
508
563
|
declare function getLockedUntilMs(value: unknown): number | null;
|
|
509
564
|
|
|
510
|
-
declare function sendEmail(config: DyrectedConfig, payload: {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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<{
|
|
516
590
|
email: string;
|
|
517
|
-
}):
|
|
518
|
-
|
|
519
|
-
html: string;
|
|
520
|
-
};
|
|
521
|
-
declare function buildInviteEmail(config: DyrectedConfig, args: {
|
|
591
|
+
}>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
|
|
592
|
+
declare function buildInviteEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
|
|
522
593
|
token: string;
|
|
523
594
|
invitedByEmail?: string;
|
|
524
595
|
url?: string;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
};
|
|
529
|
-
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<{
|
|
530
599
|
token: string;
|
|
531
600
|
url?: string;
|
|
532
|
-
}):
|
|
533
|
-
|
|
534
|
-
html: string;
|
|
535
|
-
};
|
|
536
|
-
declare function buildPasswordChangedEmail(config: DyrectedConfig, args: {
|
|
601
|
+
}>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
|
|
602
|
+
declare function buildPasswordChangedEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
|
|
537
603
|
email: string;
|
|
538
|
-
}):
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
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>;
|
|
542
612
|
|
|
543
613
|
declare function getAIModel(config?: DyrectedConfig): LanguageModel;
|
|
544
614
|
declare function formatAIErrorMessage(error: any): string;
|
|
@@ -761,4 +831,4 @@ declare class InMemoryRateLimitStore implements AIRateLimitStore {
|
|
|
761
831
|
}
|
|
762
832
|
declare function aiRateLimit(config?: DyrectedConfig): (c: Context<DyrectedContext>, next: Next) => Promise<void>;
|
|
763
833
|
|
|
764
|
-
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,
|
|
2
|
-
export {
|
|
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-v23fNf58.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-v23fNf58.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 {
|
|
@@ -232,6 +263,26 @@ declare class CollectionController {
|
|
|
232
263
|
changePassword(c: Context<DyrectedContext>): Promise<any>;
|
|
233
264
|
delete(c: Context<DyrectedContext>): Promise<any>;
|
|
234
265
|
deleteMany(c: Context<DyrectedContext>): Promise<any>;
|
|
266
|
+
listTrash(c: Context<DyrectedContext>): Promise<any>;
|
|
267
|
+
getTrashEntry(c: Context<DyrectedContext>): Promise<any>;
|
|
268
|
+
restore(c: Context<DyrectedContext>): Promise<any>;
|
|
269
|
+
restoreMany(c: Context<DyrectedContext>): Promise<any>;
|
|
270
|
+
keep(c: Context<DyrectedContext>): Promise<any>;
|
|
271
|
+
purgeTrashEntry(c: Context<DyrectedContext>): Promise<any>;
|
|
272
|
+
emptyTrash(c: Context<DyrectedContext>): Promise<any>;
|
|
273
|
+
static listAllTrash(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
274
|
+
message: string;
|
|
275
|
+
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
276
|
+
docs: {
|
|
277
|
+
snapshot: any;
|
|
278
|
+
}[];
|
|
279
|
+
total: number;
|
|
280
|
+
limit: number;
|
|
281
|
+
page: number;
|
|
282
|
+
totalPages: number;
|
|
283
|
+
hasNextPage: boolean;
|
|
284
|
+
hasPrevPage: boolean;
|
|
285
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">)>;
|
|
235
286
|
seed(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
|
|
236
287
|
message: string;
|
|
237
288
|
}, hono_utils_http_status.ContentfulStatusCode, "json">>;
|
|
@@ -492,10 +543,14 @@ declare function revokeAllAuthSessions(config: DyrectedConfig, args: {
|
|
|
492
543
|
* Returns a `salt:hash` string safe to store in the database.
|
|
493
544
|
*/
|
|
494
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;
|
|
495
550
|
/**
|
|
496
551
|
* Verify a plain-text password against a stored `salt:hash` string.
|
|
497
552
|
*/
|
|
498
|
-
declare function verifyPassword(plain: string, stored: string): Promise<boolean>;
|
|
553
|
+
declare function verifyPassword(plain: string, stored: string | null | undefined): Promise<boolean>;
|
|
499
554
|
|
|
500
555
|
declare const DEFAULT_MAX_LOGIN_ATTEMPTS = 5;
|
|
501
556
|
declare const DEFAULT_LOCK_TIME_MS: number;
|
|
@@ -507,38 +562,53 @@ type ResolvedAuthLockoutConfig = {
|
|
|
507
562
|
declare function resolveAuthLockoutConfig(collection: CollectionConfig): ResolvedAuthLockoutConfig;
|
|
508
563
|
declare function getLockedUntilMs(value: unknown): number | null;
|
|
509
564
|
|
|
510
|
-
declare function sendEmail(config: DyrectedConfig, payload: {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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<{
|
|
516
590
|
email: string;
|
|
517
|
-
}):
|
|
518
|
-
|
|
519
|
-
html: string;
|
|
520
|
-
};
|
|
521
|
-
declare function buildInviteEmail(config: DyrectedConfig, args: {
|
|
591
|
+
}>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
|
|
592
|
+
declare function buildInviteEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
|
|
522
593
|
token: string;
|
|
523
594
|
invitedByEmail?: string;
|
|
524
595
|
url?: string;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
};
|
|
529
|
-
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<{
|
|
530
599
|
token: string;
|
|
531
600
|
url?: string;
|
|
532
|
-
}):
|
|
533
|
-
|
|
534
|
-
html: string;
|
|
535
|
-
};
|
|
536
|
-
declare function buildPasswordChangedEmail(config: DyrectedConfig, args: {
|
|
601
|
+
}>, collection?: CollectionConfig, dbOverride?: EmailTemplateResult | null): EmailTemplateResult;
|
|
602
|
+
declare function buildPasswordChangedEmail(config: DyrectedConfig, args: EmailTemplateArgs<{
|
|
537
603
|
email: string;
|
|
538
|
-
}):
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
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>;
|
|
542
612
|
|
|
543
613
|
declare function getAIModel(config?: DyrectedConfig): LanguageModel;
|
|
544
614
|
declare function formatAIErrorMessage(error: any): string;
|
|
@@ -761,4 +831,4 @@ declare class InMemoryRateLimitStore implements AIRateLimitStore {
|
|
|
761
831
|
}
|
|
762
832
|
declare function aiRateLimit(config?: DyrectedConfig): (c: Context<DyrectedContext>, next: Next) => Promise<void>;
|
|
763
833
|
|
|
764
|
-
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 };
|