retell-utils 0.1.0 → 0.3.2

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.
@@ -2,9 +2,12 @@ import { z } from "zod";
2
2
  /**
3
3
  * Creates a call analysis schema with a custom `custom_analysis_data` shape.
4
4
  * Available after post-call analysis completes.
5
+ *
6
+ * `call_summary` uses `.min(1).nullable().catch(null)` so empty strings become
7
+ * null and missing/invalid summaries are caught as null.
5
8
  */
6
9
  export declare function createCallAnalysisSchema<TAnalysis extends z.ZodType>(analysisData: TAnalysis): z.ZodObject<{
7
- call_summary: z.ZodOptional<z.ZodString>;
10
+ call_summary: z.ZodCatch<z.ZodNullable<z.ZodString>>;
8
11
  in_voicemail: z.ZodOptional<z.ZodBoolean>;
9
12
  user_sentiment: z.ZodOptional<z.ZodEnum<{
10
13
  Negative: "Negative";
@@ -13,14 +16,17 @@ export declare function createCallAnalysisSchema<TAnalysis extends z.ZodType>(an
13
16
  Unknown: "Unknown";
14
17
  }>>;
15
18
  call_successful: z.ZodOptional<z.ZodBoolean>;
16
- custom_analysis_data: z.ZodOptional<TAnalysis>;
19
+ custom_analysis_data: TAnalysis;
17
20
  }, z.core.$strip>;
18
21
  /**
19
22
  * Creates a chat analysis schema with a custom `custom_analysis_data` shape.
20
23
  * Available after post-chat analysis completes.
24
+ *
25
+ * `chat_summary` uses `.min(1).nullable().catch(null)` so empty strings become
26
+ * null and missing/invalid summaries are caught as null.
21
27
  */
22
28
  export declare function createChatAnalysisSchema<TAnalysis extends z.ZodType>(analysisData: TAnalysis): z.ZodObject<{
23
- chat_summary: z.ZodOptional<z.ZodString>;
29
+ chat_summary: z.ZodCatch<z.ZodNullable<z.ZodString>>;
24
30
  user_sentiment: z.ZodOptional<z.ZodEnum<{
25
31
  Negative: "Negative";
26
32
  Positive: "Positive";
@@ -28,6 +34,5 @@ export declare function createChatAnalysisSchema<TAnalysis extends z.ZodType>(an
28
34
  Unknown: "Unknown";
29
35
  }>>;
30
36
  chat_successful: z.ZodOptional<z.ZodBoolean>;
31
- custom_analysis_data: z.ZodOptional<TAnalysis>;
37
+ custom_analysis_data: TAnalysis;
32
38
  }, z.core.$strip>;
33
- //# sourceMappingURL=analysis.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { UserSentimentSchema } from "./enums.js";
3
+ /**
4
+ * Creates a call analysis schema with a custom `custom_analysis_data` shape.
5
+ * Available after post-call analysis completes.
6
+ *
7
+ * `call_summary` uses `.min(1).nullable().catch(null)` so empty strings become
8
+ * null and missing/invalid summaries are caught as null.
9
+ */
10
+ export function createCallAnalysisSchema(analysisData) {
11
+ return z.object({
12
+ call_summary: z.string().min(1).nullable().catch(null),
13
+ in_voicemail: z.boolean().optional(),
14
+ user_sentiment: UserSentimentSchema.optional(),
15
+ call_successful: z.boolean().optional(),
16
+ custom_analysis_data: analysisData,
17
+ });
18
+ }
19
+ /**
20
+ * Creates a chat analysis schema with a custom `custom_analysis_data` shape.
21
+ * Available after post-chat analysis completes.
22
+ *
23
+ * `chat_summary` uses `.min(1).nullable().catch(null)` so empty strings become
24
+ * null and missing/invalid summaries are caught as null.
25
+ */
26
+ export function createChatAnalysisSchema(analysisData) {
27
+ return z.object({
28
+ chat_summary: z.string().min(1).nullable().catch(null),
29
+ user_sentiment: UserSentimentSchema.optional(),
30
+ chat_successful: z.boolean().optional(),
31
+ custom_analysis_data: analysisData,
32
+ });
33
+ }
package/dist/call.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { z } from "zod";
2
2
  export interface CallSchemaConfig {
3
- /** Shape of the `metadata` object. Defaults to a loose (passthrough) object. */
3
+ /**
4
+ * Shape of the `metadata` object. Defaults to a loose (passthrough) object
5
+ * with `.prefault({})`.
6
+ */
4
7
  metadata: z.ZodType;
5
8
  /** Shape of the `retell_llm_dynamic_variables` object. */
6
9
  dynamicVariables: z.ZodType;
@@ -12,24 +15,37 @@ export interface CallSchemaConfig {
12
15
  /** Shape of `call_analysis.custom_analysis_data`. */
13
16
  analysisData: z.ZodType;
14
17
  }
15
- /** Sensible defaults for all configurable fields (loose passthrough objects). */
18
+ /**
19
+ * Sensible defaults for all configurable fields. Object fields use
20
+ * `.prefault({})` so they are always present (never undefined). Analysis data
21
+ * is `.optional()` since not all agents configure custom analysis.
22
+ */
16
23
  export declare const callSchemaDefaults: {
17
- metadata: z.ZodObject<{}, z.core.$loose>;
18
- dynamicVariables: z.ZodObject<{}, z.core.$loose>;
19
- collectedDynamicVariables: z.ZodObject<{}, z.core.$loose>;
20
- analysisData: z.ZodObject<{}, z.core.$loose>;
24
+ metadata: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
25
+ dynamicVariables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
26
+ collectedDynamicVariables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
27
+ analysisData: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
21
28
  };
22
29
  /**
23
30
  * Creates a set of lifecycle-aware call schemas with custom types for
24
31
  * `metadata`, `retell_llm_dynamic_variables`, `collected_dynamic_variables`,
25
32
  * and `call_analysis.custom_analysis_data`.
26
33
  *
34
+ * Timestamps are always coerced to `Date` objects. Resilience-sensitive fields
35
+ * use `.catch()` fallbacks so webhook parsing never fails on unexpected data.
36
+ * Generic config schemas are used as-is — the defaults provide `.prefault({})`
37
+ * for always-present object fields.
38
+ *
27
39
  * Spread `callSchemaDefaults` and override only what you need:
28
40
  *
29
41
  * ```ts
30
42
  * const schemas = createCallSchemas({
31
43
  * ...callSchemaDefaults,
32
- * metadata: z.object({ location_id: z.string() }),
44
+ * metadata: z
45
+ * .looseObject({
46
+ * location_id: z.string().nullable().default(null),
47
+ * })
48
+ * .prefault({}),
33
49
  * })
34
50
  * ```
35
51
  */
@@ -41,7 +57,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
41
57
  }): {
42
58
  base: z.ZodIntersection<z.ZodObject<{
43
59
  call_id: z.ZodString;
44
- agent_id: z.ZodString;
60
+ agent_id: z.ZodOptional<z.ZodString>;
45
61
  agent_name: z.ZodOptional<z.ZodString>;
46
62
  agent_version: z.ZodNumber;
47
63
  call_status: z.ZodEnum<{
@@ -51,9 +67,9 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
51
67
  ended: "ended";
52
68
  error: "error";
53
69
  }>;
54
- metadata: z.ZodOptional<TMeta>;
55
- retell_llm_dynamic_variables: z.ZodOptional<TDynVars>;
56
- collected_dynamic_variables: z.ZodOptional<TCollected>;
70
+ metadata: TMeta;
71
+ retell_llm_dynamic_variables: TDynVars;
72
+ collected_dynamic_variables: TCollected;
57
73
  custom_sip_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
58
74
  data_storage_setting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
59
75
  everything: "everything";
@@ -61,7 +77,8 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
61
77
  basic_attributes_only: "basic_attributes_only";
62
78
  }>>>;
63
79
  opt_in_signed_url: z.ZodOptional<z.ZodBoolean>;
64
- transcript_with_tool_calls: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
80
+ start_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
81
+ transcript_with_tool_calls: z.ZodPrefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
65
82
  content: z.ZodString;
66
83
  words: z.ZodOptional<z.ZodArray<z.ZodObject<{
67
84
  word: z.ZodString;
@@ -98,6 +115,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
98
115
  role: z.ZodLiteral<"tool_call_result">;
99
116
  tool_call_id: z.ZodString;
100
117
  content: z.ZodString;
118
+ successful: z.ZodOptional<z.ZodBoolean>;
101
119
  }, z.core.$strip>, z.ZodObject<{
102
120
  role: z.ZodLiteral<"node_transition">;
103
121
  former_node_id: z.ZodString;
@@ -112,7 +130,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
112
130
  }, z.core.$strip>], "role">>>;
113
131
  }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
