@tellescope/sdk 1.255.9 → 1.255.11

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 (47) hide show
  1. package/lib/cjs/tests/api_tests/calendar_event_limits.test.js +1 -1
  2. package/lib/cjs/tests/api_tests/calendar_event_limits.test.js.map +1 -1
  3. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts +6 -0
  4. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts.map +1 -0
  5. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.js +166 -0
  6. package/lib/cjs/tests/api_tests/dont_sync_to_elation_form_submission.test.js.map +1 -0
  7. package/lib/cjs/tests/api_tests/enduser_cross_access_isolation.test.js +8 -8
  8. package/lib/cjs/tests/api_tests/enduser_cross_access_isolation.test.js.map +1 -1
  9. package/lib/cjs/tests/api_tests/nutrition_tracking.test.d.ts +6 -0
  10. package/lib/cjs/tests/api_tests/nutrition_tracking.test.d.ts.map +1 -0
  11. package/lib/cjs/tests/api_tests/nutrition_tracking.test.js +483 -0
  12. package/lib/cjs/tests/api_tests/nutrition_tracking.test.js.map +1 -0
  13. package/lib/cjs/tests/setup.d.ts +11 -1
  14. package/lib/cjs/tests/setup.d.ts.map +1 -1
  15. package/lib/cjs/tests/setup.js +19 -1
  16. package/lib/cjs/tests/setup.js.map +1 -1
  17. package/lib/cjs/tests/tests.d.ts.map +1 -1
  18. package/lib/cjs/tests/tests.js +183 -172
  19. package/lib/cjs/tests/tests.js.map +1 -1
  20. package/lib/esm/tests/api_tests/calendar_event_limits.test.js +2 -2
  21. package/lib/esm/tests/api_tests/calendar_event_limits.test.js.map +1 -1
  22. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts +6 -0
  23. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.d.ts.map +1 -0
  24. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.js +162 -0
  25. package/lib/esm/tests/api_tests/dont_sync_to_elation_form_submission.test.js.map +1 -0
  26. package/lib/esm/tests/api_tests/enduser_cross_access_isolation.test.js +9 -9
  27. package/lib/esm/tests/api_tests/enduser_cross_access_isolation.test.js.map +1 -1
  28. package/lib/esm/tests/api_tests/nutrition_tracking.test.d.ts +6 -0
  29. package/lib/esm/tests/api_tests/nutrition_tracking.test.d.ts.map +1 -0
  30. package/lib/esm/tests/api_tests/nutrition_tracking.test.js +479 -0
  31. package/lib/esm/tests/api_tests/nutrition_tracking.test.js.map +1 -0
  32. package/lib/esm/tests/setup.d.ts +11 -1
  33. package/lib/esm/tests/setup.d.ts.map +1 -1
  34. package/lib/esm/tests/setup.js +17 -0
  35. package/lib/esm/tests/setup.js.map +1 -1
  36. package/lib/esm/tests/tests.d.ts.map +1 -1
  37. package/lib/esm/tests/tests.js +184 -173
  38. package/lib/esm/tests/tests.js.map +1 -1
  39. package/lib/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +10 -10
  41. package/src/tests/api_tests/calendar_event_limits.test.ts +2 -2
  42. package/src/tests/api_tests/dont_sync_to_elation_form_submission.test.ts +91 -0
  43. package/src/tests/api_tests/enduser_cross_access_isolation.test.ts +6 -6
  44. package/src/tests/api_tests/nutrition_tracking.test.ts +425 -0
  45. package/src/tests/setup.ts +13 -0
  46. package/src/tests/tests.ts +27 -18
  47. package/test_generated.pdf +0 -0
@@ -56,7 +56,7 @@ import { journey_error_branching_tests } from "./api_tests/journey_error_branchi
56
56
  import { journey_delete_cancels_actions_tests } from "./api_tests/journey_delete_cancels_actions.test"
57
57
  import { afteraction_day_of_month_delay_tests } from "./api_tests/afteraction_day_of_month_delay.test"
58
58
  import { push_forms_to_portal_group_completion_tests } from "./api_tests/push_forms_to_portal_group_completion.test"
