chatifai 1.0.11 → 1.0.13

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 CHANGED
@@ -24,88 +24,315 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  /// <reference types="mongoose/types/inferrawdoctype" />
26
26
  export * from './types';
27
- import { Schema as MongoSchema, SchemaOptions } from 'mongoose';
28
- export declare const OrganizationSchema: MongoSchema<any, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
29
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
32
- }, any>, {}, {}, {}, {}, SchemaOptions<unknown, {}, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
33
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
36
- }, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
37
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
40
- }, any>>, Record<string, any>, import("mongoose").Document<unknown, {}, unknown, {}> & {
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: MongoSchema<any, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
46
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
49
- }, any>, {}, {}, {}, {}, SchemaOptions<unknown, {}, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
50
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
53
- }, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
54
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
57
- }, any>>, Record<string, any>, import("mongoose").Document<unknown, {}, unknown, {}> & {
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: MongoSchema<any, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
63
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
66
- }, any>, {}, {}, {}, {}, SchemaOptions<unknown, {}, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
67
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
70
- }, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
71
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
74
- }, any>>, Record<string, any>, import("mongoose").Document<unknown, {}, unknown, {}> & {
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: MongoSchema<any, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
80
- _id: import("mongoose").Types.ObjectId;
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
- __v: number;
83
- }, any>, {}, {}, {}, {}, SchemaOptions<unknown, {}, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
84
- _id: import("mongoose").Types.ObjectId;
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
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
243
+ createdAt: NativeDate;
244
+ updatedAt: NativeDate;
85
245
  } & {
86
- __v: number;
87
- }, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
88
- _id: import("mongoose").Types.ObjectId;
246
+ title: string;
247
+ is_active: boolean;
248
+ type?: string | null | undefined;
249
+ created_at?: number | null | undefined;
250
+ updated_at?: number | null | undefined;
251
+ organization_id?: string | null | undefined;
252
+ file_id?: string | null | undefined;
253
+ description?: string | null | undefined;
254
+ note?: string | null | undefined;
255
+ file_url?: string | null | undefined;
256
+ size?: number | null | undefined;
257
+ tokens?: number | null | undefined;
258
+ uploaded_by?: {
259
+ email?: string | null | undefined;
260
+ first_name?: string | null | undefined;
261
+ last_name?: string | null | undefined;
262
+ } | null | undefined;
263
+ }>, {}> & import("mongoose").FlatRecord<{
264
+ createdAt: NativeDate;
265
+ updatedAt: NativeDate;
89
266
  } & {
90
- __v: number;
91
- }, any>>, Record<string, any>, import("mongoose").Document<unknown, {}, unknown, {}> & {
267
+ title: string;
268
+ is_active: boolean;
269
+ type?: string | null | undefined;
270
+ created_at?: number | null | undefined;
271
+ updated_at?: number | null | undefined;
272
+ organization_id?: string | null | undefined;
273
+ file_id?: string | null | undefined;
274
+ description?: string | null | undefined;
275
+ note?: string | null | undefined;
276
+ file_url?: string | null | undefined;
277
+ size?: number | null | undefined;
278
+ tokens?: number | null | undefined;
279
+ uploaded_by?: {
280
+ email?: string | null | undefined;
281
+ first_name?: string | null | undefined;
282
+ last_name?: string | null | undefined;
283
+ } | null | undefined;
284
+ }> & {
92
285
  _id: import("mongoose").Types.ObjectId;
93
286
  } & {
94
287
  __v: number;
95
288
  }>;
