@dyrected/core 2.16.0 → 2.18.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/server.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, bn as DatabaseAdapter, b as AuthenticatedUser, bI as DyrectedAIContext, ao as AIThread, ak as AIMessage, cz as RAGSearchResult, an as AIRateLimitStore, am as AIRateLimitResult } from './app-KSDgfXsw.cjs';
2
- export { dd as CollectionTokenPayload, de as DEFAULT_SESSION_EXPIRY, df as DyrectedObservabilityRuntime, dg as RequestBodyCapture, dh as RequestTraceContext, di as ResolvedObservabilityConfig, dj as attachRequestMetrics, dk as bindObservabilityRuntime, dl as buildRequestLogger, dm as captureRequestBody, dn as createDyrectedApp, dp as createObservabilityRuntime, dq as createRequestSpan, dr as decodeCollectionToken, ds as endRequestSpan, dt as getConfigLogger, du as getObservabilityRuntime, dv as getRequestLogger, dw as redactBody, dx as redactHeaders, dy as renderPrometheusMetrics, dz as resolveObservabilityConfig, dA as resolveSessionTokenExpiry, dB as shouldSampleRequest, dC as signCollectionToken, dD as verifyCollectionToken } from './app-KSDgfXsw.cjs';
1
+ import { O as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, e as DatabaseAdapter, b as AuthenticatedUser, bV as DyrectedAIContext, aw as AIThread, as as AIMessage, cT as RAGSearchResult, av as AIRateLimitStore, au as AIRateLimitResult } from './app-Dd9cBbCs.cjs';
2
+ export { dH as CollectionTokenPayload, dI as DEFAULT_SESSION_EXPIRY, dJ as DyrectedObservabilityRuntime, dK as RequestBodyCapture, dL as RequestTraceContext, dM as ResolvedObservabilityConfig, dN as attachRequestMetrics, dO as bindObservabilityRuntime, dP as buildRequestLogger, dQ as captureRequestBody, dR as createDyrectedApp, dS as createObservabilityRuntime, dT as createRequestSpan, dU as decodeCollectionToken, dV as endRequestSpan, dW as getConfigLogger, dX as getObservabilityRuntime, dY as getRequestLogger, dZ as redactBody, d_ as redactHeaders, d$ as renderPrometheusMetrics, e0 as resolveObservabilityConfig, e1 as resolveSessionTokenExpiry, e2 as shouldSampleRequest, e3 as signCollectionToken, e4 as verifyCollectionToken } from './app-Dd9cBbCs.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';
@@ -14,6 +14,12 @@ import '@opentelemetry/api';
14
14
  import '@opentelemetry/exporter-prometheus';
15
15
 
16
16
  declare function serializeDetailForApi(detail?: any): any;
