chatifai 1.0.3 → 1.0.5

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.js CHANGED
@@ -44,7 +44,7 @@ exports.OrganizationSchema = Schema({
44
44
  updated_at: { type: Number },
45
45
  });
46
46
  exports.UserSchema = Schema({
47
- organization_id: { type: String, required: true },
47
+ organization_memberships: { type: [String], required: true },
48
48
  clerk_user_id: { type: String, required: true },
49
49
  email: { type: String, required: true },
50
50
  first_name: { type: String },
package/dist/types.d.ts CHANGED
@@ -43,43 +43,88 @@ export declare const zodOrganizationSchema: z.ZodObject<{
43
43
  }>;
44
44
  export declare const zodUserSchema: z.ZodObject<{
45
45
  _id: z.ZodOptional<z.ZodString>;
46
- organization_id: z.ZodString;
46
+ organization_memberships: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
47
47
  clerk_user_id: z.ZodString;
48
48
  email: z.ZodString;
49
49
  first_name: z.ZodOptional<z.ZodString>;
50
50
  last_name: z.ZodOptional<z.ZodString>;
51
51
  active_until: z.ZodOptional<z.ZodNumber>;
52
- notes: z.ZodOptional<z.ZodString>;
52
+ notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
53
+ organization_id: z.ZodString;
54
+ note: z.ZodString;
55
+ }, "strip", z.ZodTypeAny, {
56
+ organization_id: string;
57
+ note: string;
58
+ }, {
59
+ organization_id: string;
60
+ note: string;
61
+ }>, "many">>;
53
62
  avatar: z.ZodOptional<z.ZodString>;
54
- user_role: z.ZodOptional<z.ZodDefault<z.ZodEnum<["admin", "member", "client"]>>>;
63
+ user_role: z.ZodOptional<z.ZodArray<z.ZodObject<{
64
+ organization_id: z.ZodString;
65
+ role: z.ZodEnum<["admin", "member", "client"]>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ organization_id: string;
68
+ role: "admin" | "member" | "client";
69
+ }, {
70
+ organization_id: string;
71
+ role: "admin" | "member" | "client";
72
+ }>, "many">>;
55
73
  created_at: z.ZodOptional<z.ZodNumber>;
56
- updated_at: z.ZodOptional<z.ZodNumber>;
74
+ updated_at: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
+ organization_id: z.ZodString;
76
+ timestamp: z.ZodNumber;
77
+ }, "strip", z.ZodTypeAny, {
78
+ organization_id: string;
79
+ timestamp: number;
80
+ }, {
81
+ organization_id: string;
82
+ timestamp: number;
83
+ }>, "many">>;
57
84
  }, "strip", z.ZodTypeAny, {
58
- organization_id: string;
59
85
  clerk_user_id: string;
60
86
  email: string;
61
87
  _id?: string | undefined;
62
88
  created_at?: number | undefined;
63
- updated_at?: number | undefined;
89
+ updated_at?: {
90
+ organization_id: string;
91
+ timestamp: number;
92
+ }[] | undefined;
93
+ organization_memberships?: string[] | undefined;
64
94
  first_name?: string | undefined;
65
95
  last_name?: string | undefined;
66
96
  active_until?: number | undefined;
67
- notes?: string | undefined;
97
+ notes?: {
98
+ organization_id: string;
99
+ note: string;
100
+ }[] | undefined;
68
101
  avatar?: string | undefined;
69
- user_role?: "admin" | "member" | "client" | undefined;
102
+ user_role?: {
103
+ organization_id: string;
104
+ role: "admin" | "member" | "client";
105
+ }[] | undefined;
70
106
  }, {
71
- organization_id: string;
72
107
  clerk_user_id: string;
73
108
  email: string;
74
109
  _id?: string | undefined;
75
110
  created_at?: number | undefined;
76
- updated_at?: number | undefined;
111
+ updated_at?: {
112
+ organization_id: string;
113
+ timestamp: number;
114
+ }[] | undefined;
115
+ organization_memberships?: string[] | undefined;
77
116
  first_name?: string | undefined;
78
117
  last_name?: string | undefined;
79
118
  active_until?: number | undefined;
80
- notes?: string | undefined;
119
+ notes?: {
120
+ organization_id: string;
121
+ note: string;
122
+ }[] | undefined;
81
123
  avatar?: string | undefined;
82
- user_role?: "admin" | "member" | "client" | undefined;
124
+ user_role?: {
125
+ organization_id: string;
126
+ role: "admin" | "member" | "client";
127
+ }[] | undefined;
83
128
  }>;
