@tellescope/sdk 2.0.0-beta.2 → 2.0.0-beta.3

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.
Files changed (717) hide show
  1. package/lib/cjs/sdk.d.ts +6 -5
  2. package/lib/cjs/sdk.d.ts.map +1 -1
  3. package/lib/cjs/sdk.js +5 -0
  4. package/lib/cjs/sdk.js.map +1 -1
  5. package/lib/cjs/tests/api_tests/ai_conversations.test.d.ts +14 -5
  6. package/lib/cjs/tests/api_tests/ai_conversations.test.d.ts.map +1 -1
  7. package/lib/cjs/tests/api_tests/ai_conversations.test.js +163 -149
  8. package/lib/cjs/tests/api_tests/ai_conversations.test.js.map +1 -1
  9. package/lib/cjs/tests/api_tests/ai_conversations_agent_message.test.d.ts +22 -0
  10. package/lib/cjs/tests/api_tests/ai_conversations_agent_message.test.d.ts.map +1 -0
  11. package/lib/cjs/tests/api_tests/ai_conversations_agent_message.test.js +518 -0
  12. package/lib/cjs/tests/api_tests/ai_conversations_agent_message.test.js.map +1 -0
  13. package/lib/cjs/tests/api_tests/appointment_link_expiration.test.d.ts +6 -5
  14. package/lib/cjs/tests/api_tests/appointment_link_expiration.test.d.ts.map +1 -1
  15. package/lib/cjs/tests/api_tests/appointment_link_expiration.test.js +135 -73
  16. package/lib/cjs/tests/api_tests/appointment_link_expiration.test.js.map +1 -1
  17. package/lib/cjs/tests/api_tests/appointment_no_showed_trigger.test.d.ts +6 -5
  18. package/lib/cjs/tests/api_tests/appointment_no_showed_trigger.test.d.ts.map +1 -1
  19. package/lib/cjs/tests/api_tests/appointment_no_showed_trigger.test.js +240 -174
  20. package/lib/cjs/tests/api_tests/appointment_no_showed_trigger.test.js.map +1 -1
  21. package/lib/cjs/tests/api_tests/availability_block_buffer.test.d.ts +22 -0
  22. package/lib/cjs/tests/api_tests/availability_block_buffer.test.d.ts.map +1 -0
  23. package/lib/cjs/tests/api_tests/availability_block_buffer.test.js +311 -0
  24. package/lib/cjs/tests/api_tests/availability_block_buffer.test.js.map +1 -0
  25. package/lib/cjs/tests/api_tests/beluga_manual_sync.test.d.ts +6 -5
  26. package/lib/cjs/tests/api_tests/beluga_manual_sync.test.d.ts.map +1 -1
  27. package/lib/cjs/tests/api_tests/beluga_manual_sync.test.js +235 -192
  28. package/lib/cjs/tests/api_tests/beluga_manual_sync.test.js.map +1 -1
  29. package/lib/cjs/tests/api_tests/beluga_trigger_refill.test.d.ts +6 -5
  30. package/lib/cjs/tests/api_tests/beluga_trigger_refill.test.d.ts.map +1 -1
  31. package/lib/cjs/tests/api_tests/beluga_trigger_refill.test.js +351 -264
  32. package/lib/cjs/tests/api_tests/beluga_trigger_refill.test.js.map +1 -1
  33. package/lib/cjs/tests/api_tests/bulk_assignment.test.d.ts +16 -5
  34. package/lib/cjs/tests/api_tests/bulk_assignment.test.d.ts.map +1 -1
  35. package/lib/cjs/tests/api_tests/bulk_assignment.test.js +336 -243
  36. package/lib/cjs/tests/api_tests/bulk_assignment.test.js.map +1 -1
  37. package/lib/cjs/tests/api_tests/calendar_event_references_update.test.d.ts +13 -5
  38. package/lib/cjs/tests/api_tests/calendar_event_references_update.test.d.ts.map +1 -1
  39. package/lib/cjs/tests/api_tests/calendar_event_references_update.test.js +131 -108
  40. package/lib/cjs/tests/api_tests/calendar_event_references_update.test.js.map +1 -1
  41. package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.d.ts +15 -5
  42. package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.d.ts.map +1 -1
  43. package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.js +240 -252
  44. package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.js.map +1 -1
  45. package/lib/cjs/tests/api_tests/chats_analytics.test.d.ts +14 -5
  46. package/lib/cjs/tests/api_tests/chats_analytics.test.d.ts.map +1 -1
  47. package/lib/cjs/tests/api_tests/chats_analytics.test.js +190 -189
  48. package/lib/cjs/tests/api_tests/chats_analytics.test.js.map +1 -1
  49. package/lib/cjs/tests/api_tests/concurrent_build_threads.test.d.ts +23 -5
  50. package/lib/cjs/tests/api_tests/concurrent_build_threads.test.d.ts.map +1 -1
  51. package/lib/cjs/tests/api_tests/concurrent_build_threads.test.js +121 -118
  52. package/lib/cjs/tests/api_tests/concurrent_build_threads.test.js.map +1 -1
  53. package/lib/cjs/tests/api_tests/configurations_public_read.test.d.ts +21 -5
  54. package/lib/cjs/tests/api_tests/configurations_public_read.test.d.ts.map +1 -1
  55. package/lib/cjs/tests/api_tests/configurations_public_read.test.js +235 -119
  56. package/lib/cjs/tests/api_tests/configurations_public_read.test.js.map +1 -1
  57. package/lib/cjs/tests/api_tests/copied_form_response_no_enduser_sync.test.d.ts +7 -0
  58. package/lib/cjs/tests/api_tests/copied_form_response_no_enduser_sync.test.d.ts.map +1 -0
  59. package/lib/cjs/tests/api_tests/copied_form_response_no_enduser_sync.test.js +356 -0
  60. package/lib/cjs/tests/api_tests/copied_form_response_no_enduser_sync.test.js.map +1 -0
  61. package/lib/cjs/tests/api_tests/create_note_action.test.d.ts +18 -5
  62. package/lib/cjs/tests/api_tests/create_note_action.test.d.ts.map +1 -1
  63. package/lib/cjs/tests/api_tests/create_note_action.test.js +218 -173
  64. package/lib/cjs/tests/api_tests/create_note_action.test.js.map +1 -1
  65. package/lib/cjs/tests/api_tests/create_user_notifications_trigger.test.d.ts +17 -4
  66. package/lib/cjs/tests/api_tests/create_user_notifications_trigger.test.d.ts.map +1 -1
  67. package/lib/cjs/tests/api_tests/create_user_notifications_trigger.test.js +144 -205
  68. package/lib/cjs/tests/api_tests/create_user_notifications_trigger.test.js.map +1 -1
  69. package/lib/cjs/tests/api_tests/custom_aggregation.test.d.ts +15 -5
  70. package/lib/cjs/tests/api_tests/custom_aggregation.test.d.ts.map +1 -1
  71. package/lib/cjs/tests/api_tests/custom_aggregation.test.js +284 -223
  72. package/lib/cjs/tests/api_tests/custom_aggregation.test.js.map +1 -1
  73. package/lib/cjs/tests/api_tests/database_cascade_delete.test.d.ts +13 -5
  74. package/lib/cjs/tests/api_tests/database_cascade_delete.test.d.ts.map +1 -1
  75. package/lib/cjs/tests/api_tests/database_cascade_delete.test.js +218 -242
  76. package/lib/cjs/tests/api_tests/database_cascade_delete.test.js.map +1 -1
  77. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts +21 -5
  78. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts.map +1 -1
  79. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.js +168 -112
  80. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.js.map +1 -1
  81. package/lib/cjs/tests/api_tests/elation_user_id.test.d.ts +17 -5
  82. package/lib/cjs/tests/api_tests/elation_user_id.test.d.ts.map +1 -1
  83. package/lib/cjs/tests/api_tests/elation_user_id.test.js +121 -54
  84. package/lib/cjs/tests/api_tests/elation_user_id.test.js.map +1 -1
  85. package/lib/cjs/tests/api_tests/file_download_unicode_names.test.d.ts +6 -5
  86. package/lib/cjs/tests/api_tests/file_download_unicode_names.test.d.ts.map +1 -1
  87. package/lib/cjs/tests/api_tests/file_download_unicode_names.test.js +193 -143
  88. package/lib/cjs/tests/api_tests/file_download_unicode_names.test.js.map +1 -1
  89. package/lib/cjs/tests/api_tests/form_intake_email_normalization.test.d.ts +7 -0
  90. package/lib/cjs/tests/api_tests/form_intake_email_normalization.test.d.ts.map +1 -0
  91. package/lib/cjs/tests/api_tests/form_intake_email_normalization.test.js +532 -0
  92. package/lib/cjs/tests/api_tests/form_intake_email_normalization.test.js.map +1 -0
  93. package/lib/cjs/tests/api_tests/form_submitted_trigger.test.d.ts +25 -5
  94. package/lib/cjs/tests/api_tests/form_submitted_trigger.test.d.ts.map +1 -1
  95. package/lib/cjs/tests/api_tests/form_submitted_trigger.test.js +395 -366
  96. package/lib/cjs/tests/api_tests/form_submitted_trigger.test.js.map +1 -1
  97. package/lib/cjs/tests/api_tests/form_translations.test.d.ts +6 -5
  98. package/lib/cjs/tests/api_tests/form_translations.test.d.ts.map +1 -1
  99. package/lib/cjs/tests/api_tests/form_translations.test.js +269 -189
  100. package/lib/cjs/tests/api_tests/form_translations.test.js.map +1 -1
  101. package/lib/cjs/tests/api_tests/formsort_header_auth.test.d.ts +29 -5
  102. package/lib/cjs/tests/api_tests/formsort_header_auth.test.d.ts.map +1 -1
  103. package/lib/cjs/tests/api_tests/formsort_header_auth.test.js +179 -162
  104. package/lib/cjs/tests/api_tests/formsort_header_auth.test.js.map +1 -1
  105. package/lib/cjs/tests/api_tests/gcal_sync_retry.test.d.ts +12 -6
  106. package/lib/cjs/tests/api_tests/gcal_sync_retry.test.d.ts.map +1 -1
  107. package/lib/cjs/tests/api_tests/gcal_sync_retry.test.js +98 -84
  108. package/lib/cjs/tests/api_tests/gcal_sync_retry.test.js.map +1 -1
  109. package/lib/cjs/tests/api_tests/get_some_projection.test.d.ts +20 -5
  110. package/lib/cjs/tests/api_tests/get_some_projection.test.d.ts.map +1 -1
  111. package/lib/cjs/tests/api_tests/get_some_projection.test.js +342 -298
  112. package/lib/cjs/tests/api_tests/get_some_projection.test.js.map +1 -1
  113. package/lib/cjs/tests/api_tests/group_event_attendee_self_update.test.d.ts +6 -5
  114. package/lib/cjs/tests/api_tests/group_event_attendee_self_update.test.d.ts.map +1 -1
  115. package/lib/cjs/tests/api_tests/group_event_attendee_self_update.test.js +294 -223
  116. package/lib/cjs/tests/api_tests/group_event_attendee_self_update.test.js.map +1 -1
  117. package/lib/cjs/tests/api_tests/integrations_redacted.test.d.ts +6 -5
  118. package/lib/cjs/tests/api_tests/integrations_redacted.test.d.ts.map +1 -1
  119. package/lib/cjs/tests/api_tests/integrations_redacted.test.js +307 -213
  120. package/lib/cjs/tests/api_tests/integrations_redacted.test.js.map +1 -1
  121. package/lib/cjs/tests/api_tests/journey_delete_cancels_actions.test.d.ts +6 -5
  122. package/lib/cjs/tests/api_tests/journey_delete_cancels_actions.test.d.ts.map +1 -1
  123. package/lib/cjs/tests/api_tests/journey_delete_cancels_actions.test.js +179 -178
  124. package/lib/cjs/tests/api_tests/journey_delete_cancels_actions.test.js.map +1 -1
  125. package/lib/cjs/tests/api_tests/load_team_chat.test.d.ts.map +1 -1
  126. package/lib/cjs/tests/api_tests/load_team_chat.test.js +181 -124
  127. package/lib/cjs/tests/api_tests/load_team_chat.test.js.map +1 -1
  128. package/lib/cjs/tests/api_tests/load_threads_autobuild.test.d.ts +24 -5
  129. package/lib/cjs/tests/api_tests/load_threads_autobuild.test.d.ts.map +1 -1
  130. package/lib/cjs/tests/api_tests/load_threads_autobuild.test.js +261 -227
  131. package/lib/cjs/tests/api_tests/load_threads_autobuild.test.js.map +1 -1
  132. package/lib/cjs/tests/api_tests/load_threads_care_team.test.d.ts +6 -0
  133. package/lib/cjs/tests/api_tests/load_threads_care_team.test.d.ts.map +1 -1
  134. package/lib/cjs/tests/api_tests/load_threads_care_team.test.js +115 -31
  135. package/lib/cjs/tests/api_tests/load_threads_care_team.test.js.map +1 -1
  136. package/lib/cjs/tests/api_tests/managed_content_file_access.test.d.ts +15 -5
  137. package/lib/cjs/tests/api_tests/managed_content_file_access.test.d.ts.map +1 -1
  138. package/lib/cjs/tests/api_tests/managed_content_file_access.test.js +285 -311
  139. package/lib/cjs/tests/api_tests/managed_content_file_access.test.js.map +1 -1
  140. package/lib/cjs/tests/api_tests/mdb_sort.test.d.ts +20 -5
  141. package/lib/cjs/tests/api_tests/mdb_sort.test.d.ts.map +1 -1
  142. package/lib/cjs/tests/api_tests/mdb_sort.test.js +361 -305
  143. package/lib/cjs/tests/api_tests/mdb_sort.test.js.map +1 -1
  144. package/lib/cjs/tests/api_tests/mdi_manual_sync.test.d.ts +27 -0
  145. package/lib/cjs/tests/api_tests/mdi_manual_sync.test.d.ts.map +1 -0
  146. package/lib/cjs/tests/api_tests/mdi_manual_sync.test.js +395 -0
  147. package/lib/cjs/tests/api_tests/mdi_manual_sync.test.js.map +1 -0
  148. package/lib/cjs/tests/api_tests/mdi_trigger_refill.test.d.ts +6 -5
  149. package/lib/cjs/tests/api_tests/mdi_trigger_refill.test.d.ts.map +1 -1
  150. package/lib/cjs/tests/api_tests/mdi_trigger_refill.test.js +259 -209
  151. package/lib/cjs/tests/api_tests/mdi_trigger_refill.test.js.map +1 -1
  152. package/lib/cjs/tests/api_tests/mdi_webhooks.test.d.ts +12 -5
  153. package/lib/cjs/tests/api_tests/mdi_webhooks.test.d.ts.map +1 -1
  154. package/lib/cjs/tests/api_tests/mdi_webhooks.test.js +67 -61
  155. package/lib/cjs/tests/api_tests/mdi_webhooks.test.js.map +1 -1
  156. package/lib/cjs/tests/api_tests/message_assignment_trigger.test.d.ts +23 -14
  157. package/lib/cjs/tests/api_tests/message_assignment_trigger.test.d.ts.map +1 -1
  158. package/lib/cjs/tests/api_tests/message_assignment_trigger.test.js +258 -306
  159. package/lib/cjs/tests/api_tests/message_assignment_trigger.test.js.map +1 -1
  160. package/lib/cjs/tests/api_tests/metriport_push_form_response.test.d.ts +6 -5
  161. package/lib/cjs/tests/api_tests/metriport_push_form_response.test.d.ts.map +1 -1
  162. package/lib/cjs/tests/api_tests/metriport_push_form_response.test.js +301 -238
  163. package/lib/cjs/tests/api_tests/metriport_push_form_response.test.js.map +1 -1
  164. package/lib/cjs/tests/api_tests/organization_api_keys.test.d.ts.map +1 -1
  165. package/lib/cjs/tests/api_tests/organization_api_keys.test.js +226 -59
  166. package/lib/cjs/tests/api_tests/organization_api_keys.test.js.map +1 -1
  167. package/lib/cjs/tests/api_tests/organization_settings_duplicates.test.d.ts +19 -5
  168. package/lib/cjs/tests/api_tests/organization_settings_duplicates.test.d.ts.map +1 -1
  169. package/lib/cjs/tests/api_tests/organization_settings_duplicates.test.js +335 -222
  170. package/lib/cjs/tests/api_tests/organization_settings_duplicates.test.js.map +1 -1
  171. package/lib/cjs/tests/api_tests/organization_signup.test.d.ts.map +1 -1
  172. package/lib/cjs/tests/api_tests/organization_signup.test.js +218 -51
  173. package/lib/cjs/tests/api_tests/organization_signup.test.js.map +1 -1
  174. package/lib/cjs/tests/api_tests/out_of_office_endpoint.test.d.ts.map +1 -1
  175. package/lib/cjs/tests/api_tests/out_of_office_endpoint.test.js +109 -1
  176. package/lib/cjs/tests/api_tests/out_of_office_endpoint.test.js.map +1 -1
  177. package/lib/cjs/tests/api_tests/outbound_chat_sent_trigger.test.d.ts +6 -6
  178. package/lib/cjs/tests/api_tests/outbound_chat_sent_trigger.test.d.ts.map +1 -1
  179. package/lib/cjs/tests/api_tests/outbound_chat_sent_trigger.test.js +309 -361
  180. package/lib/cjs/tests/api_tests/outbound_chat_sent_trigger.test.js.map +1 -1
  181. package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.d.ts +6 -5
  182. package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.d.ts.map +1 -1
  183. package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.js +246 -165
  184. package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.js.map +1 -1
  185. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.d.ts +15 -5
  186. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.d.ts.map +1 -1
  187. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.js +130 -47
  188. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.js.map +1 -1
  189. package/lib/cjs/tests/api_tests/phone_tree_enduser_condition.test.d.ts +6 -5
  190. package/lib/cjs/tests/api_tests/phone_tree_enduser_condition.test.d.ts.map +1 -1
  191. package/lib/cjs/tests/api_tests/phone_tree_enduser_condition.test.js +180 -132
  192. package/lib/cjs/tests/api_tests/phone_tree_enduser_condition.test.js.map +1 -1
  193. package/lib/cjs/tests/api_tests/programs.test.d.ts.map +1 -1
  194. package/lib/cjs/tests/api_tests/programs.test.js +417 -50
  195. package/lib/cjs/tests/api_tests/programs.test.js.map +1 -1
  196. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.d.ts +10 -5
  197. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.d.ts.map +1 -1
  198. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.js +401 -282
  199. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.js.map +1 -1
  200. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.d.ts +9 -5
  201. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.d.ts.map +1 -1
  202. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.js +228 -211
  203. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.js.map +1 -1
  204. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts +13 -8
  205. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts.map +1 -1
  206. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js +270 -254
  207. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -1
  208. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts +16 -6
  209. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts.map +1 -1
  210. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js +167 -142
  211. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js.map +1 -1
  212. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts +10 -5
  213. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts.map +1 -1
  214. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.js +296 -221
  215. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.js.map +1 -1
  216. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts +12 -5
  217. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts.map +1 -1
  218. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js +221 -216
  219. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js.map +1 -1
  220. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts +11 -5
  221. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts.map +1 -1
  222. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +300 -203
  223. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -1
  224. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.d.ts +11 -5
  225. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.d.ts.map +1 -1
  226. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js +415 -275
  227. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js.map +1 -1
  228. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.d.ts +11 -5
  229. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.d.ts.map +1 -1
  230. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js +347 -228
  231. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -1
  232. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts +18 -7
  233. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts.map +1 -1
  234. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.js +164 -75
  235. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.js.map +1 -1
  236. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts +15 -9
  237. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts.map +1 -1
  238. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js +99 -102
  239. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js.map +1 -1
  240. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.d.ts +11 -5
  241. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.d.ts.map +1 -1
  242. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.js +132 -89
  243. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.js.map +1 -1
  244. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts +12 -5
  245. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts.map +1 -1
  246. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.js +190 -138
  247. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.js.map +1 -1
  248. package/lib/cjs/tests/api_tests/security/register_business_id_injection.test.d.ts +18 -16
  249. package/lib/cjs/tests/api_tests/security/register_business_id_injection.test.d.ts.map +1 -1
  250. package/lib/cjs/tests/api_tests/security/register_business_id_injection.test.js +164 -124
  251. package/lib/cjs/tests/api_tests/security/register_business_id_injection.test.js.map +1 -1
  252. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -1
  253. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +122 -2
  254. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -1
  255. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts +11 -5
  256. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts.map +1 -1
  257. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.js +288 -274
  258. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.js.map +1 -1
  259. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.d.ts +17 -10
  260. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.d.ts.map +1 -1
  261. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.js +173 -138
  262. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.js.map +1 -1
  263. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts +6 -5
  264. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -1
  265. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js +310 -265
  266. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js.map +1 -1
  267. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.d.ts +9 -5
  268. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.d.ts.map +1 -1
  269. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.js +108 -83
  270. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.js.map +1 -1
  271. package/lib/cjs/tests/api_tests/stedi_approval.test.d.ts +6 -5
  272. package/lib/cjs/tests/api_tests/stedi_approval.test.d.ts.map +1 -1
  273. package/lib/cjs/tests/api_tests/stedi_approval.test.js +206 -137
  274. package/lib/cjs/tests/api_tests/stedi_approval.test.js.map +1 -1
  275. package/lib/cjs/tests/api_tests/ticket_stage_archive.test.d.ts +7 -0
  276. package/lib/cjs/tests/api_tests/ticket_stage_archive.test.d.ts.map +1 -0
  277. package/lib/cjs/tests/api_tests/ticket_stage_archive.test.js +344 -0
  278. package/lib/cjs/tests/api_tests/ticket_stage_archive.test.js.map +1 -0
  279. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts +6 -5
  280. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts.map +1 -1
  281. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.js +165 -149
  282. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.js.map +1 -1
  283. package/lib/cjs/tests/api_tests/translations.test.d.ts +6 -5
  284. package/lib/cjs/tests/api_tests/translations.test.d.ts.map +1 -1
  285. package/lib/cjs/tests/api_tests/translations.test.js +104 -75
  286. package/lib/cjs/tests/api_tests/translations.test.js.map +1 -1
  287. package/lib/cjs/tests/api_tests/trigger_set_fields_date_difference.test.d.ts +21 -4
  288. package/lib/cjs/tests/api_tests/trigger_set_fields_date_difference.test.d.ts.map +1 -1
  289. package/lib/cjs/tests/api_tests/trigger_set_fields_date_difference.test.js +238 -370
  290. package/lib/cjs/tests/api_tests/trigger_set_fields_date_difference.test.js.map +1 -1
  291. package/lib/cjs/tests/api_tests/user_preferences.test.d.ts +30 -0
  292. package/lib/cjs/tests/api_tests/user_preferences.test.d.ts.map +1 -0
  293. package/lib/cjs/tests/api_tests/user_preferences.test.js +279 -0
  294. package/lib/cjs/tests/api_tests/user_preferences.test.js.map +1 -0
  295. package/lib/cjs/tests/api_tests/webhook_error_handling.test.d.ts +17 -5
  296. package/lib/cjs/tests/api_tests/webhook_error_handling.test.d.ts.map +1 -1
  297. package/lib/cjs/tests/api_tests/webhook_error_handling.test.js +204 -195
  298. package/lib/cjs/tests/api_tests/webhook_error_handling.test.js.map +1 -1
  299. package/lib/cjs/tests/api_tests/webhook_raw_json_number.test.d.ts +15 -5
  300. package/lib/cjs/tests/api_tests/webhook_raw_json_number.test.d.ts.map +1 -1
  301. package/lib/cjs/tests/api_tests/webhook_raw_json_number.test.js +154 -179
  302. package/lib/cjs/tests/api_tests/webhook_raw_json_number.test.js.map +1 -1
  303. package/lib/cjs/tests/api_tests/welle_partner_token.test.d.ts +6 -5
  304. package/lib/cjs/tests/api_tests/welle_partner_token.test.d.ts.map +1 -1
  305. package/lib/cjs/tests/api_tests/welle_partner_token.test.js +393 -251
  306. package/lib/cjs/tests/api_tests/welle_partner_token.test.js.map +1 -1
  307. package/lib/cjs/tests/setup_isolated.d.ts +7 -0
  308. package/lib/cjs/tests/setup_isolated.d.ts.map +1 -1
  309. package/lib/cjs/tests/setup_isolated.js.map +1 -1
  310. package/lib/cjs/tests/tests.d.ts.map +1 -1
  311. package/lib/cjs/tests/tests.js +229 -461
  312. package/lib/cjs/tests/tests.js.map +1 -1
  313. package/lib/cjs/tests/unit_tests/date_string_validation.test.d.ts +2 -0
  314. package/lib/cjs/tests/unit_tests/date_string_validation.test.d.ts.map +1 -0
  315. package/lib/cjs/tests/unit_tests/date_string_validation.test.js +112 -0
  316. package/lib/cjs/tests/unit_tests/date_string_validation.test.js.map +1 -0
  317. package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  318. package/lib/esm/sdk.d.ts +6 -5
  319. package/lib/esm/sdk.d.ts.map +1 -1
  320. package/lib/esm/sdk.js +5 -0
  321. package/lib/esm/sdk.js.map +1 -1
  322. package/lib/esm/tests/api_tests/ai_conversations.test.d.ts +14 -5
  323. package/lib/esm/tests/api_tests/ai_conversations.test.d.ts.map +1 -1
  324. package/lib/esm/tests/api_tests/ai_conversations.test.js +161 -148
  325. package/lib/esm/tests/api_tests/ai_conversations.test.js.map +1 -1
  326. package/lib/esm/tests/api_tests/ai_conversations_agent_message.test.d.ts +22 -0
  327. package/lib/esm/tests/api_tests/ai_conversations_agent_message.test.d.ts.map +1 -0
  328. package/lib/esm/tests/api_tests/ai_conversations_agent_message.test.js +510 -0
  329. package/lib/esm/tests/api_tests/ai_conversations_agent_message.test.js.map +1 -0
  330. package/lib/esm/tests/api_tests/appointment_link_expiration.test.d.ts +6 -5
  331. package/lib/esm/tests/api_tests/appointment_link_expiration.test.d.ts.map +1 -1
  332. package/lib/esm/tests/api_tests/appointment_link_expiration.test.js +132 -71
  333. package/lib/esm/tests/api_tests/appointment_link_expiration.test.js.map +1 -1
  334. package/lib/esm/tests/api_tests/appointment_no_showed_trigger.test.d.ts +6 -5
  335. package/lib/esm/tests/api_tests/appointment_no_showed_trigger.test.d.ts.map +1 -1
  336. package/lib/esm/tests/api_tests/appointment_no_showed_trigger.test.js +238 -173
  337. package/lib/esm/tests/api_tests/appointment_no_showed_trigger.test.js.map +1 -1
  338. package/lib/esm/tests/api_tests/availability_block_buffer.test.d.ts +22 -0
  339. package/lib/esm/tests/api_tests/availability_block_buffer.test.d.ts.map +1 -0
  340. package/lib/esm/tests/api_tests/availability_block_buffer.test.js +306 -0
  341. package/lib/esm/tests/api_tests/availability_block_buffer.test.js.map +1 -0
  342. package/lib/esm/tests/api_tests/beluga_manual_sync.test.d.ts +6 -5
  343. package/lib/esm/tests/api_tests/beluga_manual_sync.test.d.ts.map +1 -1
  344. package/lib/esm/tests/api_tests/beluga_manual_sync.test.js +232 -190
  345. package/lib/esm/tests/api_tests/beluga_manual_sync.test.js.map +1 -1
  346. package/lib/esm/tests/api_tests/beluga_trigger_refill.test.d.ts +6 -5
  347. package/lib/esm/tests/api_tests/beluga_trigger_refill.test.d.ts.map +1 -1
  348. package/lib/esm/tests/api_tests/beluga_trigger_refill.test.js +348 -262
  349. package/lib/esm/tests/api_tests/beluga_trigger_refill.test.js.map +1 -1
  350. package/lib/esm/tests/api_tests/bulk_assignment.test.d.ts +16 -5
  351. package/lib/esm/tests/api_tests/bulk_assignment.test.d.ts.map +1 -1
  352. package/lib/esm/tests/api_tests/bulk_assignment.test.js +333 -241
  353. package/lib/esm/tests/api_tests/bulk_assignment.test.js.map +1 -1
  354. package/lib/esm/tests/api_tests/calendar_event_references_update.test.d.ts +13 -5
  355. package/lib/esm/tests/api_tests/calendar_event_references_update.test.d.ts.map +1 -1
  356. package/lib/esm/tests/api_tests/calendar_event_references_update.test.js +129 -107
  357. package/lib/esm/tests/api_tests/calendar_event_references_update.test.js.map +1 -1
  358. package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.d.ts +15 -5
  359. package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.d.ts.map +1 -1
  360. package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.js +238 -251
  361. package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.js.map +1 -1
  362. package/lib/esm/tests/api_tests/chats_analytics.test.d.ts +14 -5
  363. package/lib/esm/tests/api_tests/chats_analytics.test.d.ts.map +1 -1
  364. package/lib/esm/tests/api_tests/chats_analytics.test.js +188 -188
  365. package/lib/esm/tests/api_tests/chats_analytics.test.js.map +1 -1
  366. package/lib/esm/tests/api_tests/concurrent_build_threads.test.d.ts +23 -5
  367. package/lib/esm/tests/api_tests/concurrent_build_threads.test.d.ts.map +1 -1
  368. package/lib/esm/tests/api_tests/concurrent_build_threads.test.js +119 -117
  369. package/lib/esm/tests/api_tests/concurrent_build_threads.test.js.map +1 -1
  370. package/lib/esm/tests/api_tests/configurations_public_read.test.d.ts +21 -5
  371. package/lib/esm/tests/api_tests/configurations_public_read.test.d.ts.map +1 -1
  372. package/lib/esm/tests/api_tests/configurations_public_read.test.js +233 -118
  373. package/lib/esm/tests/api_tests/configurations_public_read.test.js.map +1 -1
  374. package/lib/esm/tests/api_tests/copied_form_response_no_enduser_sync.test.d.ts +7 -0
  375. package/lib/esm/tests/api_tests/copied_form_response_no_enduser_sync.test.d.ts.map +1 -0
  376. package/lib/esm/tests/api_tests/copied_form_response_no_enduser_sync.test.js +351 -0
  377. package/lib/esm/tests/api_tests/copied_form_response_no_enduser_sync.test.js.map +1 -0
  378. package/lib/esm/tests/api_tests/create_note_action.test.d.ts +18 -5
  379. package/lib/esm/tests/api_tests/create_note_action.test.d.ts.map +1 -1
  380. package/lib/esm/tests/api_tests/create_note_action.test.js +216 -172
  381. package/lib/esm/tests/api_tests/create_note_action.test.js.map +1 -1
  382. package/lib/esm/tests/api_tests/create_user_notifications_trigger.test.d.ts +17 -4
  383. package/lib/esm/tests/api_tests/create_user_notifications_trigger.test.d.ts.map +1 -1
  384. package/lib/esm/tests/api_tests/create_user_notifications_trigger.test.js +141 -203
  385. package/lib/esm/tests/api_tests/create_user_notifications_trigger.test.js.map +1 -1
  386. package/lib/esm/tests/api_tests/custom_aggregation.test.d.ts +15 -5
  387. package/lib/esm/tests/api_tests/custom_aggregation.test.d.ts.map +1 -1
  388. package/lib/esm/tests/api_tests/custom_aggregation.test.js +282 -222
  389. package/lib/esm/tests/api_tests/custom_aggregation.test.js.map +1 -1
  390. package/lib/esm/tests/api_tests/database_cascade_delete.test.d.ts +13 -5
  391. package/lib/esm/tests/api_tests/database_cascade_delete.test.d.ts.map +1 -1
  392. package/lib/esm/tests/api_tests/database_cascade_delete.test.js +216 -241
  393. package/lib/esm/tests/api_tests/database_cascade_delete.test.js.map +1 -1
  394. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts +21 -5
  395. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts.map +1 -1
  396. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.js +165 -110
  397. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.js.map +1 -1
  398. package/lib/esm/tests/api_tests/elation_user_id.test.d.ts +17 -5
  399. package/lib/esm/tests/api_tests/elation_user_id.test.d.ts.map +1 -1
  400. package/lib/esm/tests/api_tests/elation_user_id.test.js +119 -53
  401. package/lib/esm/tests/api_tests/elation_user_id.test.js.map +1 -1
  402. package/lib/esm/tests/api_tests/file_download_unicode_names.test.d.ts +6 -5
  403. package/lib/esm/tests/api_tests/file_download_unicode_names.test.d.ts.map +1 -1
  404. package/lib/esm/tests/api_tests/file_download_unicode_names.test.js +190 -141
  405. package/lib/esm/tests/api_tests/file_download_unicode_names.test.js.map +1 -1
  406. package/lib/esm/tests/api_tests/form_intake_email_normalization.test.d.ts +7 -0
  407. package/lib/esm/tests/api_tests/form_intake_email_normalization.test.d.ts.map +1 -0
  408. package/lib/esm/tests/api_tests/form_intake_email_normalization.test.js +527 -0
  409. package/lib/esm/tests/api_tests/form_intake_email_normalization.test.js.map +1 -0
  410. package/lib/esm/tests/api_tests/form_submitted_trigger.test.d.ts +25 -5
  411. package/lib/esm/tests/api_tests/form_submitted_trigger.test.d.ts.map +1 -1
  412. package/lib/esm/tests/api_tests/form_submitted_trigger.test.js +393 -365
  413. package/lib/esm/tests/api_tests/form_submitted_trigger.test.js.map +1 -1
  414. package/lib/esm/tests/api_tests/form_translations.test.d.ts +6 -5
  415. package/lib/esm/tests/api_tests/form_translations.test.d.ts.map +1 -1
  416. package/lib/esm/tests/api_tests/form_translations.test.js +268 -189
  417. package/lib/esm/tests/api_tests/form_translations.test.js.map +1 -1
  418. package/lib/esm/tests/api_tests/formsort_header_auth.test.d.ts +29 -5
  419. package/lib/esm/tests/api_tests/formsort_header_auth.test.d.ts.map +1 -1
  420. package/lib/esm/tests/api_tests/formsort_header_auth.test.js +177 -161
  421. package/lib/esm/tests/api_tests/formsort_header_auth.test.js.map +1 -1
  422. package/lib/esm/tests/api_tests/gcal_sync_retry.test.d.ts +12 -6
  423. package/lib/esm/tests/api_tests/gcal_sync_retry.test.d.ts.map +1 -1
  424. package/lib/esm/tests/api_tests/gcal_sync_retry.test.js +96 -83
  425. package/lib/esm/tests/api_tests/gcal_sync_retry.test.js.map +1 -1
  426. package/lib/esm/tests/api_tests/get_some_projection.test.d.ts +20 -5
  427. package/lib/esm/tests/api_tests/get_some_projection.test.d.ts.map +1 -1
  428. package/lib/esm/tests/api_tests/get_some_projection.test.js +339 -296
  429. package/lib/esm/tests/api_tests/get_some_projection.test.js.map +1 -1
  430. package/lib/esm/tests/api_tests/group_event_attendee_self_update.test.d.ts +6 -5
  431. package/lib/esm/tests/api_tests/group_event_attendee_self_update.test.d.ts.map +1 -1
  432. package/lib/esm/tests/api_tests/group_event_attendee_self_update.test.js +292 -222
  433. package/lib/esm/tests/api_tests/group_event_attendee_self_update.test.js.map +1 -1
  434. package/lib/esm/tests/api_tests/integrations_redacted.test.d.ts +6 -5
  435. package/lib/esm/tests/api_tests/integrations_redacted.test.d.ts.map +1 -1
  436. package/lib/esm/tests/api_tests/integrations_redacted.test.js +304 -211
  437. package/lib/esm/tests/api_tests/integrations_redacted.test.js.map +1 -1
  438. package/lib/esm/tests/api_tests/journey_delete_cancels_actions.test.d.ts +6 -5
  439. package/lib/esm/tests/api_tests/journey_delete_cancels_actions.test.d.ts.map +1 -1
  440. package/lib/esm/tests/api_tests/journey_delete_cancels_actions.test.js +177 -154
  441. package/lib/esm/tests/api_tests/journey_delete_cancels_actions.test.js.map +1 -1
  442. package/lib/esm/tests/api_tests/load_team_chat.test.d.ts.map +1 -1
  443. package/lib/esm/tests/api_tests/load_team_chat.test.js +181 -124
  444. package/lib/esm/tests/api_tests/load_team_chat.test.js.map +1 -1
  445. package/lib/esm/tests/api_tests/load_threads_autobuild.test.d.ts +24 -5
  446. package/lib/esm/tests/api_tests/load_threads_autobuild.test.d.ts.map +1 -1
  447. package/lib/esm/tests/api_tests/load_threads_autobuild.test.js +259 -226
  448. package/lib/esm/tests/api_tests/load_threads_autobuild.test.js.map +1 -1
  449. package/lib/esm/tests/api_tests/load_threads_care_team.test.d.ts +6 -0
  450. package/lib/esm/tests/api_tests/load_threads_care_team.test.d.ts.map +1 -1
  451. package/lib/esm/tests/api_tests/load_threads_care_team.test.js +115 -31
  452. package/lib/esm/tests/api_tests/load_threads_care_team.test.js.map +1 -1
  453. package/lib/esm/tests/api_tests/managed_content_file_access.test.d.ts +15 -5
  454. package/lib/esm/tests/api_tests/managed_content_file_access.test.d.ts.map +1 -1
  455. package/lib/esm/tests/api_tests/managed_content_file_access.test.js +283 -287
  456. package/lib/esm/tests/api_tests/managed_content_file_access.test.js.map +1 -1
  457. package/lib/esm/tests/api_tests/mdb_sort.test.d.ts +20 -5
  458. package/lib/esm/tests/api_tests/mdb_sort.test.d.ts.map +1 -1
  459. package/lib/esm/tests/api_tests/mdb_sort.test.js +358 -303
  460. package/lib/esm/tests/api_tests/mdb_sort.test.js.map +1 -1
  461. package/lib/esm/tests/api_tests/mdi_manual_sync.test.d.ts +27 -0
  462. package/lib/esm/tests/api_tests/mdi_manual_sync.test.d.ts.map +1 -0
  463. package/lib/esm/tests/api_tests/mdi_manual_sync.test.js +390 -0
  464. package/lib/esm/tests/api_tests/mdi_manual_sync.test.js.map +1 -0
  465. package/lib/esm/tests/api_tests/mdi_trigger_refill.test.d.ts +6 -5
  466. package/lib/esm/tests/api_tests/mdi_trigger_refill.test.d.ts.map +1 -1
  467. package/lib/esm/tests/api_tests/mdi_trigger_refill.test.js +257 -208
  468. package/lib/esm/tests/api_tests/mdi_trigger_refill.test.js.map +1 -1
  469. package/lib/esm/tests/api_tests/mdi_webhooks.test.d.ts +12 -5
  470. package/lib/esm/tests/api_tests/mdi_webhooks.test.d.ts.map +1 -1
  471. package/lib/esm/tests/api_tests/mdi_webhooks.test.js +65 -60
  472. package/lib/esm/tests/api_tests/mdi_webhooks.test.js.map +1 -1
  473. package/lib/esm/tests/api_tests/message_assignment_trigger.test.d.ts +23 -14
  474. package/lib/esm/tests/api_tests/message_assignment_trigger.test.d.ts.map +1 -1
  475. package/lib/esm/tests/api_tests/message_assignment_trigger.test.js +256 -305
  476. package/lib/esm/tests/api_tests/message_assignment_trigger.test.js.map +1 -1
  477. package/lib/esm/tests/api_tests/metriport_push_form_response.test.d.ts +6 -5
  478. package/lib/esm/tests/api_tests/metriport_push_form_response.test.d.ts.map +1 -1
  479. package/lib/esm/tests/api_tests/metriport_push_form_response.test.js +298 -236
  480. package/lib/esm/tests/api_tests/metriport_push_form_response.test.js.map +1 -1
  481. package/lib/esm/tests/api_tests/organization_api_keys.test.d.ts.map +1 -1
  482. package/lib/esm/tests/api_tests/organization_api_keys.test.js +226 -59
  483. package/lib/esm/tests/api_tests/organization_api_keys.test.js.map +1 -1
  484. package/lib/esm/tests/api_tests/organization_settings_duplicates.test.d.ts +19 -5
  485. package/lib/esm/tests/api_tests/organization_settings_duplicates.test.d.ts.map +1 -1
  486. package/lib/esm/tests/api_tests/organization_settings_duplicates.test.js +332 -220
  487. package/lib/esm/tests/api_tests/organization_settings_duplicates.test.js.map +1 -1
  488. package/lib/esm/tests/api_tests/organization_signup.test.d.ts.map +1 -1
  489. package/lib/esm/tests/api_tests/organization_signup.test.js +218 -51
  490. package/lib/esm/tests/api_tests/organization_signup.test.js.map +1 -1
  491. package/lib/esm/tests/api_tests/out_of_office_endpoint.test.d.ts.map +1 -1
  492. package/lib/esm/tests/api_tests/out_of_office_endpoint.test.js +109 -1
  493. package/lib/esm/tests/api_tests/out_of_office_endpoint.test.js.map +1 -1
  494. package/lib/esm/tests/api_tests/outbound_chat_sent_trigger.test.d.ts +6 -6
  495. package/lib/esm/tests/api_tests/outbound_chat_sent_trigger.test.d.ts.map +1 -1
  496. package/lib/esm/tests/api_tests/outbound_chat_sent_trigger.test.js +308 -361
  497. package/lib/esm/tests/api_tests/outbound_chat_sent_trigger.test.js.map +1 -1
  498. package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.d.ts +6 -5
  499. package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.d.ts.map +1 -1
  500. package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.js +243 -163
  501. package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.js.map +1 -1
  502. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.d.ts +15 -5
  503. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.d.ts.map +1 -1
  504. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.js +127 -45
  505. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.js.map +1 -1
  506. package/lib/esm/tests/api_tests/phone_tree_enduser_condition.test.d.ts +6 -5
  507. package/lib/esm/tests/api_tests/phone_tree_enduser_condition.test.d.ts.map +1 -1
  508. package/lib/esm/tests/api_tests/phone_tree_enduser_condition.test.js +177 -130
  509. package/lib/esm/tests/api_tests/phone_tree_enduser_condition.test.js.map +1 -1
  510. package/lib/esm/tests/api_tests/programs.test.d.ts.map +1 -1
  511. package/lib/esm/tests/api_tests/programs.test.js +417 -50
  512. package/lib/esm/tests/api_tests/programs.test.js.map +1 -1
  513. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.d.ts +10 -5
  514. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.d.ts.map +1 -1
  515. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.js +399 -281
  516. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.js.map +1 -1
  517. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.d.ts +9 -5
  518. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.d.ts.map +1 -1
  519. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.js +225 -209
  520. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.js.map +1 -1
  521. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts +13 -8
  522. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts.map +1 -1
  523. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js +268 -253
  524. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -1
  525. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts +16 -6
  526. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts.map +1 -1
  527. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js +165 -141
  528. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js.map +1 -1
  529. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts +10 -5
  530. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts.map +1 -1
  531. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.js +294 -220
  532. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.js.map +1 -1
  533. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts +12 -5
  534. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts.map +1 -1
  535. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js +219 -215
  536. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js.map +1 -1
  537. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts +11 -5
  538. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts.map +1 -1
  539. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +298 -202
  540. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -1
  541. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.d.ts +11 -5
  542. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.d.ts.map +1 -1
  543. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js +413 -274
  544. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js.map +1 -1
  545. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.d.ts +11 -5
  546. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.d.ts.map +1 -1
  547. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js +345 -227
  548. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -1
  549. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts +18 -7
  550. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts.map +1 -1
  551. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.js +162 -74
  552. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.js.map +1 -1
  553. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts +15 -9
  554. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts.map +1 -1
  555. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js +96 -100
  556. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js.map +1 -1
  557. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.d.ts +11 -5
  558. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.d.ts.map +1 -1
  559. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.js +129 -87
  560. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.js.map +1 -1
  561. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts +12 -5
  562. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts.map +1 -1
  563. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.js +187 -136
  564. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.js.map +1 -1
  565. package/lib/esm/tests/api_tests/security/register_business_id_injection.test.d.ts +18 -16
  566. package/lib/esm/tests/api_tests/security/register_business_id_injection.test.d.ts.map +1 -1
  567. package/lib/esm/tests/api_tests/security/register_business_id_injection.test.js +162 -123
  568. package/lib/esm/tests/api_tests/security/register_business_id_injection.test.js.map +1 -1
  569. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -1
  570. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +122 -2
  571. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -1
  572. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts +11 -5
  573. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts.map +1 -1
  574. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.js +285 -272
  575. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.js.map +1 -1
  576. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.d.ts +17 -10
  577. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.d.ts.map +1 -1
  578. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.js +171 -137
  579. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.js.map +1 -1
  580. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts +6 -5
  581. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -1
  582. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js +307 -263
  583. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js.map +1 -1
  584. package/lib/esm/tests/api_tests/security/webhook-timeout.test.d.ts +9 -5
  585. package/lib/esm/tests/api_tests/security/webhook-timeout.test.d.ts.map +1 -1
  586. package/lib/esm/tests/api_tests/security/webhook-timeout.test.js +105 -81
  587. package/lib/esm/tests/api_tests/security/webhook-timeout.test.js.map +1 -1
  588. package/lib/esm/tests/api_tests/stedi_approval.test.d.ts +6 -5
  589. package/lib/esm/tests/api_tests/stedi_approval.test.d.ts.map +1 -1
  590. package/lib/esm/tests/api_tests/stedi_approval.test.js +204 -136
  591. package/lib/esm/tests/api_tests/stedi_approval.test.js.map +1 -1
  592. package/lib/esm/tests/api_tests/ticket_stage_archive.test.d.ts +7 -0
  593. package/lib/esm/tests/api_tests/ticket_stage_archive.test.d.ts.map +1 -0
  594. package/lib/esm/tests/api_tests/ticket_stage_archive.test.js +339 -0
  595. package/lib/esm/tests/api_tests/ticket_stage_archive.test.js.map +1 -0
  596. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts +6 -5
  597. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts.map +1 -1
  598. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.js +162 -147
  599. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.js.map +1 -1
  600. package/lib/esm/tests/api_tests/translations.test.d.ts +6 -5
  601. package/lib/esm/tests/api_tests/translations.test.d.ts.map +1 -1
  602. package/lib/esm/tests/api_tests/translations.test.js +102 -74
  603. package/lib/esm/tests/api_tests/translations.test.js.map +1 -1
  604. package/lib/esm/tests/api_tests/trigger_set_fields_date_difference.test.d.ts +21 -4
  605. package/lib/esm/tests/api_tests/trigger_set_fields_date_difference.test.d.ts.map +1 -1
  606. package/lib/esm/tests/api_tests/trigger_set_fields_date_difference.test.js +236 -369
  607. package/lib/esm/tests/api_tests/trigger_set_fields_date_difference.test.js.map +1 -1
  608. package/lib/esm/tests/api_tests/user_preferences.test.d.ts +30 -0
  609. package/lib/esm/tests/api_tests/user_preferences.test.d.ts.map +1 -0
  610. package/lib/esm/tests/api_tests/user_preferences.test.js +274 -0
  611. package/lib/esm/tests/api_tests/user_preferences.test.js.map +1 -0
  612. package/lib/esm/tests/api_tests/webhook_error_handling.test.d.ts +17 -5
  613. package/lib/esm/tests/api_tests/webhook_error_handling.test.d.ts.map +1 -1
  614. package/lib/esm/tests/api_tests/webhook_error_handling.test.js +202 -194
  615. package/lib/esm/tests/api_tests/webhook_error_handling.test.js.map +1 -1
  616. package/lib/esm/tests/api_tests/webhook_raw_json_number.test.d.ts +15 -5
  617. package/lib/esm/tests/api_tests/webhook_raw_json_number.test.d.ts.map +1 -1
  618. package/lib/esm/tests/api_tests/webhook_raw_json_number.test.js +152 -178
  619. package/lib/esm/tests/api_tests/webhook_raw_json_number.test.js.map +1 -1
  620. package/lib/esm/tests/api_tests/welle_partner_token.test.d.ts +6 -5
  621. package/lib/esm/tests/api_tests/welle_partner_token.test.d.ts.map +1 -1
  622. package/lib/esm/tests/api_tests/welle_partner_token.test.js +391 -250
  623. package/lib/esm/tests/api_tests/welle_partner_token.test.js.map +1 -1
  624. package/lib/esm/tests/setup_isolated.d.ts +7 -0
  625. package/lib/esm/tests/setup_isolated.d.ts.map +1 -1
  626. package/lib/esm/tests/setup_isolated.js.map +1 -1
  627. package/lib/esm/tests/tests.d.ts.map +1 -1
  628. package/lib/esm/tests/tests.js +229 -461
  629. package/lib/esm/tests/tests.js.map +1 -1
  630. package/lib/esm/tests/unit_tests/date_string_validation.test.d.ts +2 -0
  631. package/lib/esm/tests/unit_tests/date_string_validation.test.d.ts.map +1 -0
  632. package/lib/esm/tests/unit_tests/date_string_validation.test.js +108 -0
  633. package/lib/esm/tests/unit_tests/date_string_validation.test.js.map +1 -0
  634. package/lib/tsconfig.tsbuildinfo +1 -1
  635. package/package.json +10 -10
  636. package/src/sdk.ts +14 -3
  637. package/src/tests/api_tests/ai_conversations.test.ts +170 -138
  638. package/src/tests/api_tests/ai_conversations_agent_message.test.ts +491 -0
  639. package/src/tests/api_tests/appointment_link_expiration.test.ts +94 -35
  640. package/src/tests/api_tests/appointment_no_showed_trigger.test.ts +181 -128
  641. package/src/tests/api_tests/availability_block_buffer.test.ts +286 -0
  642. package/src/tests/api_tests/beluga_manual_sync.test.ts +103 -53
  643. package/src/tests/api_tests/beluga_trigger_refill.test.ts +131 -46
  644. package/src/tests/api_tests/bulk_assignment.test.ts +307 -220
  645. package/src/tests/api_tests/calendar_event_references_update.test.ts +97 -54
  646. package/src/tests/api_tests/calendar_event_webhook_template.test.ts +198 -158
  647. package/src/tests/api_tests/chats_analytics.test.ts +161 -123
  648. package/src/tests/api_tests/concurrent_build_threads.test.ts +80 -69
  649. package/src/tests/api_tests/configurations_public_read.test.ts +154 -67
  650. package/src/tests/api_tests/copied_form_response_no_enduser_sync.test.ts +307 -0
  651. package/src/tests/api_tests/create_note_action.test.ts +149 -70
  652. package/src/tests/api_tests/create_user_notifications_trigger.test.ts +116 -144
  653. package/src/tests/api_tests/custom_aggregation.test.ts +163 -92
  654. package/src/tests/api_tests/database_cascade_delete.test.ts +101 -87
  655. package/src/tests/api_tests/dont_sync_to_elation_form_submission.test.ts +122 -51
  656. package/src/tests/api_tests/elation_user_id.test.ts +105 -42
  657. package/src/tests/api_tests/file_download_unicode_names.test.ts +171 -122
  658. package/src/tests/api_tests/form_intake_email_normalization.test.ts +489 -0
  659. package/src/tests/api_tests/form_submitted_trigger.test.ts +152 -86
  660. package/src/tests/api_tests/form_translations.test.ts +117 -48
  661. package/src/tests/api_tests/formsort_header_auth.test.ts +147 -97
  662. package/src/tests/api_tests/gcal_sync_retry.test.ts +71 -49
  663. package/src/tests/api_tests/get_some_projection.test.ts +333 -169
  664. package/src/tests/api_tests/group_event_attendee_self_update.test.ts +103 -52
  665. package/src/tests/api_tests/integrations_redacted.test.ts +161 -84
  666. package/src/tests/api_tests/journey_delete_cancels_actions.test.ts +93 -64
  667. package/src/tests/api_tests/load_team_chat.test.ts +62 -6
  668. package/src/tests/api_tests/load_threads_autobuild.test.ts +163 -67
  669. package/src/tests/api_tests/load_threads_care_team.test.ts +103 -0
  670. package/src/tests/api_tests/managed_content_file_access.test.ts +132 -108
  671. package/src/tests/api_tests/mdb_sort.test.ts +247 -161
  672. package/src/tests/api_tests/mdi_manual_sync.test.ts +277 -0
  673. package/src/tests/api_tests/mdi_trigger_refill.test.ts +132 -78
  674. package/src/tests/api_tests/mdi_webhooks.test.ts +52 -22
  675. package/src/tests/api_tests/message_assignment_trigger.test.ts +129 -155
  676. package/src/tests/api_tests/metriport_push_form_response.test.ts +109 -49
  677. package/src/tests/api_tests/organization_api_keys.test.ts +170 -2
  678. package/src/tests/api_tests/organization_settings_duplicates.test.ts +291 -181
  679. package/src/tests/api_tests/organization_signup.test.ts +170 -5
  680. package/src/tests/api_tests/out_of_office_endpoint.test.ts +98 -0
  681. package/src/tests/api_tests/outbound_chat_sent_trigger.test.ts +163 -175
  682. package/src/tests/api_tests/phone_calls_cold_transfer.test.ts +195 -133
  683. package/src/tests/api_tests/phone_calls_conference_hold.test.ts +112 -42
  684. package/src/tests/api_tests/phone_tree_enduser_condition.test.ts +81 -32
  685. package/src/tests/api_tests/programs.test.ts +350 -0
  686. package/src/tests/api_tests/security/ai-conversations-rbac.test.ts +248 -128
  687. package/src/tests/api_tests/security/automated-actions-process-gate.test.ts +47 -42
  688. package/src/tests/api_tests/security/booking-info-idor-token-mint.test.ts +53 -45
  689. package/src/tests/api_tests/security/cascade-role-rename-cross-tenant.test.ts +100 -73
  690. package/src/tests/api_tests/security/data-sync-redaction-bypass.test.ts +125 -59
  691. package/src/tests/api_tests/security/develop-health-benefit-verification-rbac.test.ts +131 -103
  692. package/src/tests/api_tests/security/enduser-ai-summary-trust-gate.test.ts +161 -68
  693. package/src/tests/api_tests/security/enduser-cross-create.test.ts +200 -61
  694. package/src/tests/api_tests/security/enduser-write-restrictions.test.ts +179 -61
  695. package/src/tests/api_tests/security/globalunique-conflict-redaction.test.ts +163 -44
  696. package/src/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.ts +78 -70
  697. package/src/tests/api_tests/security/load-inbox-redaction.test.ts +79 -44
  698. package/src/tests/api_tests/security/proxy-image-unauth-ssrf.test.ts +95 -52
  699. package/src/tests/api_tests/security/register_business_id_injection.test.ts +132 -93
  700. package/src/tests/api_tests/security/sanitize-user-html-with-iframes.test.ts +127 -0
  701. package/src/tests/api_tests/security/schema-adminonly-enforcement.test.ts +42 -37
  702. package/src/tests/api_tests/security/self-admin-role-assignment.test.ts +92 -54
  703. package/src/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.ts +76 -34
  704. package/src/tests/api_tests/security/webhook-timeout.test.ts +67 -36
  705. package/src/tests/api_tests/stedi_approval.test.ts +156 -90
  706. package/src/tests/api_tests/ticket_stage_archive.test.ts +314 -0
  707. package/src/tests/api_tests/tickets_bulk_assign_care_team.test.ts +138 -103
  708. package/src/tests/api_tests/translations.test.ts +69 -46
  709. package/src/tests/api_tests/trigger_set_fields_date_difference.test.ts +198 -256
  710. package/src/tests/api_tests/user_preferences.test.ts +227 -0
  711. package/src/tests/api_tests/webhook_error_handling.test.ts +121 -60
  712. package/src/tests/api_tests/webhook_raw_json_number.test.ts +127 -109
  713. package/src/tests/api_tests/welle_partner_token.test.ts +217 -90
  714. package/src/tests/setup_isolated.ts +7 -0
  715. package/src/tests/tests.ts +41 -147
  716. package/src/tests/{api_tests → unit_tests}/date_string_validation.test.ts +2 -23
  717. package/test_generated.pdf +0 -0