114
132
  call_type: z.ZodLiteral<"phone_call">;
115
- from_number: z.ZodNullable<z.ZodString>;
133
+ from_number: z.ZodCatch<z.ZodNullable<z.ZodString>>;
116
134
  to_number: z.ZodString;
117
135
  direction: z.ZodEnum<{
118
136
  inbound: "inbound";
@@ -127,7 +145,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
127
145
  }, z.core.$strip>], "call_type">>;
128
146
  ended: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
129
147
  call_id: z.ZodString;
130
- agent_id: z.ZodString;
148
+ agent_id: z.ZodOptional<z.ZodString>;
131
149
  agent_name: z.ZodOptional<z.ZodString>;
132
150
  agent_version: z.ZodNumber;
133
151
  call_status: z.ZodEnum<{
@@ -137,9 +155,9 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
137
155
  ended: "ended";
138
156
  error: "error";
139
157
  }>;
140
- metadata: z.ZodOptional<TMeta>;
141
- retell_llm_dynamic_variables: z.ZodOptional<TDynVars>;
142
- collected_dynamic_variables: z.ZodOptional<TCollected>;
158
+ metadata: TMeta;
159
+ retell_llm_dynamic_variables: TDynVars;
160
+ collected_dynamic_variables: TCollected;
143
161
  custom_sip_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
