@tellescope/sdk 1.256.16 → 2.0.0-beta.1

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 (310) hide show
  1. package/CLAUDE.md +5 -0
  2. package/env.example +39 -0
  3. package/lib/cjs/enduser.d.ts +1 -0
  4. package/lib/cjs/enduser.d.ts.map +1 -1
  5. package/lib/cjs/sdk.d.ts +6 -1
  6. package/lib/cjs/sdk.d.ts.map +1 -1
  7. package/lib/cjs/sdk.js +2 -0
  8. package/lib/cjs/sdk.js.map +1 -1
  9. package/lib/cjs/session.d.ts +1 -0
  10. package/lib/cjs/session.d.ts.map +1 -1
  11. package/lib/cjs/tests/api_tests/active_patient_count.test.js +1 -1
  12. package/lib/cjs/tests/api_tests/active_patient_count.test.js.map +1 -1
  13. package/lib/cjs/tests/api_tests/appointment_rescheduled_trigger.test.js +1 -1
  14. package/lib/cjs/tests/api_tests/appointment_rescheduled_trigger.test.js.map +1 -1
  15. package/lib/cjs/tests/api_tests/calendar_event_limits.test.js +5 -5
  16. package/lib/cjs/tests/api_tests/calendar_event_limits.test.js.map +1 -1
  17. package/lib/cjs/tests/api_tests/calendar_event_references_update.test.js +1 -1
  18. package/lib/cjs/tests/api_tests/calendar_event_references_update.test.js.map +1 -1
  19. package/lib/cjs/tests/api_tests/enduser_cross_access_isolation.test.js +1 -1
  20. package/lib/cjs/tests/api_tests/enduser_cross_access_isolation.test.js.map +1 -1
  21. package/lib/cjs/tests/api_tests/enduser_fields_sync.test.d.ts +21 -0
  22. package/lib/cjs/tests/api_tests/enduser_fields_sync.test.d.ts.map +1 -0
  23. package/lib/cjs/tests/api_tests/enduser_fields_sync.test.js +215 -0
  24. package/lib/cjs/tests/api_tests/enduser_fields_sync.test.js.map +1 -0
  25. package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.js +6 -6
  26. package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.js.map +1 -1
  27. package/lib/cjs/tests/api_tests/enduser_session_invalidation.test.js +3 -3
  28. package/lib/cjs/tests/api_tests/enduser_session_invalidation.test.js.map +1 -1
  29. package/lib/cjs/tests/api_tests/load_threads_care_team.test.d.ts +32 -0
  30. package/lib/cjs/tests/api_tests/load_threads_care_team.test.d.ts.map +1 -0
  31. package/lib/cjs/tests/api_tests/load_threads_care_team.test.js +257 -0
  32. package/lib/cjs/tests/api_tests/load_threads_care_team.test.js.map +1 -0
  33. package/lib/cjs/tests/api_tests/managed_content_enduser_access.test.js +1 -1
  34. package/lib/cjs/tests/api_tests/managed_content_enduser_access.test.js.map +1 -1
  35. package/lib/cjs/tests/api_tests/managed_content_file_access.test.js +1 -1
  36. package/lib/cjs/tests/api_tests/managed_content_file_access.test.js.map +1 -1
  37. package/lib/cjs/tests/api_tests/mdi_case_offerings.test.d.ts.map +1 -1
  38. package/lib/cjs/tests/api_tests/mdi_case_offerings.test.js +139 -9
  39. package/lib/cjs/tests/api_tests/mdi_case_offerings.test.js.map +1 -1
  40. package/lib/cjs/tests/api_tests/mdi_webhooks.test.d.ts.map +1 -1
  41. package/lib/cjs/tests/api_tests/mdi_webhooks.test.js +21 -8
  42. package/lib/cjs/tests/api_tests/mdi_webhooks.test.js.map +1 -1
  43. package/lib/cjs/tests/api_tests/nutrition_tracking.test.js +1 -1
  44. package/lib/cjs/tests/api_tests/nutrition_tracking.test.js.map +1 -1
  45. package/lib/cjs/tests/api_tests/openloop_webhooks.test.js +1 -1
  46. package/lib/cjs/tests/api_tests/openloop_webhooks.test.js.map +1 -1
  47. package/lib/cjs/tests/api_tests/programs.test.d.ts +5 -0
  48. package/lib/cjs/tests/api_tests/programs.test.d.ts.map +1 -0
  49. package/lib/cjs/tests/api_tests/programs.test.js +370 -0
  50. package/lib/cjs/tests/api_tests/programs.test.js.map +1 -0
  51. package/lib/cjs/tests/api_tests/programs_trigger_filters.test.d.ts +5 -0
  52. package/lib/cjs/tests/api_tests/programs_trigger_filters.test.d.ts.map +1 -0
  53. package/lib/cjs/tests/api_tests/programs_trigger_filters.test.js +295 -0
  54. package/lib/cjs/tests/api_tests/programs_trigger_filters.test.js.map +1 -0
  55. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts.map +1 -1
  56. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js +55 -47
  57. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js.map +1 -1
  58. package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.js +1 -1
  59. package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.js.map +1 -1
  60. package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts +42 -0
  61. package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts.map +1 -0
  62. package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.js +484 -0
  63. package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.js.map +1 -0
  64. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js +1 -1
  65. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -1
  66. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +1 -1
  67. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -1
  68. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js +1 -1
  69. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js.map +1 -1
  70. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js +1 -1
  71. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -1
  72. package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.js +2 -2
  73. package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.js.map +1 -1
  74. package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts +32 -0
  75. package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts.map +1 -0
  76. package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js +297 -0
  77. package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js.map +1 -0
  78. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -1
  79. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +4 -1
  80. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -1
  81. package/lib/cjs/tests/api_tests/templated_message_date_fields.test.d.ts +3 -0
  82. package/lib/cjs/tests/api_tests/templated_message_date_fields.test.d.ts.map +1 -0
  83. package/lib/cjs/tests/api_tests/templated_message_date_fields.test.js +202 -0
  84. package/lib/cjs/tests/api_tests/templated_message_date_fields.test.js.map +1 -0
  85. package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.d.ts +3 -0
  86. package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.d.ts.map +1 -0
  87. package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.js +233 -0
  88. package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.js.map +1 -0
  89. package/lib/cjs/tests/api_tests/templated_message_links.test.d.ts +3 -0
  90. package/lib/cjs/tests/api_tests/templated_message_links.test.d.ts.map +1 -0
  91. package/lib/cjs/tests/api_tests/templated_message_links.test.js +235 -0
  92. package/lib/cjs/tests/api_tests/templated_message_links.test.js.map +1 -0
  93. package/lib/cjs/tests/api_tests/time_tracks.test.js +1 -1
  94. package/lib/cjs/tests/api_tests/time_tracks.test.js.map +1 -1
  95. package/lib/cjs/tests/api_tests/trigger_contains_matching.test.d.ts +5 -0
  96. package/lib/cjs/tests/api_tests/trigger_contains_matching.test.d.ts.map +1 -0
  97. package/lib/cjs/tests/api_tests/trigger_contains_matching.test.js +395 -0
  98. package/lib/cjs/tests/api_tests/trigger_contains_matching.test.js.map +1 -0
  99. package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.d.ts +5 -0
  100. package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.d.ts.map +1 -0
  101. package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.js +471 -0
  102. package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.js.map +1 -0
  103. package/lib/cjs/tests/api_tests/user_portal_settings.test.js +1 -1
  104. package/lib/cjs/tests/api_tests/user_portal_settings.test.js.map +1 -1
  105. package/lib/cjs/tests/api_tests/validation_behavior_locks.test.d.ts +2 -0
  106. package/lib/cjs/tests/api_tests/validation_behavior_locks.test.d.ts.map +1 -0
  107. package/lib/cjs/tests/api_tests/validation_behavior_locks.test.js +233 -0
  108. package/lib/cjs/tests/api_tests/validation_behavior_locks.test.js.map +1 -0
  109. package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.d.ts +5 -0
  110. package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.d.ts.map +1 -0
  111. package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.js +569 -0
  112. package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.js.map +1 -0
  113. package/lib/cjs/tests/public_endpoint_tests.js +3 -2
  114. package/lib/cjs/tests/public_endpoint_tests.js.map +1 -1
  115. package/lib/cjs/tests/setup.d.ts +16 -0
  116. package/lib/cjs/tests/setup.d.ts.map +1 -1
  117. package/lib/cjs/tests/setup.js +55 -8
  118. package/lib/cjs/tests/setup.js.map +1 -1
  119. package/lib/cjs/tests/setup_isolated.d.ts +9 -0
  120. package/lib/cjs/tests/setup_isolated.d.ts.map +1 -1
  121. package/lib/cjs/tests/setup_isolated.js +23 -2
  122. package/lib/cjs/tests/setup_isolated.js.map +1 -1
  123. package/lib/cjs/tests/socket_tests.d.ts.map +1 -1
  124. package/lib/cjs/tests/socket_tests.js +3 -2
  125. package/lib/cjs/tests/socket_tests.js.map +1 -1
  126. package/lib/cjs/tests/tests.d.ts.map +1 -1
  127. package/lib/cjs/tests/tests.js +244 -216
  128. package/lib/cjs/tests/tests.js.map +1 -1
  129. package/lib/cjs/tests/unit_tests/trigger_title_partials.test.d.ts +3 -0
  130. package/lib/cjs/tests/unit_tests/trigger_title_partials.test.d.ts.map +1 -0
  131. package/lib/cjs/tests/unit_tests/trigger_title_partials.test.js +118 -0
  132. package/lib/cjs/tests/unit_tests/trigger_title_partials.test.js.map +1 -0
  133. package/lib/cjs/tests/webhooks_tests.js +3 -2
  134. package/lib/cjs/tests/webhooks_tests.js.map +1 -1
  135. package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  136. package/lib/esm/enduser.d.ts +2 -0
  137. package/lib/esm/enduser.d.ts.map +1 -1
  138. package/lib/esm/sdk.d.ts +9 -3
  139. package/lib/esm/sdk.d.ts.map +1 -1
  140. package/lib/esm/sdk.js +2 -0
  141. package/lib/esm/sdk.js.map +1 -1
  142. package/lib/esm/session.d.ts +2 -0
  143. package/lib/esm/session.d.ts.map +1 -1
  144. package/lib/esm/tests/api_tests/active_patient_count.test.js +1 -1
  145. package/lib/esm/tests/api_tests/active_patient_count.test.js.map +1 -1
  146. package/lib/esm/tests/api_tests/appointment_rescheduled_trigger.test.js +1 -1
  147. package/lib/esm/tests/api_tests/appointment_rescheduled_trigger.test.js.map +1 -1
  148. package/lib/esm/tests/api_tests/calendar_event_limits.test.js +5 -5
  149. package/lib/esm/tests/api_tests/calendar_event_limits.test.js.map +1 -1
  150. package/lib/esm/tests/api_tests/calendar_event_references_update.test.js +1 -1
  151. package/lib/esm/tests/api_tests/calendar_event_references_update.test.js.map +1 -1
  152. package/lib/esm/tests/api_tests/enduser_cross_access_isolation.test.js +1 -1
  153. package/lib/esm/tests/api_tests/enduser_cross_access_isolation.test.js.map +1 -1
  154. package/lib/esm/tests/api_tests/enduser_fields_sync.test.d.ts +21 -0
  155. package/lib/esm/tests/api_tests/enduser_fields_sync.test.d.ts.map +1 -0
  156. package/lib/esm/tests/api_tests/enduser_fields_sync.test.js +210 -0
  157. package/lib/esm/tests/api_tests/enduser_fields_sync.test.js.map +1 -0
  158. package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.js +7 -7
  159. package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.js.map +1 -1
  160. package/lib/esm/tests/api_tests/enduser_session_invalidation.test.js +4 -4
  161. package/lib/esm/tests/api_tests/enduser_session_invalidation.test.js.map +1 -1
  162. package/lib/esm/tests/api_tests/load_threads_care_team.test.d.ts +32 -0
  163. package/lib/esm/tests/api_tests/load_threads_care_team.test.d.ts.map +1 -0
  164. package/lib/esm/tests/api_tests/load_threads_care_team.test.js +252 -0
  165. package/lib/esm/tests/api_tests/load_threads_care_team.test.js.map +1 -0
  166. package/lib/esm/tests/api_tests/managed_content_enduser_access.test.js +1 -1
  167. package/lib/esm/tests/api_tests/managed_content_enduser_access.test.js.map +1 -1
  168. package/lib/esm/tests/api_tests/managed_content_file_access.test.js +1 -1
  169. package/lib/esm/tests/api_tests/managed_content_file_access.test.js.map +1 -1
  170. package/lib/esm/tests/api_tests/mdi_case_offerings.test.d.ts.map +1 -1
  171. package/lib/esm/tests/api_tests/mdi_case_offerings.test.js +139 -9
  172. package/lib/esm/tests/api_tests/mdi_case_offerings.test.js.map +1 -1
  173. package/lib/esm/tests/api_tests/mdi_webhooks.test.d.ts.map +1 -1
  174. package/lib/esm/tests/api_tests/mdi_webhooks.test.js +21 -8
  175. package/lib/esm/tests/api_tests/mdi_webhooks.test.js.map +1 -1
  176. package/lib/esm/tests/api_tests/nutrition_tracking.test.js +1 -1
  177. package/lib/esm/tests/api_tests/nutrition_tracking.test.js.map +1 -1
  178. package/lib/esm/tests/api_tests/openloop_webhooks.test.js +1 -1
  179. package/lib/esm/tests/api_tests/openloop_webhooks.test.js.map +1 -1
  180. package/lib/esm/tests/api_tests/programs.test.d.ts +5 -0
  181. package/lib/esm/tests/api_tests/programs.test.d.ts.map +1 -0
  182. package/lib/esm/tests/api_tests/programs.test.js +365 -0
  183. package/lib/esm/tests/api_tests/programs.test.js.map +1 -0
  184. package/lib/esm/tests/api_tests/programs_trigger_filters.test.d.ts +5 -0
  185. package/lib/esm/tests/api_tests/programs_trigger_filters.test.d.ts.map +1 -0
  186. package/lib/esm/tests/api_tests/programs_trigger_filters.test.js +290 -0
  187. package/lib/esm/tests/api_tests/programs_trigger_filters.test.js.map +1 -0
  188. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts.map +1 -1
  189. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js +55 -47
  190. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js.map +1 -1
  191. package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.js +1 -1
  192. package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.js.map +1 -1
  193. package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts +42 -0
  194. package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts.map +1 -0
  195. package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.js +479 -0
  196. package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.js.map +1 -0
  197. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js +1 -1
  198. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -1
  199. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +1 -1
  200. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -1
  201. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js +1 -1
  202. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js.map +1 -1
  203. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js +1 -1
  204. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -1
  205. package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.js +3 -3
  206. package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.js.map +1 -1
  207. package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts +32 -0
  208. package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts.map +1 -0
  209. package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js +292 -0
  210. package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js.map +1 -0
  211. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -1
  212. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +4 -1
  213. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -1
  214. package/lib/esm/tests/api_tests/templated_message_date_fields.test.d.ts +3 -0
  215. package/lib/esm/tests/api_tests/templated_message_date_fields.test.d.ts.map +1 -0
  216. package/lib/esm/tests/api_tests/templated_message_date_fields.test.js +198 -0
  217. package/lib/esm/tests/api_tests/templated_message_date_fields.test.js.map +1 -0
  218. package/lib/esm/tests/api_tests/templated_message_link_in_href.test.d.ts +3 -0
  219. package/lib/esm/tests/api_tests/templated_message_link_in_href.test.d.ts.map +1 -0
  220. package/lib/esm/tests/api_tests/templated_message_link_in_href.test.js +229 -0
  221. package/lib/esm/tests/api_tests/templated_message_link_in_href.test.js.map +1 -0
  222. package/lib/esm/tests/api_tests/templated_message_links.test.d.ts +3 -0
  223. package/lib/esm/tests/api_tests/templated_message_links.test.d.ts.map +1 -0
  224. package/lib/esm/tests/api_tests/templated_message_links.test.js +231 -0
  225. package/lib/esm/tests/api_tests/templated_message_links.test.js.map +1 -0
  226. package/lib/esm/tests/api_tests/time_tracks.test.js +1 -1
  227. package/lib/esm/tests/api_tests/time_tracks.test.js.map +1 -1
  228. package/lib/esm/tests/api_tests/trigger_contains_matching.test.d.ts +5 -0
  229. package/lib/esm/tests/api_tests/trigger_contains_matching.test.d.ts.map +1 -0
  230. package/lib/esm/tests/api_tests/trigger_contains_matching.test.js +390 -0
  231. package/lib/esm/tests/api_tests/trigger_contains_matching.test.js.map +1 -0
  232. package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.d.ts +5 -0
  233. package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.d.ts.map +1 -0
  234. package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.js +466 -0
  235. package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.js.map +1 -0
  236. package/lib/esm/tests/api_tests/user_portal_settings.test.js +1 -1
  237. package/lib/esm/tests/api_tests/user_portal_settings.test.js.map +1 -1
  238. package/lib/esm/tests/api_tests/validation_behavior_locks.test.d.ts +2 -0
  239. package/lib/esm/tests/api_tests/validation_behavior_locks.test.d.ts.map +1 -0
  240. package/lib/esm/tests/api_tests/validation_behavior_locks.test.js +229 -0
  241. package/lib/esm/tests/api_tests/validation_behavior_locks.test.js.map +1 -0
  242. package/lib/esm/tests/api_tests/vital_review_trigger_action.test.d.ts +5 -0
  243. package/lib/esm/tests/api_tests/vital_review_trigger_action.test.d.ts.map +1 -0
  244. package/lib/esm/tests/api_tests/vital_review_trigger_action.test.js +564 -0
  245. package/lib/esm/tests/api_tests/vital_review_trigger_action.test.js.map +1 -0
  246. package/lib/esm/tests/public_endpoint_tests.js +3 -2
  247. package/lib/esm/tests/public_endpoint_tests.js.map +1 -1
  248. package/lib/esm/tests/setup.d.ts +16 -0
  249. package/lib/esm/tests/setup.d.ts.map +1 -1
  250. package/lib/esm/tests/setup.js +53 -7
  251. package/lib/esm/tests/setup.js.map +1 -1
  252. package/lib/esm/tests/setup_isolated.d.ts +9 -0
  253. package/lib/esm/tests/setup_isolated.d.ts.map +1 -1
  254. package/lib/esm/tests/setup_isolated.js +21 -1
  255. package/lib/esm/tests/setup_isolated.js.map +1 -1
  256. package/lib/esm/tests/socket_tests.d.ts.map +1 -1
  257. package/lib/esm/tests/socket_tests.js +3 -2
  258. package/lib/esm/tests/socket_tests.js.map +1 -1
  259. package/lib/esm/tests/tests.d.ts.map +1 -1
  260. package/lib/esm/tests/tests.js +244 -216
  261. package/lib/esm/tests/tests.js.map +1 -1
  262. package/lib/esm/tests/unit_tests/trigger_title_partials.test.d.ts +3 -0
  263. package/lib/esm/tests/unit_tests/trigger_title_partials.test.d.ts.map +1 -0
  264. package/lib/esm/tests/unit_tests/trigger_title_partials.test.js +115 -0
  265. package/lib/esm/tests/unit_tests/trigger_title_partials.test.js.map +1 -0
  266. package/lib/esm/tests/webhooks_tests.js +3 -2
  267. package/lib/esm/tests/webhooks_tests.js.map +1 -1
  268. package/lib/tsconfig.tsbuildinfo +1 -1
  269. package/package.json +22 -19
  270. package/src/sdk.ts +11 -1
  271. package/src/tests/api_tests/active_patient_count.test.ts +1 -1
  272. package/src/tests/api_tests/appointment_rescheduled_trigger.test.ts +1 -1
  273. package/src/tests/api_tests/calendar_event_references_update.test.ts +1 -1
  274. package/src/tests/api_tests/enduser_cross_access_isolation.test.ts +1 -1
  275. package/src/tests/api_tests/enduser_fields_sync.test.ts +150 -0
  276. package/src/tests/api_tests/enduser_login_rate_limits.test.ts +7 -7
  277. package/src/tests/api_tests/enduser_session_invalidation.test.ts +4 -4
  278. package/src/tests/api_tests/load_threads_care_team.test.ts +210 -0
  279. package/src/tests/api_tests/managed_content_enduser_access.test.ts +1 -1
  280. package/src/tests/api_tests/managed_content_file_access.test.ts +1 -1
  281. package/src/tests/api_tests/mdi_case_offerings.test.ts +138 -0
  282. package/src/tests/api_tests/mdi_webhooks.test.ts +9 -0
  283. package/src/tests/api_tests/nutrition_tracking.test.ts +1 -1
  284. package/src/tests/api_tests/openloop_webhooks.test.ts +1 -1
  285. package/src/tests/api_tests/security/add-to-journey-foreign-enduserid.test.ts +33 -26
  286. package/src/tests/api_tests/security/allowed-paths-confinement.test.ts +1 -1
  287. package/src/tests/api_tests/security/appointment-reschedule-ownership.test.ts +432 -0
  288. package/src/tests/api_tests/security/booking-info-idor-token-mint.test.ts +1 -1
  289. package/src/tests/api_tests/security/enduser-ai-summary-trust-gate.test.ts +1 -1
  290. package/src/tests/api_tests/security/enduser-cross-create.test.ts +1 -1
  291. package/src/tests/api_tests/security/enduser-write-restrictions.test.ts +1 -1
  292. package/src/tests/api_tests/security/invite-user-enumeration.test.ts +3 -3
  293. package/src/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.ts +197 -0
  294. package/src/tests/api_tests/security/sanitize-user-html-with-iframes.test.ts +4 -1
  295. package/src/tests/api_tests/templated_message_date_fields.test.ts +146 -0
  296. package/src/tests/api_tests/templated_message_links.test.ts +192 -0
  297. package/src/tests/api_tests/time_tracks.test.ts +1 -1
  298. package/src/tests/api_tests/trigger_contains_matching.test.ts +345 -0
  299. package/src/tests/api_tests/user_logs_restore_deleted.test.ts +415 -0
  300. package/src/tests/api_tests/user_portal_settings.test.ts +1 -1
  301. package/src/tests/api_tests/validation_behavior_locks.test.ts +204 -0
  302. package/src/tests/public_endpoint_tests.ts +3 -2
  303. package/src/tests/setup.ts +43 -7
  304. package/src/tests/setup_isolated.ts +10 -0
  305. package/src/tests/socket_tests.ts +3 -2
  306. package/src/tests/tests.ts +22 -2
  307. package/src/tests/unit_tests/trigger_title_partials.test.ts +174 -0
  308. package/src/tests/webhooks_tests.ts +4 -2
  309. package/test_generated.pdf +0 -0
  310. package/tsconfig.cjs.json +17 -0