96
- export declare const QuerySchema: MongoSchema<any, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
97
- _id: import("mongoose").Types.ObjectId;
289
+ export declare const QuerySchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
290
+ versionKey: false;
291
+ toJSON: {
292
+ virtuals: true;
293
+ };
294
+ toObject: {
295
+ virtuals: true;
296
+ };
297
+ timestamps: true;
298
+ id: true;
299
+ }, {
300
+ createdAt: NativeDate;
301
+ updatedAt: NativeDate;
98
302
  } & {
99
- __v: number;
100
- }, any>, {}, {}, {}, {}, SchemaOptions<unknown, {}, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
101
- _id: import("mongoose").Types.ObjectId;
303
+ status: "active" | "inactive" | "archived";
304
+ query: string;
305
+ context_ids: string[];
306
+ users_ids: string[];
307
+ title?: string | null | undefined;
308
+ created_at?: number | null | undefined;
309
+ updated_at?: number | null | undefined;
310
+ organization_id?: string | null | undefined;
311
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
312
+ createdAt: NativeDate;
313
+ updatedAt: NativeDate;
102
314
  } & {
103
- __v: number;
104
- }, import("mongoose").Model<unknown, {}, {}, {}, import("mongoose").Document<unknown, {}, unknown, {}> & {
105
- _id: import("mongoose").Types.ObjectId;
315
+ status: "active" | "inactive" | "archived";
316
+ query: string;
317
+ context_ids: string[];
318
+ users_ids: string[];
319
+ title?: string | null | undefined;
320
+ created_at?: number | null | undefined;
321
+ updated_at?: number | null | undefined;
322
+ organization_id?: string | null | undefined;
323
+ }>, {}> & import("mongoose").FlatRecord<{
324
+ createdAt: NativeDate;
325
+ updatedAt: NativeDate;
106
326
  } & {
107
- __v: number;
108
- }, any>>, Record<string, any>, import("mongoose").Document<unknown, {}, unknown, {}> & {
327
+ status: "active" | "inactive" | "archived";
328
+ query: string;
329
+ context_ids: string[];
330
+ users_ids: string[];
331
+ title?: string | null | undefined;
332
+ created_at?: number | null | undefined;
333
+ updated_at?: number | null | undefined;
334
+ organization_id?: string | null | undefined;
335
+ }> & {
109
336
  _id: import("mongoose").Types.ObjectId;
110
337
  } & {
111
338
  __v: number;
package/dist/index.js CHANGED
@@ -19,18 +19,7 @@ exports.QuerySchema = exports.ContextSchema = exports.AgentSchema = exports.User
19
19
  __exportStar(require("./types"), exports);
20
20
  const mongoose_1 = require("mongoose");
21
21
  const types_1 = require("./types");
22
- const mongoDefaultOptions = {
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 },
@@ -81,16 +91,40 @@ exports.ContextSchema = Schema({
81
91
  size: { type: Number },
82
92
  tokens: { type: Number },
83
93
  is_active: { type: Boolean, default: true },
94
+ uploaded_by: {
95
+ first_name: { type: String },
96
+ last_name: { type: String },
97
+ email: { type: String },
98
+ },
84
99
  created_at: { type: Number },
85
100
  updated_at: { type: Number },
101
+ }, {
102
+ versionKey: false,
103
+ toJSON: { virtuals: true },
104
+ toObject: { virtuals: true },
105
+ timestamps: true,
106
+ id: true,
107
+ // encryptionType: 'csfle',
86
108
  });
87
- exports.QuerySchema = Schema({
109
+ exports.QuerySchema = new mongoose_1.Schema({
88
110
  organization_id: { type: String },
89
111
  title: { type: String, minlength: 1, maxlength: 100 },
90
112
  query: { type: String, required: true },
91
113
  context_ids: { type: [String] },
92
- status: { type: String, enum: ['active', 'inactive', 'archived'], default: 'active', required: true },
114
+ status: {
115
+ type: String,
116
+ enum: ['active', 'inactive', 'archived'],
117
+ default: 'active',
118
+ required: true,
119
+ },
93
120
  users_ids: { type: [String] },
94
121
  created_at: { type: Number },
95
122
  updated_at: { type: Number },
123
+ }, {
124
+ versionKey: false,
125
+ toJSON: { virtuals: true },
126
+ toObject: { virtuals: true },
127
+ timestamps: true,
128
+ id: true,
129
+ // encryptionType: 'csfle',
96
130
  });
package/dist/types.d.ts CHANGED
@@ -95,6 +95,19 @@ export declare const zodContextSchema: z.ZodObject<{
95
95
  is_active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
96
96
  created_at: z.ZodOptional<z.ZodNumber>;
97
97
  updated_at: z.ZodOptional<z.ZodNumber>;
98
+ uploaded_by: z.ZodOptional<z.ZodObject<{
99
+ first_name: z.ZodOptional<z.ZodString>;
100
+ last_name: z.ZodOptional<z.ZodString>;
101
+ email: z.ZodOptional<z.ZodString>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ email?: string | undefined;
104
+ first_name?: string | undefined;
105
+ last_name?: string | undefined;
106
+ }, {
107
+ email?: string | undefined;
108
+ first_name?: string | undefined;
109
+ last_name?: string | undefined;
110
+ }>>;
98
111
  }, "strip", z.ZodTypeAny, {
99
112
  title: string;
100
113
  _id?: string | undefined;
@@ -109,6 +122,11 @@ export declare const zodContextSchema: z.ZodObject<{
109
122
  size?: number | undefined;
110
123
  tokens?: number | undefined;
111
124
  is_active?: boolean | undefined;
125
+ uploaded_by?: {
126
+ email?: string | undefined;
127
+ first_name?: string | undefined;
128
+ last_name?: string | undefined;
129
+ } | undefined;
112
130
  }, {
113
131
  title: string;
114
132
  _id?: string | undefined;
@@ -123,6 +141,11 @@ export declare const zodContextSchema: z.ZodObject<{
123
141
  size?: number | undefined;
124
142
  tokens?: number | undefined;
125
143
  is_active?: boolean | undefined;
144
+ uploaded_by?: {
145
+ email?: string | undefined;
146
+ first_name?: string | undefined;
147
+ last_name?: string | undefined;
148
+ } | undefined;
126
149
  }>;
127
150
  export declare const zodAgentSchema: z.ZodObject<{
128
151
  _id: z.ZodOptional<z.ZodString>;
package/dist/types.js CHANGED
@@ -55,6 +55,11 @@ 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.object({
59
+ first_name: zod_1.z.string().optional(),
60
+ last_name: zod_1.z.string().optional(),
61
+ email: zod_1.z.string().email().optional(),
62
+ }).optional(),
58
63
  });
59
64
  exports.zodAgentSchema = zod_1.z.object({
60
65
  _id: zod_1.z.string().optional(),
package/index.ts CHANGED
@@ -1,91 +1,134 @@
1
1
  // Export types for consumers
2
2
  export * from './types';
3
3
 
4
- import { Schema as MongoSchema, SchemaOptions } from 'mongoose';
4
+ import { Schema } from 'mongoose';
5
5
  import { modelsList, userRoles } from './types';
6
6
 
7
- const mongoDefaultOptions: SchemaOptions = {
8
- versionKey: false,
9
- toJSON: { virtuals: true },
10
- toObject: { virtuals: true },
11
- timestamps: true,
12
- id: true,
13
- // encryptionType: 'csfle',
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
+ );
14
30
 
15
- }
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
+ );
16
54
 
17
- const Schema = (values: Record<string, any>) => {
18
- return new MongoSchema(
19
- values,
20
- mongoDefaultOptions
21
- );
22
- }
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
+ );
23
79
 
24
- export const OrganizationSchema = Schema({
25
- clerk_organization_id: { type: String, required: true },
26
- title: { type: String, required: true, minlength: 1, maxlength: 100 },
27
- image: { type: String },
28
- client_email: { type: String },
29
- plan: { type: String, minlength: 1, maxlength: 100 },
30
- active_user_limit: { type: Number, min: 1 },
31
- documents_size_limit: { type: Number, min: 1 },
32
- allowed_models: { type: [String], enum: modelsList },
33
- queries_limit: { type: Number, min: 1 },
34
- created_at: { type: Number },
35
- updated_at: { type: Number },
36
- });
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
+ created_at: { type: Number },
98
+ updated_at: { type: Number },
99
+ },
100
+ {
101
+ versionKey: false,
102
+ toJSON: { virtuals: true },
103
+ toObject: { virtuals: true },
104
+ timestamps: true,
105
+ id: true,
106
+ // encryptionType: 'csfle',
107
+ }
108
+ );
37
109
 
38
- export const UserSchema = Schema({
39
- organization_memberships: { type: [String], required: true },
40
- clerk_user_id: { type: String, required: true },
41
- email: { type: String, required: true },
42
- first_name: { type: String },
43
- last_name: { type: String },
44
- active_until: { type: Number },
45
- notes: { type: String, maxlength: 500 },
46
- avatar: { type: String },
47
- user_role: { type: String, enum: userRoles, required: true },
48
- created_at: { type: Number },
49
- updated_at: { type: Number },
50
- });
51
-
52
- export const AgentSchema = Schema({
53
- organization_id: { type: String },
54
- title: { type: String, required: true, minlength: 1, maxlength: 100 },
55
- description: { type: String, minlength: 1, maxlength: 500 },
56
- instructions: { type: String, minlength: 1, maxlength: 1000 },
57
- model: { type: String, enum: modelsList, required: true },
58
- temperature: { type: Number, min: 0, max: 1 },
59
- max_tokens: { type: Number, min: 1, max: 4000 },
60
- elevenlabs_voice_id: { type: String, minlength: 1, maxlength: 100 },
61
- message_count_limit: { type: Number, min: 1 },
62
- is_editable: { type: Boolean, default: true },
63
- created_at: { type: Number },
64
- updated_at: { type: Number },
65
- });
66
-
67
- export const ContextSchema = Schema({
68
- organization_id: { type: String },
69
- file_id: { type: String },
70
- title: { type: String, required: true, minlength: 1, maxlength: 100 },
71
- description: { type: String, minlength: 1, maxlength: 500 },
72
- note: { type: String, maxlength: 500 },
73
- file_url: { type: String },
74
- type: { type: String, minlength: 1, maxlength: 100 },
75
- size: { type: Number },
76
- tokens: { type: Number },
77
- is_active: { type: Boolean, default: true },
78
- created_at: { type: Number },
79
- updated_at: { type: Number },
80
- });
81
-
82
- export const QuerySchema = Schema({
83
- organization_id: { type: String },
84
- title: { type: String, minlength: 1, maxlength: 100 },
85
- query: { type: String, required: true },
86
- context_ids: { type: [String] },
87
- status: { type: String, enum: ['active', 'inactive', 'archived'], default: 'active', required: true },
88
- users_ids: { type: [String] },
89
- created_at: { type: Number },
90
- updated_at: { type: Number },
91
- });
110
+ export const QuerySchema = new Schema(
111
+ {
112
+ organization_id: { type: String },
113
+ title: { type: String, minlength: 1, maxlength: 100 },
114
+ query: { type: String, required: true },
115
+ context_ids: { type: [String] },
116
+ status: {
117
+ type: String,
118
+ enum: ['active', 'inactive', 'archived'],
119
+ default: 'active',
120
+ required: true,
121
+ },
122
+ users_ids: { type: [String] },
123
+ created_at: { type: Number },
124
+ updated_at: { type: Number },
125
+ },
126
+ {
127
+ versionKey: false,
128
+ toJSON: { virtuals: true },
129
+ toObject: { virtuals: true },
130
+ timestamps: true,
131
+ id: true,
132
+ // encryptionType: 'csfle',
133
+ }
134
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatifai",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "SDK for interacting with the Chatifai API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/types.ts CHANGED
@@ -57,6 +57,11 @@ 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.object({
61
+ first_name: z.string().optional(),
62
+ last_name: z.string().optional(),
63
+ email: z.string().email().optional(),
64
+ }).optional(),
60
65
  });
61
66
 
62
67
  export const zodAgentSchema = z.object({