144
162
  data_storage_setting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
145
163
  everything: "everything";
@@ -147,7 +165,8 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
147
165
  basic_attributes_only: "basic_attributes_only";
148
166
  }>>>;
149
167
  opt_in_signed_url: z.ZodOptional<z.ZodBoolean>;
150
- transcript_with_tool_calls: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
168
+ start_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
169
+ transcript_with_tool_calls: z.ZodPrefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
151
170
  content: z.ZodString;
152
171
  words: z.ZodOptional<z.ZodArray<z.ZodObject<{
153
172
  word: z.ZodString;
@@ -184,6 +203,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
184
203
  role: z.ZodLiteral<"tool_call_result">;
185
204
  tool_call_id: z.ZodString;
186
205
  content: z.ZodString;
206
+ successful: z.ZodOptional<z.ZodBoolean>;
187
207
  }, z.core.$strip>, z.ZodObject<{
188
208
  role: z.ZodLiteral<"node_transition">;
189
209
  former_node_id: z.ZodString;
@@ -198,7 +218,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
198
218
  }, z.core.$strip>], "role">>>;
199
219
  }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
200
220
  call_type: z.ZodLiteral<"phone_call">;
201
- from_number: z.ZodNullable<z.ZodString>;
221
+ from_number: z.ZodCatch<z.ZodNullable<z.ZodString>>;
202
222
  to_number: z.ZodString;