@@ -36,11 +36,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.outbound_chat_sent_trigger_tests = void 0;
39
+ exports.ISOLATED_SUITE = exports.outbound_chat_sent_trigger_tests = exports.outbound_chat_sent_trigger_checks = void 0;
40
40
  require('source-map-support').install();
41
41
  var sdk_1 = require("../../sdk");
42
42
  var testing_1 = require("@tellescope/testing");
43
- var setup_1 = require("../setup");
43
+ var setup_isolated_1 = require("../setup_isolated");
44
+ var host = process.env.API_URL || 'http://localhost:8080';
45
+ var RAND = function () { return Math.random().toString(36).slice(2, 10); };
44
46
  /**
45
47
  * Tests for the "Outbound Chat Sent" automation trigger event.
46
48
  *
@@ -50,8 +52,22 @@ var setup_1 = require("../setup");
50
52
  * 3. Multi-enduser room, inbound (one enduser's session) → neither enduser tagged or stamped
51
53
  * 4. Multi-enduser room, outbound (user session) → BOTH endusers tagged + stamped
52
54
  * 5. User session, senderId = enduser.id (backfill case) → treated as inbound: no trigger, no stamp
55
+ * 6. Autoreply chat (isAutoreply: true) → no trigger, no stamp
53
56
  *
54
- * Chats are NOT explicitly deleted — they cascade-delete from chat_rooms.
57
+ * Runs on its own provisioned tenant, which is not optional here for two reasons: the trigger it
58
+ * installs is ENTIRELY unfiltered (`info: {}`), so on the shared organization it tagged every
59
+ * outbound chat any concurrently running suite sent; and case 6 switches `outOfOfficeHours` and
60
+ * `settings.endusers.autoReplyEnabled` ON at the organization level, which made every other suite's
61
+ * inbound chats generate autoreplies while this one ran. It never calls `sdk.reset_db()`, which
62
+ * clears throttle namespaces shared with other suites.
63
+ *
64
+ * The org settings are deliberately NOT restored any more: they are this tenant's own settings, no
65
+ * other suite can observe them, and the tenant (organization record included) is deleted in the
66
+ * `finally`. For the same reason no record is deleted individually — teardown removes them all.
67
+ *
68
+ * The `wait` after each send is the trigger-processing barrier. The positive cases then poll, which
69
+ * returns immediately once the tag is visible; the "did NOT fire" cases read once after the same
70
+ * fixed wait, since polling a must-not-happen check only delays it.
55
71
  */