84
129
  export declare const zodAgentSchema: z.ZodObject<{
85
130
  _id: z.ZodOptional<z.ZodString>;
@@ -187,11 +232,9 @@ export declare const zodQuerySchema: z.ZodObject<{
187
232
  users_ids?: string[] | undefined;
188
233
  }>;
189
234
  export type EventAttributeType = {
190
- event_attributes: {
191
- http_request: {
192
- client_ip: string;
193
- user_agent: string;
194
- };
235
+ http_request: {
236
+ client_ip?: string;
237
+ user_agent?: string;
195
238
  };
196
239
  };
197
240
  export type OrganizationType = z.infer<typeof zodOrganizationSchema>;
package/dist/types.js CHANGED
@@ -29,17 +29,32 @@ exports.zodOrganizationSchema = zod_1.z.object({
29
29
  });
30
30
  exports.zodUserSchema = zod_1.z.object({
31
31
  _id: zod_1.z.string().optional(),
32
- organization_id: zod_1.z.string(),
32
+ organization_memberships: zod_1.z.array(zod_1.z.string()).optional(),
33
33
  clerk_user_id: zod_1.z.string(),
34
34
  email: zod_1.z.string().email(),
35
35
  first_name: zod_1.z.string().optional(),
36
36
  last_name: zod_1.z.string().optional(),
37
37
  active_until: zod_1.z.number().optional(),
38
- notes: zod_1.z.string().max(500).optional(),
38
+ notes: zod_1.z
39
+ .array(zod_1.z.object({
40
+ organization_id: zod_1.z.string(),
41
+ note: zod_1.z.string().max(500),
42
+ }))
43
+ .optional(),
39
44
  avatar: zod_1.z.string().url().optional(),
40
- user_role: zod_1.z.enum(exports.userRoles).default('member').optional(),
45
+ user_role: zod_1.z
46
+ .array(zod_1.z.object({
47
+ organization_id: zod_1.z.string(),
48
+ role: zod_1.z.enum(exports.userRoles),
49
+ }))
50
+ .optional(),
41
51
  created_at: zod_1.z.number().optional(),
42
- updated_at: zod_1.z.number().optional(),
52
+ updated_at: zod_1.z
53
+ .array(zod_1.z.object({
54
+ organization_id: zod_1.z.string(),
55
+ timestamp: zod_1.z.number(),
56
+ }))
57
+ .optional(),
43
58
  });
44
59
  exports.zodAgentSchema = zod_1.z.object({
45
60
  _id: zod_1.z.string().optional(),
package/index.ts CHANGED
@@ -36,7 +36,7 @@ export const OrganizationSchema = Schema({
36
36
  });
37
37
 
38
38
  export const UserSchema = Schema({
39
- organization_id: { type: String, required: true },
39
+ organization_memberships: { type: [String], required: true },
40
40
  clerk_user_id: { type: String, required: true },
41
41
  email: { type: String, required: true },
42
42
  first_name: { type: String },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatifai",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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
@@ -30,17 +30,38 @@ export const zodOrganizationSchema = z.object({
30
30
 
31
31
  export const zodUserSchema = z.object({
32
32
  _id: z.string().optional(),
33
- organization_id: z.string(),
33
+ organization_memberships: z.array(z.string()).optional(),
34
34
  clerk_user_id: z.string(),
35
35
  email: z.string().email(),
36
36
  first_name: z.string().optional(),
37
37
  last_name: z.string().optional(),
38
38
  active_until: z.number().optional(),
39
- notes: z.string().max(500).optional(),
39
+ notes: z
40
+ .array(
41
+ z.object({
42
+ organization_id: z.string(),
43
+ note: z.string().max(500),
44
+ })
45
+ )
46
+ .optional(),
40
47
  avatar: z.string().url().optional(),
41
- user_role: z.enum(userRoles).default('member').optional(),
48
+ user_role: z
49
+ .array(
50
+ z.object({
51
+ organization_id: z.string(),
52
+ role: z.enum(userRoles),
53
+ })
54
+ )
55
+ .optional(),
42
56
  created_at: z.number().optional(),
43
- updated_at: z.number().optional(),
57
+ updated_at: z
58
+ .array(
59
+ z.object({
60
+ organization_id: z.string(),
61
+ timestamp: z.number(),
62
+ })
63
+ )
64
+ .optional(),
44
65
  });
45
66
 
46
67
  export const zodAgentSchema = z.object({
@@ -84,11 +105,9 @@ export const zodQuerySchema = z.object({
84
105
  });
85
106
 
86
107
  export type EventAttributeType = {
87
- event_attributes: {
88
- http_request: {
89
- client_ip: string;
90
- user_agent: string;
91
- };
108
+ http_request: {
109
+ client_ip?: string;
110
+ user_agent?: string;
92
111
  };
93
112
  };
94
113