203
223
  direction: z.ZodEnum<{
204
224
  inbound: "inbound";
@@ -211,10 +231,9 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
211
231
  call_type: z.ZodLiteral<"web_call">;
212
232
  access_token: z.ZodString;
213
233
  }, z.core.$strip>], "call_type">>, z.ZodObject<{
214
- start_timestamp: z.ZodNumber;
215
- end_timestamp: z.ZodNumber;
216
- duration_ms: z.ZodNumber;
217
- disconnection_reason: z.ZodEnum<{
234
+ end_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
235
+ duration_ms: z.ZodCatch<z.ZodNumber>;
236
+ disconnection_reason: z.ZodCatch<z.ZodEnum<{
218
237
  user_hangup: "user_hangup";
219
238
  agent_hangup: "agent_hangup";
220
239
  call_transfer: "call_transfer";
@@ -243,7 +262,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
243
262
  error_unknown: "error_unknown";
244
263
  error_user_not_joined: "error_user_not_joined";
245
264
  registered_call_timeout: "registered_call_timeout";
246
- }>;
265
+ }>>;
247
266
  transcript: z.ZodOptional<z.ZodString>;
248
267
  transcript_object: z.ZodOptional<z.ZodArray<z.ZodObject<{
249
268
  role: z.ZodEnum<{
@@ -296,6 +315,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
296
315
  role: z.ZodLiteral<"tool_call_result">;
297
316
  tool_call_id: z.ZodString;
298
317
  content: z.ZodString;
318
+ successful: z.ZodOptional<z.ZodBoolean>;
299
319
  }, z.core.$strip>, z.ZodObject<{
300
320
  role: z.ZodLiteral<"node_transition">;
301
321
  former_node_id: z.ZodString;
@@ -308,13 +328,14 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
308
328
  role: z.ZodLiteral<"dtmf">;
309
329
  digit: z.ZodString;
310
330
  }, z.core.$strip>], "role">>>;
311
- recording_url: z.ZodOptional<z.ZodString>;
331
+ recording_url: z.ZodCatch<z.ZodNullable<z.ZodURL>>;
312
332
  recording_multi_channel_url: z.ZodOptional<z.ZodString>;
313
333
  scrubbed_recording_url: z.ZodOptional<z.ZodString>;
314
334
  scrubbed_recording_multi_channel_url: z.ZodOptional<z.ZodString>;
315
335
  public_log_url: z.ZodOptional<z.ZodString>;
316
336
  knowledge_base_retrieved_contents_url: z.ZodOptional<z.ZodString>;
317
337
  transfer_destination: z.ZodOptional<z.ZodNullable<z.ZodString>>;
338
+ transfer_end_timestamp: z.ZodOptional<z.ZodCoercedDate<unknown>>;
318
339
  latency: z.ZodOptional<z.ZodObject<{
319
340
  e2e: z.ZodOptional<z.ZodObject<{
320
341
  p50: z.ZodNumber;
@@ -405,7 +426,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
405
426
  }, z.core.$strip>>;
406
427
  analyzed: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
407
428
  call_id: z.ZodString;
408
- agent_id: z.ZodString;
429
+ agent_id: z.ZodOptional<z.ZodString>;
409
430
  agent_name: z.ZodOptional<z.ZodString>;
410
431
  agent_version: z.ZodNumber;
411
432
  call_status: z.ZodEnum<{
@@ -415,9 +436,9 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
415
436
  ended: "ended";
416
437
  error: "error";
417
438
  }>;
418
- metadata: z.ZodOptional<TMeta>;
419
- retell_llm_dynamic_variables: z.ZodOptional<TDynVars>;
420
- collected_dynamic_variables: z.ZodOptional<TCollected>;
439
+ metadata: TMeta;
440
+ retell_llm_dynamic_variables: TDynVars;
441
+ collected_dynamic_variables: TCollected;
421
442
  custom_sip_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
422
443
  data_storage_setting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
423
444
  everything: "everything";
@@ -425,7 +446,8 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
425
446
  basic_attributes_only: "basic_attributes_only";
426
447
  }>>>;
427
448
  opt_in_signed_url: z.ZodOptional<z.ZodBoolean>;
428
- transcript_with_tool_calls: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
449
+ start_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
450
+ transcript_with_tool_calls: z.ZodPrefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
429
451
  content: z.ZodString;
430
452
  words: z.ZodOptional<z.ZodArray<z.ZodObject<{
431
453
  word: z.ZodString;
@@ -462,6 +484,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
462
484
  role: z.ZodLiteral<"tool_call_result">;
463
485
  tool_call_id: z.ZodString;
464
486
  content: z.ZodString;
487
+ successful: z.ZodOptional<z.ZodBoolean>;
465
488
  }, z.core.$strip>, z.ZodObject<{
466
489
  role: z.ZodLiteral<"node_transition">;
467
490
  former_node_id: z.ZodString;
@@ -476,7 +499,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
476
499
  }, z.core.$strip>], "role">>>;
477
500
  }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
478
501
  call_type: z.ZodLiteral<"phone_call">;
479
- from_number: z.ZodNullable<z.ZodString>;
502
+ from_number: z.ZodCatch<z.ZodNullable<z.ZodString>>;
480
503
  to_number: z.ZodString;