56
72
  var isRecent = function (value, sinceMs) {
57
73
  if (!value)
@@ -59,371 +75,303 @@ var isRecent = function (value, sinceMs) {
59
75
  var t = new Date(value).valueOf();
60
76
  return t >= sinceMs - 1000 && t <= Date.now() + 1000;
61
77
  };
62
- var outbound_chat_sent_trigger_tests = function (_a) {
63
- var sdk = _a.sdk;
64
- return __awaiter(void 0, void 0, void 0, function () {
65
- var host, TAG, endSolo, endA, endB, endBackfill, endAutoreply, trigger, roomSolo, roomGroup, roomBackfill, roomAutoreply, settingsModified, originalOutOfOfficeHours, originalAutoReplyEnabled, tokenSolo, endSoloSDK, tokenA, endASDK, soloAfterInbound, c1_notTagged, c1_noStamp, c2_sendStart, soloAfterOutbound, c2_tagged, c2_stamped, aAfterInbound, bAfterInbound, c3_aNotTagged, c3_bNotTagged, c3_neitherTagged, c3_neitherStamped, c4_sendStart, aAfterOutbound, bAfterOutbound, c4_bothTagged, c4_bothStamped, backfillAfter, c5_notTagged, c5_noStamp, originalOrg, tokenAR, endAutoreplySDK, arAfter, roomChats, sanity_autoreplySent, c6_notTagged, c6_noStamp, allPassed, err_1, cleanups, error_1;
66
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
67
- return __generator(this, function (_o) {
68
- switch (_o.label) {
69
- case 0:
70
- (0, testing_1.log_header)("Outbound Chat Sent Trigger Tests");
71
- host = process.env.API_URL || 'http://localhost:8080';
72
- TAG = "outbound-chat-sent-".concat(Date.now());
73
- settingsModified = false;
74
- originalOutOfOfficeHours = [];
75
- originalAutoReplyEnabled = false;
76
- _o.label = 1;
77
- case 1:
78
- _o.trys.push([1, , 38, 46]);
79
- return [4 /*yield*/, sdk.api.endusers.createOne({ fname: 'Solo', lname: 'Patient' })];
80
- case 2:
81
- // ── Endusers ──────────────────────────────────────────────────────
82
- endSolo = _o.sent();
83
- return [4 /*yield*/, sdk.api.endusers.createOne({ fname: 'GroupA', lname: 'Patient' })];
84
- case 3:
85
- endA = _o.sent();
86
- return [4 /*yield*/, sdk.api.endusers.createOne({ fname: 'GroupB', lname: 'Patient' })];
87
- case 4:
88
- endB = _o.sent();
89
- return [4 /*yield*/, sdk.api.endusers.createOne({ fname: 'Backfill', lname: 'Patient' })];
90
- case 5:
91
- endBackfill = _o.sent();
92
- console.log("Created endusers: solo=".concat(endSolo.id, ", A=").concat(endA.id, ", B=").concat(endB.id, ", backfill=").concat(endBackfill.id));
93
- return [4 /*yield*/, sdk.api.endusers.generate_auth_token({ id: endSolo.id })];
94
- case 6:
95
- tokenSolo = (_o.sent()).authToken;
96
- endSoloSDK = new sdk_1.EnduserSession({ host: host, authToken: tokenSolo, businessId: sdk.userInfo.businessId });
97
- return [4 /*yield*/, sdk.api.endusers.generate_auth_token({ id: endA.id })];
98
- case 7:
99
- tokenA = (_o.sent()).authToken;
100
- endASDK = new sdk_1.EnduserSession({ host: host, authToken: tokenA, businessId: sdk.userInfo.businessId });
101
- return [4 /*yield*/, sdk.api.automation_triggers.createOne({
102
- title: "Outbound Chat Sent Test ".concat(Date.now()),
103
- status: 'Active',
104
- event: { type: 'Outbound Chat Sent', info: {} },
105
- action: { type: 'Add Tags', info: { tags: [TAG] } },
106
- })];
107
- case 8:
108
- // ── Trigger ───────────────────────────────────────────────────────
109
- trigger = _o.sent();
110
- console.log("Created trigger: ".concat(trigger.id));
111
- return [4 /*yield*/, sdk.api.chat_rooms.createOne({
112
- userIds: [sdk.userInfo.id],
113
- enduserIds: [endSolo.id],
114
- })];
115
- case 9:
116
- // ── Rooms ─────────────────────────────────────────────────────────
117
- roomSolo = _o.sent();
118
- return [4 /*yield*/, sdk.api.chat_rooms.createOne({
119
- userIds: [sdk.userInfo.id],
120
- enduserIds: [endA.id, endB.id],
121
- })];
122
- case 10:
123
- roomGroup = _o.sent();
124
- return [4 /*yield*/, sdk.api.chat_rooms.createOne({
125
- userIds: [sdk.userInfo.id],
126
- enduserIds: [endBackfill.id],
127
- })];
128
- case 11:
129
- roomBackfill = _o.sent();
130
- console.log("Created rooms: solo=".concat(roomSolo.id, ", group=").concat(roomGroup.id, ", backfill=").concat(roomBackfill.id));
131
- // ═════════════════════════════════════════════════════════════════
132
- // Case 1: Single-enduser inbound (enduser session)
133
- // ═════════════════════════════════════════════════════════════════
134
- return [4 /*yield*/, endSoloSDK.api.chats.createOne({
135
- roomId: roomSolo.id,
136
- message: 'solo inbound from enduser',
137
- })];
138
- case 12:
139
- // ═════════════════════════════════════════════════════════════════
140
- // Case 1: Single-enduser inbound (enduser session)
141
- // ═════════════════════════════════════════════════════════════════
142
- _o.sent();
143
- return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
144
- case 13:
145
- _o.sent();
146
- return [4 /*yield*/, sdk.api.endusers.getOne(endSolo.id)];
147
- case 14:
148
- soloAfterInbound = _o.sent();
149
- c1_notTagged = !((_b = soloAfterInbound.tags) === null || _b === void 0 ? void 0 : _b.includes(TAG));
150
- c1_noStamp = !soloAfterInbound.recentOutboundChatAt;
151
- console.log(c1_notTagged
152
- ? "\u2705 [1] Solo inbound did NOT fire trigger"
153
- : "\u274C [1] Solo inbound fired trigger. tags=".concat(JSON.stringify(soloAfterInbound.tags)));
154
- console.log(c1_noStamp
155
- ? "\u2705 [1] Solo inbound did NOT set recentOutboundChatAt"
156
- : "\u274C [1] Solo inbound set recentOutboundChatAt=".concat(soloAfterInbound.recentOutboundChatAt));
157
- c2_sendStart = Date.now();
158
- return [4 /*yield*/, sdk.api.chats.createOne({
159
- roomId: roomSolo.id,
160
- message: 'solo outbound from user',
161
- senderId: sdk.userInfo.id,
162
- })];
163
- case 15:
164
- _o.sent();
165
- return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
166
- case 16:
167
- _o.sent();
168
- return [4 /*yield*/, sdk.api.endusers.getOne(endSolo.id)];
169
- case 17:
170
- soloAfterOutbound = _o.sent();
171
- c2_tagged = !!((_c = soloAfterOutbound.tags) === null || _c === void 0 ? void 0 : _c.includes(TAG));
172
- c2_stamped = isRecent(soloAfterOutbound.recentOutboundChatAt, c2_sendStart);
173
- console.log(c2_tagged
174
- ? "\u2705 [2] Solo outbound fired trigger"
175
- : "\u274C [2] Solo outbound did NOT fire trigger. tags=".concat(JSON.stringify(soloAfterOutbound.tags)));
176
- console.log(c2_stamped
177
- ? "\u2705 [2] Solo outbound set recentOutboundChatAt=".concat(soloAfterOutbound.recentOutboundChatAt)
178
- : "\u274C [2] Solo outbound did not set a recent recentOutboundChatAt. got=".concat(soloAfterOutbound.recentOutboundChatAt));
179
- // ═════════════════════════════════════════════════════════════════
180
- // Case 3: Multi-enduser inbound (endA sends in [A, B] room)
181
- // ═════════════════════════════════════════════════════════════════
182
- return [4 /*yield*/, endASDK.api.chats.createOne({
183
- roomId: roomGroup.id,
184
- message: 'group inbound from endA',
185
- })];
186
- case 18:
187
- // ═════════════════════════════════════════════════════════════════
188
- // Case 3: Multi-enduser inbound (endA sends in [A, B] room)
189
- // ═════════════════════════════════════════════════════════════════
190
- _o.sent();
191
- return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
192
- case 19:
193
- _o.sent();
194
- return [4 /*yield*/, sdk.api.endusers.getOne(endA.id)];
195
- case 20:
196
- aAfterInbound = _o.sent();
197
- return [4 /*yield*/, sdk.api.endusers.getOne(endB.id)];
198
- case 21:
199
- bAfterInbound = _o.sent();
200
- c3_aNotTagged = !((_d = aAfterInbound.tags) === null || _d === void 0 ? void 0 : _d.includes(TAG));
201
- c3_bNotTagged = !((_e = bAfterInbound.tags) === null || _e === void 0 ? void 0 : _e.includes(TAG));
202
- c3_neitherTagged = c3_aNotTagged && c3_bNotTagged;
203
- c3_neitherStamped = !aAfterInbound.recentOutboundChatAt && !bAfterInbound.recentOutboundChatAt;
204
- console.log(c3_neitherTagged
205
- ? "\u2705 [3] Group inbound did NOT fire trigger on either enduser"
206
- : "\u274C [3] Group inbound fired trigger. A tags=".concat(JSON.stringify(aAfterInbound.tags), " B tags=").concat(JSON.stringify(bAfterInbound.tags)));
207
- console.log(c3_neitherStamped
208
- ? "\u2705 [3] Group inbound did NOT set recentOutboundChatAt on either enduser"
209
- : "\u274C [3] Group inbound stamped recentOutboundChatAt. A=".concat(aAfterInbound.recentOutboundChatAt, " B=").concat(bAfterInbound.recentOutboundChatAt));
210
- c4_sendStart = Date.now();
211
- return [4 /*yield*/, sdk.api.chats.createOne({
212
- roomId: roomGroup.id,
213
- message: 'group outbound from user',
214
- senderId: sdk.userInfo.id,
215
- })];
216
- case 22:
217
- _o.sent();
218
- return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
219
- case 23:
220
- _o.sent();
221
- return [4 /*yield*/, sdk.api.endusers.getOne(endA.id)];
222
- case 24:
223
- aAfterOutbound = _o.sent();
224
- return [4 /*yield*/, sdk.api.endusers.getOne(endB.id)];
225
- case 25:
226
- bAfterOutbound = _o.sent();
227
- c4_bothTagged = !!((_f = aAfterOutbound.tags) === null || _f === void 0 ? void 0 : _f.includes(TAG)) && !!((_g = bAfterOutbound.tags) === null || _g === void 0 ? void 0 : _g.includes(TAG));
228
- c4_bothStamped = isRecent(aAfterOutbound.recentOutboundChatAt, c4_sendStart)
229
- && isRecent(bAfterOutbound.recentOutboundChatAt, c4_sendStart);
230
- console.log(c4_bothTagged
231
- ? "\u2705 [4] Group outbound fired trigger on BOTH endusers"
232
- : "\u274C [4] Group outbound did not tag both. A tags=".concat(JSON.stringify(aAfterOutbound.tags), " B tags=").concat(JSON.stringify(bAfterOutbound.tags)));
233
- console.log(c4_bothStamped
234
- ? "\u2705 [4] Group outbound set recentOutboundChatAt on BOTH endusers"
235
- : "\u274C [4] Group outbound did not stamp both. A=".concat(aAfterOutbound.recentOutboundChatAt, " B=").concat(bAfterOutbound.recentOutboundChatAt));
236
- // ═════════════════════════════════════════════════════════════════
237
- // Case 5: User session, senderId = enduser.id (backfill)
238
- // ═════════════════════════════════════════════════════════════════
239
- return [4 /*yield*/, sdk.api.chats.createOne({
240
- roomId: roomBackfill.id,
241
- message: 'backfilled inbound (user session, enduser senderId)',
242
- senderId: endBackfill.id,
243
- })];
244
- case 26:
245
- // ═════════════════════════════════════════════════════════════════
246
- // Case 5: User session, senderId = enduser.id (backfill)
247
- // ═════════════════════════════════════════════════════════════════
248
- _o.sent();
249
- return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
250
- case 27:
251
- _o.sent();
252
- return [4 /*yield*/, sdk.api.endusers.getOne(endBackfill.id)];
253
- case 28:
254
- backfillAfter = _o.sent();
255
- c5_notTagged = !((_h = backfillAfter.tags) === null || _h === void 0 ? void 0 : _h.includes(TAG));
256
- c5_noStamp = !backfillAfter.recentOutboundChatAt;
257
- console.log(c5_notTagged
258
- ? "\u2705 [5] Backfill (user-session + enduser senderId) did NOT fire trigger"
259
- : "\u274C [5] Backfill fired trigger. tags=".concat(JSON.stringify(backfillAfter.tags)));
260
- console.log(c5_noStamp
261
- ? "\u2705 [5] Backfill did NOT set recentOutboundChatAt"
262
- : "\u274C [5] Backfill set recentOutboundChatAt=".concat(backfillAfter.recentOutboundChatAt));
263
- return [4 /*yield*/, sdk.api.organizations.getOne(sdk.userInfo.businessId)];
264
- case 29:
265
- originalOrg = _o.sent();
266
- originalOutOfOfficeHours = (_j = originalOrg.outOfOfficeHours) !== null && _j !== void 0 ? _j : [];
267
- originalAutoReplyEnabled = !!((_l = (_k = originalOrg.settings) === null || _k === void 0 ? void 0 : _k.endusers) === null || _l === void 0 ? void 0 : _l.autoReplyEnabled);
268
- settingsModified = true;
269
- return [4 /*yield*/, sdk.api.organizations.updateOne(sdk.userInfo.businessId, {
270
- outOfOfficeHours: [{
271
- from: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
272
- to: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
273
- autoreplyText: 'OOO autoreply (test)',
274
- }],
275
- settings: { endusers: { autoReplyEnabled: true } },
276
- }, { replaceObjectFields: true })];
277
- case 30:
278
- _o.sent();
279
- return [4 /*yield*/, sdk.api.endusers.createOne({ fname: 'Autoreply', lname: 'Patient' })];
280
- case 31:
281
- endAutoreply = _o.sent();
282
- return [4 /*yield*/, sdk.api.endusers.generate_auth_token({ id: endAutoreply.id })];
283
- case 32:
284
- tokenAR = (_o.sent()).authToken;
285
- endAutoreplySDK = new sdk_1.EnduserSession({ host: host, authToken: tokenAR, businessId: sdk.userInfo.businessId });
286
- return [4 /*yield*/, sdk.api.chat_rooms.createOne({
287
- userIds: [sdk.userInfo.id],
288
- enduserIds: [endAutoreply.id],
289
- })];
290
- case 33:
291
- roomAutoreply = _o.sent();
292
- return [4 /*yield*/, endAutoreplySDK.api.chats.createOne({
293
- roomId: roomAutoreply.id,
294
- message: 'trigger an autoreply',
295
- })
296
- // Autoreply path involves an extra org/user lookup + insert before
297
- // handle_chat_create re-runs against the autoreply chat.
298
- ];
299
- case 34:
300
- _o.sent();
78
+ var outbound_chat_sent_trigger_checks = function () { return __awaiter(void 0, void 0, void 0, function () {
79
+ var checks, record, TAG, tenant, sdk_2, endSolo_1, endA_1, endB_1, endBackfill, tokenSolo, endSoloSDK, tokenA, endASDK, trigger, roomSolo, roomGroup, roomBackfill, soloAfterInbound, c2_sendStart, soloAfterOutbound, aAfterInbound, bAfterInbound, c4_sendStart, _a, aAfterOutbound, bAfterOutbound, backfillAfter, endAutoreply, tokenAR, endAutoreplySDK, roomAutoreply_1, roomChats, sanity_autoreplySent, arAfter, e_1;
80
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
81
+ return __generator(this, function (_t) {
82
+ switch (_t.label) {
83
+ case 0:
84
+ checks = [];
85
+ record = function (label, pass, detail) { return checks.push({ label: label, pass: pass, detail: detail }); };
86
+ TAG = "outbound-chat-sent-".concat(Date.now());
87
+ _t.label = 1;
88
+ case 1:
89
+ _t.trys.push([1, , 38, 43]);
90
+ return [4 /*yield*/, (0, setup_isolated_1.setup_isolated_tenant)({
91
+ name: "Outbound Chat Sent trigger ".concat(RAND()),
92
+ users: [{ isAdmin: true }],
93
+ apiKeys: 0,
94
+ })];
95
+ case 2:
96
+ tenant = _t.sent();
97
+ sdk_2 = tenant.sdk;
98
+ return [4 /*yield*/, sdk_2.api.endusers.createOne({ fname: 'Solo', lname: 'Patient' })];
99
+ case 3:
100
+ endSolo_1 = _t.sent();
101
+ return [4 /*yield*/, sdk_2.api.endusers.createOne({ fname: 'GroupA', lname: 'Patient' })];
102
+ case 4:
103
+ endA_1 = _t.sent();
104
+ return [4 /*yield*/, sdk_2.api.endusers.createOne({ fname: 'GroupB', lname: 'Patient' })];
105
+ case 5:
106
+ endB_1 = _t.sent();
107
+ return [4 /*yield*/, sdk_2.api.endusers.createOne({ fname: 'Backfill', lname: 'Patient' })];
108
+ case 6:
109
+ endBackfill = _t.sent();
110
+ console.log("Created endusers: solo=".concat(endSolo_1.id, ", A=").concat(endA_1.id, ", B=").concat(endB_1.id, ", backfill=").concat(endBackfill.id));
111
+ return [4 /*yield*/, sdk_2.api.endusers.generate_auth_token({ id: endSolo_1.id })];
112
+ case 7:
113
+ tokenSolo = (_t.sent()).authToken;
114
+ endSoloSDK = new sdk_1.EnduserSession({ host: host, authToken: tokenSolo, businessId: tenant.businessId });
115
+ return [4 /*yield*/, sdk_2.api.endusers.generate_auth_token({ id: endA_1.id })];
116
+ case 8:
117
+ tokenA = (_t.sent()).authToken;
118
+ endASDK = new sdk_1.EnduserSession({ host: host, authToken: tokenA, businessId: tenant.businessId });
119
+ return [4 /*yield*/, sdk_2.api.automation_triggers.createOne({
120
+ title: "Outbound Chat Sent Test ".concat(Date.now()),
121
+ status: 'Active',
122
+ event: { type: 'Outbound Chat Sent', info: {} },
123
+ action: { type: 'Add Tags', info: { tags: [TAG] } },
124
+ })];
125
+ case 9:
126
+ trigger = _t.sent();
127
+ console.log("Created trigger: ".concat(trigger.id));
128
+ return [4 /*yield*/, sdk_2.api.chat_rooms.createOne({
129
+ userIds: [sdk_2.userInfo.id],
130
+ enduserIds: [endSolo_1.id],
131
+ })];
132
+ case 10:
133
+ roomSolo = _t.sent();
134
+ return [4 /*yield*/, sdk_2.api.chat_rooms.createOne({
135
+ userIds: [sdk_2.userInfo.id],
136
+ enduserIds: [endA_1.id, endB_1.id],
137
+ })];
138
+ case 11:
139
+ roomGroup = _t.sent();
140
+ return [4 /*yield*/, sdk_2.api.chat_rooms.createOne({
141
+ userIds: [sdk_2.userInfo.id],
142
+ enduserIds: [endBackfill.id],
143
+ })];
144
+ case 12:
145
+ roomBackfill = _t.sent();
146
+ console.log("Created rooms: solo=".concat(roomSolo.id, ", group=").concat(roomGroup.id, ", backfill=").concat(roomBackfill.id));
147
+ // ═════════════════════════════════════════════════════════════════
148
+ // Case 1: Single-enduser inbound (enduser session)
149
+ // ═════════════════════════════════════════════════════════════════
150
+ return [4 /*yield*/, endSoloSDK.api.chats.createOne({
151
+ roomId: roomSolo.id,
152
+ message: 'solo inbound from enduser',
153
+ })];
154
+ case 13:
155
+ // ═════════════════════════════════════════════════════════════════
156
+ // Case 1: Single-enduser inbound (enduser session)
157
+ // ═════════════════════════════════════════════════════════════════
158
+ _t.sent();
159
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
160
+ case 14:
161
+ _t.sent();
162
+ return [4 /*yield*/, sdk_2.api.endusers.getOne(endSolo_1.id)];
163
+ case 15:
164
+ soloAfterInbound = _t.sent();
165
+ record('[1] Solo inbound did NOT fire trigger', !((_b = soloAfterInbound.tags) === null || _b === void 0 ? void 0 : _b.includes(TAG)), "tags=".concat(JSON.stringify(soloAfterInbound.tags), " expected to exclude ").concat(TAG));
166
+ record('[1] Solo inbound did NOT set recentOutboundChatAt', !soloAfterInbound.recentOutboundChatAt, "recentOutboundChatAt=".concat((_c = soloAfterInbound.recentOutboundChatAt) !== null && _c !== void 0 ? _c : '(unset)'));
167
+ c2_sendStart = Date.now();
168
+ return [4 /*yield*/, sdk_2.api.chats.createOne({
169
+ roomId: roomSolo.id,
170
+ message: 'solo outbound from user',
171
+ senderId: sdk_2.userInfo.id,
172
+ })];
173
+ case 16:
174
+ _t.sent();
175
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
176
+ case 17:
177
+ _t.sent();
178
+ return [4 /*yield*/, (0, testing_1.poll_for_results)(function () { return sdk_2.api.endusers.getOne(endSolo_1.id); }, function (e) { var _a; return !!((_a = e.tags) === null || _a === void 0 ? void 0 : _a.includes(TAG)) && !!e.recentOutboundChatAt; })];
179
+ case 18:
180
+ soloAfterOutbound = _t.sent();
181
+ record('[2] Solo outbound fired trigger', !!((_d = soloAfterOutbound.tags) === null || _d === void 0 ? void 0 : _d.includes(TAG)), "tags=".concat(JSON.stringify(soloAfterOutbound.tags), " expected to include ").concat(TAG));
182
+ record('[2] Solo outbound set a recent recentOutboundChatAt', isRecent(soloAfterOutbound.recentOutboundChatAt, c2_sendStart), "recentOutboundChatAt=".concat((_e = soloAfterOutbound.recentOutboundChatAt) !== null && _e !== void 0 ? _e : '(unset)')
183
+ + " sendStart=".concat(new Date(c2_sendStart).toISOString()));
184
+ // ═════════════════════════════════════════════════════════════════
185
+ // Case 3: Multi-enduser inbound (endA sends in [A, B] room)
186
+ // ═════════════════════════════════════════════════════════════════
187
+ return [4 /*yield*/, endASDK.api.chats.createOne({
188
+ roomId: roomGroup.id,
189
+ message: 'group inbound from endA',
190
+ })];
191
+ case 19:
192
+ // ═════════════════════════════════════════════════════════════════
193
+ // Case 3: Multi-enduser inbound (endA sends in [A, B] room)
194
+ // ═════════════════════════════════════════════════════════════════
195
+ _t.sent();
196
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
197
+ case 20:
198
+ _t.sent();
199
+ return [4 /*yield*/, sdk_2.api.endusers.getOne(endA_1.id)];
200
+ case 21:
201
+ aAfterInbound = _t.sent();
202
+ return [4 /*yield*/, sdk_2.api.endusers.getOne(endB_1.id)];
203
+ case 22:
204
+ bAfterInbound = _t.sent();
205
+ record('[3] Group inbound did NOT fire trigger on either enduser', !((_f = aAfterInbound.tags) === null || _f === void 0 ? void 0 : _f.includes(TAG)) && !((_g = bAfterInbound.tags) === null || _g === void 0 ? void 0 : _g.includes(TAG)), "A tags=".concat(JSON.stringify(aAfterInbound.tags), " B tags=").concat(JSON.stringify(bAfterInbound.tags))
206
+ + " expected both to exclude ".concat(TAG));
207
+ record('[3] Group inbound did NOT set recentOutboundChatAt on either enduser', !aAfterInbound.recentOutboundChatAt && !bAfterInbound.recentOutboundChatAt, "A=".concat((_h = aAfterInbound.recentOutboundChatAt) !== null && _h !== void 0 ? _h : '(unset)', " B=").concat((_j = bAfterInbound.recentOutboundChatAt) !== null && _j !== void 0 ? _j : '(unset)'));
208
+ c4_sendStart = Date.now();
209
+ return [4 /*yield*/, sdk_2.api.chats.createOne({
210
+ roomId: roomGroup.id,
211
+ message: 'group outbound from user',
212
+ senderId: sdk_2.userInfo.id,
213
+ })];
214
+ case 23:
215
+ _t.sent();
216
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
217
+ case 24:
218
+ _t.sent();
219
+ return [4 /*yield*/, (0, testing_1.poll_for_results)(function () { return Promise.all([sdk_2.api.endusers.getOne(endA_1.id), sdk_2.api.endusers.getOne(endB_1.id)]); }, function (_a) {
220
+ var _b, _c;
221
+ var a = _a[0], b = _a[1];
222
+ return (!!((_b = a.tags) === null || _b === void 0 ? void 0 : _b.includes(TAG)) && !!a.recentOutboundChatAt
223
+ && !!((_c = b.tags) === null || _c === void 0 ? void 0 : _c.includes(TAG)) && !!b.recentOutboundChatAt);
224
+ })];
225
+ case 25:
226
+ _a = _t.sent(), aAfterOutbound = _a[0], bAfterOutbound = _a[1];
227
+ record('[4] Group outbound fired trigger on BOTH endusers', !!((_k = aAfterOutbound.tags) === null || _k === void 0 ? void 0 : _k.includes(TAG)) && !!((_l = bAfterOutbound.tags) === null || _l === void 0 ? void 0 : _l.includes(TAG)), "A tags=".concat(JSON.stringify(aAfterOutbound.tags), " B tags=").concat(JSON.stringify(bAfterOutbound.tags))
228
+ + " expected both to include ".concat(TAG));
229
+ record('[4] Group outbound set recentOutboundChatAt on BOTH endusers', isRecent(aAfterOutbound.recentOutboundChatAt, c4_sendStart)
230
+ && isRecent(bAfterOutbound.recentOutboundChatAt, c4_sendStart), "A=".concat((_m = aAfterOutbound.recentOutboundChatAt) !== null && _m !== void 0 ? _m : '(unset)', " B=").concat((_o = bAfterOutbound.recentOutboundChatAt) !== null && _o !== void 0 ? _o : '(unset)')
231
+ + " sendStart=".concat(new Date(c4_sendStart).toISOString()));
232
+ // ═════════════════════════════════════════════════════════════════
233
+ // Case 5: User session, senderId = enduser.id (backfill)
234
+ // ═════════════════════════════════════════════════════════════════
235
+ return [4 /*yield*/, sdk_2.api.chats.createOne({
236
+ roomId: roomBackfill.id,
237
+ message: 'backfilled inbound (user session, enduser senderId)',
238
+ senderId: endBackfill.id,
239
+ })];
240
+ case 26:
241
+ // ═════════════════════════════════════════════════════════════════
242
+ // Case 5: User session, senderId = enduser.id (backfill)
243
+ // ═════════════════════════════════════════════════════════════════
244
+ _t.sent();
245
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 2000)];
246
+ case 27:
247
+ _t.sent();
248
+ return [4 /*yield*/, sdk_2.api.endusers.getOne(endBackfill.id)];
249
+ case 28:
250
+ backfillAfter = _t.sent();
251
+ record('[5] Backfill (user-session + enduser senderId) did NOT fire trigger', !((_p = backfillAfter.tags) === null || _p === void 0 ? void 0 : _p.includes(TAG)), "tags=".concat(JSON.stringify(backfillAfter.tags), " expected to exclude ").concat(TAG));
252
+ record('[5] Backfill did NOT set recentOutboundChatAt', !backfillAfter.recentOutboundChatAt, "recentOutboundChatAt=".concat((_q = backfillAfter.recentOutboundChatAt) !== null && _q !== void 0 ? _q : '(unset)'));
253
+ // ═════════════════════════════════════════════════════════════════
254
+ // Case 6: Autoreply — enduser inbound triggers an org autoreply.
255
+ // The autoreply chat (isAutoreply: true) MUST NOT fire the trigger
256
+ // or stamp recentOutboundChatAt.
257
+ //
258
+ // Setup requires enabling org autoreply with an OOO window covering
259
+ // "now" (is_out_of_office returns false on empty config). These are
260
+ // this tenant's own settings and go away with it at teardown.
261
+ // ═════════════════════════════════════════════════════════════════
262
+ return [4 /*yield*/, sdk_2.api.organizations.updateOne(tenant.businessId, {
263
+ outOfOfficeHours: [{
264
+ from: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
265
+ to: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
266
+ autoreplyText: 'OOO autoreply (test)',
267
+ }],
268
+ settings: { endusers: { autoReplyEnabled: true } },
269
+ }, { replaceObjectFields: true })];
270
+ case 29:
271
+ // ═════════════════════════════════════════════════════════════════
272
+ // Case 6: Autoreply — enduser inbound triggers an org autoreply.
273
+ // The autoreply chat (isAutoreply: true) MUST NOT fire the trigger
274
+ // or stamp recentOutboundChatAt.
275
+ //
276
+ // Setup requires enabling org autoreply with an OOO window covering
277
+ // "now" (is_out_of_office returns false on empty config). These are
278
+ // this tenant's own settings and go away with it at teardown.
279
+ // ═════════════════════════════════════════════════════════════════
280
+ _t.sent();
281
+ return [4 /*yield*/, sdk_2.api.endusers.createOne({ fname: 'Autoreply', lname: 'Patient' })];
282
+ case 30:
283
+ endAutoreply = _t.sent();
284
+ return [4 /*yield*/, sdk_2.api.endusers.generate_auth_token({ id: endAutoreply.id })];
285
+ case 31:
286
+ tokenAR = (_t.sent()).authToken;
287
+ endAutoreplySDK = new sdk_1.EnduserSession({ host: host, authToken: tokenAR, businessId: tenant.businessId });
288
+ return [4 /*yield*/, sdk_2.api.chat_rooms.createOne({
289
+ userIds: [sdk_2.userInfo.id],
290
+ enduserIds: [endAutoreply.id],
291
+ })];
292
+ case 32:
293
+ roomAutoreply_1 = _t.sent();
294
+ return [4 /*yield*/, endAutoreplySDK.api.chats.createOne({
295
+ roomId: roomAutoreply_1.id,
296
+ message: 'trigger an autoreply',
297
+ })
301
298
  // Autoreply path involves an extra org/user lookup + insert before
302
299
  // handle_chat_create re-runs against the autoreply chat.
303
- return [4 /*yield*/, (0, testing_1.wait)(undefined, 4000)];
304
- case 35:
305
- // Autoreply path involves an extra org/user lookup + insert before
306
- // handle_chat_create re-runs against the autoreply chat.
307
- _o.sent();
308
- return [4 /*yield*/, sdk.api.endusers.getOne(endAutoreply.id)];
309
- case 36:
310
- arAfter = _o.sent();
311
- return [4 /*yield*/, sdk.api.chats.getSome({ filter: { roomId: roomAutoreply.id } })];
312
- case 37:
313
- roomChats = _o.sent();
314
- sanity_autoreplySent = roomChats.some(function (c) { return c.isAutoreply === true; });
315
- c6_notTagged = !((_m = arAfter.tags) === null || _m === void 0 ? void 0 : _m.includes(TAG));
316
- c6_noStamp = !arAfter.recentOutboundChatAt;
317
- console.log(sanity_autoreplySent
318
- ? "\u2705 [6] Autoreply chat was sent (sanity check)"
319
- : "\u274C [6] No autoreply chat found in room \u2014 test setup invalid. Cannot validate trigger skip.");
320
- console.log(c6_notTagged
321
- ? "\u2705 [6] Autoreply did NOT fire trigger"
322
- : "\u274C [6] Autoreply fired trigger. tags=".concat(JSON.stringify(arAfter.tags)));
323
- console.log(c6_noStamp
324
- ? "\u2705 [6] Autoreply did NOT set recentOutboundChatAt"
325
- : "\u274C [6] Autoreply set recentOutboundChatAt=".concat(arAfter.recentOutboundChatAt));
326
- // ── Summary ───────────────────────────────────────────────────────
327
- console.log("\n=== Outbound Chat Sent Trigger Test Results ===");
328
- console.log("[1] Solo inbound \u2014 no trigger: ".concat(c1_notTagged ? '✅' : '❌'));
329
- console.log("[1] Solo inbound \u2014 no stamp: ".concat(c1_noStamp ? '✅' : '❌'));
330
- console.log("[2] Solo outbound \u2014 trigger: ".concat(c2_tagged ? '✅' : '❌'));
331
- console.log("[2] Solo outbound \u2014 stamp: ".concat(c2_stamped ? '✅' : '❌'));
332
- console.log("[3] Group inbound \u2014 no trigger (both): ".concat(c3_neitherTagged ? '✅' : '❌'));
333
- console.log("[3] Group inbound \u2014 no stamp (both): ".concat(c3_neitherStamped ? '✅' : '❌'));
334
- console.log("[4] Group outbound \u2014 trigger (both): ".concat(c4_bothTagged ? '✅' : '❌'));
335
- console.log("[4] Group outbound \u2014 stamp (both): ".concat(c4_bothStamped ? '✅' : '❌'));
336
- console.log("[5] Backfill \u2014 no trigger: ".concat(c5_notTagged ? '✅' : '❌'));
337
- console.log("[5] Backfill \u2014 no stamp: ".concat(c5_noStamp ? '✅' : '❌'));
338
- console.log("[6] Autoreply \u2014 sanity sent: ".concat(sanity_autoreplySent ? '✅' : '❌'));
339
- console.log("[6] Autoreply \u2014 no trigger: ".concat(c6_notTagged ? '✅' : '❌'));
340
- console.log("[6] Autoreply \u2014 no stamp: ".concat(c6_noStamp ? '✅' : '❌'));
341
- allPassed = c1_notTagged && c1_noStamp
342
- && c2_tagged && c2_stamped
343
- && c3_neitherTagged && c3_neitherStamped
344
- && c4_bothTagged && c4_bothStamped
345
- && c5_notTagged && c5_noStamp
346
- && sanity_autoreplySent && c6_notTagged && c6_noStamp;
347
- if (!allPassed) {
348
- throw new Error('Outbound Chat Sent trigger tests failed');
349
- }
350
- return [2 /*return*/, { success: true }];
351
- case 38:
352
- _o.trys.push([38, 44, , 45]);
353
- if (!settingsModified) return [3 /*break*/, 42];
354
- _o.label = 39;
355
- case 39:
356
- _o.trys.push([39, 41, , 42]);
357
- return [4 /*yield*/, sdk.api.organizations.updateOne(sdk.userInfo.businessId, {
358
- outOfOfficeHours: originalOutOfOfficeHours,
359
- settings: { endusers: { autoReplyEnabled: originalAutoReplyEnabled } },
360
- }, { replaceObjectFields: true })];
361
- case 40:
362
- _o.sent();
363
- console.log("Restored org settings (autoReplyEnabled=".concat(originalAutoReplyEnabled, ", outOfOfficeHours.length=").concat(originalOutOfOfficeHours.length, ")"));
364
- return [3 /*break*/, 42];
365
- case 41:
366
- err_1 = _o.sent();
367
- console.error("\u274C Failed to restore org settings \u2014 manual cleanup may be required: ".concat(err_1));
368
- return [3 /*break*/, 42];
369
- case 42:
370
- cleanups = [];
371
- if (trigger === null || trigger === void 0 ? void 0 : trigger.id)
372
- cleanups.push(sdk.api.automation_triggers.deleteOne(trigger.id).catch(function () { }));
373
- if (roomSolo === null || roomSolo === void 0 ? void 0 : roomSolo.id)
374
- cleanups.push(sdk.api.chat_rooms.deleteOne(roomSolo.id).catch(function () { }));
375
- if (roomGroup === null || roomGroup === void 0 ? void 0 : roomGroup.id)
376
- cleanups.push(sdk.api.chat_rooms.deleteOne(roomGroup.id).catch(function () { }));
377
- if (roomBackfill === null || roomBackfill === void 0 ? void 0 : roomBackfill.id)
378
- cleanups.push(sdk.api.chat_rooms.deleteOne(roomBackfill.id).catch(function () { }));
379
- if (roomAutoreply === null || roomAutoreply === void 0 ? void 0 : roomAutoreply.id)
380
- cleanups.push(sdk.api.chat_rooms.deleteOne(roomAutoreply.id).catch(function () { }));
381
- if (endSolo === null || endSolo === void 0 ? void 0 : endSolo.id)
382
- cleanups.push(sdk.api.endusers.deleteOne(endSolo.id).catch(function () { }));
383
- if (endA === null || endA === void 0 ? void 0 : endA.id)
384
- cleanups.push(sdk.api.endusers.deleteOne(endA.id).catch(function () { }));
385
- if (endB === null || endB === void 0 ? void 0 : endB.id)
386
- cleanups.push(sdk.api.endusers.deleteOne(endB.id).catch(function () { }));
387
- if (endBackfill === null || endBackfill === void 0 ? void 0 : endBackfill.id)
388
- cleanups.push(sdk.api.endusers.deleteOne(endBackfill.id).catch(function () { }));
389
- if (endAutoreply === null || endAutoreply === void 0 ? void 0 : endAutoreply.id)
390
- cleanups.push(sdk.api.endusers.deleteOne(endAutoreply.id).catch(function () { }));
391
- return [4 /*yield*/, Promise.all(cleanups)];
392
- case 43:
393
- _o.sent();
394
- console.log("Outbound Chat Sent trigger test cleanup completed");
395
- return [3 /*break*/, 45];
396
- case 44:
397
- error_1 = _o.sent();
398
- console.error("Cleanup error: ".concat(error_1));
399
- return [3 /*break*/, 45];
400
- case 45: return [7 /*endfinally*/];
401
- case 46: return [2 /*return*/];
402
- }
403
- });
300
+ ];
301
+ case 33:
302
+ _t.sent();
303
+ // Autoreply path involves an extra org/user lookup + insert before
304
+ // handle_chat_create re-runs against the autoreply chat.
305
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 4000)];
306
+ case 34:
307
+ // Autoreply path involves an extra org/user lookup + insert before
308
+ // handle_chat_create re-runs against the autoreply chat.
309
+ _t.sent();
310
+ return [4 /*yield*/, (0, testing_1.poll_for_results)(function () { return sdk_2.api.chats.getSome({ filter: { roomId: roomAutoreply_1.id } }); }, function (cs) { return cs.some(function (c) { return c.isAutoreply === true; }); })];
311
+ case 35:
312
+ roomChats = _t.sent();
313
+ sanity_autoreplySent = roomChats.some(function (c) { return c.isAutoreply === true; });
314
+ record('[6] Autoreply chat was sent (sanity check)', sanity_autoreplySent, sanity_autoreplySent
315
+ ? "".concat(roomChats.length, " chat(s) in the room, one of them isAutoreply")
316
+ : "no autoreply chat found in room \u2014 test setup invalid, the trigger skip is NOT validated."
317
+ + " chats=".concat(JSON.stringify(roomChats.map(function (c) { return ({ id: c.id, isAutoreply: c.isAutoreply }); }))));
318
+ // Only read the enduser once the autoreply chat exists, plus a barrier: the negative checks
319
+ // below would pass vacuously if the chat the trigger must ignore had not been written yet.
320
+ return [4 /*yield*/, (0, testing_1.wait)(undefined, 1000)];
321
+ case 36:
322
+ // Only read the enduser once the autoreply chat exists, plus a barrier: the negative checks
323
+ // below would pass vacuously if the chat the trigger must ignore had not been written yet.
324
+ _t.sent();
325
+ return [4 /*yield*/, sdk_2.api.endusers.getOne(endAutoreply.id)];
326
+ case 37:
327
+ arAfter = _t.sent();
328
+ record('[6] Autoreply did NOT fire trigger', !((_r = arAfter.tags) === null || _r === void 0 ? void 0 : _r.includes(TAG)), "tags=".concat(JSON.stringify(arAfter.tags), " expected to exclude ").concat(TAG));
329
+ record('[6] Autoreply did NOT set recentOutboundChatAt', !arAfter.recentOutboundChatAt, "recentOutboundChatAt=".concat((_s = arAfter.recentOutboundChatAt) !== null && _s !== void 0 ? _s : '(unset)'));
330
+ return [3 /*break*/, 43];
331
+ case 38:
332
+ if (!tenant) return [3 /*break*/, 42];
333
+ _t.label = 39;
334
+ case 39:
335
+ _t.trys.push([39, 41, , 42]);
336
+ return [4 /*yield*/, tenant.teardown()];
337
+ case 40:
338
+ _t.sent();
339
+ return [3 /*break*/, 42];
340
+ case 41:
341
+ e_1 = _t.sent();
342
+ console.error('teardown failed', e_1);
343
+ return [3 /*break*/, 42];
344
+ case 42: return [7 /*endfinally*/];
345
+ case 43: return [2 /*return*/, checks];
346
+ }
404
347
  });
405
- };
348
+ }); };
349
+ exports.outbound_chat_sent_trigger_checks = outbound_chat_sent_trigger_checks;
350
+ /** Asserting wrapper, for standalone runs and for sequential use in the suite. */
351
+ var outbound_chat_sent_trigger_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
352
+ var _a, _b;
353
+ return __generator(this, function (_c) {
354
+ switch (_c.label) {
355
+ case 0:
356
+ _a = setup_isolated_1.assert_checks;
357
+ _b = ['Outbound Chat Sent trigger'];
358
+ return [4 /*yield*/, (0, exports.outbound_chat_sent_trigger_checks)()];
359
+ case 1:
360
+ _a.apply(void 0, _b.concat([_c.sent()]));
361
+ return [2 /*return*/];
362
+ }
363
+ });
364
+ }); };
406
365
  exports.outbound_chat_sent_trigger_tests = outbound_chat_sent_trigger_tests;
