chatifai 1.0.29 → 1.0.31

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
@@ -99,14 +99,14 @@ export declare const UserSchema: Schema<any, import("mongoose").Model<any, any,
99
99
  createdAt: NativeDate;
100
100
  updatedAt: NativeDate;
101
101
  } & {
102
+ email: string;
102
103
  organization_memberships: string[];
103
104
  clerk_user_id: string;
104
- email: string;
105
105
  user_role: "admin" | "member" | "client";
106
- created_at?: number | null | undefined;
107
- updated_at?: number | null | undefined;
108
106
  first_name?: string | null | undefined;
109
107
  last_name?: string | null | undefined;
108
+ created_at?: number | null | undefined;
109
+ updated_at?: number | null | undefined;
110
110
  active_until?: number | null | undefined;
111
111
  notes?: string | null | undefined;
112
112
  avatar?: string | null | undefined;
@@ -114,14 +114,14 @@ export declare const UserSchema: Schema<any, import("mongoose").Model<any, any,
114
114
  createdAt: NativeDate;
115
115
  updatedAt: NativeDate;
116
116
  } & {
117
+ email: string;
117
118
  organization_memberships: string[];
118
119
  clerk_user_id: string;
119
- email: string;
120
120
  user_role: "admin" | "member" | "client";
121
- created_at?: number | null | undefined;
122
- updated_at?: number | null | undefined;
123
121
  first_name?: string | null | undefined;
124
122
  last_name?: string | null | undefined;
123
+ created_at?: number | null | undefined;
124
+ updated_at?: number | null | undefined;
125
125
  active_until?: number | null | undefined;
126
126
  notes?: string | null | undefined;
127
127
  avatar?: string | null | undefined;
@@ -129,14 +129,14 @@ export declare const UserSchema: Schema<any, import("mongoose").Model<any, any,
129
129
  createdAt: NativeDate;
130
130
  updatedAt: NativeDate;
131
131
  } & {
132
+ email: string;
132
133
  organization_memberships: string[];
133
134
  clerk_user_id: string;
134
- email: string;
135
135
  user_role: "admin" | "member" | "client";
136
- created_at?: number | null | undefined;
137
- updated_at?: number | null | undefined;
138
136
  first_name?: string | null | undefined;
139
137
  last_name?: string | null | undefined;
138
+ created_at?: number | null | undefined;
139
+ updated_at?: number | null | undefined;
140
140
  active_until?: number | null | undefined;
141
141
  notes?: string | null | undefined;
142
142
  avatar?: string | null | undefined;
@@ -235,9 +235,9 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
235
235
  size?: number | null | undefined;
236
236
  tokens?: number | null | undefined;
237
237
  uploaded_by?: {
238
- email?: string | null | undefined;
239
238
  first_name?: string | null | undefined;
240
239
  last_name?: string | null | undefined;
240
+ email?: string | null | undefined;
241
241
  } | null | undefined;
242
242
  bucket_name?: string | null | undefined;
243
243
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
@@ -260,9 +260,9 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
260
260
  size?: number | null | undefined;
261
261
  tokens?: number | null | undefined;
262
262
  uploaded_by?: {
263
- email?: string | null | undefined;
264
263
  first_name?: string | null | undefined;
265
264
  last_name?: string | null | undefined;
265
+ email?: string | null | undefined;
266
266
  } | null | undefined;
267
267
  bucket_name?: string | null | undefined;
268
268
  }>, {}> & import("mongoose").FlatRecord<{
@@ -285,9 +285,9 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
285
285
  size?: number | null | undefined;
286
286
  tokens?: number | null | undefined;
287
287
  uploaded_by?: {
288
- email?: string | null | undefined;
289
288
  first_name?: string | null | undefined;
290
289
  last_name?: string | null | undefined;
290
+ email?: string | null | undefined;
291
291
  } | null | undefined;
292
292
  bucket_name?: string | null | undefined;
293
293
  }> & {
@@ -417,8 +417,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
417
417
  status: "active" | "inactive" | "archived";
418
418
  query: string;
419
419
  contexts: import("mongoose").Types.DocumentArray<{
420
- entries?: {} | null | undefined;
421
420
  keys?: {} | null | undefined;
421
+ entries?: {} | null | undefined;
422
422
  values?: {} | null | undefined;
423
423
  prototype?: {
424
424
  toString: {} | null;
@@ -459,8 +459,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
459
459
  getOwnPropertyDescriptors?: {} | null | undefined;
460
460
  fromEntries?: {} | null | undefined;
461
461
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
462
- entries?: {} | null | undefined;
463
462
  keys?: {} | null | undefined;
463
+ entries?: {} | null | undefined;
464
464
  values?: {} | null | undefined;
465
465
  prototype?: {
466
466
  toString: {} | null;
@@ -501,8 +501,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
501
501
  getOwnPropertyDescriptors?: {} | null | undefined;
502
502
  fromEntries?: {} | null | undefined;
503
503
  }> & {
504
- entries?: {} | null | undefined;
505
504
  keys?: {} | null | undefined;
505
+ entries?: {} | null | undefined;
506
506
  values?: {} | null | undefined;
507
507
  prototype?: {
508
508
  toString: {} | null;
@@ -545,8 +545,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
545
545
  }>;
546
546
  full_document_search: boolean;
547
547
  users: import("mongoose").Types.DocumentArray<{
548
- entries?: {} | null | undefined;
549
548
  keys?: {} | null | undefined;
549
+ entries?: {} | null | undefined;
550
550
  values?: {} | null | undefined;
551
551
  prototype?: {
552
552
  toString: {} | null;
@@ -587,8 +587,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
587
587
  getOwnPropertyDescriptors?: {} | null | undefined;
588
588
  fromEntries?: {} | null | undefined;
589
589
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
590
- entries?: {} | null | undefined;
591
590
  keys?: {} | null | undefined;
591
+ entries?: {} | null | undefined;
592
592
  values?: {} | null | undefined;
593
593
  prototype?: {
594
594
  toString: {} | null;
@@ -629,8 +629,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
629
629
  getOwnPropertyDescriptors?: {} | null | undefined;
630
630
  fromEntries?: {} | null | undefined;
631
631
  }> & {
632
- entries?: {} | null | undefined;
633
632
  keys?: {} | null | undefined;
633
+ entries?: {} | null | undefined;
634
634
  values?: {} | null | undefined;
635
635
  prototype?: {
636
636
  toString: {} | null;
@@ -685,8 +685,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
685
685
  status: "active" | "inactive" | "archived";
686
686
  query: string;
687
687
  contexts: import("mongoose").Types.DocumentArray<{
688
- entries?: {} | null | undefined;
689
688
  keys?: {} | null | undefined;
689
+ entries?: {} | null | undefined;
690
690
  values?: {} | null | undefined;
691
691
  prototype?: {
692
692
  toString: {} | null;
@@ -727,8 +727,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
727
727
  getOwnPropertyDescriptors?: {} | null | undefined;
728
728
  fromEntries?: {} | null | undefined;
729
729
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
730
- entries?: {} | null | undefined;
731
730
  keys?: {} | null | undefined;
731
+ entries?: {} | null | undefined;
732
732
  values?: {} | null | undefined;
733
733
  prototype?: {
734
734
  toString: {} | null;
@@ -769,8 +769,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
769
769
  getOwnPropertyDescriptors?: {} | null | undefined;
770
770
  fromEntries?: {} | null | undefined;
771
771
  }> & {
772
- entries?: {} | null | undefined;
773
772
  keys?: {} | null | undefined;
773
+ entries?: {} | null | undefined;
774
774
  values?: {} | null | undefined;
775
775
  prototype?: {
776
776
  toString: {} | null;
@@ -813,8 +813,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
813
813
  }>;
814
814
  full_document_search: boolean;
815
815
  users: import("mongoose").Types.DocumentArray<{
816
- entries?: {} | null | undefined;
817
816
  keys?: {} | null | undefined;
817
+ entries?: {} | null | undefined;
818
818
  values?: {} | null | undefined;
819
819
  prototype?: {
820
820
  toString: {} | null;
@@ -855,8 +855,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
855
855
  getOwnPropertyDescriptors?: {} | null | undefined;
856
856
  fromEntries?: {} | null | undefined;
857
857
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
858
- entries?: {} | null | undefined;
859
858
  keys?: {} | null | undefined;
859
+ entries?: {} | null | undefined;
860
860
  values?: {} | null | undefined;
861
861
  prototype?: {
862
862
  toString: {} | null;
@@ -897,8 +897,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
897
897
  getOwnPropertyDescriptors?: {} | null | undefined;
898
898
  fromEntries?: {} | null | undefined;
899
899
  }> & {
900
- entries?: {} | null | undefined;
901
900
  keys?: {} | null | undefined;
901
+ entries?: {} | null | undefined;
902
902
  values?: {} | null | undefined;
903
903
  prototype?: {
904
904
  toString: {} | null;
@@ -953,8 +953,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
953
953
  status: "active" | "inactive" | "archived";
954
954
  query: string;
955
955
  contexts: import("mongoose").Types.DocumentArray<{
956
- entries?: {} | null | undefined;
957
956
  keys?: {} | null | undefined;
957
+ entries?: {} | null | undefined;
958
958
  values?: {} | null | undefined;
959
959
  prototype?: {
960
960
  toString: {} | null;
@@ -995,8 +995,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
995
995
  getOwnPropertyDescriptors?: {} | null | undefined;
996
996
  fromEntries?: {} | null | undefined;
997
997
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
998
- entries?: {} | null | undefined;
999
998
  keys?: {} | null | undefined;
999
+ entries?: {} | null | undefined;
1000
1000
  values?: {} | null | undefined;
1001
1001
  prototype?: {
1002
1002
  toString: {} | null;
@@ -1037,8 +1037,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
1037
1037
  getOwnPropertyDescriptors?: {} | null | undefined;
1038
1038
  fromEntries?: {} | null | undefined;
1039
1039
  }> & {
1040
- entries?: {} | null | undefined;
1041
1040
  keys?: {} | null | undefined;
1041
+ entries?: {} | null | undefined;
1042
1042
  values?: {} | null | undefined;
1043
1043
  prototype?: {
1044
1044
  toString: {} | null;
@@ -1081,8 +1081,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
1081
1081
  }>;
1082
1082
  full_document_search: boolean;
1083
1083
  users: import("mongoose").Types.DocumentArray<{
1084
- entries?: {} | null | undefined;
1085
1084
  keys?: {} | null | undefined;
1085
+ entries?: {} | null | undefined;
1086
1086
  values?: {} | null | undefined;
1087
1087
  prototype?: {
1088
1088
  toString: {} | null;
@@ -1123,8 +1123,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
1123
1123
  getOwnPropertyDescriptors?: {} | null | undefined;
1124
1124
  fromEntries?: {} | null | undefined;
1125
1125
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
1126
- entries?: {} | null | undefined;
1127
1126
  keys?: {} | null | undefined;
1127
+ entries?: {} | null | undefined;
1128
1128
  values?: {} | null | undefined;
1129
1129
  prototype?: {
1130
1130
  toString: {} | null;
@@ -1165,8 +1165,8 @@ export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model
1165
1165
  getOwnPropertyDescriptors?: {} | null | undefined;
1166
1166
  fromEntries?: {} | null | undefined;
1167
1167
  }> & {
1168
- entries?: {} | null | undefined;
1169
1168
  keys?: {} | null | undefined;
1169
+ entries?: {} | null | undefined;
1170
1170
  values?: {} | null | undefined;
1171
1171
  prototype?: {
1172
1172
  toString: {} | null;
@@ -1270,40 +1270,37 @@ export declare const ThreadSchema: Schema<any, import("mongoose").Model<any, any
1270
1270
  updatedAt: NativeDate;
1271
1271
  } & {
1272
1272
  organization_id: string;
1273
- user_id: string;
1274
- agent_id: string;
1273
+ user: any;
1275
1274
  messages_count: number;
1276
1275
  title?: string | null | undefined;
1277
1276
  created_at?: number | null | undefined;
1278
1277
  updated_at?: number | null | undefined;
1279
1278
  description?: string | null | undefined;
1280
- query_id?: string | null | undefined;
1279
+ pre_defined_query_id?: string | null | undefined;
1281
1280
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
1282
1281
  createdAt: NativeDate;
1283
1282
  updatedAt: NativeDate;
1284
1283
  } & {
1285
1284
  organization_id: string;
1286
- user_id: string;
1287
- agent_id: string;
1285
+ user: any;
1288
1286
  messages_count: number;
1289
1287
  title?: string | null | undefined;
1290
1288
  created_at?: number | null | undefined;
1291
1289
  updated_at?: number | null | undefined;
1292
1290
  description?: string | null | undefined;
1293
- query_id?: string | null | undefined;
1291
+ pre_defined_query_id?: string | null | undefined;
1294
1292
  }>, {}> & import("mongoose").FlatRecord<{
1295
1293
  createdAt: NativeDate;
1296
1294
  updatedAt: NativeDate;
1297
1295
  } & {
1298
1296
  organization_id: string;
1299
- user_id: string;
1300
- agent_id: string;
1297
+ user: any;
1301
1298
  messages_count: number;
1302
1299
  title?: string | null | undefined;
1303
1300
  created_at?: number | null | undefined;
1304
1301
  updated_at?: number | null | undefined;
1305
1302
  description?: string | null | undefined;
1306
- query_id?: string | null | undefined;
1303
+ pre_defined_query_id?: string | null | undefined;
1307
1304
  }> & {
1308
1305
  _id: import("mongoose").Types.ObjectId;
1309
1306
  } & {
@@ -1329,9 +1326,9 @@ export declare const MessageSchema: Schema<any, import("mongoose").Model<any, an
1329
1326
  content: string;
1330
1327
  is_favorite: boolean;
1331
1328
  like: "liked" | "disliked" | "waiting_response";
1329
+ user_id?: string | null | undefined;
1332
1330
  created_at?: number | null | undefined;
1333
1331
  updated_at?: number | null | undefined;
1334
- user_id?: string | null | undefined;
1335
1332
  agent_id?: string | null | undefined;
1336
1333
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
1337
1334
  createdAt: NativeDate;
@@ -1343,9 +1340,9 @@ export declare const MessageSchema: Schema<any, import("mongoose").Model<any, an
1343
1340
  content: string;
1344
1341
  is_favorite: boolean;
1345
1342
  like: "liked" | "disliked" | "waiting_response";
1343
+ user_id?: string | null | undefined;
1346
1344
  created_at?: number | null | undefined;
1347
1345
  updated_at?: number | null | undefined;
1348
- user_id?: string | null | undefined;
1349
1346
  agent_id?: string | null | undefined;
1350
1347
  }>, {}> & import("mongoose").FlatRecord<{
1351
1348
  createdAt: NativeDate;
@@ -1357,9 +1354,9 @@ export declare const MessageSchema: Schema<any, import("mongoose").Model<any, an
1357
1354
  content: string;
1358
1355
  is_favorite: boolean;
1359
1356
  like: "liked" | "disliked" | "waiting_response";
1357
+ user_id?: string | null | undefined;
1360
1358
  created_at?: number | null | undefined;
1361
1359
  updated_at?: number | null | undefined;
1362
- user_id?: string | null | undefined;
1363
1360
  agent_id?: string | null | undefined;
1364
1361
  }> & {
1365
1362
  _id: import("mongoose").Types.ObjectId;
package/dist/index.js CHANGED
@@ -189,11 +189,10 @@ exports.FullFileTextSchema = new mongoose_1.Schema({
189
189
  });
190
190
  exports.ThreadSchema = new mongoose_1.Schema({
191
191
  organization_id: { type: String, required: true },
192
- user_id: { type: String, required: true },
193
- agent_id: { type: String, required: true },
192
+ user: { type: Object, required: true },
194
193
  title: { type: String, minlength: 1, maxlength: 200 },
195
194
  description: { type: String },
196
- query_id: { type: String },
195
+ pre_defined_query_id: { type: String },
197
196
  messages_count: { type: Number, default: 0 },
198
197
  created_at: { type: Number },
199
198
  updated_at: { type: Number },
package/dist/types.d.ts CHANGED
@@ -1,6 +1,22 @@
1
1
  import { z } from 'zod';
2
2
  export declare const modelsList: readonly ["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"];
3
3
  export declare const userRoles: readonly ["admin", "member", "client"];
4
+ export declare const zodClerkMinimalUserSchema: z.ZodObject<{
5
+ user_id: z.ZodString;
6
+ first_name: z.ZodOptional<z.ZodString>;
7
+ last_name: z.ZodOptional<z.ZodString>;
8
+ email: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ user_id: string;
11
+ first_name?: string | undefined;
12
+ last_name?: string | undefined;
13
+ email?: string | undefined;
14
+ }, {
15
+ user_id: string;
16
+ first_name?: string | undefined;
17
+ last_name?: string | undefined;
18
+ email?: string | undefined;
19
+ }>;
4
20
  export declare const zodOrganizationSchema: z.ZodObject<{
5
21
  _id: z.ZodOptional<z.ZodString>;
6
22
  clerk_organization_id: z.ZodString;
@@ -55,27 +71,27 @@ export declare const zodUserSchema: z.ZodObject<{
55
71
  created_at: z.ZodOptional<z.ZodNumber>;
56
72
  updated_at: z.ZodOptional<z.ZodNumber>;
57
73
  }, "strip", z.ZodTypeAny, {
58
- clerk_user_id: string;
59
74
  email: string;
75
+ clerk_user_id: string;
76
+ first_name?: string | undefined;
77
+ last_name?: string | undefined;
60
78
  _id?: string | undefined;
61
79
  created_at?: number | undefined;
62
80
  updated_at?: number | undefined;
63
81
  organization_memberships?: string[] | undefined;
64
- first_name?: string | undefined;
65
- last_name?: string | undefined;
66
82
  active_until?: number | undefined;
67
83
  notes?: string | undefined;
68
84
  avatar?: string | undefined;
69
85
  user_role?: "admin" | "member" | "client" | undefined;
70
86
  }, {
71
- clerk_user_id: string;
72
87
  email: string;
88
+ clerk_user_id: string;
89
+ first_name?: string | undefined;
90
+ last_name?: string | undefined;
73
91
  _id?: string | undefined;
74
92
  created_at?: number | undefined;
75
93
  updated_at?: number | undefined;
76
94
  organization_memberships?: string[] | undefined;
77
- first_name?: string | undefined;
78
- last_name?: string | undefined;
79
95
  active_until?: number | undefined;
80
96
  notes?: string | undefined;
81
97
  avatar?: string | undefined;
@@ -102,20 +118,20 @@ export declare const zodContextSchema: z.ZodObject<{
102
118
  last_name: z.ZodOptional<z.ZodString>;
103
119
  email: z.ZodOptional<z.ZodString>;
104
120
  }, "strip", z.ZodTypeAny, {
105
- email?: string | undefined;
106
121
  first_name?: string | undefined;
107
122
  last_name?: string | undefined;
108
- }, {
109
123
  email?: string | undefined;
124
+ }, {
110
125
  first_name?: string | undefined;
111
126
  last_name?: string | undefined;
127
+ email?: string | undefined;
112
128
  }>>;
113
129
  bucket_name: z.ZodOptional<z.ZodString>;
114
130
  processing_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
115
131
  }, "strip", z.ZodTypeAny, {
116
132
  title: string;
117
- _id?: string | undefined;
118
133
  type?: string | undefined;
134
+ _id?: string | undefined;
119
135
  created_at?: number | undefined;
120
136
  updated_at?: number | undefined;
121
137
  organization_id?: string | undefined;
@@ -129,16 +145,16 @@ export declare const zodContextSchema: z.ZodObject<{
129
145
  tokens?: number | undefined;
130
146
  is_active?: boolean | undefined;
131
147
  uploaded_by?: {
132
- email?: string | undefined;
133
148
  first_name?: string | undefined;
134
149
  last_name?: string | undefined;
150
+ email?: string | undefined;
135
151
  } | undefined;
136
152
  bucket_name?: string | undefined;
137
153
  processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
138
154
  }, {
139
155
  title: string;
140
- _id?: string | undefined;
141
156
  type?: string | undefined;
157
+ _id?: string | undefined;
142
158
  created_at?: number | undefined;
143
159
  updated_at?: number | undefined;
144
160
  organization_id?: string | undefined;
@@ -152,9 +168,9 @@ export declare const zodContextSchema: z.ZodObject<{
152
168
  tokens?: number | undefined;
153
169
  is_active?: boolean | undefined;
154
170
  uploaded_by?: {
155
- email?: string | undefined;
156
171
  first_name?: string | undefined;
157
172
  last_name?: string | undefined;
173
+ email?: string | undefined;
158
174
  } | undefined;
159
175
  bucket_name?: string | undefined;
160
176
  processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
@@ -346,20 +362,20 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
346
362
  last_name: z.ZodOptional<z.ZodString>;
347
363
  email: z.ZodOptional<z.ZodString>;
348
364
  }, "strip", z.ZodTypeAny, {
349
- email?: string | undefined;
350
365
  first_name?: string | undefined;
351
366
  last_name?: string | undefined;
352
- }, {
353
367
  email?: string | undefined;
368
+ }, {
354
369
  first_name?: string | undefined;
355
370
  last_name?: string | undefined;
371
+ email?: string | undefined;
356
372
  }>>>;
357
373
  bucket_name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
358
374
  processing_status: z.ZodOptional<z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>>;
359
375
  }, "strip", z.ZodTypeAny, {
376
+ type?: string | undefined;
360
377
  _id?: string | undefined;
361
378
  title?: string | undefined;
362
- type?: string | undefined;
363
379
  created_at?: number | undefined;
364
380
  updated_at?: number | undefined;
365
381
  organization_id?: string | undefined;
@@ -373,16 +389,16 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
373
389
  tokens?: number | undefined;
374
390
  is_active?: boolean | undefined;
375
391
  uploaded_by?: {
376
- email?: string | undefined;
377
392
  first_name?: string | undefined;
378
393
  last_name?: string | undefined;
394
+ email?: string | undefined;
379
395
  } | undefined;
380
396
  bucket_name?: string | undefined;
381
397
  processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
382
398
  }, {
399
+ type?: string | undefined;
383
400
  _id?: string | undefined;
384
401
  title?: string | undefined;
385
- type?: string | undefined;
386
402
  created_at?: number | undefined;
387
403
  updated_at?: number | undefined;
388
404
  organization_id?: string | undefined;
@@ -396,9 +412,9 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
396
412
  tokens?: number | undefined;
397
413
  is_active?: boolean | undefined;
398
414
  uploaded_by?: {
399
- email?: string | undefined;
400
415
  first_name?: string | undefined;
401
416
  last_name?: string | undefined;
417
+ email?: string | undefined;
402
418
  } | undefined;
403
419
  bucket_name?: string | undefined;
404
420
  processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
@@ -406,44 +422,20 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
406
422
  full_document_search: z.ZodOptional<z.ZodBoolean>;
407
423
  status: z.ZodDefault<z.ZodEnum<["active", "inactive", "archived"]>>;
408
424
  users: z.ZodOptional<z.ZodArray<z.ZodObject<{
409
- _id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
410
- organization_memberships: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
411
- clerk_user_id: z.ZodOptional<z.ZodString>;
425
+ user_id: z.ZodString;
426
+ first_name: z.ZodOptional<z.ZodString>;
427
+ last_name: z.ZodOptional<z.ZodString>;
412
428
  email: z.ZodOptional<z.ZodString>;
413
- first_name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
414
- last_name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
415
- active_until: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
416
- notes: z.ZodOptional<z.ZodOptional<z.ZodString>>;
417
- avatar: z.ZodOptional<z.ZodOptional<z.ZodString>>;
418
- user_role: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodEnum<["admin", "member", "client"]>>>>;
419
- created_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
420
- updated_at: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
421
429
  }, "strip", z.ZodTypeAny, {
422
- _id?: string | undefined;
423
- created_at?: number | undefined;
424
- updated_at?: number | undefined;
425
- organization_memberships?: string[] | undefined;
426
- clerk_user_id?: string | undefined;
427
- email?: string | undefined;
430
+ user_id: string;
428
431
  first_name?: string | undefined;
429
432
  last_name?: string | undefined;
430
- active_until?: number | undefined;
431
- notes?: string | undefined;
432
- avatar?: string | undefined;
433
- user_role?: "admin" | "member" | "client" | undefined;
434
- }, {
435
- _id?: string | undefined;
436
- created_at?: number | undefined;
437
- updated_at?: number | undefined;
438
- organization_memberships?: string[] | undefined;
439
- clerk_user_id?: string | undefined;
440
433
  email?: string | undefined;
434
+ }, {
435
+ user_id: string;
441
436
  first_name?: string | undefined;
442
437
  last_name?: string | undefined;
443
- active_until?: number | undefined;
444
- notes?: string | undefined;
445
- avatar?: string | undefined;
446
- user_role?: "admin" | "member" | "client" | undefined;
438
+ email?: string | undefined;
447
439
  }>, "many">>;
448
440
  click_count: z.ZodOptional<z.ZodNumber>;
449
441
  created_at: z.ZodOptional<z.ZodNumber>;
@@ -459,9 +451,9 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
459
451
  query_name?: string | undefined;
460
452
  query_hint?: string | undefined;
461
453
  contexts?: {
454
+ type?: string | undefined;
462
455
  _id?: string | undefined;
463
456
  title?: string | undefined;
464
- type?: string | undefined;
465
457
  created_at?: number | undefined;
466
458
  updated_at?: number | undefined;
467
459
  organization_id?: string | undefined;
@@ -475,33 +467,25 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
475
467
  tokens?: number | undefined;
476
468
  is_active?: boolean | undefined;
477
469
  uploaded_by?: {
478
- email?: string | undefined;
479
470
  first_name?: string | undefined;
480
471
  last_name?: string | undefined;
472
+ email?: string | undefined;
481
473
  } | undefined;
482
474
  bucket_name?: string | undefined;
483
475
  processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
484
476
  }[] | undefined;
485
477
  full_document_search?: boolean | undefined;
486
478
  users?: {
487
- _id?: string | undefined;
488
- created_at?: number | undefined;
489
- updated_at?: number | undefined;
490
- organization_memberships?: string[] | undefined;
491
- clerk_user_id?: string | undefined;
492
- email?: string | undefined;
479
+ user_id: string;
493
480
  first_name?: string | undefined;
494
481
  last_name?: string | undefined;
495
- active_until?: number | undefined;
496
- notes?: string | undefined;
497
- avatar?: string | undefined;
498
- user_role?: "admin" | "member" | "client" | undefined;
482
+ email?: string | undefined;
499
483
  }[] | undefined;
500
484
  click_count?: number | undefined;
501
485
  }, {
502
486
  query: string;
503
- _id?: string | undefined;
504
487
  status?: "active" | "inactive" | "archived" | undefined;
488
+ _id?: string | undefined;
505
489
  created_at?: number | undefined;
506
490
  updated_at?: number | undefined;
507
491
  organization_id?: string | undefined;
@@ -509,9 +493,9 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
509
493
  query_name?: string | undefined;
510
494
  query_hint?: string | undefined;
511
495
  contexts?: {
496
+ type?: string | undefined;
512
497
  _id?: string | undefined;
513
498
  title?: string | undefined;
514
- type?: string | undefined;
515
499
  created_at?: number | undefined;
516
500
  updated_at?: number | undefined;
517
501
  organization_id?: string | undefined;
@@ -525,27 +509,19 @@ export declare const zodPreDefinedQuerySchema: z.ZodObject<{
525
509
  tokens?: number | undefined;
526
510
  is_active?: boolean | undefined;
527
511
  uploaded_by?: {
528
- email?: string | undefined;
529
512
  first_name?: string | undefined;
530
513
  last_name?: string | undefined;
514
+ email?: string | undefined;
531
515
  } | undefined;
532
516
  bucket_name?: string | undefined;
533
517
  processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
534
518
  }[] | undefined;
535
519
  full_document_search?: boolean | undefined;
536
520
  users?: {
537
- _id?: string | undefined;
538
- created_at?: number | undefined;
539
- updated_at?: number | undefined;
540
- organization_memberships?: string[] | undefined;
541
- clerk_user_id?: string | undefined;
542
- email?: string | undefined;
521
+ user_id: string;
543
522
  first_name?: string | undefined;
544
523
  last_name?: string | undefined;
545
- active_until?: number | undefined;
546
- notes?: string | undefined;
547
- avatar?: string | undefined;
548
- user_role?: "admin" | "member" | "client" | undefined;
524
+ email?: string | undefined;
549
525
  }[] | undefined;
550
526
  click_count?: number | undefined;
551
527
  }>;
@@ -560,14 +536,14 @@ export declare const zodQuerySchema: z.ZodObject<{
560
536
  email: z.ZodOptional<z.ZodString>;
561
537
  }, "strip", z.ZodTypeAny, {
562
538
  user_id: string;
563
- email?: string | undefined;
564
539
  first_name?: string | undefined;
565
540
  last_name?: string | undefined;
541
+ email?: string | undefined;
566
542
  }, {
567
543
  user_id: string;
568
- email?: string | undefined;
569
544
  first_name?: string | undefined;
570
545
  last_name?: string | undefined;
546
+ email?: string | undefined;
571
547
  }>;
572
548
  query: z.ZodString;
573
549
  pre_defined_query_id: z.ZodOptional<z.ZodString>;
@@ -579,9 +555,9 @@ export declare const zodQuerySchema: z.ZodObject<{
579
555
  query: string;
580
556
  user: {
581
557
  user_id: string;
582
- email?: string | undefined;
583
558
  first_name?: string | undefined;
584
559
  last_name?: string | undefined;
560
+ email?: string | undefined;
585
561
  };
586
562
  timestamp: number;
587
563
  full_document_search?: boolean | undefined;
@@ -594,9 +570,9 @@ export declare const zodQuerySchema: z.ZodObject<{
594
570
  query: string;
595
571
  user: {
596
572
  user_id: string;
597
- email?: string | undefined;
598
573
  first_name?: string | undefined;
599
574
  last_name?: string | undefined;
575
+ email?: string | undefined;
600
576
  };
601
577
  timestamp: number;
602
578
  full_document_search?: boolean | undefined;
@@ -608,35 +584,57 @@ export declare const zodQuerySchema: z.ZodObject<{
608
584
  export declare const zodThreadSchema: z.ZodObject<{
609
585
  _id: z.ZodOptional<z.ZodString>;
610
586
  organization_id: z.ZodString;
611
- user_id: z.ZodString;
612
- agent_id: z.ZodOptional<z.ZodString>;
587
+ user: z.ZodObject<{
588
+ user_id: z.ZodString;
589
+ first_name: z.ZodOptional<z.ZodString>;
590
+ last_name: z.ZodOptional<z.ZodString>;
591
+ email: z.ZodOptional<z.ZodString>;
592
+ }, "strip", z.ZodTypeAny, {
593
+ user_id: string;
594
+ first_name?: string | undefined;
595
+ last_name?: string | undefined;
596
+ email?: string | undefined;
597
+ }, {
598
+ user_id: string;
599
+ first_name?: string | undefined;
600
+ last_name?: string | undefined;
601
+ email?: string | undefined;
602
+ }>;
613
603
  title: z.ZodOptional<z.ZodString>;
614
604
  description: z.ZodOptional<z.ZodString>;
615
605
  created_at: z.ZodOptional<z.ZodNumber>;
616
606
  updated_at: z.ZodOptional<z.ZodNumber>;
617
- query_id: z.ZodOptional<z.ZodString>;
607
+ pre_defined_query_id: z.ZodOptional<z.ZodString>;
618
608
  messages_count: z.ZodOptional<z.ZodNumber>;
619
609
  }, "strip", z.ZodTypeAny, {
620
610
  organization_id: string;
621
- user_id: string;
611
+ user: {
612
+ user_id: string;
613
+ first_name?: string | undefined;
614
+ last_name?: string | undefined;
615
+ email?: string | undefined;
616
+ };
622
617
  _id?: string | undefined;
623
618
  title?: string | undefined;
624
619
  created_at?: number | undefined;
625
620
  updated_at?: number | undefined;
626
621
  description?: string | undefined;
627
- agent_id?: string | undefined;
628
- query_id?: string | undefined;
622
+ pre_defined_query_id?: string | undefined;
629
623
  messages_count?: number | undefined;
630
624
  }, {
631
625
  organization_id: string;
632
- user_id: string;
626
+ user: {
627
+ user_id: string;
628
+ first_name?: string | undefined;
629
+ last_name?: string | undefined;
630
+ email?: string | undefined;
631
+ };
633
632
  _id?: string | undefined;
634
633
  title?: string | undefined;
635
634
  created_at?: number | undefined;
636
635
  updated_at?: number | undefined;
637
636
  description?: string | undefined;
638
- agent_id?: string | undefined;
639
- query_id?: string | undefined;
637
+ pre_defined_query_id?: string | undefined;
640
638
  messages_count?: number | undefined;
641
639
  }>;
642
640
  export declare const zodMessageSchema: z.ZodObject<{
@@ -656,10 +654,10 @@ export declare const zodMessageSchema: z.ZodObject<{
656
654
  thread_id: string;
657
655
  role: "user" | "agent" | "system";
658
656
  content: string;
657
+ user_id?: string | undefined;
659
658
  _id?: string | undefined;
660
659
  created_at?: number | undefined;
661
660
  updated_at?: number | undefined;
662
- user_id?: string | undefined;
663
661
  agent_id?: string | undefined;
664
662
  is_favorite?: boolean | undefined;
665
663
  like?: "liked" | "disliked" | "waiting_response" | undefined;
@@ -668,10 +666,10 @@ export declare const zodMessageSchema: z.ZodObject<{
668
666
  thread_id: string;
669
667
  role: "user" | "agent" | "system";
670
668
  content: string;
669
+ user_id?: string | undefined;
671
670
  _id?: string | undefined;
672
671
  created_at?: number | undefined;
673
672
  updated_at?: number | undefined;
674
- user_id?: string | undefined;
675
673
  agent_id?: string | undefined;
676
674
  is_favorite?: boolean | undefined;
677
675
  like?: "liked" | "disliked" | "waiting_response" | undefined;
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QueuesList = exports.FileType = exports.zodMessageSchema = exports.zodThreadSchema = exports.zodQuerySchema = exports.zodPreDefinedQuerySchema = exports.zodFullTextSchema = exports.zodChunkSchema = exports.zodAgentSchema = exports.zodContextSchema = exports.zodUserSchema = exports.zodOrganizationSchema = exports.userRoles = exports.modelsList = void 0;
3
+ exports.QueuesList = exports.FileType = exports.zodMessageSchema = exports.zodThreadSchema = exports.zodQuerySchema = exports.zodPreDefinedQuerySchema = exports.zodFullTextSchema = exports.zodChunkSchema = exports.zodAgentSchema = exports.zodContextSchema = exports.zodUserSchema = exports.zodOrganizationSchema = exports.zodClerkMinimalUserSchema = exports.userRoles = exports.modelsList = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.modelsList = [
6
6
  'gemini-2.5-flash-lite',
@@ -13,6 +13,12 @@ exports.modelsList = [
13
13
  'gpt-4.1-nano',
14
14
  ];
15
15
  exports.userRoles = ['admin', 'member', 'client'];
16
+ exports.zodClerkMinimalUserSchema = zod_1.z.object({
17
+ user_id: zod_1.z.string(),
18
+ first_name: zod_1.z.string().optional(),
19
+ last_name: zod_1.z.string().optional(),
20
+ email: zod_1.z.string().email().optional(),
21
+ });
16
22
  exports.zodOrganizationSchema = zod_1.z.object({
17
23
  _id: zod_1.z.string().optional(),
18
24
  clerk_organization_id: zod_1.z.string(),
@@ -129,7 +135,7 @@ exports.zodPreDefinedQuerySchema = zod_1.z.object({
129
135
  contexts: zod_1.z.array(exports.zodContextSchema.partial()).optional(),
130
136
  full_document_search: zod_1.z.boolean().optional(),
131
137
  status: zod_1.z.enum(['active', 'inactive', 'archived']).default('active'),
132
- users: zod_1.z.array(exports.zodUserSchema.partial()).optional(),
138
+ users: zod_1.z.array(exports.zodClerkMinimalUserSchema).optional(),
133
139
  click_count: zod_1.z.number().optional(),
134
140
  created_at: zod_1.z.number().optional(),
135
141
  updated_at: zod_1.z.number().optional(),
@@ -139,12 +145,7 @@ exports.zodQuerySchema = zod_1.z.object({
139
145
  thread_id: zod_1.z.string().optional(),
140
146
  context_ids: zod_1.z.array(zod_1.z.string()).optional(),
141
147
  organization_id: zod_1.z.string(),
142
- user: zod_1.z.object({
143
- user_id: zod_1.z.string(),
144
- first_name: zod_1.z.string().optional(),
145
- last_name: zod_1.z.string().optional(),
146
- email: zod_1.z.string().email().optional(),
147
- }),
148
+ user: exports.zodClerkMinimalUserSchema,
148
149
  query: zod_1.z.string().min(1),
149
150
  pre_defined_query_id: zod_1.z.string().optional(),
150
151
  custom_instructions: zod_1.z.string().optional(),
@@ -154,13 +155,12 @@ exports.zodQuerySchema = zod_1.z.object({
154
155
  exports.zodThreadSchema = zod_1.z.object({
155
156
  _id: zod_1.z.string().optional(),
156
157
  organization_id: zod_1.z.string(),
157
- user_id: zod_1.z.string(),
158
- agent_id: zod_1.z.string().optional(),
158
+ user: exports.zodClerkMinimalUserSchema,
159
159
  title: zod_1.z.string().min(1).max(200).optional(),
160
160
  description: zod_1.z.string().optional(),
161
161
  created_at: zod_1.z.number().optional(),
162
162
  updated_at: zod_1.z.number().optional(),
163
- query_id: zod_1.z.string().optional(),
163
+ pre_defined_query_id: zod_1.z.string().optional(),
164
164
  messages_count: zod_1.z.number().optional(),
165
165
  });
166
166
  exports.zodMessageSchema = zod_1.z.object({
package/index.ts CHANGED
@@ -203,11 +203,10 @@ export const FullFileTextSchema = new Schema(
203
203
  export const ThreadSchema = new Schema(
204
204
  {
205
205
  organization_id: { type: String, required: true },
206
- user_id: { type: String, required: true },
207
- agent_id: { type: String, required: true },
206
+ user: { type: Object, required: true },
208
207
  title: { type: String, minlength: 1, maxlength: 200 },
209
208
  description: { type: String },
210
- query_id: { type: String },
209
+ pre_defined_query_id: { type: String },
211
210
  messages_count: { type: Number, default: 0 },
212
211
  created_at: { type: Number },
213
212
  updated_at: { type: Number },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatifai",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
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
@@ -13,6 +13,13 @@ export const modelsList = [
13
13
 
14
14
  export const userRoles = ['admin', 'member', 'client'] as const;
15
15
 
16
+ export const zodClerkMinimalUserSchema = z.object({
17
+ user_id: z.string(),
18
+ first_name: z.string().optional(),
19
+ last_name: z.string().optional(),
20
+ email: z.string().email().optional(),
21
+ });
22
+
16
23
  export const zodOrganizationSchema = z.object({
17
24
  _id: z.string().optional(),
18
25
  clerk_organization_id: z.string(),
@@ -135,7 +142,7 @@ export const zodPreDefinedQuerySchema = z.object({
135
142
  contexts: z.array(zodContextSchema.partial()).optional(),
136
143
  full_document_search: z.boolean().optional(),
137
144
  status: z.enum(['active', 'inactive', 'archived']).default('active'),
138
- users: z.array(zodUserSchema.partial()).optional(),
145
+ users: z.array(zodClerkMinimalUserSchema).optional(),
139
146
  click_count: z.number().optional(),
140
147
  created_at: z.number().optional(),
141
148
  updated_at: z.number().optional(),
@@ -146,12 +153,7 @@ export const zodQuerySchema = z.object({
146
153
  thread_id: z.string().optional(), // If there is not thread id provided, a new thread will be created
147
154
  context_ids: z.array(z.string()).optional(), // Run on all organization files unless specific file ids are provided
148
155
  organization_id: z.string(), // Will be used to fetch the agent, contexts, chunks, etc.
149
- user: z.object({
150
- user_id: z.string(),
151
- first_name: z.string().optional(),
152
- last_name: z.string().optional(),
153
- email: z.string().email().optional(),
154
- }),
156
+ user: zodClerkMinimalUserSchema,
155
157
  query: z.string().min(1),
156
158
  pre_defined_query_id: z.string().optional(),
157
159
  custom_instructions: z.string().optional(),
@@ -162,13 +164,12 @@ export const zodQuerySchema = z.object({
162
164
  export const zodThreadSchema = z.object({
163
165
  _id: z.string().optional(),
164
166
  organization_id: z.string(),
165
- user_id: z.string(),
166
- agent_id: z.string().optional(),
167
+ user: zodClerkMinimalUserSchema,
167
168
  title: z.string().min(1).max(200).optional(),
168
169
  description: z.string().optional(),
169
170
  created_at: z.number().optional(),
170
171
  updated_at: z.number().optional(),
171
- query_id: z.string().optional(),
172
+ pre_defined_query_id: z.string().optional(),
172
173
  messages_count: z.number().optional(),
173
174
  });
174
175