481
504
  direction: z.ZodEnum<{
482
505
  inbound: "inbound";
@@ -489,10 +512,9 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
489
512
  call_type: z.ZodLiteral<"web_call">;
490
513
  access_token: z.ZodString;
491
514
  }, z.core.$strip>], "call_type">>, z.ZodObject<{
492
- start_timestamp: z.ZodNumber;
493
- end_timestamp: z.ZodNumber;
494
- duration_ms: z.ZodNumber;
495
- disconnection_reason: z.ZodEnum<{
515
+ end_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
516
+ duration_ms: z.ZodCatch<z.ZodNumber>;
517
+ disconnection_reason: z.ZodCatch<z.ZodEnum<{
496
518
  user_hangup: "user_hangup";
497
519
  agent_hangup: "agent_hangup";
498
520
  call_transfer: "call_transfer";
@@ -521,7 +543,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
521
543
  error_unknown: "error_unknown";
522
544
  error_user_not_joined: "error_user_not_joined";
523
545
  registered_call_timeout: "registered_call_timeout";
524
- }>;
546
+ }>>;
525
547
  transcript: z.ZodOptional<z.ZodString>;
526
548
  transcript_object: z.ZodOptional<z.ZodArray<z.ZodObject<{
527
549
  role: z.ZodEnum<{
@@ -574,6 +596,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
574
596
  role: z.ZodLiteral<"tool_call_result">;
575
597
  tool_call_id: z.ZodString;
576
598
  content: z.ZodString;
599
+ successful: z.ZodOptional<z.ZodBoolean>;
577
600
  }, z.core.$strip>, z.ZodObject<{
578
601
  role: z.ZodLiteral<"node_transition">;
579
602
  former_node_id: z.ZodString;
@@ -586,13 +609,14 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
586
609
  role: z.ZodLiteral<"dtmf">;
587
610
  digit: z.ZodString;
588
611
  }, z.core.$strip>], "role">>>;
589
- recording_url: z.ZodOptional<z.ZodString>;
612
+ recording_url: z.ZodCatch<z.ZodNullable<z.ZodURL>>;
590
613
  recording_multi_channel_url: z.ZodOptional<z.ZodString>;
591
614
  scrubbed_recording_url: z.ZodOptional<z.ZodString>;
592
615
  scrubbed_recording_multi_channel_url: z.ZodOptional<z.ZodString>;
593
616
  public_log_url: z.ZodOptional<z.ZodString>;
594
617
  knowledge_base_retrieved_contents_url: z.ZodOptional<z.ZodString>;
595
618
  transfer_destination: z.ZodOptional<z.ZodNullable<z.ZodString>>;
619
+ transfer_end_timestamp: z.ZodOptional<z.ZodCoercedDate<unknown>>;
596
620
  latency: z.ZodOptional<z.ZodObject<{
597
621
  e2e: z.ZodOptional<z.ZodObject<{
598
622
  p50: z.ZodNumber;
@@ -682,7 +706,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
682
706
  }, z.core.$strip>>;
683
707
  }, z.core.$strip>>, z.ZodObject<{
684
708
  call_analysis: z.ZodObject<{
685
- call_summary: z.ZodOptional<z.ZodString>;
709
+ call_summary: z.ZodCatch<z.ZodNullable<z.ZodString>>;
686
710
  in_voicemail: z.ZodOptional<z.ZodBoolean>;
687
711
  user_sentiment: z.ZodOptional<z.ZodEnum<{
688
712
  Negative: "Negative";
@@ -691,7 +715,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
691
715
  Unknown: "Unknown";
692
716
  }>>;
693
717
  call_successful: z.ZodOptional<z.ZodBoolean>;
694
- custom_analysis_data: z.ZodOptional<TAnalysis>;
718
+ custom_analysis_data: TAnalysis;
695
719
  }, z.core.$strip>;
696
720
  }, z.core.$strip>>;
697
721
  };