366
+ /** Enrolls this suite in the auto-discovered parallel pool — see run_discovered_isolated_suites. */
367
+ exports.ISOLATED_SUITE = {
368
+ name: 'Outbound Chat Sent trigger',
369
+ run: exports.outbound_chat_sent_trigger_checks,
370
+ };
407
371
  // Allow running this test file independently
408
372
  if (require.main === module) {
409
- var host = process.env.API_URL || 'http://localhost:8080';
410
373
  console.log("\uD83C\uDF10 Using API URL: ".concat(host));
411
- var sdk_2 = new sdk_1.Session({ host: host });
412
- var sdkNonAdmin_1 = new sdk_1.Session({ host: host });
413
- var runTests = function () { return __awaiter(void 0, void 0, void 0, function () {
414
- return __generator(this, function (_a) {
415
- switch (_a.label) {
416
- case 0: return [4 /*yield*/, (0, setup_1.setup_tests)(sdk_2, sdkNonAdmin_1)];
417
- case 1:
418
- _a.sent();
419
- return [4 /*yield*/, (0, exports.outbound_chat_sent_trigger_tests)({ sdk: sdk_2 })];
420
- case 2:
421
- _a.sent();
422
- return [2 /*return*/];
423
- }
424
- });
425
- }); };
426
- runTests()
374
+ (0, exports.outbound_chat_sent_trigger_tests)()
427
375
  .then(function () {
428
376
  console.log("✅ Outbound Chat Sent trigger tests completed successfully");
429
377
  process.exit(0);