59
- import { setup_tests } from "./setup"
59
+ import { authenticate_enduser_via_token, setup_tests } from "./setup"
60
60
  import { evaluate_conditional_logic_for_enduser_fields, FORM_LOGIC_CALCULATED_FIELDS, get_care_team_primary, get_flattened_fields, get_next_reminder_timestamp, object_is_empty, replace_enduser_template_values, replace_form_field_template_values, responses_satisfy_conditions, truncate_string, weighted_round_robin, YYYY_MM_DD_to_MM_DD_YYYY } from "@tellescope/utilities"
61
61
  import { DEFAULT_OPERATIONS, PLACEHOLDER_ID, ZENDESK_INTEGRATIONS_TITLE, ZOOM_TITLE } from "@tellescope/constants"
62
62
  import {
@@ -94,6 +94,7 @@ import { monthly_availability_restrictions_tests } from "./api_tests/monthly_ava
94
94
  import { calendar_event_limits_tests } from "./api_tests/calendar_event_limits.test";
95
95
  import { custom_aggregation_tests } from "./api_tests/custom_aggregation.test";
96
96
  import { chats_analytics_tests } from "./api_tests/chats_analytics.test";
97
+ import { nutrition_tracking_tests } from "./api_tests/nutrition_tracking.test";
97
98
  import { no_access_permission_checks_tests } from "./api_tests/no_access_permission_checks.test";
98
99
  import { resource_access_tags_tests } from "./api_tests/resource_access_tags.test";
99
100
  import { field_redaction_tests } from "./api_tests/field_redaction.test";
@@ -120,6 +121,7 @@ import { ai_conversations_tests } from "./api_tests/ai_conversations.test";
120
121
  import { load_team_chat_tests } from "./api_tests/load_team_chat.test";
121
122
  import { form_started_trigger_tests } from "./api_tests/form_started_trigger.test";
122
123
  import { form_submitted_trigger_tests } from "./api_tests/form_submitted_trigger.test";
124
+ import { dont_sync_to_elation_form_submission_tests } from "./api_tests/dont_sync_to_elation_form_submission.test";
123
125
  import { medication_added_trigger_tests } from "./api_tests/medication_added_trigger.test";
124
126
  import { conditional_logic_medication_unit_tests } from "./unit_tests/conditional_logic_medication.test";
125
127
  import { elation_user_id_tests } from "./api_tests/elation_user_id.test";
@@ -283,7 +285,7 @@ const sub_organization_tests = async() => {
283
285
  await async_test(`subsub get subsub`, () => sdkSubSub.api.endusers.getOne(subSubEnduser.id), passOnAnyResult)
284
286
 
285
287
  await sdk.api.endusers.set_password({ id: rootEnduser.id, password })
286
- await enduserSDK.authenticate(rootEnduser.email!, password)
288
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: rootEnduser.id })
287
289
  await async_test(
288
290
  `root enduser create`,
289
291
  () => enduserSDK.api.engagement_events.createOne({ significance: 1, type: 'test', enduserId: rootEnduser.id }),
@@ -295,7 +297,7 @@ const sub_organization_tests = async() => {
295
297
 
296
298
 
297
299
  await sdk.api.endusers.set_password({ id: subEnduser.id, password })
298
- await enduserSDK.authenticate(subEnduser.email!, password)
300
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: subEnduser.id })
299
301
  await async_test(
300
302
  `sub enduser create`,
301
303
  () => enduserSDK.api.engagement_events.createOne({ significance: 1, type: 'test', enduserId: subEnduser.id }),
@@ -303,7 +305,7 @@ const sub_organization_tests = async() => {
303
305
  )
304
306
 
305
307
  await sdk.api.endusers.set_password({ id: subSubEnduser.id, password })
306
- await enduserSDK.authenticate(subSubEnduser.email!, password)
308
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: subSubEnduser.id })
307
309
  await async_test(
308
310
  `subSub enduser create`,
309
311
  () => enduserSDK.api.engagement_events.createOne({ significance: 1, type: 'test', enduserId: subSubEnduser.id }),
@@ -827,9 +829,14 @@ const enduser_tests = async (queries=sdk.api.endusers) => {
827
829
  )
828
830
  await async_test(
829
831
  `enduser registered can log in`,
830
- () => enduserSDK.authenticate('test3@gmail.com', 'testenduserpassword'),
832
+ () => enduserSDK.authenticate('test3@gmail.com', 'testenduserpassword'),
831
833
  { onResult: e => !!e.authToken && e.enduser.email === 'test3@gmail.com' },
832
834
  )
835
+ await async_test(
836
+ `enduser login rejects a wrong password`,
837
+ () => new EnduserSession({ host, businessId }).authenticate('test3@gmail.com', 'wrong-password'),
838
+ handleAnyError,
839
+ )
833
840
 
834
841
  await async_test(
835
842
  `update-enduser email conflict`,
@@ -1379,7 +1386,7 @@ const chat_tests = async() => {
1379
1386
 
1380
1387
  const enduser = await sdk.api.endusers.createOne({ email })
1381
1388
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
1382
- await enduserSDK.authenticate(email, password).catch(console.error)
1389
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
1383
1390
 
1384
1391
  const room = await sdk.api.chat_rooms.createOne({ type: 'internal', userIds: [userId] })
1385
1392
  const chat = await sdk.api.chats.createOne({ roomId: room.id, message: "Hello!" })
@@ -1522,7 +1529,7 @@ const enduserAccessTests = async () => {
1522
1529
  const enduser = await sdk.api.endusers.createOne({ email })
1523
1530
  const enduser2 = await sdk.api.endusers.createOne({ email: 'hi' + email })
1524
1531
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
1525
- await enduserSDK.authenticate(email, password).catch(console.error)
1532
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
1526
1533
 
1527
1534
  await wait(undefined, 1000) // wait so that refresh_session generates a new authToken (different timestamp)
1528
1535
 
@@ -1707,7 +1714,7 @@ const files_tests = async () => {
1707
1714
  log_header("Files")
1708
1715
  const enduser = await sdk.api.endusers.createOne({ email })
1709
1716
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
1710
- await enduserSDK.authenticate(email, password).catch(console.error)
1717
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
1711
1718
  await sdkNonAdmin.authenticate(nonAdminEmail, nonAdminPassword) // to use new role, handle logout on role change
1712
1719
 
1713
1720
  const buff = buffer.Buffer.from('test file data')
@@ -1818,7 +1825,7 @@ const enduser_session_tests = async () => {
1818
1825
 
1819
1826
  const enduser = await sdk.api.endusers.createOne({ email })
1820
1827
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
1821
- await enduserSDK.authenticate(email, password).catch(console.error)
1828
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
1822
1829
 
1823
1830
  const users = await enduserSDK.api.users.display_info()
1824
1831
  assert(users && users.length > 0, 'No users returned', 'Get user display info for enduser')
@@ -5840,7 +5847,7 @@ export const meetings_tests = async () => {
5840
5847
 
5841
5848
  const enduser = await sdk.api.endusers.createOne({ email })
5842
5849
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
5843
- await enduserSDK.authenticate(email, password).catch(console.error)
5850
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
5844
5851
 
5845
5852
  const privateMeeting = await sdk.api.meetings.start_meeting({ })
5846
5853
  const publicMeeting = await sdk.api.meetings.start_meeting({ publicRead: true })
@@ -6206,7 +6213,7 @@ const community_tests = async () => {
6206
6213
 
6207
6214
  const enduser = await sdk.api.endusers.createOne({ email })
6208
6215
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
6209
- await enduserSDK.authenticate(email, password).catch(console.error)
6216
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
6210
6217
 
6211
6218
  const forum = await sdk.api.forums.createOne({ title: 'test', publicRead: true })
6212
6219
  const privateForum = await sdk.api.forums.createOne({ title: 'test 2', publicRead: false })
@@ -6353,7 +6360,7 @@ const redaction_tests = async () => {
6353
6360
  unredactedFields: [{ field: 'testField', value: 'testValue' }] as any,
6354
6361
  })
6355
6362
  await sdk.api.endusers.set_password({ id: enduser.id, password }).catch(console.error)
6356
- await enduserSDK.authenticate(email, password).catch(console.error)
6363
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id }).catch(console.error)
6357
6364
 
6358
6365
  const endusers = await enduserSDK.api.endusers.getSome()
6359
6366
  const forUser = await sdk.api.endusers.getSome()
@@ -6600,7 +6607,7 @@ export const calendar_event_RSVPs_tests = async () => {
6600
6607
  log_header("Calendar Event RSVPs")
6601
6608
 
6602
6609
  await enduserSDK.register({ email: 'rsvps@tellescope.com', password: "testenduserpassword" })
6603
- await enduserSDK.authenticate('rsvps@tellescope.com', "testenduserpassword")
6610
+ await authenticate_enduser_via_token(sdk, enduserSDK, { email: 'rsvps@tellescope.com' })
6604
6611
 
6605
6612
  const event = await sdk.api.calendar_events.createOne({
6606
6613
  title: "RSVP Event",
@@ -6685,7 +6692,7 @@ const post_comments_tests = async () => {
6685
6692
  log_header("Post Comments")
6686
6693
 
6687
6694
  await enduserSDK.register({ email: 'rsvps@tellescope.com', password: "testenduserpassword" })
6688
- await enduserSDK.authenticate('rsvps@tellescope.com', "testenduserpassword")
6695
+ await authenticate_enduser_via_token(sdk, enduserSDK, { email: 'rsvps@tellescope.com' })
6689
6696
 
6690
6697
  const forumId = (await sdk.api.forums.createOne({ title: "RSVP Event", publicRead: true })).id
6691
6698
  const postId = (await sdk.api.forum_posts.createOne({ forumId, title: 'Post', htmlContent: '', textContent: '', })).id
@@ -6903,13 +6910,13 @@ export const self_serve_appointment_booking_tests = async () => {
6903
6910
  })
6904
6911
 
6905
6912
  const enduserSDK2 = new EnduserSession({ host, businessId })
6906
- await enduserSDK2.authenticate('sebass+ca@tellescope.com', password).catch(console.error)
6913
+ await authenticate_enduser_via_token(sdk, enduserSDK2, { email: 'sebass+ca@tellescope.com' }).catch(console.error)
6907
6914
 
6908
6915
  const enduserSDK3 = new EnduserSession({ host, businessId })
6909
- await enduserSDK3.authenticate('sebass+3@tellescope.com', password).catch(console.error)
6916
+ await authenticate_enduser_via_token(sdk, enduserSDK3, { email: 'sebass+3@tellescope.com' }).catch(console.error)
6910
6917
 
6911
6918
  // NY Enduser Tests
6912
- await enduserSDK.authenticate('sebass+ny@tellescope.com', password).catch(console.error)
6919
+ await authenticate_enduser_via_token(sdk, enduserSDK, { email: 'sebass+ny@tellescope.com' }).catch(console.error)
6913
6920
  await async_test(
6914
6921
  '30 minute slots for state restriction',
6915
6922
  () => enduserSDK.api.calendar_events.get_appointment_availability({
@@ -7570,7 +7577,7 @@ const run_autoreply_test = async (title: string, { expectingAutoreply, autoreply
7570
7577
 
7571
7578
  const enduser = await sdk.api.endusers.createOne({ fname: 'Autoreply', lname: "Test", email: "autoreply@tellescope.com" })
7572
7579
  await sdk.api.endusers.set_password({ id: enduser.id, password })
7573
- await enduserSDK.authenticate(enduser.email!, password)
7580
+ await authenticate_enduser_via_token(sdk, enduserSDK, { id: enduser.id })
7574
7581
 
7575
7582
  const room = await sdk.api.chat_rooms.createOne({
7576
7583
  userIds: [sdk.userInfo.id],
@@ -15076,6 +15083,7 @@ const ip_address_form_tests = async () => {
15076
15083
  await chats_analytics_tests({ sdk, sdkNonAdmin })
15077
15084
  await field_redaction_tests({ sdk, sdkNonAdmin })
15078
15085
  await form_submitted_trigger_tests({ sdk, sdkNonAdmin })
15086
+ await dont_sync_to_elation_form_submission_tests({ sdk, sdkNonAdmin })
15079
15087
  await date_string_validation_tests({ sdk, sdkNonAdmin })
15080
15088
  await openloop_webhooks_tests({ sdk, sdkNonAdmin })
15081
15089
  await mdi_webhooks_tests({ sdk, sdkNonAdmin })
@@ -15122,6 +15130,7 @@ const ip_address_form_tests = async () => {
15122
15130
  await inbox_threads_loading_tests()
15123
15131
  await load_inbox_data_tests({ sdk, sdkNonAdmin })
15124
15132
  await enduser_observations_acknowledge_tests({ sdk, sdkNonAdmin })
15133
+ await nutrition_tracking_tests({ sdk, sdkNonAdmin })
15125
15134
  await translations_tests({ sdk, sdkNonAdmin })
15126
15135
  await create_user_notifications_trigger_tests({ sdk })
15127
15136
  await group_mms_active_tests()
Binary file