@@ -0,0 +1,345 @@
1
+ require('source-map-support').install();
2
+
3
+ import {
4
+ assert_checks,
5
+ Check,
6
+ setup_isolated_tenant,
7
+ } from "../setup_isolated"
8
+
9
+ const host = process.env.API_URL || 'http://localhost:8080' as const
10
+
11
+ const RAND = () => Math.random().toString(36).slice(2, 10)
12
+
13
+ /**
14
+ * End-to-end coverage for "contains" title matching on the `Problem Created` and `Order Created`
15
+ * automation triggers — the optional `titlePartials` (case sensitive) and `titlePartialsIgnoreCase`
16
+ * lists that sit beside the existing exact `titles` list.
17
+ *
18
+ * Three backend call sites implement this and they must agree:
19
+ * - handle_problems_create (enduser_problems.ts — single AND bulk problem creates)
20
+ * - handle_order_created (automation_triggers.ts — orders created ONE at a time)
21
+ * - handle_orders_create bulk branch (enduser_orders.ts — orders created via createSome, >1)
22
+ *
23
+ * The order paths diverge structurally (`created.length === 1` takes an entirely different branch),
24
+ * so every order assertion here is made twice: once through `createOne` and once through a
25
+ * `createSome` of more than one record. That divergence is the main risk in this change.
26
+ *
27
+ * Own tenant: automation triggers are business-wide, so a shared tenant would let these triggers tag
28
+ * other concurrently running suites' endusers and vice versa. Never calls sdk.reset_db().
29
+ *
30
+ * Trigger actions are fire-and-forget, so positives poll. Negatives wait for a catch-all sentinel
31
+ * trigger (one with no title filter at all, which must fire for every record) to land first, then
32
+ * settle before reading — otherwise "the tag is absent" would just mean "the tag has not arrived
33
+ * yet".
34
+ */
35
+
36
+ const poll_for = async <T,>(get: () => Promise<T>, done: (v: T) => boolean, attempts=24): Promise<T> => {
37
+ let value = await get()
38
+ for (let i = 0; i < attempts && !done(value); i++) {
39
+ await new Promise(resolve => setTimeout(resolve, 250))
40
+ value = await get()
41
+ }
42
+ return value
43
+ }
44
+
45
+ const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
46
+
47
+ export const trigger_contains_matching_checks = async (): Promise<Check[]> => {
48
+ const checks: Check[] = []
49
+ const record = (label: string, pass: boolean, detail: string) => checks.push({ label, pass, detail })
50
+
51
+ let tenant: Awaited<ReturnType<typeof setup_isolated_tenant>> | undefined
52
+
53
+ try {
54
+ tenant = await setup_isolated_tenant({
55
+ name: `ContainsTriggers ${RAND()}`,
56
+ users: [{ isAdmin: true }],
57
+ apiKeys: 0,
58
+ })
59
+ const { sdk } = tenant
60
+
61
+ /* ============================ triggers ============================ */
62
+
63
+ const trigger = (
64
+ title: string,
65
+ event: any,
66
+ tag: string,
67
+ ) => sdk.api.automation_triggers.createOne({
68
+ title,
69
+ status: 'Active',
70
+ event,
71
+ action: { type: 'Add Tags', info: { tags: [tag] } },
72
+ })
73
+
74
+ await Promise.all([
75
+ // ---- Order Created ----
76
+ // fires for every order — the sentinel that tells a negative check "the handler has run"
77
+ trigger('Order any', { type: 'Order Created', info: {} }, 'order-any'),
78
+ trigger('Order contains CS', { type: 'Order Created', info: { titlePartials: ['Semaglutide'] } }, 'order-cs'),
79
+ trigger('Order contains CI', { type: 'Order Created', info: { titlePartialsIgnoreCase: ['semaglutide'] } }, 'order-ci'),
80
+ // exact titles AND a contains fragment — both must pass
81
+ trigger(
82
+ 'Order exact AND contains',
83
+ { type: 'Order Created', info: { titles: ['Semaglutide 0.25mg'], titlePartials: ['Sema'] } },
84
+ 'order-and',
85
+ ),
86
+ // exact-only, unchanged prior behaviour
87
+ trigger('Order exact only', { type: 'Order Created', info: { titles: ['Semaglutide 0.25mg'] } }, 'order-exact'),
88
+
89
+ // ---- Problem Created ----
90
+ trigger('Problem any', { type: 'Problem Created', info: {} }, 'problem-any'),
91
+ trigger('Problem contains CS', { type: 'Problem Created', info: { titlePartials: ['Endometriosis'] } }, 'problem-cs'),
92
+ trigger('Problem contains CI', { type: 'Problem Created', info: { titlePartialsIgnoreCase: ['endometriosis'] } }, 'problem-ci'),
93
+ trigger(
94
+ 'Problem exact AND contains',
95
+ { type: 'Problem Created', info: { titles: ['Endometriosis, unspecified'], titlePartials: ['Endo'] } },
96
+ 'problem-and',
97
+ ),
98
+ trigger('Problem exact only', { type: 'Problem Created', info: { titles: ['Diabetes'] } }, 'problem-exact'),
99
+ // entries are trimmed before matching
100
+ trigger('Problem contains padded', { type: 'Problem Created', info: { titlePartials: [' Endo '] } }, 'problem-padded'),
101
+ // a blank sibling entry is dropped, not treated as "matches everything"
102
+ trigger(
103
+ 'Problem contains with blank entry',
104
+ { type: 'Problem Created', info: { titlePartials: ['Endometriosis', ' '] } },
105
+ 'problem-blankentry',
106
+ ),
107
+ ])
108
+
109
+ /* ============================ helpers ============================ */
110
+
111
+ const new_enduser = (fname: string) => sdk.api.endusers.createOne({ fname, lname: 'Contains' })
112
+
113
+ /** enduser_orders requires externalId/source/status; none of them affect title matching. */
114
+ const order_fields = (enduserId: string, title: string) => ({
115
+ enduserId,
116
+ title,
117
+ externalId: `contains-${RAND()}`,
118
+ source: 'ContainsQA',
119
+ status: 'created',
120
+ })
121
+
122
+ /** Polls until the sentinel tag has landed, then settles so absent tags mean absent. */
123
+ const tags_after_settling = async (enduserId: string, sentinel: string) => {
124
+ await poll_for(
125
+ () => sdk.api.endusers.getOne(enduserId),
126
+ e => !!e.tags?.includes(sentinel),
127
+ )
128
+ await wait(1500)
129
+ const e = await sdk.api.endusers.getOne(enduserId)
130
+ return e.tags ?? []
131
+ }
132
+
133
+ const expect_tags = async (
134
+ label: string,
135
+ enduserId: string,
136
+ sentinel: string,
137
+ expected: string[],
138
+ unexpected: string[],
139
+ ) => {
140
+ // give the positives a chance to arrive before the sentinel settle window closes
141
+ await poll_for(
142
+ () => sdk.api.endusers.getOne(enduserId),
143
+ e => expected.every(t => e.tags?.includes(t)),
144
+ )
145
+ const tags = await tags_after_settling(enduserId, sentinel)
146
+ const missing = expected.filter(t => !tags.includes(t))
147
+ const present = unexpected.filter(t => tags.includes(t))
148
+ record(
149
+ label,
150
+ missing.length === 0 && present.length === 0,
151
+ `tags=${JSON.stringify(tags)}`
152
+ + (missing.length ? ` MISSING=${JSON.stringify(missing)}` : '')
153
+ + (present.length ? ` UNEXPECTED=${JSON.stringify(present)}` : ''),
154
+ )
155
+ }
156
+
157
+ /* ============================ orders: single-create path ============================ */
158
+
159
+ const orderSingleMatch = await new_enduser('OrderSingleMatch')
160
+ await sdk.api.enduser_orders.createOne(order_fields(orderSingleMatch.id, 'Semaglutide 0.25mg'))
161
+ await expect_tags(
162
+ 'A1: single-created order matching both contains lists and the exact title fires all four triggers',
163
+ orderSingleMatch.id, 'order-any',
164
+ ['order-any', 'order-cs', 'order-ci', 'order-and', 'order-exact'],
165
+ [],
166
+ )
167
+
168
+ const orderSingleCase = await new_enduser('OrderSingleCase')
169
+ await sdk.api.enduser_orders.createOne(order_fields(orderSingleCase.id, 'SEMAGLUTIDE injection'))
170
+ await expect_tags(
171
+ 'A2: single-created order in a different case fires only the case-insensitive contains trigger',
172
+ orderSingleCase.id, 'order-any',
173
+ ['order-any', 'order-ci'],
174
+ ['order-cs', 'order-and', 'order-exact'],
175
+ )
176
+
177
+ const orderSingleMiss = await new_enduser('OrderSingleMiss')
178
+ await sdk.api.enduser_orders.createOne(order_fields(orderSingleMiss.id, 'Tirzepatide 5mg'))
179
+ await expect_tags(
180
+ 'A3: single-created order matching no contains entry fires only the unfiltered trigger',
181
+ orderSingleMiss.id, 'order-any',
182
+ ['order-any'],
183
+ ['order-cs', 'order-ci', 'order-and', 'order-exact'],
184
+ )
185
+
186
+ const orderSingleAndMiss = await new_enduser('OrderSingleAndMiss')
187
+ // contains 'Sema' but is not exactly 'Semaglutide 0.25mg' — the lists AND, they do not OR
188
+ await sdk.api.enduser_orders.createOne(order_fields(orderSingleAndMiss.id, 'Semaglutide 1mg'))
189
+ await expect_tags(
190
+ 'A4: exact+contains trigger does NOT fire when only the contains half matches (single create)',
191
+ orderSingleAndMiss.id, 'order-any',
192
+ ['order-any', 'order-cs', 'order-ci'],
193
+ ['order-and', 'order-exact'],
194
+ )
195
+
196
+ /* ============================ orders: bulk-create path ============================ */
197
+ /* createSome with more than one record takes handle_orders_create's bulk branch, which is a
198
+ * separate implementation of the same filtering. Same four assertions, same expectations. */
199
+
200
+ const [bulkMatch, bulkCase, bulkMiss, bulkAndMiss] = await Promise.all([
201
+ new_enduser('OrderBulkMatch'),
202
+ new_enduser('OrderBulkCase'),
203
+ new_enduser('OrderBulkMiss'),
204
+ new_enduser('OrderBulkAndMiss'),
205
+ ])
206
+
207
+ await sdk.api.enduser_orders.createSome([
208
+ order_fields(bulkMatch.id, 'Semaglutide 0.25mg'),
209
+ order_fields(bulkCase.id, 'SEMAGLUTIDE injection'),
210
+ order_fields(bulkMiss.id, 'Tirzepatide 5mg'),
211
+ order_fields(bulkAndMiss.id, 'Semaglutide 1mg'),
212
+ ])
213
+
214
+ await expect_tags(
215
+ 'B1: bulk-created order matching both contains lists and the exact title fires all four triggers',
216
+ bulkMatch.id, 'order-any',
217
+ ['order-any', 'order-cs', 'order-ci', 'order-and', 'order-exact'],
218
+ [],
219
+ )
220
+ await expect_tags(
221
+ 'B2: bulk-created order in a different case fires only the case-insensitive contains trigger',
222
+ bulkCase.id, 'order-any',
223
+ ['order-any', 'order-ci'],
224
+ ['order-cs', 'order-and', 'order-exact'],
225
+ )
226
+ await expect_tags(
227
+ 'B3: bulk-created order matching no contains entry fires only the unfiltered trigger',
228
+ bulkMiss.id, 'order-any',
229
+ ['order-any'],
230
+ ['order-cs', 'order-ci', 'order-and', 'order-exact'],
231
+ )
232
+ await expect_tags(
233
+ 'B4: exact+contains trigger does NOT fire when only the contains half matches (bulk create)',
234
+ bulkAndMiss.id, 'order-any',
235
+ ['order-any', 'order-cs', 'order-ci'],
236
+ ['order-and', 'order-exact'],
237
+ )
238
+
239
+ /* ============================ problems ============================ */
240
+
241
+ const problemMatch = await new_enduser('ProblemMatch')
242
+ await sdk.api.enduser_problems.createOne({ enduserId: problemMatch.id, title: 'Endometriosis, unspecified' })
243
+ await expect_tags(
244
+ 'C1: problem whose title contains the case-sensitive fragment fires the contains triggers',
245
+ problemMatch.id, 'problem-any',
246
+ ['problem-any', 'problem-cs', 'problem-ci', 'problem-and', 'problem-padded', 'problem-blankentry'],
247
+ ['problem-exact'],
248
+ )
249
+
250
+ const problemCase = await new_enduser('ProblemCase')
251
+ await sdk.api.enduser_problems.createOne({ enduserId: problemCase.id, title: 'Chronic endometriosis pain' })
252
+ await expect_tags(
253
+ 'C2: a lowercase title fires the case-insensitive trigger but not the case-sensitive one',
254
+ problemCase.id, 'problem-any',
255
+ ['problem-any', 'problem-ci'],
256
+ ['problem-cs', 'problem-and', 'problem-blankentry', 'problem-exact'],
257
+ )
258
+
259
+ const problemAndMiss = await new_enduser('ProblemAndMiss')
260
+ // contains 'Endo' (so the padded trigger fires) but is not the exact title the AND trigger needs
261
+ await sdk.api.enduser_problems.createOne({ enduserId: problemAndMiss.id, title: 'Endometrial hyperplasia' })
262
+ await expect_tags(
263
+ 'C3: exact+contains problem trigger does NOT fire on a title that only satisfies the contains half',
264
+ problemAndMiss.id, 'problem-any',
265
+ ['problem-any', 'problem-padded'],
266
+ ['problem-and', 'problem-cs', 'problem-ci', 'problem-blankentry', 'problem-exact'],
267
+ )
268
+
269
+ const problemBlank = await new_enduser('ProblemBlank')
270
+ await sdk.api.enduser_problems.createOne({ enduserId: problemBlank.id, title: 'Common cold' })
271
+ await expect_tags(
272
+ 'C4: a blank entry beside a real one does not make the trigger fire on an unrelated title',
273
+ problemBlank.id, 'problem-any',
274
+ ['problem-any'],
275
+ ['problem-blankentry', 'problem-cs', 'problem-ci', 'problem-and', 'problem-padded', 'problem-exact'],
276
+ )
277
+
278
+ /* ---- problems created in bulk (the EHR-sync shape) take the same handler with created.length > 1 ---- */
279
+
280
+ const [problemBulkMatch, problemBulkMiss] = await Promise.all([
281
+ new_enduser('ProblemBulkMatch'),
282
+ new_enduser('ProblemBulkMiss'),
283
+ ])
284
+ await sdk.api.enduser_problems.createSome([
285
+ { enduserId: problemBulkMatch.id, title: 'Endometriosis, unspecified' },
286
+ { enduserId: problemBulkMiss.id, title: 'Common cold' },
287
+ ])
288
+ await expect_tags(
289
+ 'D1: bulk-created problem matching the contains lists fires the same triggers as a single create',
290
+ problemBulkMatch.id, 'problem-any',
291
+ ['problem-any', 'problem-cs', 'problem-ci', 'problem-and', 'problem-padded', 'problem-blankentry'],
292
+ ['problem-exact'],
293
+ )
294
+ await expect_tags(
295
+ 'D2: an unrelated problem in the same bulk create fires only the unfiltered trigger',
296
+ problemBulkMiss.id, 'problem-any',
297
+ ['problem-any'],
298
+ ['problem-cs', 'problem-ci', 'problem-and', 'problem-padded', 'problem-blankentry'],
299
+ )
300
+
301
+ /* ============================ regression: exact matching unchanged ============================ */
302
+
303
+ const exactHit = await new_enduser('ExactHit')
304
+ await sdk.api.enduser_problems.createOne({ enduserId: exactHit.id, title: 'Diabetes' })
305
+ await expect_tags(
306
+ 'E1: an exact-titles-only trigger still fires on an exactly matching title',
307
+ exactHit.id, 'problem-any',
308
+ ['problem-any', 'problem-exact'],
309
+ ['problem-cs', 'problem-ci', 'problem-and', 'problem-padded', 'problem-blankentry'],
310
+ )
311
+
312
+ const exactMiss = await new_enduser('ExactMiss')
313
+ await sdk.api.enduser_problems.createOne({ enduserId: exactMiss.id, title: 'Diabetes mellitus type 2' })
314
+ await expect_tags(
315
+ 'E2: an exact-titles-only trigger still does NOT fire on a superstring of its title',
316
+ exactMiss.id, 'problem-any',
317
+ ['problem-any'],
318
+ ['problem-exact', 'problem-cs', 'problem-ci', 'problem-and', 'problem-padded', 'problem-blankentry'],
319
+ )
320
+ } finally {
321
+ // Teardown BEFORE anything asserts — assert calls process.exit, which would strand this tenant.
322
+ if (tenant) { try { await tenant.teardown() } catch (e) { console.error('teardown failed', e) } }
323
+ }
324
+
325
+ return checks
326
+ }
327
+
328
+ /** Asserting wrapper, for standalone runs and for sequential use in the suite. */
329
+ export const trigger_contains_matching_tests = async () => {
330
+ assert_checks('Trigger contains title matching', await trigger_contains_matching_checks())
331
+ }
332
+
333
+ // Allow running this test file independently
334
+ if (require.main === module) {
335
+ console.log(`🌐 Using API URL: ${host}`)
336
+ trigger_contains_matching_tests()
337
+ .then(() => {
338
+ console.log("✅ Trigger contains matching test suite completed successfully")
339
+ process.exit(0)
340
+ })
341
+ .catch((error) => {
342
+ console.error("❌ Trigger contains matching test suite failed:", error)
343
+ process.exit(1)
344
+ })
345
+ }