@librechat/data-schemas 0.0.36 → 0.0.37
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.cjs +78 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +78 -1
- package/dist/index.es.js.map +1 -1
- package/dist/types/methods/index.d.ts +3 -2
- package/dist/types/methods/transaction.d.ts +46 -0
- package/dist/types/schema/defaults.d.ts +3 -0
- package/dist/types/schema/transaction.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/transaction.d.ts +17 -0
- package/dist/types/utils/transactions.d.ts +1 -0
- package/package.json +3 -3
|
@@ -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
|
-
|
|
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 {};
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@librechat/data-schemas",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
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.
|
|
54
|
-
"rollup": "^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",
|