17
+ /**
18
+ * Serializes a list of operational actions (view-level or collection-level)
19
+ * for the Admin API. Function properties (self-hosted handlers) are stripped so
20
+ * the payload stays JSON-safe; access rules are resolved to static values.
21
+ */
22
+ declare function serializeActionsForApi(actions: any[] | undefined, serializeAccess: (access: any) => Promise<any>): Promise<any[]>;
17
23
  /**
18
24
  * Serializes an operational view config for the Admin API.
19
25
  * Function properties (action handlers) are stripped so the payload stays
@@ -153,7 +159,7 @@ declare class AuthController {
153
159
  success: true;
154
160
  message: string;
155
161
  token: string;
156
- inviteUrl: string | undefined;
162
+ inviteUrl: string;
157
163
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
158
164
  acceptInvite(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
159
165
  message: string;
@@ -186,6 +192,16 @@ declare class CollectionController {
186
192
  create(c: Context<DyrectedContext>): Promise<any>;
187
193
  upload(c: Context<DyrectedContext>): Promise<any>;
188
194
  update(c: Context<DyrectedContext>): Promise<any>;
195
+ /**
196
+ * Builds the callback that runs the collection's `beforeCommit` hooks inside
197
+ * the write transaction, or `undefined` when the collection has none.
198
+ */
199
+ private buildBeforeCommit;
200
+ /**
201
+ * Runs a single write. When `beforeCommit` hooks exist the write and the
202
+ * hooks share one transaction, so a throwing hook rolls the write back.
203
+ */
204
+ private persistInTransaction;
189
205
  /**
190
206
  * Core update pipeline shared by PATCH requests and operational actions:
191
207
  * auth-field stripping, timestamps, access enforcement, field write access,
@@ -745,4 +761,4 @@ declare class InMemoryRateLimitStore implements AIRateLimitStore {
745
761
  }
746
762
  declare function aiRateLimit(config?: DyrectedConfig): (c: Context<DyrectedContext>, next: Next) => Promise<void>;
747
763
 
748
- 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, serializeDetailForApi, serializeViewForApi, touchAuthSession, validatePayloadAgainstFields, verifyPassword };
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 };
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, bn as DatabaseAdapter, b as AuthenticatedUser, bI as DyrectedAIContext, ao as AIThread, ak as AIMessage, cz as RAGSearchResult, an as AIRateLimitStore, am as AIRateLimitResult } from './app-KSDgfXsw.js';
2
- export { dd as CollectionTokenPayload, de as DEFAULT_SESSION_EXPIRY, df as DyrectedObservabilityRuntime, dg as RequestBodyCapture, dh as RequestTraceContext, di as ResolvedObservabilityConfig, dj as attachRequestMetrics, dk as bindObservabilityRuntime, dl as buildRequestLogger, dm as captureRequestBody, dn as createDyrectedApp, dp as createObservabilityRuntime, dq as createRequestSpan, dr as decodeCollectionToken, ds as endRequestSpan, dt as getConfigLogger, du as getObservabilityRuntime, dv as getRequestLogger, dw as redactBody, dx as redactHeaders, dy as renderPrometheusMetrics, dz as resolveObservabilityConfig, dA as resolveSessionTokenExpiry, dB as shouldSampleRequest, dC as signCollectionToken, dD as verifyCollectionToken } from './app-KSDgfXsw.js';
1
+ import { O as DyrectedContext, D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig, e as DatabaseAdapter, b as AuthenticatedUser, bV as DyrectedAIContext, aw as AIThread, as as AIMessage, cT as RAGSearchResult, av as AIRateLimitStore, au as AIRateLimitResult } from './app-Dd9cBbCs.js';
2
+ export { dH as CollectionTokenPayload, dI as DEFAULT_SESSION_EXPIRY, dJ as DyrectedObservabilityRuntime, dK as RequestBodyCapture, dL as RequestTraceContext, dM as ResolvedObservabilityConfig, dN as attachRequestMetrics, dO as bindObservabilityRuntime, dP as buildRequestLogger, dQ as captureRequestBody, dR as createDyrectedApp, dS as createObservabilityRuntime, dT as createRequestSpan, dU as decodeCollectionToken, dV as endRequestSpan, dW as getConfigLogger, dX as getObservabilityRuntime, dY as getRequestLogger, dZ as redactBody, d_ as redactHeaders, d$ as renderPrometheusMetrics, e0 as resolveObservabilityConfig, e1 as resolveSessionTokenExpiry, e2 as shouldSampleRequest, e3 as signCollectionToken, e4 as verifyCollectionToken } from './app-Dd9cBbCs.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';
@@ -14,6 +14,12 @@ import '@opentelemetry/api';
14
14
  import '@opentelemetry/exporter-prometheus';
15
15
 
16
16
  declare function serializeDetailForApi(detail?: any): any;
17
+ /**
18
+ * Serializes a list of operational actions (view-level or collection-level)
19
+ * for the Admin API. Function properties (self-hosted handlers) are stripped so
20
+ * the payload stays JSON-safe; access rules are resolved to static values.
21
+ */
22
+ declare function serializeActionsForApi(actions: any[] | undefined, serializeAccess: (access: any) => Promise<any>): Promise<any[]>;
17
23
  /**
18
24
  * Serializes an operational view config for the Admin API.
19
25
  * Function properties (action handlers) are stripped so the payload stays
@@ -153,7 +159,7 @@ declare class AuthController {
153
159
  success: true;
154
160
  message: string;
155
161
  token: string;
156
- inviteUrl: string | undefined;
162
+ inviteUrl: string;
157
163
  }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
158
164
  acceptInvite(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
159
165
  message: string;
@@ -186,6 +192,16 @@ declare class CollectionController {
186
192
  create(c: Context<DyrectedContext>): Promise<any>;
187
193
  upload(c: Context<DyrectedContext>): Promise<any>;
188
194
  update(c: Context<DyrectedContext>): Promise<any>;
195
+ /**
196
+ * Builds the callback that runs the collection's `beforeCommit` hooks inside
197
+ * the write transaction, or `undefined` when the collection has none.
198
+ */
199
+ private buildBeforeCommit;
200
+ /**
201
+ * Runs a single write. When `beforeCommit` hooks exist the write and the
202
+ * hooks share one transaction, so a throwing hook rolls the write back.
203
+ */
204
+ private persistInTransaction;
189
205
  /**
190
206
  * Core update pipeline shared by PATCH requests and operational actions:
191
207
  * auth-field stripping, timestamps, access enforcement, field write access,
@@ -745,4 +761,4 @@ declare class InMemoryRateLimitStore implements AIRateLimitStore {
745
761
  }
746
762
  declare function aiRateLimit(config?: DyrectedConfig): (c: Context<DyrectedContext>, next: Next) => Promise<void>;
747
763
 
748
- 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, serializeDetailForApi, serializeViewForApi, touchAuthSession, validatePayloadAgainstFields, verifyPassword };
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 };