@@ -699,7 +723,7 @@ export declare function createCallSchemas<TMeta extends z.ZodType, TDynVars exte
699
723
  export declare const CallSchemas: {
700
724
  base: z.ZodIntersection<z.ZodObject<{
701
725
  call_id: z.ZodString;
702
- agent_id: z.ZodString;
726
+ agent_id: z.ZodOptional<z.ZodString>;
703
727
  agent_name: z.ZodOptional<z.ZodString>;
704
728
  agent_version: z.ZodNumber;
705
729
  call_status: z.ZodEnum<{
@@ -709,9 +733,9 @@ export declare const CallSchemas: {
709
733
  ended: "ended";
710
734
  error: "error";
711
735
  }>;
712
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
713
- retell_llm_dynamic_variables: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
714
- collected_dynamic_variables: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
736
+ metadata: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
737
+ retell_llm_dynamic_variables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
738
+ collected_dynamic_variables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
715
739
  custom_sip_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
716
740
  data_storage_setting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
717
741
  everything: "everything";
@@ -719,7 +743,8 @@ export declare const CallSchemas: {
719
743
  basic_attributes_only: "basic_attributes_only";
720
744
  }>>>;
721
745
  opt_in_signed_url: z.ZodOptional<z.ZodBoolean>;
722
- transcript_with_tool_calls: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
746
+ start_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
747
+ transcript_with_tool_calls: z.ZodPrefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
723
748
  content: z.ZodString;
724
749
  words: z.ZodOptional<z.ZodArray<z.ZodObject<{
725
750
  word: z.ZodString;
@@ -756,6 +781,7 @@ export declare const CallSchemas: {
756
781
  role: z.ZodLiteral<"tool_call_result">;
757
782
  tool_call_id: z.ZodString;
758
783
  content: z.ZodString;
784
+ successful: z.ZodOptional<z.ZodBoolean>;
759
785
  }, z.core.$strip>, z.ZodObject<{
760
786
  role: z.ZodLiteral<"node_transition">;
761
787
  former_node_id: z.ZodString;
@@ -770,7 +796,7 @@ export declare const CallSchemas: {
770
796
  }, z.core.$strip>], "role">>>;
771
797
  }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
772
798
  call_type: z.ZodLiteral<"phone_call">;
773
- from_number: z.ZodNullable<z.ZodString>;
799
+ from_number: z.ZodCatch<z.ZodNullable<z.ZodString>>;
774
800
  to_number: z.ZodString;
775
801
  direction: z.ZodEnum<{
776
802
  inbound: "inbound";
@@ -785,7 +811,7 @@ export declare const CallSchemas: {
785
811
  }, z.core.$strip>], "call_type">>;
786
812
  ended: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
787
813
  call_id: z.ZodString;
788
- agent_id: z.ZodString;
814
+ agent_id: z.ZodOptional<z.ZodString>;
789
815
  agent_name: z.ZodOptional<z.ZodString>;
790
816
  agent_version: z.ZodNumber;
791
817
  call_status: z.ZodEnum<{
@@ -795,9 +821,9 @@ export declare const CallSchemas: {
795
821
  ended: "ended";
796
822
  error: "error";
797
823
  }>;
798
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
799
- retell_llm_dynamic_variables: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
800
- collected_dynamic_variables: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
824
+ metadata: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
825
+ retell_llm_dynamic_variables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
826
+ collected_dynamic_variables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
801
827
  custom_sip_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
802
828
  data_storage_setting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
803
829
  everything: "everything";
@@ -805,7 +831,8 @@ export declare const CallSchemas: {
805
831
  basic_attributes_only: "basic_attributes_only";
806
832
  }>>>;
807
833
  opt_in_signed_url: z.ZodOptional<z.ZodBoolean>;
808
- transcript_with_tool_calls: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
834
+ start_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
835
+ transcript_with_tool_calls: z.ZodPrefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
809
836
  content: z.ZodString;
810
837
  words: z.ZodOptional<z.ZodArray<z.ZodObject<{
811
838
  word: z.ZodString;
@@ -842,6 +869,7 @@ export declare const CallSchemas: {
842
869
  role: z.ZodLiteral<"tool_call_result">;
843
870
  tool_call_id: z.ZodString;
844
871
  content: z.ZodString;
872
+ successful: z.ZodOptional<z.ZodBoolean>;
845
873
  }, z.core.$strip>, z.ZodObject<{
846
874
  role: z.ZodLiteral<"node_transition">;
847
875
  former_node_id: z.ZodString;
@@ -856,7 +884,7 @@ export declare const CallSchemas: {
856
884
  }, z.core.$strip>], "role">>>;
857
885
  }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
858
886
  call_type: z.ZodLiteral<"phone_call">;
859
- from_number: z.ZodNullable<z.ZodString>;
887
+ from_number: z.ZodCatch<z.ZodNullable<z.ZodString>>;
860
888
  to_number: z.ZodString;
861
889
  direction: z.ZodEnum<{
862
890
  inbound: "inbound";
@@ -869,10 +897,9 @@ export declare const CallSchemas: {
869
897
  call_type: z.ZodLiteral<"web_call">;
870
898
  access_token: z.ZodString;
871
899
  }, z.core.$strip>], "call_type">>, z.ZodObject<{
872
- start_timestamp: z.ZodNumber;
873
- end_timestamp: z.ZodNumber;
874
- duration_ms: z.ZodNumber;
875
- disconnection_reason: z.ZodEnum<{
900
+ end_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
901
+ duration_ms: z.ZodCatch<z.ZodNumber>;
902
+ disconnection_reason: z.ZodCatch<z.ZodEnum<{
876
903
  user_hangup: "user_hangup";
877
904
  agent_hangup: "agent_hangup";
878
905
  call_transfer: "call_transfer";
@@ -901,7 +928,7 @@ export declare const CallSchemas: {
901
928
  error_unknown: "error_unknown";
902
929
  error_user_not_joined: "error_user_not_joined";
903
930
  registered_call_timeout: "registered_call_timeout";
904
- }>;
931
+ }>>;
905
932
  transcript: z.ZodOptional<z.ZodString>;
906
933
  transcript_object: z.ZodOptional<z.ZodArray<z.ZodObject<{
907
934
  role: z.ZodEnum<{
@@ -954,6 +981,7 @@ export declare const CallSchemas: {
954
981
  role: z.ZodLiteral<"tool_call_result">;
955
982
  tool_call_id: z.ZodString;
956
983
  content: z.ZodString;
984
+ successful: z.ZodOptional<z.ZodBoolean>;
957
985
  }, z.core.$strip>, z.ZodObject<{
958
986
  role: z.ZodLiteral<"node_transition">;
959
987
  former_node_id: z.ZodString;
@@ -966,13 +994,14 @@ export declare const CallSchemas: {
966
994
  role: z.ZodLiteral<"dtmf">;
967
995
  digit: z.ZodString;
968
996
  }, z.core.$strip>], "role">>>;
969
- recording_url: z.ZodOptional<z.ZodString>;
997
+ recording_url: z.ZodCatch<z.ZodNullable<z.ZodURL>>;
970
998
  recording_multi_channel_url: z.ZodOptional<z.ZodString>;
971
999
  scrubbed_recording_url: z.ZodOptional<z.ZodString>;
972
1000
  scrubbed_recording_multi_channel_url: z.ZodOptional<z.ZodString>;
973
1001
  public_log_url: z.ZodOptional<z.ZodString>;
974
1002
  knowledge_base_retrieved_contents_url: z.ZodOptional<z.ZodString>;
975
1003
  transfer_destination: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1004
+ transfer_end_timestamp: z.ZodOptional<z.ZodCoercedDate<unknown>>;
976
1005
  latency: z.ZodOptional<z.ZodObject<{
977
1006
  e2e: z.ZodOptional<z.ZodObject<{
978
1007
  p50: z.ZodNumber;
@@ -1063,7 +1092,7 @@ export declare const CallSchemas: {
1063
1092
  }, z.core.$strip>>;
1064
1093
  analyzed: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
1065
1094
  call_id: z.ZodString;
1066
- agent_id: z.ZodString;
1095
+ agent_id: z.ZodOptional<z.ZodString>;
1067
1096
  agent_name: z.ZodOptional<z.ZodString>;
1068
1097
  agent_version: z.ZodNumber;
1069
1098
  call_status: z.ZodEnum<{
@@ -1073,9 +1102,9 @@ export declare const CallSchemas: {
1073
1102
  ended: "ended";
1074
1103
  error: "error";
1075
1104
  }>;
1076
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1077
- retell_llm_dynamic_variables: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1078
- collected_dynamic_variables: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1105
+ metadata: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
1106
+ retell_llm_dynamic_variables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
1107
+ collected_dynamic_variables: z.ZodPrefault<z.ZodObject<{}, z.core.$loose>>;
1079
1108
  custom_sip_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1080
1109
  data_storage_setting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1081
1110
  everything: "everything";
@@ -1083,7 +1112,8 @@ export declare const CallSchemas: {
1083
1112
  basic_attributes_only: "basic_attributes_only";
1084
1113
  }>>>;
1085
1114
  opt_in_signed_url: z.ZodOptional<z.ZodBoolean>;
1086
- transcript_with_tool_calls: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1115
+ start_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
1116
+ transcript_with_tool_calls: z.ZodPrefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1087
1117
  content: z.ZodString;
1088
1118
  words: z.ZodOptional<z.ZodArray<z.ZodObject<{
1089
1119
  word: z.ZodString;
@@ -1120,6 +1150,7 @@ export declare const CallSchemas: {
1120
1150
  role: z.ZodLiteral<"tool_call_result">;
1121
1151
  tool_call_id: z.ZodString;
1122
1152
  content: z.ZodString;
1153
+ successful: z.ZodOptional<z.ZodBoolean>;
1123
1154
  }, z.core.$strip>, z.ZodObject<{
1124
1155
  role: z.ZodLiteral<"node_transition">;
1125
1156
  former_node_id: z.ZodString;
@@ -1134,7 +1165,7 @@ export declare const CallSchemas: {
1134
1165
  }, z.core.$strip>], "role">>>;
1135
1166
  }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1136
1167
  call_type: z.ZodLiteral<"phone_call">;
1137
- from_number: z.ZodNullable<z.ZodString>;
1168
+ from_number: z.ZodCatch<z.ZodNullable<z.ZodString>>;
1138
1169
  to_number: z.ZodString;
1139
1170
  direction: z.ZodEnum<{
1140
1171
  inbound: "inbound";
@@ -1147,10 +1178,9 @@ export declare const CallSchemas: {
1147
1178
  call_type: z.ZodLiteral<"web_call">;
1148
1179
  access_token: z.ZodString;
1149
1180
  }, z.core.$strip>], "call_type">>, z.ZodObject<{
1150
- start_timestamp: z.ZodNumber;
1151
- end_timestamp: z.ZodNumber;
1152
- duration_ms: z.ZodNumber;
1153
- disconnection_reason: z.ZodEnum<{
1181
+ end_timestamp: z.ZodCatch<z.ZodCoercedDate<unknown>>;
1182
+ duration_ms: z.ZodCatch<z.ZodNumber>;
1183
+ disconnection_reason: z.ZodCatch<z.ZodEnum<{
1154
1184
  user_hangup: "user_hangup";
1155
1185
  agent_hangup: "agent_hangup";
1156
1186
  call_transfer: "call_transfer";
@@ -1179,7 +1209,7 @@ export declare const CallSchemas: {
1179
1209
  error_unknown: "error_unknown";
1180
1210
  error_user_not_joined: "error_user_not_joined";
1181
1211
  registered_call_timeout: "registered_call_timeout";
1182
- }>;
1212
+ }>>;
1183
1213
  transcript: z.ZodOptional<z.ZodString>;
1184
1214
  transcript_object: z.ZodOptional<z.ZodArray<z.ZodObject<{
1185
1215
  role: z.ZodEnum<{
@@ -1232,6 +1262,7 @@ export declare const CallSchemas: {
1232
1262
  role: z.ZodLiteral<"tool_call_result">;
1233
1263
  tool_call_id: z.ZodString;
1234
1264
  content: z.ZodString;
1265
+ successful: z.ZodOptional<z.ZodBoolean>;
1235
1266
  }, z.core.$strip>, z.ZodObject<{
1236
1267
  role: z.ZodLiteral<"node_transition">;
1237
1268
  former_node_id: z.ZodString;
@@ -1244,13 +1275,14 @@ export declare const CallSchemas: {
1244
1275
  role: z.ZodLiteral<"dtmf">;
1245
1276
  digit: z.ZodString;
1246
1277
  }, z.core.$strip>], "role">>>;
1247
- recording_url: z.ZodOptional<z.ZodString>;
1278
+ recording_url: z.ZodCatch<z.ZodNullable<z.ZodURL>>;
1248
1279
  recording_multi_channel_url: z.ZodOptional<z.ZodString>;
1249
1280
  scrubbed_recording_url: z.ZodOptional<z.ZodString>;
1250
1281
  scrubbed_recording_multi_channel_url: z.ZodOptional<z.ZodString>;
1251
1282
  public_log_url: z.ZodOptional<z.ZodString>;
1252
1283
  knowledge_base_retrieved_contents_url: z.ZodOptional<z.ZodString>;
1253
1284
  transfer_destination: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1285
+ transfer_end_timestamp: z.ZodOptional<z.ZodCoercedDate<unknown>>;
1254
1286
  latency: z.ZodOptional<z.ZodObject<{
1255
1287
  e2e: z.ZodOptional<z.ZodObject<{
1256
1288
  p50: z.ZodNumber;
@@ -1340,7 +1372,7 @@ export declare const CallSchemas: {
1340
1372
  }, z.core.$strip>>;
1341
1373
  }, z.core.$strip>>, z.ZodObject<{
1342
1374
  call_analysis: z.ZodObject<{
1343
- call_summary: z.ZodOptional<z.ZodString>;
1375
+ call_summary: z.ZodCatch<z.ZodNullable<z.ZodString>>;
1344
1376
  in_voicemail: z.ZodOptional<z.ZodBoolean>;
1345
1377
  user_sentiment: z.ZodOptional<z.ZodEnum<{
1346
1378
  Negative: "Negative";
@@ -1353,4 +1385,3 @@ export declare const CallSchemas: {
1353
1385
  }, z.core.$strip>;
1354
1386
  }, z.core.$strip>>;
1355
1387
  };
1356
- //# sourceMappingURL=call.d.ts.map