@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.
- package/CLAUDE.md +5 -0
- package/env.example +39 -0
- package/lib/cjs/enduser.d.ts +1 -0
- package/lib/cjs/enduser.d.ts.map +1 -1
- package/lib/cjs/sdk.d.ts +6 -1
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +2 -0
- package/lib/cjs/sdk.js.map +1 -1
- package/lib/cjs/session.d.ts +1 -0
- package/lib/cjs/session.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/active_patient_count.test.js +1 -1
- package/lib/cjs/tests/api_tests/active_patient_count.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/appointment_rescheduled_trigger.test.js +1 -1
- package/lib/cjs/tests/api_tests/appointment_rescheduled_trigger.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/calendar_event_limits.test.js +5 -5
- package/lib/cjs/tests/api_tests/calendar_event_limits.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/calendar_event_references_update.test.js +1 -1
- package/lib/cjs/tests/api_tests/calendar_event_references_update.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/enduser_cross_access_isolation.test.js +1 -1
- package/lib/cjs/tests/api_tests/enduser_cross_access_isolation.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/enduser_fields_sync.test.d.ts +21 -0
- package/lib/cjs/tests/api_tests/enduser_fields_sync.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/enduser_fields_sync.test.js +215 -0
- package/lib/cjs/tests/api_tests/enduser_fields_sync.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.js +6 -6
- package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/enduser_session_invalidation.test.js +3 -3
- package/lib/cjs/tests/api_tests/enduser_session_invalidation.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/load_threads_care_team.test.d.ts +32 -0
- package/lib/cjs/tests/api_tests/load_threads_care_team.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/load_threads_care_team.test.js +257 -0
- package/lib/cjs/tests/api_tests/load_threads_care_team.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/managed_content_enduser_access.test.js +1 -1
- package/lib/cjs/tests/api_tests/managed_content_enduser_access.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/managed_content_file_access.test.js +1 -1
- package/lib/cjs/tests/api_tests/managed_content_file_access.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/mdi_case_offerings.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/mdi_case_offerings.test.js +139 -9
- package/lib/cjs/tests/api_tests/mdi_case_offerings.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/mdi_webhooks.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/mdi_webhooks.test.js +21 -8
- package/lib/cjs/tests/api_tests/mdi_webhooks.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/nutrition_tracking.test.js +1 -1
- package/lib/cjs/tests/api_tests/nutrition_tracking.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/openloop_webhooks.test.js +1 -1
- package/lib/cjs/tests/api_tests/openloop_webhooks.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/programs.test.d.ts +5 -0
- package/lib/cjs/tests/api_tests/programs.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/programs.test.js +370 -0
- package/lib/cjs/tests/api_tests/programs.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/programs_trigger_filters.test.d.ts +5 -0
- package/lib/cjs/tests/api_tests/programs_trigger_filters.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/programs_trigger_filters.test.js +295 -0
- package/lib/cjs/tests/api_tests/programs_trigger_filters.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js +55 -47
- package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.js +1 -1
- package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts +42 -0
- package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.js +484 -0
- package/lib/cjs/tests/api_tests/security/appointment-reschedule-ownership.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js +1 -1
- package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +1 -1
- package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js +1 -1
- package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js +1 -1
- package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.js +2 -2
- package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts +32 -0
- package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js +297 -0
- package/lib/cjs/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +4 -1
- package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/templated_message_date_fields.test.d.ts +3 -0
- package/lib/cjs/tests/api_tests/templated_message_date_fields.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/templated_message_date_fields.test.js +202 -0
- package/lib/cjs/tests/api_tests/templated_message_date_fields.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.d.ts +3 -0
- package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.js +233 -0
- package/lib/cjs/tests/api_tests/templated_message_link_in_href.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/templated_message_links.test.d.ts +3 -0
- package/lib/cjs/tests/api_tests/templated_message_links.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/templated_message_links.test.js +235 -0
- package/lib/cjs/tests/api_tests/templated_message_links.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/time_tracks.test.js +1 -1
- package/lib/cjs/tests/api_tests/time_tracks.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/trigger_contains_matching.test.d.ts +5 -0
- package/lib/cjs/tests/api_tests/trigger_contains_matching.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/trigger_contains_matching.test.js +395 -0
- package/lib/cjs/tests/api_tests/trigger_contains_matching.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.d.ts +5 -0
- package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.js +471 -0
- package/lib/cjs/tests/api_tests/user_logs_restore_deleted.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/user_portal_settings.test.js +1 -1
- package/lib/cjs/tests/api_tests/user_portal_settings.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/validation_behavior_locks.test.d.ts +2 -0
- package/lib/cjs/tests/api_tests/validation_behavior_locks.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/validation_behavior_locks.test.js +233 -0
- package/lib/cjs/tests/api_tests/validation_behavior_locks.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.d.ts +5 -0
- package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.js +569 -0
- package/lib/cjs/tests/api_tests/vital_review_trigger_action.test.js.map +1 -0
- package/lib/cjs/tests/public_endpoint_tests.js +3 -2
- package/lib/cjs/tests/public_endpoint_tests.js.map +1 -1
- package/lib/cjs/tests/setup.d.ts +16 -0
- package/lib/cjs/tests/setup.d.ts.map +1 -1
- package/lib/cjs/tests/setup.js +55 -8
- package/lib/cjs/tests/setup.js.map +1 -1
- package/lib/cjs/tests/setup_isolated.d.ts +9 -0
- package/lib/cjs/tests/setup_isolated.d.ts.map +1 -1
- package/lib/cjs/tests/setup_isolated.js +23 -2
- package/lib/cjs/tests/setup_isolated.js.map +1 -1
- package/lib/cjs/tests/socket_tests.d.ts.map +1 -1
- package/lib/cjs/tests/socket_tests.js +3 -2
- package/lib/cjs/tests/socket_tests.js.map +1 -1
- package/lib/cjs/tests/tests.d.ts.map +1 -1
- package/lib/cjs/tests/tests.js +244 -216
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/cjs/tests/unit_tests/trigger_title_partials.test.d.ts +3 -0
- package/lib/cjs/tests/unit_tests/trigger_title_partials.test.d.ts.map +1 -0
- package/lib/cjs/tests/unit_tests/trigger_title_partials.test.js +118 -0
- package/lib/cjs/tests/unit_tests/trigger_title_partials.test.js.map +1 -0
- package/lib/cjs/tests/webhooks_tests.js +3 -2
- package/lib/cjs/tests/webhooks_tests.js.map +1 -1
- package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/esm/enduser.d.ts +2 -0
- package/lib/esm/enduser.d.ts.map +1 -1
- package/lib/esm/sdk.d.ts +9 -3
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +2 -0
- package/lib/esm/sdk.js.map +1 -1
- package/lib/esm/session.d.ts +2 -0
- package/lib/esm/session.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/active_patient_count.test.js +1 -1
- package/lib/esm/tests/api_tests/active_patient_count.test.js.map +1 -1
- package/lib/esm/tests/api_tests/appointment_rescheduled_trigger.test.js +1 -1
- package/lib/esm/tests/api_tests/appointment_rescheduled_trigger.test.js.map +1 -1
- package/lib/esm/tests/api_tests/calendar_event_limits.test.js +5 -5
- package/lib/esm/tests/api_tests/calendar_event_limits.test.js.map +1 -1
- package/lib/esm/tests/api_tests/calendar_event_references_update.test.js +1 -1
- package/lib/esm/tests/api_tests/calendar_event_references_update.test.js.map +1 -1
- package/lib/esm/tests/api_tests/enduser_cross_access_isolation.test.js +1 -1
- package/lib/esm/tests/api_tests/enduser_cross_access_isolation.test.js.map +1 -1
- package/lib/esm/tests/api_tests/enduser_fields_sync.test.d.ts +21 -0
- package/lib/esm/tests/api_tests/enduser_fields_sync.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/enduser_fields_sync.test.js +210 -0
- package/lib/esm/tests/api_tests/enduser_fields_sync.test.js.map +1 -0
- package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.js +7 -7
- package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.js.map +1 -1
- package/lib/esm/tests/api_tests/enduser_session_invalidation.test.js +4 -4
- package/lib/esm/tests/api_tests/enduser_session_invalidation.test.js.map +1 -1
- package/lib/esm/tests/api_tests/load_threads_care_team.test.d.ts +32 -0
- package/lib/esm/tests/api_tests/load_threads_care_team.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/load_threads_care_team.test.js +252 -0
- package/lib/esm/tests/api_tests/load_threads_care_team.test.js.map +1 -0
- package/lib/esm/tests/api_tests/managed_content_enduser_access.test.js +1 -1
- package/lib/esm/tests/api_tests/managed_content_enduser_access.test.js.map +1 -1
- package/lib/esm/tests/api_tests/managed_content_file_access.test.js +1 -1
- package/lib/esm/tests/api_tests/managed_content_file_access.test.js.map +1 -1
- package/lib/esm/tests/api_tests/mdi_case_offerings.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/mdi_case_offerings.test.js +139 -9
- package/lib/esm/tests/api_tests/mdi_case_offerings.test.js.map +1 -1
- package/lib/esm/tests/api_tests/mdi_webhooks.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/mdi_webhooks.test.js +21 -8
- package/lib/esm/tests/api_tests/mdi_webhooks.test.js.map +1 -1
- package/lib/esm/tests/api_tests/nutrition_tracking.test.js +1 -1
- package/lib/esm/tests/api_tests/nutrition_tracking.test.js.map +1 -1
- package/lib/esm/tests/api_tests/openloop_webhooks.test.js +1 -1
- package/lib/esm/tests/api_tests/openloop_webhooks.test.js.map +1 -1
- package/lib/esm/tests/api_tests/programs.test.d.ts +5 -0
- package/lib/esm/tests/api_tests/programs.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/programs.test.js +365 -0
- package/lib/esm/tests/api_tests/programs.test.js.map +1 -0
- package/lib/esm/tests/api_tests/programs_trigger_filters.test.d.ts +5 -0
- package/lib/esm/tests/api_tests/programs_trigger_filters.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/programs_trigger_filters.test.js +290 -0
- package/lib/esm/tests/api_tests/programs_trigger_filters.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js +55 -47
- package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.js +1 -1
- package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts +42 -0
- package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.js +479 -0
- package/lib/esm/tests/api_tests/security/appointment-reschedule-ownership.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js +1 -1
- package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +1 -1
- package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js +1 -1
- package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js +1 -1
- package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.js +3 -3
- package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts +32 -0
- package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js +292 -0
- package/lib/esm/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +4 -1
- package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -1
- package/lib/esm/tests/api_tests/templated_message_date_fields.test.d.ts +3 -0
- package/lib/esm/tests/api_tests/templated_message_date_fields.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/templated_message_date_fields.test.js +198 -0
- package/lib/esm/tests/api_tests/templated_message_date_fields.test.js.map +1 -0
- package/lib/esm/tests/api_tests/templated_message_link_in_href.test.d.ts +3 -0
- package/lib/esm/tests/api_tests/templated_message_link_in_href.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/templated_message_link_in_href.test.js +229 -0
- package/lib/esm/tests/api_tests/templated_message_link_in_href.test.js.map +1 -0
- package/lib/esm/tests/api_tests/templated_message_links.test.d.ts +3 -0
- package/lib/esm/tests/api_tests/templated_message_links.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/templated_message_links.test.js +231 -0
- package/lib/esm/tests/api_tests/templated_message_links.test.js.map +1 -0
- package/lib/esm/tests/api_tests/time_tracks.test.js +1 -1
- package/lib/esm/tests/api_tests/time_tracks.test.js.map +1 -1
- package/lib/esm/tests/api_tests/trigger_contains_matching.test.d.ts +5 -0
- package/lib/esm/tests/api_tests/trigger_contains_matching.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/trigger_contains_matching.test.js +390 -0
- package/lib/esm/tests/api_tests/trigger_contains_matching.test.js.map +1 -0
- package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.d.ts +5 -0
- package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.js +466 -0
- package/lib/esm/tests/api_tests/user_logs_restore_deleted.test.js.map +1 -0
- package/lib/esm/tests/api_tests/user_portal_settings.test.js +1 -1
- package/lib/esm/tests/api_tests/user_portal_settings.test.js.map +1 -1
- package/lib/esm/tests/api_tests/validation_behavior_locks.test.d.ts +2 -0
- package/lib/esm/tests/api_tests/validation_behavior_locks.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/validation_behavior_locks.test.js +229 -0
- package/lib/esm/tests/api_tests/validation_behavior_locks.test.js.map +1 -0
- package/lib/esm/tests/api_tests/vital_review_trigger_action.test.d.ts +5 -0
- package/lib/esm/tests/api_tests/vital_review_trigger_action.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/vital_review_trigger_action.test.js +564 -0
- package/lib/esm/tests/api_tests/vital_review_trigger_action.test.js.map +1 -0
- package/lib/esm/tests/public_endpoint_tests.js +3 -2
- package/lib/esm/tests/public_endpoint_tests.js.map +1 -1
- package/lib/esm/tests/setup.d.ts +16 -0
- package/lib/esm/tests/setup.d.ts.map +1 -1
- package/lib/esm/tests/setup.js +53 -7
- package/lib/esm/tests/setup.js.map +1 -1
- package/lib/esm/tests/setup_isolated.d.ts +9 -0
- package/lib/esm/tests/setup_isolated.d.ts.map +1 -1
- package/lib/esm/tests/setup_isolated.js +21 -1
- package/lib/esm/tests/setup_isolated.js.map +1 -1
- package/lib/esm/tests/socket_tests.d.ts.map +1 -1
- package/lib/esm/tests/socket_tests.js +3 -2
- package/lib/esm/tests/socket_tests.js.map +1 -1
- package/lib/esm/tests/tests.d.ts.map +1 -1
- package/lib/esm/tests/tests.js +244 -216
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/esm/tests/unit_tests/trigger_title_partials.test.d.ts +3 -0
- package/lib/esm/tests/unit_tests/trigger_title_partials.test.d.ts.map +1 -0
- package/lib/esm/tests/unit_tests/trigger_title_partials.test.js +115 -0
- package/lib/esm/tests/unit_tests/trigger_title_partials.test.js.map +1 -0
- package/lib/esm/tests/webhooks_tests.js +3 -2
- package/lib/esm/tests/webhooks_tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -19
- package/src/sdk.ts +11 -1
- package/src/tests/api_tests/active_patient_count.test.ts +1 -1
- package/src/tests/api_tests/appointment_rescheduled_trigger.test.ts +1 -1
- package/src/tests/api_tests/calendar_event_references_update.test.ts +1 -1
- package/src/tests/api_tests/enduser_cross_access_isolation.test.ts +1 -1
- package/src/tests/api_tests/enduser_fields_sync.test.ts +150 -0
- package/src/tests/api_tests/enduser_login_rate_limits.test.ts +7 -7
- package/src/tests/api_tests/enduser_session_invalidation.test.ts +4 -4
- package/src/tests/api_tests/load_threads_care_team.test.ts +210 -0
- package/src/tests/api_tests/managed_content_enduser_access.test.ts +1 -1
- package/src/tests/api_tests/managed_content_file_access.test.ts +1 -1
- package/src/tests/api_tests/mdi_case_offerings.test.ts +138 -0
- package/src/tests/api_tests/mdi_webhooks.test.ts +9 -0
- package/src/tests/api_tests/nutrition_tracking.test.ts +1 -1
- package/src/tests/api_tests/openloop_webhooks.test.ts +1 -1
- package/src/tests/api_tests/security/add-to-journey-foreign-enduserid.test.ts +33 -26
- package/src/tests/api_tests/security/allowed-paths-confinement.test.ts +1 -1
- package/src/tests/api_tests/security/appointment-reschedule-ownership.test.ts +432 -0
- package/src/tests/api_tests/security/booking-info-idor-token-mint.test.ts +1 -1
- package/src/tests/api_tests/security/enduser-ai-summary-trust-gate.test.ts +1 -1
- package/src/tests/api_tests/security/enduser-cross-create.test.ts +1 -1
- package/src/tests/api_tests/security/enduser-write-restrictions.test.ts +1 -1
- package/src/tests/api_tests/security/invite-user-enumeration.test.ts +3 -3
- package/src/tests/api_tests/security/rich-text-answer-sanitized-on-write.test.ts +197 -0
- package/src/tests/api_tests/security/sanitize-user-html-with-iframes.test.ts +4 -1
- package/src/tests/api_tests/templated_message_date_fields.test.ts +146 -0
- package/src/tests/api_tests/templated_message_links.test.ts +192 -0
- package/src/tests/api_tests/time_tracks.test.ts +1 -1
- package/src/tests/api_tests/trigger_contains_matching.test.ts +345 -0
- package/src/tests/api_tests/user_logs_restore_deleted.test.ts +415 -0
- package/src/tests/api_tests/user_portal_settings.test.ts +1 -1
- package/src/tests/api_tests/validation_behavior_locks.test.ts +204 -0
- package/src/tests/public_endpoint_tests.ts +3 -2
- package/src/tests/setup.ts +43 -7
- package/src/tests/setup_isolated.ts +10 -0
- package/src/tests/socket_tests.ts +3 -2
- package/src/tests/tests.ts +22 -2
- package/src/tests/unit_tests/trigger_title_partials.test.ts +174 -0
- package/src/tests/webhooks_tests.ts +4 -2
- package/test_generated.pdf +0 -0
- package/tsconfig.cjs.json +17 -0
package/src/tests/setup.ts
CHANGED
|
@@ -9,19 +9,55 @@ import {
|
|
|
9
9
|
assert,
|
|
10
10
|
} from "@tellescope/testing"
|
|
11
11
|
|
|
12
|
+
import { test_support_request } from "./setup_isolated"
|
|
13
|
+
|
|
12
14
|
const host = process.env.API_URL || 'http://localhost:8080' as const
|
|
13
15
|
const [email, password] = [process.env.TEST_EMAIL, process.env.TEST_PASSWORD]
|
|
14
16
|
const [nonAdminEmail, nonAdminPassword] = [process.env.NON_ADMIN_EMAIL, process.env.NON_ADMIN_PASSWORD]
|
|
15
|
-
const businessId = '60398b1131a295e64f084ff6'
|
|
16
17
|
|
|
18
|
+
/** The hand-seeded shared fixture this suite was written against; still the default. */
|
|
19
|
+
export const LEGACY_TEST_BUSINESS_ID = '60398b1131a295e64f084ff6'
|
|
20
|
+
const businessId = process.env.TEST_BUSINESS_ID || LEGACY_TEST_BUSINESS_ID
|
|
21
|
+
// The legacy fixture's local API key. `npm run bootstrap` writes a provisioned tenant's key to
|
|
22
|
+
// TEST_API_KEY, so a fresh checkout does not need a copy of anyone's database.
|
|
23
|
+
const apiKey = process.env.TEST_API_KEY || '3n5q0SCBT_iUvZz-b9BJtX7o7HQUVJ9v132PgHJNJsg.'
|
|
24
|
+
|
|
25
|
+
// exit 1, not 0: a bare process.exit() reports success, which turns "nobody configured the
|
|
26
|
+
// credentials" into a silently passing test run
|
|
17
27
|
if (!(email && password)) {
|
|
18
28
|
console.error("Set TEST_EMAIL and TEST_PASSWORD")
|
|
19
|
-
process.exit()
|
|
29
|
+
process.exit(1)
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
if (!(nonAdminEmail && nonAdminPassword)) {
|
|
23
33
|
console.error("Set NON_ADMIN_EMAIL and NON_ADMIN_PASSWORD")
|
|
24
|
-
process.exit()
|
|
34
|
+
process.exit(1)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Per-run database reset for whichever tenant the fixture is pointed at.
|
|
39
|
+
*
|
|
40
|
+
* The legacy path is `sdk.reset_db()` (POST /reset-demo): it deletes a HARDCODED businessId's records
|
|
41
|
+
* plus six global throttle namespaces, and requires a session whose email is in the API's
|
|
42
|
+
* ADMIN_EMAILS allowlist — so it does nothing useful for, and is not even authorized for, a tenant
|
|
43
|
+
* provisioned by /test-support. That tenant resets through /test-support/reset-tenant instead, which
|
|
44
|
+
* is scoped to its own businessId and keeps the org, users, API keys and roles the caller is holding.
|
|
45
|
+
*
|
|
46
|
+
* `clearGlobalThrottles` is requested here (and honored only under LOCAL) because this is the shared
|
|
47
|
+
* fixture: setup_tests deliberately exhausts login throttles and must clear them, exactly as
|
|
48
|
+
* reset_db did. Isolated tests use `reset_isolated_tenant`, which never touches global state.
|
|
49
|
+
*/
|
|
50
|
+
export const reset_test_tenant = async (sdk: Session) => {
|
|
51
|
+
const id = sdk.userInfo?.businessId || businessId
|
|
52
|
+
const provisioned = process.env.TEST_TENANT_PROVISIONED === 'true' || id !== LEGACY_TEST_BUSINESS_ID
|
|
53
|
+
if (!provisioned) { await sdk.reset_db(); return }
|
|
54
|
+
|
|
55
|
+
const { status, body } = await test_support_request('/reset-tenant', {
|
|
56
|
+
businessId: id, clearGlobalThrottles: true,
|
|
57
|
+
})
|
|
58
|
+
if (status !== 200) {
|
|
59
|
+
throw new Error(`test-support /reset-tenant failed (${status}): ${JSON.stringify(body)}`)
|
|
60
|
+
}
|
|
25
61
|
}
|
|
26
62
|
|
|
27
63
|
const passOnAnyResult = { shouldError: false, onResult: () => true }
|
|
@@ -49,7 +85,7 @@ export const setup_tests = async (sdk: Session, sdkNonAdmin: Session) => {
|
|
|
49
85
|
|
|
50
86
|
await async_test(
|
|
51
87
|
'test_authenticated (with API Key)',
|
|
52
|
-
(new Session({ host, apiKey
|
|
88
|
+
(new Session({ host, apiKey })).test_authenticated,
|
|
53
89
|
{ expectedResult: 'Authenticated!' }
|
|
54
90
|
)
|
|
55
91
|
|
|
@@ -71,7 +107,7 @@ export const setup_tests = async (sdk: Session, sdkNonAdmin: Session) => {
|
|
|
71
107
|
passOnAnyResult
|
|
72
108
|
)
|
|
73
109
|
|
|
74
|
-
const badEnduserSDK = new EnduserSession({ host, businessId });
|
|
110
|
+
const badEnduserSDK = new EnduserSession({ host, businessId: sdk.userInfo.businessId });
|
|
75
111
|
await badEnduserSDK.authenticate('bademail@tellescope.com', 'badpassword').catch(console.error)
|
|
76
112
|
await badEnduserSDK.authenticate('bademail@tellescope.com', 'badpassword').catch(console.error)
|
|
77
113
|
await badEnduserSDK.authenticate('bademail@tellescope.com', 'badpassword').catch(console.error)
|
|
@@ -89,7 +125,7 @@ export const setup_tests = async (sdk: Session, sdkNonAdmin: Session) => {
|
|
|
89
125
|
)
|
|
90
126
|
|
|
91
127
|
// prevent additional login throttling
|
|
92
|
-
await async_test('
|
|
128
|
+
await async_test('reset_test_tenant', () => reset_test_tenant(sdk), passOnVoid)
|
|
93
129
|
|
|
94
130
|
await sdk.logout()
|
|
95
131
|
await async_test<string, string>('test_authenticated - (logout invalidates jwt)', sdk.test_authenticated, { shouldError: true, onError: e => e === 'Unauthenticated' })
|
|
@@ -148,7 +184,7 @@ export const setup_tests = async (sdk: Session, sdkNonAdmin: Session) => {
|
|
|
148
184
|
await sdkNonAdmin.authenticate(nonAdminEmail, nonAdminPassword)
|
|
149
185
|
|
|
150
186
|
// may do some stuff in background after returning
|
|
151
|
-
await async_test('
|
|
187
|
+
await async_test('reset_test_tenant', () => reset_test_tenant(sdk), passOnVoid)
|
|
152
188
|
await wait(undefined, 250)
|
|
153
189
|
|
|
154
190
|
// Prevent test-triggered notifications (e.g. timeTrackRejected, inbound-message
|
|
@@ -103,6 +103,16 @@ export const set_email_verification_code = async (email: string, code: string) =
|
|
|
103
103
|
post('/set-email-verification-code', { email, code })
|
|
104
104
|
)
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Empties a provisioned tenant's records while keeping the tenant, its users, API keys and roles —
|
|
108
|
+
* for a test that wants a clean slate between phases without re-provisioning.
|
|
109
|
+
*
|
|
110
|
+
* Records only: the shared login/IP throttle namespaces are NOT cleared, so this stays safe to call
|
|
111
|
+
* while another suite is running. (setup.ts's `reset_test_tenant` does ask for those, because the
|
|
112
|
+
* shared fixture deliberately exhausts login throttles.)
|
|
113
|
+
*/
|
|
114
|
+
export const reset_isolated_tenant = async (businessId: string) => post('/reset-tenant', { businessId })
|
|
115
|
+
|
|
106
116
|
/** Raw access, for tests that need to assert on the response of a rejected call. */
|
|
107
117
|
export const test_support_request = async (path: string, body: object) => {
|
|
108
118
|
const r = await axios.request({
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "@tellescope/types-utilities"
|
|
17
17
|
import { EnduserSession } from "../enduser"
|
|
18
18
|
import { Session, /* APIQuery */ } from "../sdk"
|
|
19
|
+
import { reset_test_tenant } from "./setup"
|
|
19
20
|
import { PLACEHOLDER_ID } from "@tellescope/constants"
|
|
20
21
|
import { UserSession } from "@tellescope/types-models"
|
|
21
22
|
|
|
@@ -29,7 +30,7 @@ const host = process.env.API_URL || 'http://localhost:8080'
|
|
|
29
30
|
const [email, password] = [process.env.TEST_EMAIL, process.env.TEST_PASSWORD]
|
|
30
31
|
const [email2, password2] = [process.env.TEST_EMAIL_2, process.env.TEST_PASSWORD_2]
|
|
31
32
|
const [nonAdminEmail, nonAdminPassword] = [process.env.NON_ADMIN_EMAIL, process.env.NON_ADMIN_PASSWORD]
|
|
32
|
-
const businessId = '60398b1131a295e64f084ff6'
|
|
33
|
+
const businessId = process.env.TEST_BUSINESS_ID || '60398b1131a295e64f084ff6'
|
|
33
34
|
|
|
34
35
|
const subUserEmail = process.env.SUB_EMAIL
|
|
35
36
|
const otherSubUserEmail = process.env.OTHER_SUB_EMAIL
|
|
@@ -487,7 +488,7 @@ const cleanup_cache = () => {
|
|
|
487
488
|
|
|
488
489
|
try {
|
|
489
490
|
await user1.authenticate(email, password)
|
|
490
|
-
await user1
|
|
491
|
+
await reset_test_tenant(user1)
|
|
491
492
|
|
|
492
493
|
await Promise.all([
|
|
493
494
|
user2.authenticate(email2, password2), // generate authToken + socket connection for API keyj
|
package/src/tests/tests.ts
CHANGED
|
@@ -123,6 +123,9 @@ import { register_business_id_injection_tests } from "./api_tests/security/regis
|
|
|
123
123
|
import { handle_incoming_communication_cross_tenant_tests } from "./api_tests/security/handle-incoming-communication-cross-tenant.test";
|
|
124
124
|
import { sanitize_user_html_xss_tests } from "./api_tests/security/sanitize-user-html.test";
|
|
125
125
|
import { sanitize_user_html_with_iframes_tests } from "./api_tests/security/sanitize-user-html-with-iframes.test";
|
|
126
|
+
import { validation_behavior_lock_tests } from "./api_tests/validation_behavior_locks.test";
|
|
127
|
+
import { templated_message_date_field_tests } from "./api_tests/templated_message_date_fields.test";
|
|
128
|
+
import { templated_message_link_tests } from "./api_tests/templated_message_links.test";
|
|
126
129
|
import { prototype_pollution_tests } from "./api_tests/security/prototype-pollution.test";
|
|
127
130
|
import { enduser_cross_create_tests } from "./api_tests/security/enduser-cross-create.test";
|
|
128
131
|
import { globalunique_leak_tests } from "./api_tests/security/globalunique-conflict-redaction.test";
|
|
@@ -140,6 +143,7 @@ import { automated_actions_process_gate_tests } from "./api_tests/security/autom
|
|
|
140
143
|
import { schema_adminonly_enforcement_tests } from "./api_tests/security/schema-adminonly-enforcement.test";
|
|
141
144
|
import { startlinktoken_escalation_tests } from "./api_tests/security/startlinktoken-enduser-staff-escalation.test";
|
|
142
145
|
import { form_logic_js_execution_checks } from "./api_tests/security/form-logic-js-execution.test";
|
|
146
|
+
import { rich_text_answer_sanitized_on_write_checks } from "./api_tests/security/rich-text-answer-sanitized-on-write.test";
|
|
143
147
|
import { bulk_assignment_tests } from "./api_tests/bulk_assignment.test";
|
|
144
148
|
import { tickets_bulk_assign_care_team_tests } from "./api_tests/tickets_bulk_assign_care_team.test";
|
|
145
149
|
import { managed_content_enduser_access_tests } from "./api_tests/managed_content_enduser_access.test";
|
|
@@ -159,12 +163,18 @@ import { conditional_logic_medication_unit_tests } from "./unit_tests/conditiona
|
|
|
159
163
|
import { phone_validation_unit_tests } from "./unit_tests/phone_validation.test";
|
|
160
164
|
import { openapi_spec_freshness_unit_tests } from "./unit_tests/openapi_spec_freshness.test";
|
|
161
165
|
import { do_not_send_address_unit_tests } from "./unit_tests/do_not_send_address.test";
|
|
166
|
+
import { trigger_title_partials_unit_tests } from "./unit_tests/trigger_title_partials.test";
|
|
167
|
+
import { trigger_contains_matching_checks } from "./api_tests/trigger_contains_matching.test";
|
|
162
168
|
import { organization_signup_checks } from "./api_tests/organization_signup.test";
|
|
163
169
|
import { add_to_journey_foreign_enduserid_checks } from "./api_tests/security/add-to-journey-foreign-enduserid.test";
|
|
164
170
|
import { tickets_bulk_assign_from_queue_checks } from "./api_tests/tickets_bulk_assign_from_queue.test";
|
|
165
171
|
import { enduser_observations_auto_review_checks } from "./api_tests/enduser_observations_auto_review.test";
|
|
166
172
|
import { file_link_session_confinement_checks } from "./api_tests/security/file-link-session-confinement.test";
|
|
173
|
+
import { appointment_reschedule_ownership_checks } from "./api_tests/security/appointment-reschedule-ownership.test";
|
|
174
|
+
import { load_threads_care_team_checks } from "./api_tests/load_threads_care_team.test";
|
|
167
175
|
import { run_isolated_in_parallel } from "./setup_isolated";
|
|
176
|
+
import { enduser_fields_sync_checks } from "./api_tests/enduser_fields_sync.test";
|
|
177
|
+
import { user_logs_restore_deleted_checks } from "./api_tests/user_logs_restore_deleted.test";
|
|
168
178
|
import { elation_user_id_tests } from "./api_tests/elation_user_id.test";
|
|
169
179
|
import { organization_settings_duplicates_tests } from "./api_tests/organization_settings_duplicates.test";
|
|
170
180
|
import { stedi_approval_tests } from "./api_tests/stedi_approval.test";
|
|
@@ -205,7 +215,7 @@ const otherSubUserEmail = process.env.OTHER_SUB_EMAIL
|
|
|
205
215
|
const subSubUserEmail = process.env.SUB_SUB_EMAIL
|
|
206
216
|
|
|
207
217
|
const userId = '60398b0231a295e64f084fd9'
|
|
208
|
-
const businessId = '60398b1131a295e64f084ff6'
|
|
218
|
+
const businessId = process.env.TEST_BUSINESS_ID || '60398b1131a295e64f084ff6'
|
|
209
219
|
|
|
210
220
|
// const example_SDK_usage = async () => {
|
|
211
221
|
// // initialize SDK and authenticate a user
|
|
@@ -256,7 +266,7 @@ const enduserSDKDifferentBusinessId = new EnduserSession({ host, businessId: '80
|
|
|
256
266
|
|
|
257
267
|
if (!(email && mfaEmail && mfaPassword && subUserEmail && otherSubUserEmail && subSubUserEmail && password && email2 && password2 && nonAdminEmail && nonAdminPassword)) {
|
|
258
268
|
console.error("Set TEST_EMAIL and TEST_PASSWORD")
|
|
259
|
-
process.exit()
|
|
269
|
+
process.exit(1) // 1, not 0: an unconfigured run must not report success
|
|
260
270
|
}
|
|
261
271
|
|
|
262
272
|
const recordNotFound = { shouldError: true, onError: (e: { message: string }) => e.message === 'Could not find a record for the given id' }
|
|
@@ -15391,6 +15401,7 @@ const ip_address_form_tests = async () => {
|
|
|
15391
15401
|
await phone_validation_unit_tests()
|
|
15392
15402
|
await openapi_spec_freshness_unit_tests()
|
|
15393
15403
|
await do_not_send_address_unit_tests()
|
|
15404
|
+
await trigger_title_partials_unit_tests()
|
|
15394
15405
|
await replace_enduser_template_values_tests()
|
|
15395
15406
|
await safe_json_parse_template_tests()
|
|
15396
15407
|
await replace_form_field_template_values_tests()
|
|
@@ -15406,7 +15417,13 @@ const ip_address_form_tests = async () => {
|
|
|
15406
15417
|
{ name: 'Tickets bulk assign from queue', run: tickets_bulk_assign_from_queue_checks },
|
|
15407
15418
|
{ name: 'Vital auto-review on create', run: enduser_observations_auto_review_checks },
|
|
15408
15419
|
{ name: '$JS in stored conditional logic', run: form_logic_js_execution_checks },
|
|
15420
|
+
{ name: 'Rich Text answers sanitized on write', run: rich_text_answer_sanitized_on_write_checks },
|
|
15409
15421
|
{ name: 'Shared file link session confinement', run: file_link_session_confinement_checks },
|
|
15422
|
+
{ name: 'book_appointment reschedule ownership', run: appointment_reschedule_ownership_checks },
|
|
15423
|
+
{ name: 'Enduser fields sync schema round-trip', run: enduser_fields_sync_checks },
|
|
15424
|
+
{ name: 'Trigger contains title matching', run: trigger_contains_matching_checks },
|
|
15425
|
+
{ name: 'user_logs restore_deleted', run: user_logs_restore_deleted_checks },
|
|
15426
|
+
{ name: 'Load threads care team', run: load_threads_care_team_checks },
|
|
15410
15427
|
])
|
|
15411
15428
|
await embeddables_auth_token_tests({ sdk, sdkNonAdmin })
|
|
15412
15429
|
await proxy_image_ssrf_tests({ sdk, sdkNonAdmin })
|
|
@@ -15452,6 +15469,9 @@ const ip_address_form_tests = async () => {
|
|
|
15452
15469
|
await self_admin_role_assignment_tests({ sdk, sdkNonAdmin })
|
|
15453
15470
|
await sanitize_user_html_xss_tests()
|
|
15454
15471
|
await sanitize_user_html_with_iframes_tests()
|
|
15472
|
+
await validation_behavior_lock_tests()
|
|
15473
|
+
await templated_message_date_field_tests()
|
|
15474
|
+
await templated_message_link_tests()
|
|
15455
15475
|
await prototype_pollution_tests()
|
|
15456
15476
|
await account_switcher_tests({ sdk, sdkNonAdmin })
|
|
15457
15477
|
await totp_mfa_tests({ sdk, sdkNonAdmin })
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { title_matches_partials } from "@tellescope/utilities"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Unit coverage for the shared "contains" matcher behind the Problem Created / Order Created title
|
|
5
|
+
* filters. The backend call sites (enduser_problems.ts, enduser_orders.ts, handle_order_created)
|
|
6
|
+
* all delegate here, so the semantics are pinned in one place:
|
|
7
|
+
*
|
|
8
|
+
* - each list is OR internally, the two lists AND together
|
|
9
|
+
* - the case-sensitive list is `titlePartials`, the case-insensitive one `titlePartialsIgnoreCase`
|
|
10
|
+
* - entries are trimmed, and blank-after-trim entries are dropped rather than matching everything
|
|
11
|
+
* - no list set (or every entry blank) means "leave blank for all"
|
|
12
|
+
* - a missing/empty title never satisfies a non-empty list
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
let failures = 0
|
|
16
|
+
let passed = 0
|
|
17
|
+
|
|
18
|
+
const assert = (name: string, actual: boolean, expected: boolean) => {
|
|
19
|
+
if (actual === expected) {
|
|
20
|
+
passed++
|
|
21
|
+
console.log(` ✓ ${name}`)
|
|
22
|
+
} else {
|
|
23
|
+
failures++
|
|
24
|
+
console.error(` ✗ ${name} — expected ${expected}, got ${actual}`)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const run_unset_tests = () => {
|
|
29
|
+
console.log("\n[title_matches_partials — unset lists mean no filter]")
|
|
30
|
+
|
|
31
|
+
assert("both lists undefined", title_matches_partials('Endometriosis, unspecified'), true)
|
|
32
|
+
assert("both lists empty arrays", title_matches_partials('Endometriosis', [], []), true)
|
|
33
|
+
assert("undefined title with no lists set", title_matches_partials(undefined), true)
|
|
34
|
+
assert("empty title with no lists set", title_matches_partials(''), true)
|
|
35
|
+
assert("null title with no lists set", title_matches_partials(null), true)
|
|
36
|
+
assert("all-blank case-sensitive list counts as unset", title_matches_partials('Common cold', [' ']), true)
|
|
37
|
+
assert("all-blank case-insensitive list counts as unset", title_matches_partials('Common cold', [], ['', ' ']), true)
|
|
38
|
+
assert("all-blank lists on an empty title", title_matches_partials('', [' '], ['\t']), true)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const run_case_sensitive_tests = () => {
|
|
42
|
+
console.log("\n[title_matches_partials — case sensitive list]")
|
|
43
|
+
|
|
44
|
+
assert("substring match", title_matches_partials('Endometriosis, unspecified', ['Endometriosis']), true)
|
|
45
|
+
assert("prefix fragment match", title_matches_partials('Endometriosis, unspecified', ['Endo']), true)
|
|
46
|
+
assert("mid-string fragment match", title_matches_partials('Chronic Endometriosis pain', ['metrios']), true)
|
|
47
|
+
assert("case mismatch does not match", title_matches_partials('Chronic endometriosis pain', ['Endometriosis']), false)
|
|
48
|
+
assert("uppercase entry does not match lowercase title", title_matches_partials('endometriosis', ['ENDO']), false)
|
|
49
|
+
assert("exact-equal title matches", title_matches_partials('Endometriosis', ['Endometriosis']), true)
|
|
50
|
+
assert("unrelated title does not match", title_matches_partials('Common cold', ['Endo']), false)
|
|
51
|
+
|
|
52
|
+
// OR within the list
|
|
53
|
+
assert("OR within list — second entry matches", title_matches_partials('Type 2 Diabetes', ['Endo', 'Diabetes']), true)
|
|
54
|
+
assert("OR within list — no entry matches", title_matches_partials('Common cold', ['Endo', 'Diabetes']), false)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const run_case_insensitive_tests = () => {
|
|
58
|
+
console.log("\n[title_matches_partials — case insensitive list]")
|
|
59
|
+
|
|
60
|
+
assert("lowercase entry matches capitalized title", title_matches_partials('Semaglutide 0.25mg', [], ['semaglutide']), true)
|
|
61
|
+
assert("lowercase entry matches uppercase title", title_matches_partials('SEMAGLUTIDE injection', [], ['semaglutide']), true)
|
|
62
|
+
assert("uppercase entry matches lowercase title", title_matches_partials('semaglutide injection', [], ['SEMAGLUTIDE']), true)
|
|
63
|
+
assert("mixed-case entry matches", title_matches_partials('Chronic endometriosis pain', [], ['EnDoMeTrIoSiS']), true)
|
|
64
|
+
assert("unrelated title does not match", title_matches_partials('Tirzepatide 5mg', [], ['semaglutide']), false)
|
|
65
|
+
assert("OR within list — second entry matches", title_matches_partials('Tirzepatide 5mg', [], ['sema', 'TIRZ']), true)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const run_trimming_tests = () => {
|
|
69
|
+
console.log("\n[title_matches_partials — trimming and blank entries]")
|
|
70
|
+
|
|
71
|
+
assert("padded entry is trimmed before matching", title_matches_partials('Endometriosis, unspecified', [' Endo ']), true)
|
|
72
|
+
assert("padded case-insensitive entry is trimmed", title_matches_partials('SEMAGLUTIDE injection', [], [' semaglutide ']), true)
|
|
73
|
+
assert(
|
|
74
|
+
"blank sibling entry is ignored, real entry still matches",
|
|
75
|
+
title_matches_partials('Endometriosis', ['Endo', ' ']),
|
|
76
|
+
true,
|
|
77
|
+
)
|
|
78
|
+
assert(
|
|
79
|
+
"blank sibling entry does not make a non-matching title match",
|
|
80
|
+
title_matches_partials('Common cold', ['Endo', ' ']),
|
|
81
|
+
false,
|
|
82
|
+
)
|
|
83
|
+
assert(
|
|
84
|
+
"a list of only blanks counts as unset rather than as a match-everything entry",
|
|
85
|
+
title_matches_partials('Common cold', ['', ' ', '\t']),
|
|
86
|
+
true, // unset — and per the next check it cannot rescue a failing sibling list either
|
|
87
|
+
)
|
|
88
|
+
assert(
|
|
89
|
+
"blank case-sensitive list does not rescue a failing case-insensitive list",
|
|
90
|
+
title_matches_partials('Common cold', [' '], ['semaglutide']),
|
|
91
|
+
false,
|
|
92
|
+
)
|
|
93
|
+
assert(
|
|
94
|
+
"whitespace-only title against a real entry",
|
|
95
|
+
title_matches_partials(' ', ['Endo']),
|
|
96
|
+
false,
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const run_both_lists_tests = () => {
|
|
101
|
+
console.log("\n[title_matches_partials — the two lists AND together]")
|
|
102
|
+
|
|
103
|
+
assert(
|
|
104
|
+
"both lists match",
|
|
105
|
+
title_matches_partials('Endometriosis, unspecified', ['Endo'], ['unspecified']),
|
|
106
|
+
true,
|
|
107
|
+
)
|
|
108
|
+
assert(
|
|
109
|
+
"case-sensitive list matches, case-insensitive does not",
|
|
110
|
+
title_matches_partials('Endometriosis, unspecified', ['Endo'], ['diabetes']),
|
|
111
|
+
false,
|
|
112
|
+
)
|
|
113
|
+
assert(
|
|
114
|
+
"case-insensitive list matches, case-sensitive does not",
|
|
115
|
+
title_matches_partials('Endometriosis, unspecified', ['ENDO'], ['endometriosis']),
|
|
116
|
+
false,
|
|
117
|
+
)
|
|
118
|
+
assert(
|
|
119
|
+
"neither list matches",
|
|
120
|
+
title_matches_partials('Common cold', ['Endo'], ['semaglutide']),
|
|
121
|
+
false,
|
|
122
|
+
)
|
|
123
|
+
assert(
|
|
124
|
+
"same fragment in both lists, case differing — case-sensitive one decides",
|
|
125
|
+
title_matches_partials('chronic endometriosis', ['Endometriosis'], ['endometriosis']),
|
|
126
|
+
false,
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const run_missing_title_tests = () => {
|
|
131
|
+
console.log("\n[title_matches_partials — absent or empty title with a filter set]")
|
|
132
|
+
|
|
133
|
+
assert("undefined title vs case-sensitive list", title_matches_partials(undefined, ['Endo']), false)
|
|
134
|
+
assert("undefined title vs case-insensitive list", title_matches_partials(undefined, [], ['endo']), false)
|
|
135
|
+
assert("null title vs a set list", title_matches_partials(null, ['Endo']), false)
|
|
136
|
+
assert("empty-string title vs a set list", title_matches_partials('', ['Endo']), false)
|
|
137
|
+
assert("empty-string title vs both lists set", title_matches_partials('', ['Endo'], ['endo']), false)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const run_literal_matching_tests = () => {
|
|
141
|
+
console.log("\n[title_matches_partials — entries are literal, never regex]")
|
|
142
|
+
|
|
143
|
+
assert("hyphenated fragment matches literally", title_matches_partials('Diabetes Type-2', ['Type-2']), true)
|
|
144
|
+
assert("dosage fragment matches literally", title_matches_partials('Semaglutide 10mg', ['10mg']), true)
|
|
145
|
+
assert("dot is not a wildcard", title_matches_partials('Semaglutide 0x25mg', ['0.25']), false)
|
|
146
|
+
assert("dot matches itself", title_matches_partials('Semaglutide 0.25mg', ['0.25']), true)
|
|
147
|
+
assert("regex metacharacters are literal", title_matches_partials('Order (urgent)', ['(urgent)']), true)
|
|
148
|
+
assert("regex alternation is literal, not alternation", title_matches_partials('Endometriosis', ['Endo|Diabetes']), false)
|
|
149
|
+
assert("star is literal", title_matches_partials('a*b', ['a*b']), true)
|
|
150
|
+
assert("very long entry simply does not match", title_matches_partials('Endometriosis', ['E'.repeat(250)]), false)
|
|
151
|
+
|
|
152
|
+
// non-string entries from bad stored data must not throw
|
|
153
|
+
assert("non-string entries are ignored, not crashed on", title_matches_partials('Endometriosis', [null as any, 'Endo']), true)
|
|
154
|
+
assert("only non-string entries counts as unset", title_matches_partials('Common cold', [undefined as any]), true)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const run_all = () => {
|
|
158
|
+
console.log("Running trigger_title_partials unit tests")
|
|
159
|
+
run_unset_tests()
|
|
160
|
+
run_case_sensitive_tests()
|
|
161
|
+
run_case_insensitive_tests()
|
|
162
|
+
run_trimming_tests()
|
|
163
|
+
run_both_lists_tests()
|
|
164
|
+
run_missing_title_tests()
|
|
165
|
+
run_literal_matching_tests()
|
|
166
|
+
console.log(`\nResults: ${passed} passed, ${failures} failed`)
|
|
167
|
+
if (failures > 0) process.exit(1)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (require.main === module) {
|
|
171
|
+
run_all()
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export { run_all as trigger_title_partials_unit_tests }
|
|
@@ -31,7 +31,9 @@ const [nonAdminEmail, nonAdminPassword] = [process.env.NON_ADMIN_EMAIL, process.
|
|
|
31
31
|
const subUserEmail = process.env.SUB_EMAIL
|
|
32
32
|
|
|
33
33
|
const host = process.env.API_URL || 'http://localhost:8080'
|
|
34
|
-
|
|
34
|
+
import { reset_test_tenant } from "./setup"
|
|
35
|
+
|
|
36
|
+
const businessId = process.env.TEST_BUSINESS_ID || '60398b1131a295e64f084ff6'
|
|
35
37
|
const enduserSDK = new EnduserSession({ host, businessId })
|
|
36
38
|
|
|
37
39
|
if (!(email && subUserEmail && password && email2 && password2 && nonAdminEmail && nonAdminPassword)) {
|
|
@@ -754,7 +756,7 @@ const run_tests = async () => {
|
|
|
754
756
|
log_header("Webhooks Tests")
|
|
755
757
|
await sdk.authenticate(email, password)
|
|
756
758
|
await sdkSub.authenticate(subUserEmail, password)
|
|
757
|
-
await sdk
|
|
759
|
+
await reset_test_tenant(sdk)
|
|
758
760
|
await nonAdminSdk.authenticate(nonAdminEmail, nonAdminPassword)
|
|
759
761
|
|
|
760
762
|
await async_test(
|
package/test_generated.pdf
CHANGED
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
// CommonJS build (lib/cjs, also where the runnable tests land); see constants/tsconfig.cjs.json.
|
|
3
|
+
"extends": "./tsconfig.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"outDir": "lib/cjs",
|
|
7
|
+
"tsBuildInfoFile": "lib/cjs/tsconfig.cjs.tsbuildinfo"
|
|
8
|
+
},
|
|
9
|
+
"references": [
|
|
10
|
+
{ "path": "../constants/tsconfig.cjs.json" },
|
|
11
|
+
{ "path": "../schema/tsconfig.cjs.json" },
|
|
12
|
+
{ "path": "../testing/tsconfig.cjs.json" },
|
|
13
|
+
{ "path": "../types-client/tsconfig.cjs.json" },
|
|
14
|
+
{ "path": "../utilities/tsconfig.cjs.json" },
|
|
15
|
+
{ "path": "../validation/tsconfig.cjs.json" }
|
|
16
|
+
]
|
|
17
|
+
}
|