@nexo-labs/payload-typesense 1.6.5 → 1.6.6

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/index.d.mts CHANGED
@@ -24915,9 +24915,10 @@ interface TypesenseSearchConfig {
24915
24915
  * - Schema synchronization
24916
24916
  * - Agent synchronization
24917
24917
  */
24918
- interface TypesenseRAGPluginConfig {
24918
+ interface TypesenseRAGPluginConfig<TSlug extends CollectionSlug> {
24919
24919
  /** Typesense connection configuration */
24920
24920
  typesense: TypesenseConnectionConfig;
24921
+ collectionName: TSlug;
24921
24922
  /**
24922
24923
  * Embedding provider config (for RAG query embedding)
24923
24924
  * Note: The RAG handler creates its own provider instance to track usage/spending.
@@ -24953,7 +24954,7 @@ interface TypesenseRAGPluginConfig {
24953
24954
  * @param config - Typesense RAG plugin configuration
24954
24955
  * @returns Payload config modifier function
24955
24956
  */
24956
- declare function createTypesenseRAGPlugin(config: TypesenseRAGPluginConfig): (payloadConfig: Config) => Config;
24957
+ declare function createTypesenseRAGPlugin<TConfig extends Config, TSlug extends CollectionSlug>(config: TypesenseRAGPluginConfig<TSlug>): (payloadConfig: TConfig) => TConfig;
24957
24958
  //#endregion
24958
24959
  //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.28.4/node_modules/typesense/lib/Typesense/Errors/TypesenseError.d.ts
24959
24960
  declare class TypesenseError extends Error {
@@ -27053,9 +27054,9 @@ type ChatSessionData = {
27053
27054
  /**
27054
27055
  * Configuration for session operations
27055
27056
  */
27056
- type SessionConfig = {
27057
+ type SessionConfig<TSlug extends CollectionSlug> = {
27057
27058
  /** Collection name for sessions */
27058
- collectionName?: CollectionSlug;
27059
+ collectionName?: TSlug;
27059
27060
  /** Time window for active sessions in milliseconds */
27060
27061
  activeSessionWindow?: number;
27061
27062
  };
@@ -27067,7 +27068,7 @@ type SessionConfig = {
27067
27068
  * @param config - Session configuration
27068
27069
  * @returns Promise with session data or null
27069
27070
  */
27070
- declare function getActiveSession(payload: Payload, userId: string | number, config?: SessionConfig): Promise<ChatSessionData | null>;
27071
+ declare function getActiveSession<TSlug extends CollectionSlug>(payload: Payload, userId: string | number, config?: SessionConfig<TSlug>): Promise<ChatSessionData | null>;
27071
27072
  /**
27072
27073
  * Get session by conversation ID
27073
27074
  *
@@ -27077,7 +27078,7 @@ declare function getActiveSession(payload: Payload, userId: string | number, con
27077
27078
  * @param config - Session configuration
27078
27079
  * @returns Promise with session data or null
27079
27080
  */
27080
- declare function getSessionByConversationId(payload: Payload, userId: string | number, conversationId: string, config?: SessionConfig): Promise<ChatSessionData | null>;
27081
+ declare function getSessionByConversationId<TSlug extends CollectionSlug>(payload: Payload, userId: string | number, conversationId: string, config?: SessionConfig<TSlug>): Promise<ChatSessionData | null>;
27081
27082
  /**
27082
27083
  * Close a chat session
27083
27084
  *
@@ -27087,7 +27088,7 @@ declare function getSessionByConversationId(payload: Payload, userId: string | n
27087
27088
  * @param config - Session configuration
27088
27089
  * @returns Promise with updated session data or null if not found
27089
27090
  */
27090
- declare function closeSession(payload: Payload, userId: string | number, conversationId: string, config?: SessionConfig): Promise<ChatSessionData | null>;
27091
+ declare function closeSession<TSlug extends CollectionSlug>(payload: Payload, userId: string | number, conversationId: string, config?: SessionConfig<TSlug>): Promise<ChatSessionData | null>;
27091
27092
  //#endregion
27092
27093
  //#region src/features/rag/utils/sse-utils.d.ts
27093
27094
  /**
@@ -27134,7 +27135,7 @@ interface ChatMessageWithSources {
27134
27135
  * @param spending - Token spending entries
27135
27136
  * @param collectionName - Collection name for sessions (default: 'chat-sessions')
27136
27137
  */
27137
- declare function saveChatSession(payload: Payload, userId: string | number, conversationId: string, userMessage: string, assistantMessage: string, sources: ChunkSource[], spending: SpendingEntry[], collectionName?: CollectionSlug): Promise<void>;
27138
+ declare function saveChatSession(payload: Payload, userId: string | number, conversationId: string, userMessage: string, assistantMessage: string, sources: ChunkSource[], spending: SpendingEntry[], collectionName: CollectionSlug): Promise<void>;
27138
27139
  //#endregion
27139
27140
  //#region src/features/rag/endpoints/types.d.ts
27140
27141
  /**
@@ -27215,7 +27216,7 @@ declare const createSearchEndpoints: (typesenseClient: Client, pluginOptions: Mo
27215
27216
  *
27216
27217
  * @param config - RAG plugin configuration (composable, doesn't depend on ModularPluginConfig)
27217
27218
  */
27218
- declare function createRAGPayloadHandlers(config: TypesenseRAGPluginConfig): Array<{
27219
+ declare function createRAGPayloadHandlers<TSlug extends CollectionSlug>(config: TypesenseRAGPluginConfig<TSlug>): Array<{
27219
27220
  path: string;
27220
27221
  method: 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put';
27221
27222
  handler: PayloadHandler;