@librechat/data-schemas 0.0.36 → 0.0.38

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.
@@ -40,10 +40,11 @@ import { type AccessRoleMethods } from './accessRole';
40
40
  import { type UserGroupMethods } from './userGroup';
41
41
  import { type AclEntryMethods } from './aclEntry';
42
42
  import { type ShareMethods } from './share';
43
- export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & KeyMethods & FileMethods & MemoryMethods & AgentCategoryMethods & AgentApiKeyMethods & MCPServerMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods;
43
+ import { type TransactionMethods } from './transaction';
44
+ export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & KeyMethods & FileMethods & MemoryMethods & AgentCategoryMethods & AgentApiKeyMethods & MCPServerMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods & TransactionMethods;
44
45
  /**
45
46
  * Creates all database methods for all collections
46
47
  * @param mongoose - Mongoose instance
47
48
  */
48
49
  export declare function createMethods(mongoose: typeof import('mongoose')): AllMethods;
49
- export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, KeyMethods, FileMethods, MemoryMethods, AgentCategoryMethods, AgentApiKeyMethods, MCPServerMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, };
50
+ export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, KeyMethods, FileMethods, MemoryMethods, AgentCategoryMethods, AgentApiKeyMethods, MCPServerMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, TransactionMethods, };
@@ -0,0 +1,46 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ import type { IBalance, TransactionData } from '~/types';
28
+ interface UpdateBalanceParams {
29
+ user: string;
30
+ incrementValue: number;
31
+ setValues?: Partial<Pick<IBalance, 'tokenCredits' | 'lastRefill'>>;
32
+ }
33
+ export declare function createTransactionMethods(mongoose: typeof import('mongoose')): {
34
+ updateBalance: ({ user, incrementValue, setValues }: UpdateBalanceParams) => Promise<(import("mongoose").FlattenMaps<any> & Required<{
35
+ _id: unknown;
36
+ }> & {
37
+ __v: number;
38
+ })[] | (import("mongoose").FlattenMaps<any> & Required<{
39
+ _id: unknown;
40
+ }> & {
41
+ __v: number;
42
+ })>;
43
+ bulkInsertTransactions: (docs: TransactionData[]) => Promise<void>;
44
+ };
45
+ export type TransactionMethods = ReturnType<typeof createTransactionMethods>;
46
+ export {};
@@ -109,6 +109,9 @@ export declare const conversationPreset: {
109
109
  thinkingBudget: {
110
110
  type: NumberConstructor;
111
111
  };
112
+ thinkingLevel: {
113
+ type: StringConstructor;
114
+ };
112
115
  effort: {
113
116
  type: StringConstructor;
114
117
  };
@@ -37,6 +37,7 @@ export interface ITransaction extends Document {
37
37
  inputTokens?: number;
38
38
  writeTokens?: number;
39
39
  readTokens?: number;
40
+ messageId?: string;
40
41
  createdAt?: Date;
41
42
  updatedAt?: Date;
42
43
  }
@@ -32,6 +32,7 @@ export * from './convo';
32
32
  export * from './session';
33
33
  export * from './balance';
34
34
  export * from './banner';
35
+ export * from './transaction';
35
36
  export * from './message';
36
37
  export * from './agent';
37
38
  export * from './agentApiKey';
@@ -0,0 +1,17 @@
1
+ export interface TransactionData {
2
+ user: string;
3
+ conversationId: string;
4
+ tokenType: string;
5
+ model?: string;
6
+ context?: string;
7
+ valueKey?: string;
8
+ rate?: number;
9
+ rawAmount?: number;
10
+ tokenValue?: number;
11
+ inputTokens?: number;
12
+ writeTokens?: number;
13
+ readTokens?: number;
14
+ messageId?: string;
15
+ inputTokenCount?: number;
16
+ rateDetail?: Record<string, number>;
17
+ }
@@ -1,3 +1,4 @@
1
+ export declare const CANCEL_RATE = 1.15;
1
2
  /**
2
3
  * Checks if the connected MongoDB deployment supports transactions
3
4
  * This requires a MongoDB replica set configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/data-schemas",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "Mongoose schemas and models for LibreChat",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,8 +50,8 @@
50
50
  "jest": "^30.2.0",
51
51
  "jest-junit": "^16.0.0",
52
52
  "mongodb-memory-server": "^10.1.4",
53
- "rimraf": "^6.1.2",
54
- "rollup": "^4.22.4",
53
+ "rimraf": "^6.1.3",
54
+ "rollup": "^4.34.9",
55
55
  "rollup-plugin-peer-deps-external": "^2.2.4",
56
56
  "rollup-plugin-typescript2": "^0.35.0",
57
57
  "ts-node": "^10.9.2",