chatifai 1.0.12 → 1.0.14
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.ts +345 -49
- package/dist/index.js +76 -18
- package/dist/types.d.ts +64 -0
- package/dist/types.js +26 -3
- package/index.ts +156 -85
- package/package.json +1 -1
- package/types.ts +31 -5
package/dist/index.d.ts
CHANGED
|
@@ -24,88 +24,384 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
export * from './types';
|
|
27
|
-
import { Schema
|
|
28
|
-
export declare const OrganizationSchema:
|
|
29
|
-
|
|
27
|
+
import { Schema } from 'mongoose';
|
|
28
|
+
export declare const OrganizationSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
29
|
+
versionKey: false;
|
|
30
|
+
toJSON: {
|
|
31
|
+
virtuals: true;
|
|
32
|
+
};
|
|
33
|
+
toObject: {
|
|
34
|
+
virtuals: true;
|
|
35
|
+
};
|
|
36
|
+
timestamps: true;
|
|
37
|
+
id: true;
|
|
38
|
+
}, {
|
|
39
|
+
createdAt: NativeDate;
|
|
40
|
+
updatedAt: NativeDate;
|
|
30
41
|
} & {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
clerk_organization_id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
allowed_models: string[];
|
|
45
|
+
image?: string | null | undefined;
|
|
46
|
+
client_email?: string | null | undefined;
|
|
47
|
+
plan?: string | null | undefined;
|
|
48
|
+
active_user_limit?: number | null | undefined;
|
|
49
|
+
documents_size_limit?: number | null | undefined;
|
|
50
|
+
queries_limit?: number | null | undefined;
|
|
51
|
+
created_at?: number | null | undefined;
|
|
52
|
+
updated_at?: number | null | undefined;
|
|
53
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
54
|
+
createdAt: NativeDate;
|
|
55
|
+
updatedAt: NativeDate;
|
|
34
56
|
} & {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
57
|
+
clerk_organization_id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
allowed_models: string[];
|
|
60
|
+
image?: string | null | undefined;
|
|
61
|
+
client_email?: string | null | undefined;
|
|
62
|
+
plan?: string | null | undefined;
|
|
63
|
+
active_user_limit?: number | null | undefined;
|
|
64
|
+
documents_size_limit?: number | null | undefined;
|
|
65
|
+
queries_limit?: number | null | undefined;
|
|
66
|
+
created_at?: number | null | undefined;
|
|
67
|
+
updated_at?: number | null | undefined;
|
|
68
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
69
|
+
createdAt: NativeDate;
|
|
70
|
+
updatedAt: NativeDate;
|
|
38
71
|
} & {
|
|
39
|
-
|
|
40
|
-
|
|
72
|
+
clerk_organization_id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
allowed_models: string[];
|
|
75
|
+
image?: string | null | undefined;
|
|
76
|
+
client_email?: string | null | undefined;
|
|
77
|
+
plan?: string | null | undefined;
|
|
78
|
+
active_user_limit?: number | null | undefined;
|
|
79
|
+
documents_size_limit?: number | null | undefined;
|
|
80
|
+
queries_limit?: number | null | undefined;
|
|
81
|
+
created_at?: number | null | undefined;
|
|
82
|
+
updated_at?: number | null | undefined;
|
|
83
|
+
}> & {
|
|
41
84
|
_id: import("mongoose").Types.ObjectId;
|
|
42
85
|
} & {
|
|
43
86
|
__v: number;
|
|
44
87
|
}>;
|
|
45
|
-
export declare const UserSchema:
|
|
46
|
-
|
|
88
|
+
export declare const UserSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
89
|
+
versionKey: false;
|
|
90
|
+
toJSON: {
|
|
91
|
+
virtuals: true;
|
|
92
|
+
};
|
|
93
|
+
toObject: {
|
|
94
|
+
virtuals: true;
|
|
95
|
+
};
|
|
96
|
+
timestamps: true;
|
|
97
|
+
id: true;
|
|
98
|
+
}, {
|
|
99
|
+
createdAt: NativeDate;
|
|
100
|
+
updatedAt: NativeDate;
|
|
47
101
|
} & {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
102
|
+
organization_memberships: string[];
|
|
103
|
+
clerk_user_id: string;
|
|
104
|
+
email: string;
|
|
105
|
+
user_role: "admin" | "member" | "client";
|
|
106
|
+
created_at?: number | null | undefined;
|
|
107
|
+
updated_at?: number | null | undefined;
|
|
108
|
+
first_name?: string | null | undefined;
|
|
109
|
+
last_name?: string | null | undefined;
|
|
110
|
+
active_until?: number | null | undefined;
|
|
111
|
+
notes?: string | null | undefined;
|
|
112
|
+
avatar?: string | null | undefined;
|
|
113
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
114
|
+
createdAt: NativeDate;
|
|
115
|
+
updatedAt: NativeDate;
|
|
51
116
|
} & {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
117
|
+
organization_memberships: string[];
|
|
118
|
+
clerk_user_id: string;
|
|
119
|
+
email: string;
|
|
120
|
+
user_role: "admin" | "member" | "client";
|
|
121
|
+
created_at?: number | null | undefined;
|
|
122
|
+
updated_at?: number | null | undefined;
|
|
123
|
+
first_name?: string | null | undefined;
|
|
124
|
+
last_name?: string | null | undefined;
|
|
125
|
+
active_until?: number | null | undefined;
|
|
126
|
+
notes?: string | null | undefined;
|
|
127
|
+
avatar?: string | null | undefined;
|
|
128
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
129
|
+
createdAt: NativeDate;
|
|
130
|
+
updatedAt: NativeDate;
|
|
55
131
|
} & {
|
|
56
|
-
|
|
57
|
-
|
|
132
|
+
organization_memberships: string[];
|
|
133
|
+
clerk_user_id: string;
|
|
134
|
+
email: string;
|
|
135
|
+
user_role: "admin" | "member" | "client";
|
|
136
|
+
created_at?: number | null | undefined;
|
|
137
|
+
updated_at?: number | null | undefined;
|
|
138
|
+
first_name?: string | null | undefined;
|
|
139
|
+
last_name?: string | null | undefined;
|
|
140
|
+
active_until?: number | null | undefined;
|
|
141
|
+
notes?: string | null | undefined;
|
|
142
|
+
avatar?: string | null | undefined;
|
|
143
|
+
}> & {
|
|
58
144
|
_id: import("mongoose").Types.ObjectId;
|
|
59
145
|
} & {
|
|
60
146
|
__v: number;
|
|
61
147
|
}>;
|
|
62
|
-
export declare const AgentSchema:
|
|
63
|
-
|
|
148
|
+
export declare const AgentSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
149
|
+
versionKey: false;
|
|
150
|
+
toJSON: {
|
|
151
|
+
virtuals: true;
|
|
152
|
+
};
|
|
153
|
+
toObject: {
|
|
154
|
+
virtuals: true;
|
|
155
|
+
};
|
|
156
|
+
timestamps: true;
|
|
157
|
+
id: true;
|
|
158
|
+
}, {
|
|
159
|
+
createdAt: NativeDate;
|
|
160
|
+
updatedAt: NativeDate;
|
|
64
161
|
} & {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
162
|
+
title: string;
|
|
163
|
+
model: "gemini-2.5-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro" | "grok-4-fast-non-reasoning" | "grok-4-fast-reasoning" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano";
|
|
164
|
+
is_editable: boolean;
|
|
165
|
+
created_at?: number | null | undefined;
|
|
166
|
+
updated_at?: number | null | undefined;
|
|
167
|
+
organization_id?: string | null | undefined;
|
|
168
|
+
description?: string | null | undefined;
|
|
169
|
+
instructions?: string | null | undefined;
|
|
170
|
+
temperature?: number | null | undefined;
|
|
171
|
+
max_tokens?: number | null | undefined;
|
|
172
|
+
elevenlabs_voice_id?: string | null | undefined;
|
|
173
|
+
message_count_limit?: number | null | undefined;
|
|
174
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
175
|
+
createdAt: NativeDate;
|
|
176
|
+
updatedAt: NativeDate;
|
|
68
177
|
} & {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
178
|
+
title: string;
|
|
179
|
+
model: "gemini-2.5-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro" | "grok-4-fast-non-reasoning" | "grok-4-fast-reasoning" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano";
|
|
180
|
+
is_editable: boolean;
|
|
181
|
+
created_at?: number | null | undefined;
|
|
182
|
+
updated_at?: number | null | undefined;
|
|
183
|
+
organization_id?: string | null | undefined;
|
|
184
|
+
description?: string | null | undefined;
|
|
185
|
+
instructions?: string | null | undefined;
|
|
186
|
+
temperature?: number | null | undefined;
|
|
187
|
+
max_tokens?: number | null | undefined;
|
|
188
|
+
elevenlabs_voice_id?: string | null | undefined;
|
|
189
|
+
message_count_limit?: number | null | undefined;
|
|
190
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
191
|
+
createdAt: NativeDate;
|
|
192
|
+
updatedAt: NativeDate;
|
|
72
193
|
} & {
|
|
73
|
-
|
|
74
|
-
|
|
194
|
+
title: string;
|
|
195
|
+
model: "gemini-2.5-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro" | "grok-4-fast-non-reasoning" | "grok-4-fast-reasoning" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano";
|
|
196
|
+
is_editable: boolean;
|
|
197
|
+
created_at?: number | null | undefined;
|
|
198
|
+
updated_at?: number | null | undefined;
|
|
199
|
+
organization_id?: string | null | undefined;
|
|
200
|
+
description?: string | null | undefined;
|
|
201
|
+
instructions?: string | null | undefined;
|
|
202
|
+
temperature?: number | null | undefined;
|
|
203
|
+
max_tokens?: number | null | undefined;
|
|
204
|
+
elevenlabs_voice_id?: string | null | undefined;
|
|
205
|
+
message_count_limit?: number | null | undefined;
|
|
206
|
+
}> & {
|
|
75
207
|
_id: import("mongoose").Types.ObjectId;
|
|
76
208
|
} & {
|
|
77
209
|
__v: number;
|
|
78
210
|
}>;
|
|
79
|
-
export declare const ContextSchema:
|
|
80
|
-
|
|
211
|
+
export declare const ContextSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
212
|
+
versionKey: false;
|
|
213
|
+
toJSON: {
|
|
214
|
+
virtuals: true;
|
|
215
|
+
};
|
|
216
|
+
toObject: {
|
|
217
|
+
virtuals: true;
|
|
218
|
+
};
|
|
219
|
+
timestamps: true;
|
|
220
|
+
id: true;
|
|
221
|
+
}, {
|
|
222
|
+
createdAt: NativeDate;
|
|
223
|
+
updatedAt: NativeDate;
|
|
81
224
|
} & {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
225
|
+
title: string;
|
|
226
|
+
is_active: boolean;
|
|
227
|
+
type?: string | null | undefined;
|
|
228
|
+
created_at?: number | null | undefined;
|
|
229
|
+
updated_at?: number | null | undefined;
|
|
230
|
+
organization_id?: string | null | undefined;
|
|
231
|
+
file_id?: string | null | undefined;
|
|
232
|
+
description?: string | null | undefined;
|
|
233
|
+
note?: string | null | undefined;
|
|
234
|
+
file_url?: string | null | undefined;
|
|
235
|
+
size?: number | null | undefined;
|
|
236
|
+
tokens?: number | null | undefined;
|
|
237
|
+
uploaded_by?: {
|
|
238
|
+
email?: string | null | undefined;
|
|
239
|
+
first_name?: string | null | undefined;
|
|
240
|
+
last_name?: string | null | undefined;
|
|
241
|
+
} | null | undefined;
|
|
242
|
+
bucket_name?: string | null | undefined;
|
|
243
|
+
file_name?: string | null | undefined;
|
|
244
|
+
ocr_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
245
|
+
vector_index_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
246
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
247
|
+
createdAt: NativeDate;
|
|
248
|
+
updatedAt: NativeDate;
|
|
85
249
|
} & {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
250
|
+
title: string;
|
|
251
|
+
is_active: boolean;
|
|
252
|
+
type?: string | null | undefined;
|
|
253
|
+
created_at?: number | null | undefined;
|
|
254
|
+
updated_at?: number | null | undefined;
|
|
255
|
+
organization_id?: string | null | undefined;
|
|
256
|
+
file_id?: string | null | undefined;
|
|
257
|
+
description?: string | null | undefined;
|
|
258
|
+
note?: string | null | undefined;
|
|
259
|
+
file_url?: string | null | undefined;
|
|
260
|
+
size?: number | null | undefined;
|
|
261
|
+
tokens?: number | null | undefined;
|
|
262
|
+
uploaded_by?: {
|
|
263
|
+
email?: string | null | undefined;
|
|
264
|
+
first_name?: string | null | undefined;
|
|
265
|
+
last_name?: string | null | undefined;
|
|
266
|
+
} | null | undefined;
|
|
267
|
+
bucket_name?: string | null | undefined;
|
|
268
|
+
file_name?: string | null | undefined;
|
|
269
|
+
ocr_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
270
|
+
vector_index_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
271
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
272
|
+
createdAt: NativeDate;
|
|
273
|
+
updatedAt: NativeDate;
|
|
89
274
|
} & {
|
|
90
|
-
|
|
91
|
-
|
|
275
|
+
title: string;
|
|
276
|
+
is_active: boolean;
|
|
277
|
+
type?: string | null | undefined;
|
|
278
|
+
created_at?: number | null | undefined;
|
|
279
|
+
updated_at?: number | null | undefined;
|
|
280
|
+
organization_id?: string | null | undefined;
|
|
281
|
+
file_id?: string | null | undefined;
|
|
282
|
+
description?: string | null | undefined;
|
|
283
|
+
note?: string | null | undefined;
|
|
284
|
+
file_url?: string | null | undefined;
|
|
285
|
+
size?: number | null | undefined;
|
|
286
|
+
tokens?: number | null | undefined;
|
|
287
|
+
uploaded_by?: {
|
|
288
|
+
email?: string | null | undefined;
|
|
289
|
+
first_name?: string | null | undefined;
|
|
290
|
+
last_name?: string | null | undefined;
|
|
291
|
+
} | null | undefined;
|
|
292
|
+
bucket_name?: string | null | undefined;
|
|
293
|
+
file_name?: string | null | undefined;
|
|
294
|
+
ocr_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
295
|
+
vector_index_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
296
|
+
}> & {
|
|
92
297
|
_id: import("mongoose").Types.ObjectId;
|
|
93
298
|
} & {
|
|
94
299
|
__v: number;
|
|
95
300
|
}>;
|
|
96
|
-
export declare const
|
|
97
|
-
|
|
301
|
+
export declare const ChunkSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
302
|
+
versionKey: false;
|
|
303
|
+
toJSON: {
|
|
304
|
+
virtuals: true;
|
|
305
|
+
};
|
|
306
|
+
toObject: {
|
|
307
|
+
virtuals: true;
|
|
308
|
+
};
|
|
309
|
+
timestamps: true;
|
|
310
|
+
id: true;
|
|
311
|
+
}, {
|
|
312
|
+
createdAt: NativeDate;
|
|
313
|
+
updatedAt: NativeDate;
|
|
98
314
|
} & {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
315
|
+
embedding: number[];
|
|
316
|
+
created_at?: number | null | undefined;
|
|
317
|
+
metadata?: {
|
|
318
|
+
organization_id: string;
|
|
319
|
+
file_id: string;
|
|
320
|
+
context_id: string;
|
|
321
|
+
chunk_index: number;
|
|
322
|
+
text_preview: string;
|
|
323
|
+
page_number?: number | null | undefined;
|
|
324
|
+
} | null | undefined;
|
|
325
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
326
|
+
createdAt: NativeDate;
|
|
327
|
+
updatedAt: NativeDate;
|
|
102
328
|
} & {
|
|
103
|
-
|
|
104
|
-
|
|
329
|
+
embedding: number[];
|
|
330
|
+
created_at?: number | null | undefined;
|
|
331
|
+
metadata?: {
|
|
332
|
+
organization_id: string;
|
|
333
|
+
file_id: string;
|
|
334
|
+
context_id: string;
|
|
335
|
+
chunk_index: number;
|
|
336
|
+
text_preview: string;
|
|
337
|
+
page_number?: number | null | undefined;
|
|
338
|
+
} | null | undefined;
|
|
339
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
340
|
+
createdAt: NativeDate;
|
|
341
|
+
updatedAt: NativeDate;
|
|
342
|
+
} & {
|
|
343
|
+
embedding: number[];
|
|
344
|
+
created_at?: number | null | undefined;
|
|
345
|
+
metadata?: {
|
|
346
|
+
organization_id: string;
|
|
347
|
+
file_id: string;
|
|
348
|
+
context_id: string;
|
|
349
|
+
chunk_index: number;
|
|
350
|
+
text_preview: string;
|
|
351
|
+
page_number?: number | null | undefined;
|
|
352
|
+
} | null | undefined;
|
|
353
|
+
}> & {
|
|
105
354
|
_id: import("mongoose").Types.ObjectId;
|
|
106
355
|
} & {
|
|
107
356
|
__v: number;
|
|
108
|
-
}
|
|
357
|
+
}>;
|
|
358
|
+
export declare const QuerySchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
359
|
+
versionKey: false;
|
|
360
|
+
toJSON: {
|
|
361
|
+
virtuals: true;
|
|
362
|
+
};
|
|
363
|
+
toObject: {
|
|
364
|
+
virtuals: true;
|
|
365
|
+
};
|
|
366
|
+
timestamps: true;
|
|
367
|
+
id: true;
|
|
368
|
+
}, {
|
|
369
|
+
createdAt: NativeDate;
|
|
370
|
+
updatedAt: NativeDate;
|
|
371
|
+
} & {
|
|
372
|
+
status: "active" | "inactive" | "archived";
|
|
373
|
+
query: string;
|
|
374
|
+
context_ids: string[];
|
|
375
|
+
users_ids: string[];
|
|
376
|
+
title?: string | null | undefined;
|
|
377
|
+
created_at?: number | null | undefined;
|
|
378
|
+
updated_at?: number | null | undefined;
|
|
379
|
+
organization_id?: string | null | undefined;
|
|
380
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
381
|
+
createdAt: NativeDate;
|
|
382
|
+
updatedAt: NativeDate;
|
|
383
|
+
} & {
|
|
384
|
+
status: "active" | "inactive" | "archived";
|
|
385
|
+
query: string;
|
|
386
|
+
context_ids: string[];
|
|
387
|
+
users_ids: string[];
|
|
388
|
+
title?: string | null | undefined;
|
|
389
|
+
created_at?: number | null | undefined;
|
|
390
|
+
updated_at?: number | null | undefined;
|
|
391
|
+
organization_id?: string | null | undefined;
|
|
392
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
393
|
+
createdAt: NativeDate;
|
|
394
|
+
updatedAt: NativeDate;
|
|
395
|
+
} & {
|
|
396
|
+
status: "active" | "inactive" | "archived";
|
|
397
|
+
query: string;
|
|
398
|
+
context_ids: string[];
|
|
399
|
+
users_ids: string[];
|
|
400
|
+
title?: string | null | undefined;
|
|
401
|
+
created_at?: number | null | undefined;
|
|
402
|
+
updated_at?: number | null | undefined;
|
|
403
|
+
organization_id?: string | null | undefined;
|
|
404
|
+
}> & {
|
|
109
405
|
_id: import("mongoose").Types.ObjectId;
|
|
110
406
|
} & {
|
|
111
407
|
__v: number;
|
package/dist/index.js
CHANGED
|
@@ -14,23 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.QuerySchema = exports.ContextSchema = exports.AgentSchema = exports.UserSchema = exports.OrganizationSchema = void 0;
|
|
17
|
+
exports.QuerySchema = exports.ChunkSchema = exports.ContextSchema = exports.AgentSchema = exports.UserSchema = exports.OrganizationSchema = void 0;
|
|
18
18
|
// Export types for consumers
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
const mongoose_1 = require("mongoose");
|
|
21
21
|
const types_1 = require("./types");
|
|
22
|
-
|
|
23
|
-
versionKey: false,
|
|
24
|
-
toJSON: { virtuals: true },
|
|
25
|
-
toObject: { virtuals: true },
|
|
26
|
-
timestamps: true,
|
|
27
|
-
id: true,
|
|
28
|
-
// encryptionType: 'csfle',
|
|
29
|
-
};
|
|
30
|
-
const Schema = (values) => {
|
|
31
|
-
return new mongoose_1.Schema(values, mongoDefaultOptions);
|
|
32
|
-
};
|
|
33
|
-
exports.OrganizationSchema = Schema({
|
|
22
|
+
exports.OrganizationSchema = new mongoose_1.Schema({
|
|
34
23
|
clerk_organization_id: { type: String, required: true },
|
|
35
24
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
36
25
|
image: { type: String },
|
|
@@ -42,8 +31,15 @@ exports.OrganizationSchema = Schema({
|
|
|
42
31
|
queries_limit: { type: Number, min: 1 },
|
|
43
32
|
created_at: { type: Number },
|
|
44
33
|
updated_at: { type: Number },
|
|
34
|
+
}, {
|
|
35
|
+
versionKey: false,
|
|
36
|
+
toJSON: { virtuals: true },
|
|
37
|
+
toObject: { virtuals: true },
|
|
38
|
+
timestamps: true,
|
|
39
|
+
id: true,
|
|
40
|
+
// encryptionType: 'csfle',
|
|
45
41
|
});
|
|
46
|
-
exports.UserSchema = Schema({
|
|
42
|
+
exports.UserSchema = new mongoose_1.Schema({
|
|
47
43
|
organization_memberships: { type: [String], required: true },
|
|
48
44
|
clerk_user_id: { type: String, required: true },
|
|
49
45
|
email: { type: String, required: true },
|
|
@@ -55,8 +51,15 @@ exports.UserSchema = Schema({
|
|
|
55
51
|
user_role: { type: String, enum: types_1.userRoles, required: true },
|
|
56
52
|
created_at: { type: Number },
|
|
57
53
|
updated_at: { type: Number },
|
|
54
|
+
}, {
|
|
55
|
+
versionKey: false,
|
|
56
|
+
toJSON: { virtuals: true },
|
|
57
|
+
toObject: { virtuals: true },
|
|
58
|
+
timestamps: true,
|
|
59
|
+
id: true,
|
|
60
|
+
// encryptionType: 'csfle',
|
|
58
61
|
});
|
|
59
|
-
exports.AgentSchema = Schema({
|
|
62
|
+
exports.AgentSchema = new mongoose_1.Schema({
|
|
60
63
|
organization_id: { type: String },
|
|
61
64
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
62
65
|
description: { type: String, minlength: 1, maxlength: 500 },
|
|
@@ -69,8 +72,15 @@ exports.AgentSchema = Schema({
|
|
|
69
72
|
is_editable: { type: Boolean, default: true },
|
|
70
73
|
created_at: { type: Number },
|
|
71
74
|
updated_at: { type: Number },
|
|
75
|
+
}, {
|
|
76
|
+
versionKey: false,
|
|
77
|
+
toJSON: { virtuals: true },
|
|
78
|
+
toObject: { virtuals: true },
|
|
79
|
+
timestamps: true,
|
|
80
|
+
id: true,
|
|
81
|
+
// encryptionType: 'csfle',
|
|
72
82
|
});
|
|
73
|
-
exports.ContextSchema = Schema({
|
|
83
|
+
exports.ContextSchema = new mongoose_1.Schema({
|
|
74
84
|
organization_id: { type: String },
|
|
75
85
|
file_id: { type: String },
|
|
76
86
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
@@ -86,16 +96,64 @@ exports.ContextSchema = Schema({
|
|
|
86
96
|
last_name: { type: String },
|
|
87
97
|
email: { type: String },
|
|
88
98
|
},
|
|
99
|
+
bucket_name: { type: String },
|
|
100
|
+
file_name: { type: String },
|
|
101
|
+
ocr_status: {
|
|
102
|
+
type: String,
|
|
103
|
+
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
104
|
+
},
|
|
105
|
+
vector_index_status: {
|
|
106
|
+
type: String,
|
|
107
|
+
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
108
|
+
},
|
|
89
109
|
created_at: { type: Number },
|
|
90
110
|
updated_at: { type: Number },
|
|
111
|
+
}, {
|
|
112
|
+
versionKey: false,
|
|
113
|
+
toJSON: { virtuals: true },
|
|
114
|
+
toObject: { virtuals: true },
|
|
115
|
+
timestamps: true,
|
|
116
|
+
id: true,
|
|
117
|
+
// encryptionType: 'csfle',
|
|
91
118
|
});
|
|
92
|
-
exports.
|
|
119
|
+
exports.ChunkSchema = new mongoose_1.Schema({
|
|
120
|
+
embedding: { type: [Number], required: true },
|
|
121
|
+
metadata: {
|
|
122
|
+
organization_id: { type: String, required: true },
|
|
123
|
+
context_id: { type: String, required: true },
|
|
124
|
+
file_id: { type: String, required: true },
|
|
125
|
+
page_number: { type: Number },
|
|
126
|
+
chunk_index: { type: Number, required: true },
|
|
127
|
+
text_preview: { type: String, required: true },
|
|
128
|
+
},
|
|
129
|
+
created_at: { type: Number },
|
|
130
|
+
}, {
|
|
131
|
+
versionKey: false,
|
|
132
|
+
toJSON: { virtuals: true },
|
|
133
|
+
toObject: { virtuals: true },
|
|
134
|
+
timestamps: true,
|
|
135
|
+
id: true,
|
|
136
|
+
// encryptionType: 'csfle',
|
|
137
|
+
});
|
|
138
|
+
exports.QuerySchema = new mongoose_1.Schema({
|
|
93
139
|
organization_id: { type: String },
|
|
94
140
|
title: { type: String, minlength: 1, maxlength: 100 },
|
|
95
141
|
query: { type: String, required: true },
|
|
96
142
|
context_ids: { type: [String] },
|
|
97
|
-
status: {
|
|
143
|
+
status: {
|
|
144
|
+
type: String,
|
|
145
|
+
enum: ['active', 'inactive', 'archived'],
|
|
146
|
+
default: 'active',
|
|
147
|
+
required: true,
|
|
148
|
+
},
|
|
98
149
|
users_ids: { type: [String] },
|
|
99
150
|
created_at: { type: Number },
|
|
100
151
|
updated_at: { type: Number },
|
|
152
|
+
}, {
|
|
153
|
+
versionKey: false,
|
|
154
|
+
toJSON: { virtuals: true },
|
|
155
|
+
toObject: { virtuals: true },
|
|
156
|
+
timestamps: true,
|
|
157
|
+
id: true,
|
|
158
|
+
// encryptionType: 'csfle',
|
|
101
159
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
108
108
|
first_name?: string | undefined;
|
|
109
109
|
last_name?: string | undefined;
|
|
110
110
|
}>>;
|
|
111
|
+
bucket_name: z.ZodOptional<z.ZodString>;
|
|
112
|
+
file_name: z.ZodOptional<z.ZodString>;
|
|
113
|
+
ocr_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
114
|
+
vector_index_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
111
115
|
}, "strip", z.ZodTypeAny, {
|
|
112
116
|
title: string;
|
|
113
117
|
_id?: string | undefined;
|
|
@@ -127,6 +131,10 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
127
131
|
first_name?: string | undefined;
|
|
128
132
|
last_name?: string | undefined;
|
|
129
133
|
} | undefined;
|
|
134
|
+
bucket_name?: string | undefined;
|
|
135
|
+
file_name?: string | undefined;
|
|
136
|
+
ocr_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
137
|
+
vector_index_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
130
138
|
}, {
|
|
131
139
|
title: string;
|
|
132
140
|
_id?: string | undefined;
|
|
@@ -146,6 +154,61 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
146
154
|
first_name?: string | undefined;
|
|
147
155
|
last_name?: string | undefined;
|
|
148
156
|
} | undefined;
|
|
157
|
+
bucket_name?: string | undefined;
|
|
158
|
+
file_name?: string | undefined;
|
|
159
|
+
ocr_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
160
|
+
vector_index_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
161
|
+
}>;
|
|
162
|
+
export declare const zodChunkSchema: z.ZodObject<{
|
|
163
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
164
|
+
embedding: z.ZodArray<z.ZodNumber, "many">;
|
|
165
|
+
metadata: z.ZodObject<{
|
|
166
|
+
organization_id: z.ZodString;
|
|
167
|
+
context_id: z.ZodString;
|
|
168
|
+
file_id: z.ZodString;
|
|
169
|
+
page_number: z.ZodOptional<z.ZodNumber>;
|
|
170
|
+
chunk_index: z.ZodNumber;
|
|
171
|
+
text_preview: z.ZodString;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
organization_id: string;
|
|
174
|
+
file_id: string;
|
|
175
|
+
context_id: string;
|
|
176
|
+
chunk_index: number;
|
|
177
|
+
text_preview: string;
|
|
178
|
+
page_number?: number | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
organization_id: string;
|
|
181
|
+
file_id: string;
|
|
182
|
+
context_id: string;
|
|
183
|
+
chunk_index: number;
|
|
184
|
+
text_preview: string;
|
|
185
|
+
page_number?: number | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
embedding: number[];
|
|
190
|
+
metadata: {
|
|
191
|
+
organization_id: string;
|
|
192
|
+
file_id: string;
|
|
193
|
+
context_id: string;
|
|
194
|
+
chunk_index: number;
|
|
195
|
+
text_preview: string;
|
|
196
|
+
page_number?: number | undefined;
|
|
197
|
+
};
|
|
198
|
+
_id?: string | undefined;
|
|
199
|
+
created_at?: number | undefined;
|
|
200
|
+
}, {
|
|
201
|
+
embedding: number[];
|
|
202
|
+
metadata: {
|
|
203
|
+
organization_id: string;
|
|
204
|
+
file_id: string;
|
|
205
|
+
context_id: string;
|
|
206
|
+
chunk_index: number;
|
|
207
|
+
text_preview: string;
|
|
208
|
+
page_number?: number | undefined;
|
|
209
|
+
};
|
|
210
|
+
_id?: string | undefined;
|
|
211
|
+
created_at?: number | undefined;
|
|
149
212
|
}>;
|
|
150
213
|
export declare const zodAgentSchema: z.ZodObject<{
|
|
151
214
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -231,6 +294,7 @@ export type OrganizationType = z.infer<typeof zodOrganizationSchema>;
|
|
|
231
294
|
export type UserType = z.infer<typeof zodUserSchema>;
|
|
232
295
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
233
296
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
297
|
+
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
234
298
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
235
299
|
export type ModelType = (typeof modelsList)[number];
|
|
236
300
|
export type UserRoleType = (typeof userRoles)[number];
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zodQuerySchema = exports.zodAgentSchema = exports.zodContextSchema = exports.zodUserSchema = exports.zodOrganizationSchema = exports.userRoles = exports.modelsList = void 0;
|
|
3
|
+
exports.zodQuerySchema = exports.zodAgentSchema = exports.zodChunkSchema = exports.zodContextSchema = exports.zodUserSchema = exports.zodOrganizationSchema = exports.userRoles = exports.modelsList = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.modelsList = [
|
|
6
6
|
'gemini-2.5-flash-lite',
|
|
@@ -55,11 +55,34 @@ exports.zodContextSchema = zod_1.z.object({
|
|
|
55
55
|
is_active: zod_1.z.boolean().default(true).optional(),
|
|
56
56
|
created_at: zod_1.z.number().optional(),
|
|
57
57
|
updated_at: zod_1.z.number().optional(),
|
|
58
|
-
uploaded_by: zod_1.z
|
|
58
|
+
uploaded_by: zod_1.z
|
|
59
|
+
.object({
|
|
59
60
|
first_name: zod_1.z.string().optional(),
|
|
60
61
|
last_name: zod_1.z.string().optional(),
|
|
61
62
|
email: zod_1.z.string().email().optional(),
|
|
62
|
-
})
|
|
63
|
+
})
|
|
64
|
+
.optional(),
|
|
65
|
+
bucket_name: zod_1.z.string().optional(),
|
|
66
|
+
file_name: zod_1.z.string().optional(),
|
|
67
|
+
ocr_status: zod_1.z
|
|
68
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
69
|
+
.optional(),
|
|
70
|
+
vector_index_status: zod_1.z
|
|
71
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
|
+
.optional(),
|
|
73
|
+
});
|
|
74
|
+
exports.zodChunkSchema = zod_1.z.object({
|
|
75
|
+
_id: zod_1.z.string().optional(),
|
|
76
|
+
embedding: zod_1.z.array(zod_1.z.number()),
|
|
77
|
+
metadata: zod_1.z.object({
|
|
78
|
+
organization_id: zod_1.z.string(),
|
|
79
|
+
context_id: zod_1.z.string(),
|
|
80
|
+
file_id: zod_1.z.string(),
|
|
81
|
+
page_number: zod_1.z.number().optional(),
|
|
82
|
+
chunk_index: zod_1.z.number(),
|
|
83
|
+
text_preview: zod_1.z.string(),
|
|
84
|
+
}),
|
|
85
|
+
created_at: zod_1.z.number().optional(),
|
|
63
86
|
});
|
|
64
87
|
exports.zodAgentSchema = zod_1.z.object({
|
|
65
88
|
_id: zod_1.z.string().optional(),
|
package/index.ts
CHANGED
|
@@ -1,96 +1,167 @@
|
|
|
1
1
|
// Export types for consumers
|
|
2
2
|
export * from './types';
|
|
3
3
|
|
|
4
|
-
import { Schema
|
|
4
|
+
import { Schema } from 'mongoose';
|
|
5
5
|
import { modelsList, userRoles } from './types';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
export const OrganizationSchema = new Schema(
|
|
8
|
+
{
|
|
9
|
+
clerk_organization_id: { type: String, required: true },
|
|
10
|
+
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
11
|
+
image: { type: String },
|
|
12
|
+
client_email: { type: String },
|
|
13
|
+
plan: { type: String, minlength: 1, maxlength: 100 },
|
|
14
|
+
active_user_limit: { type: Number, min: 1 },
|
|
15
|
+
documents_size_limit: { type: Number, min: 1 },
|
|
16
|
+
allowed_models: { type: [String], enum: modelsList },
|
|
17
|
+
queries_limit: { type: Number, min: 1 },
|
|
18
|
+
created_at: { type: Number },
|
|
19
|
+
updated_at: { type: Number },
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
versionKey: false,
|
|
23
|
+
toJSON: { virtuals: true },
|
|
24
|
+
toObject: { virtuals: true },
|
|
25
|
+
timestamps: true,
|
|
26
|
+
id: true,
|
|
27
|
+
// encryptionType: 'csfle',
|
|
28
|
+
}
|
|
29
|
+
);
|
|
23
30
|
|
|
24
|
-
export const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
31
|
+
export const UserSchema = new Schema(
|
|
32
|
+
{
|
|
33
|
+
organization_memberships: { type: [String], required: true },
|
|
34
|
+
clerk_user_id: { type: String, required: true },
|
|
35
|
+
email: { type: String, required: true },
|
|
36
|
+
first_name: { type: String },
|
|
37
|
+
last_name: { type: String },
|
|
38
|
+
active_until: { type: Number },
|
|
39
|
+
notes: { type: String, maxlength: 500 },
|
|
40
|
+
avatar: { type: String },
|
|
41
|
+
user_role: { type: String, enum: userRoles, required: true },
|
|
42
|
+
created_at: { type: Number },
|
|
43
|
+
updated_at: { type: Number },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
versionKey: false,
|
|
47
|
+
toJSON: { virtuals: true },
|
|
48
|
+
toObject: { virtuals: true },
|
|
49
|
+
timestamps: true,
|
|
50
|
+
id: true,
|
|
51
|
+
// encryptionType: 'csfle',
|
|
52
|
+
}
|
|
53
|
+
);
|
|
37
54
|
|
|
38
|
-
export const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
55
|
+
export const AgentSchema = new Schema(
|
|
56
|
+
{
|
|
57
|
+
organization_id: { type: String },
|
|
58
|
+
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
59
|
+
description: { type: String, minlength: 1, maxlength: 500 },
|
|
60
|
+
instructions: { type: String, minlength: 1, maxlength: 1000 },
|
|
61
|
+
model: { type: String, enum: modelsList, required: true },
|
|
62
|
+
temperature: { type: Number, min: 0, max: 1 },
|
|
63
|
+
max_tokens: { type: Number, min: 1, max: 4000 },
|
|
64
|
+
elevenlabs_voice_id: { type: String, minlength: 1, maxlength: 100 },
|
|
65
|
+
message_count_limit: { type: Number, min: 1 },
|
|
66
|
+
is_editable: { type: Boolean, default: true },
|
|
67
|
+
created_at: { type: Number },
|
|
68
|
+
updated_at: { type: Number },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
versionKey: false,
|
|
72
|
+
toJSON: { virtuals: true },
|
|
73
|
+
toObject: { virtuals: true },
|
|
74
|
+
timestamps: true,
|
|
75
|
+
id: true,
|
|
76
|
+
// encryptionType: 'csfle',
|
|
77
|
+
}
|
|
78
|
+
);
|
|
51
79
|
|
|
52
|
-
export const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
80
|
+
export const ContextSchema = new Schema(
|
|
81
|
+
{
|
|
82
|
+
organization_id: { type: String },
|
|
83
|
+
file_id: { type: String },
|
|
84
|
+
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
85
|
+
description: { type: String, minlength: 1, maxlength: 500 },
|
|
86
|
+
note: { type: String, maxlength: 500 },
|
|
87
|
+
file_url: { type: String },
|
|
88
|
+
type: { type: String, minlength: 1, maxlength: 100 },
|
|
89
|
+
size: { type: Number },
|
|
90
|
+
tokens: { type: Number },
|
|
91
|
+
is_active: { type: Boolean, default: true },
|
|
92
|
+
uploaded_by: {
|
|
93
|
+
first_name: { type: String },
|
|
94
|
+
last_name: { type: String },
|
|
95
|
+
email: { type: String },
|
|
96
|
+
},
|
|
97
|
+
bucket_name: { type: String },
|
|
98
|
+
file_name: { type: String },
|
|
99
|
+
ocr_status: {
|
|
100
|
+
type: String,
|
|
101
|
+
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
102
|
+
},
|
|
103
|
+
vector_index_status: {
|
|
104
|
+
type: String,
|
|
105
|
+
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
106
|
+
},
|
|
107
|
+
created_at: { type: Number },
|
|
108
|
+
updated_at: { type: Number },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
versionKey: false,
|
|
112
|
+
toJSON: { virtuals: true },
|
|
113
|
+
toObject: { virtuals: true },
|
|
114
|
+
timestamps: true,
|
|
115
|
+
id: true,
|
|
116
|
+
// encryptionType: 'csfle',
|
|
117
|
+
}
|
|
118
|
+
);
|
|
66
119
|
|
|
67
|
-
export const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
first_name: { type: String },
|
|
80
|
-
last_name: { type: String },
|
|
81
|
-
email: { type: String },
|
|
120
|
+
export const ChunkSchema = new Schema(
|
|
121
|
+
{
|
|
122
|
+
embedding: { type: [Number], required: true },
|
|
123
|
+
metadata: {
|
|
124
|
+
organization_id: { type: String, required: true },
|
|
125
|
+
context_id: { type: String, required: true },
|
|
126
|
+
file_id: { type: String, required: true },
|
|
127
|
+
page_number: { type: Number },
|
|
128
|
+
chunk_index: { type: Number, required: true },
|
|
129
|
+
text_preview: { type: String, required: true },
|
|
130
|
+
},
|
|
131
|
+
created_at: { type: Number },
|
|
82
132
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
133
|
+
{
|
|
134
|
+
versionKey: false,
|
|
135
|
+
toJSON: { virtuals: true },
|
|
136
|
+
toObject: { virtuals: true },
|
|
137
|
+
timestamps: true,
|
|
138
|
+
id: true,
|
|
139
|
+
// encryptionType: 'csfle',
|
|
140
|
+
}
|
|
141
|
+
);
|
|
86
142
|
|
|
87
|
-
export const QuerySchema = Schema(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
143
|
+
export const QuerySchema = new Schema(
|
|
144
|
+
{
|
|
145
|
+
organization_id: { type: String },
|
|
146
|
+
title: { type: String, minlength: 1, maxlength: 100 },
|
|
147
|
+
query: { type: String, required: true },
|
|
148
|
+
context_ids: { type: [String] },
|
|
149
|
+
status: {
|
|
150
|
+
type: String,
|
|
151
|
+
enum: ['active', 'inactive', 'archived'],
|
|
152
|
+
default: 'active',
|
|
153
|
+
required: true,
|
|
154
|
+
},
|
|
155
|
+
users_ids: { type: [String] },
|
|
156
|
+
created_at: { type: Number },
|
|
157
|
+
updated_at: { type: Number },
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
versionKey: false,
|
|
161
|
+
toJSON: { virtuals: true },
|
|
162
|
+
toObject: { virtuals: true },
|
|
163
|
+
timestamps: true,
|
|
164
|
+
id: true,
|
|
165
|
+
// encryptionType: 'csfle',
|
|
166
|
+
}
|
|
167
|
+
);
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -57,11 +57,36 @@ export const zodContextSchema = z.object({
|
|
|
57
57
|
is_active: z.boolean().default(true).optional(),
|
|
58
58
|
created_at: z.number().optional(),
|
|
59
59
|
updated_at: z.number().optional(),
|
|
60
|
-
uploaded_by: z
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
uploaded_by: z
|
|
61
|
+
.object({
|
|
62
|
+
first_name: z.string().optional(),
|
|
63
|
+
last_name: z.string().optional(),
|
|
64
|
+
email: z.string().email().optional(),
|
|
65
|
+
})
|
|
66
|
+
.optional(),
|
|
67
|
+
|
|
68
|
+
bucket_name: z.string().optional(),
|
|
69
|
+
file_name: z.string().optional(),
|
|
70
|
+
ocr_status: z
|
|
71
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
|
+
.optional(),
|
|
73
|
+
vector_index_status: z
|
|
74
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
75
|
+
.optional(),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const zodChunkSchema = z.object({
|
|
79
|
+
_id: z.string().optional(),
|
|
80
|
+
embedding: z.array(z.number()),
|
|
81
|
+
metadata: z.object({
|
|
82
|
+
organization_id: z.string(),
|
|
83
|
+
context_id: z.string(),
|
|
84
|
+
file_id: z.string(),
|
|
85
|
+
page_number: z.number().optional(),
|
|
86
|
+
chunk_index: z.number(),
|
|
87
|
+
text_preview: z.string(),
|
|
88
|
+
}),
|
|
89
|
+
created_at: z.number().optional(),
|
|
65
90
|
});
|
|
66
91
|
|
|
67
92
|
export const zodAgentSchema = z.object({
|
|
@@ -103,6 +128,7 @@ export type OrganizationType = z.infer<typeof zodOrganizationSchema>;
|
|
|
103
128
|
export type UserType = z.infer<typeof zodUserSchema>;
|
|
104
129
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
105
130
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
131
|
+
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
106
132
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
107
133
|
export type ModelType = (typeof modelsList)[number];
|
|
108
134
|
export type UserRoleType = (typeof userRoles)[number];
|