@tellescope/sdk 1.255.17 → 1.255.19

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 (106) hide show
  1. package/lib/cjs/sdk.d.ts +7 -2
  2. package/lib/cjs/sdk.d.ts.map +1 -1
  3. package/lib/cjs/sdk.js +1 -0
  4. package/lib/cjs/sdk.js.map +1 -1
  5. package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.d.ts.map +1 -1
  6. package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.js +18 -8
  7. package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.js.map +1 -1
  8. package/lib/cjs/tests/api_tests/healthie_multi_integration.test.d.ts.map +1 -1
  9. package/lib/cjs/tests/api_tests/healthie_multi_integration.test.js +203 -72
  10. package/lib/cjs/tests/api_tests/healthie_multi_integration.test.js.map +1 -1
  11. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.d.ts +6 -0
  12. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.d.ts.map +1 -0
  13. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.js +102 -0
  14. package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.js.map +1 -0
  15. package/lib/cjs/tests/api_tests/scoped_api_keys.test.d.ts.map +1 -1
  16. package/lib/cjs/tests/api_tests/scoped_api_keys.test.js +215 -112
  17. package/lib/cjs/tests/api_tests/scoped_api_keys.test.js.map +1 -1
  18. package/lib/cjs/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.d.ts.map +1 -1
  19. package/lib/cjs/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js +121 -78
  20. package/lib/cjs/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js.map +1 -1
  21. package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts +6 -0
  22. package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts.map +1 -0
  23. package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js +773 -0
  24. package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js.map +1 -0
  25. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts +17 -0
  26. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts.map +1 -0
  27. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +215 -0
  28. package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -0
  29. package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts +6 -0
  30. package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts.map +1 -0
  31. package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js +1200 -0
  32. package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js.map +1 -0
  33. package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts +6 -0
  34. package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts.map +1 -0
  35. package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.js +2330 -0
  36. package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.js.map +1 -0
  37. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts +6 -0
  38. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts.map +1 -0
  39. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.js +204 -0
  40. package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.js.map +1 -0
  41. package/lib/cjs/tests/tests.d.ts.map +1 -1
  42. package/lib/cjs/tests/tests.js +211 -178
  43. package/lib/cjs/tests/tests.js.map +1 -1
  44. package/lib/esm/enduser.d.ts +1 -0
  45. package/lib/esm/enduser.d.ts.map +1 -1
  46. package/lib/esm/sdk.d.ts +10 -4
  47. package/lib/esm/sdk.d.ts.map +1 -1
  48. package/lib/esm/sdk.js +1 -0
  49. package/lib/esm/sdk.js.map +1 -1
  50. package/lib/esm/session.d.ts +1 -0
  51. package/lib/esm/session.d.ts.map +1 -1
  52. package/lib/esm/tests/api_tests/auto_merge_form_submission.test.d.ts.map +1 -1
  53. package/lib/esm/tests/api_tests/auto_merge_form_submission.test.js +18 -8
  54. package/lib/esm/tests/api_tests/auto_merge_form_submission.test.js.map +1 -1
  55. package/lib/esm/tests/api_tests/healthie_multi_integration.test.d.ts.map +1 -1
  56. package/lib/esm/tests/api_tests/healthie_multi_integration.test.js +205 -74
  57. package/lib/esm/tests/api_tests/healthie_multi_integration.test.js.map +1 -1
  58. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.d.ts +6 -0
  59. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.d.ts.map +1 -0
  60. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.js +98 -0
  61. package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.js.map +1 -0
  62. package/lib/esm/tests/api_tests/scoped_api_keys.test.d.ts.map +1 -1
  63. package/lib/esm/tests/api_tests/scoped_api_keys.test.js +215 -112
  64. package/lib/esm/tests/api_tests/scoped_api_keys.test.js.map +1 -1
  65. package/lib/esm/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.d.ts.map +1 -1
  66. package/lib/esm/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js +121 -78
  67. package/lib/esm/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js.map +1 -1
  68. package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts +6 -0
  69. package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts.map +1 -0
  70. package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js +766 -0
  71. package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js.map +1 -0
  72. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts +17 -0
  73. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts.map +1 -0
  74. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +211 -0
  75. package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -0
  76. package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts +6 -0
  77. package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts.map +1 -0
  78. package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js +1193 -0
  79. package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js.map +1 -0
  80. package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts +6 -0
  81. package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts.map +1 -0
  82. package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.js +2323 -0
  83. package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.js.map +1 -0
  84. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts +6 -0
  85. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts.map +1 -0
  86. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.js +200 -0
  87. package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.js.map +1 -0
  88. package/lib/esm/tests/tests.d.ts.map +1 -1
  89. package/lib/esm/tests/tests.js +211 -178
  90. package/lib/esm/tests/tests.js.map +1 -1
  91. package/lib/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +10 -10
  93. package/src/sdk.ts +4 -0
  94. package/src/tests/api_tests/auto_merge_form_submission.test.ts +13 -4
  95. package/src/tests/api_tests/healthie_multi_integration.test.ts +103 -5
  96. package/src/tests/api_tests/phone_calls_conference_hold.test.ts +62 -0
  97. package/src/tests/api_tests/scoped_api_keys.test.ts +87 -0
  98. package/src/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.ts +38 -4
  99. package/src/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.ts +506 -0
  100. package/src/tests/api_tests/security/enduser-ai-summary-trust-gate.test.ts +125 -0
  101. package/src/tests/api_tests/security/formsort_webhook_auth_field_lock.test.ts +753 -0
  102. package/src/tests/api_tests/security/public_endpoint_auth_field_lock.test.ts +1707 -0
  103. package/src/tests/api_tests/tickets_bulk_assign_care_team.test.ts +132 -0
  104. package/src/tests/tests.ts +20 -1
  105. package/test_generated.pdf +0 -0
  106. package/.env +0 -13
@@ -0,0 +1,132 @@
1
+ require('source-map-support').install();
2
+
3
+ import { Session } from "../../sdk"
4
+ import {
5
+ async_test,
6
+ log_header,
7
+ } from "@tellescope/testing"
8
+ import { setup_tests } from "../setup"
9
+
10
+ const host = process.env.API_URL || 'http://localhost:8080' as const
11
+
12
+ // Main test function for tickets bulk_assign addToCareTeam flag
13
+ export const tickets_bulk_assign_care_team_tests = async ({ sdk, sdkNonAdmin } : { sdk: Session, sdkNonAdmin: Session }) => {
14
+ log_header("Tickets Bulk Assign (addToCareTeam) Tests")
15
+
16
+ // Throwaway user to act as the new ticket owner
17
+ const owner = await sdk.api.users.createOne({
18
+ email: `test-bulk-assign-owner-${Date.now()}@test.com`,
19
+ fname: 'BulkAssign',
20
+ lname: 'Owner',
21
+ verifiedEmail: true,
22
+ })
23
+
24
+ const enduser1 = await sdk.api.endusers.createOne({ fname: 'BulkAssign', lname: 'PatientOne' })
25
+ const enduser2 = await sdk.api.endusers.createOne({ fname: 'BulkAssign', lname: 'PatientTwo' })
26
+
27
+ // Tickets are created without an owner so the on-create care team side effect doesn't run
28
+ const ticket1 = await sdk.api.tickets.createOne({ title: 'Bulk Assign Test 1', enduserId: enduser1.id })
29
+ const ticket2 = await sdk.api.tickets.createOne({ title: 'Bulk Assign Test 2', enduserId: enduser1.id })
30
+ const ticket3 = await sdk.api.tickets.createOne({ title: 'Bulk Assign Test 3', enduserId: enduser2.id, skipCareTeamAssignment: true })
31
+ const ticketNoEnduser = await sdk.api.tickets.createOne({ title: 'Bulk Assign Test 4' })
32
+
33
+ try {
34
+ // Default behavior (flag omitted): owner set, care team untouched
35
+ await async_test(
36
+ "bulk_assign: assigns owner without flag",
37
+ () => sdk.api.tickets.bulk_assign({ ids: [ticket1.id], userId: owner.id }),
38
+ { onResult: () => true }
39
+ )
40
+ await async_test(
41
+ "bulk_assign: owner set on ticket (no flag)",
42
+ () => sdk.api.tickets.getOne(ticket1.id),
43
+ { onResult: t => t.owner === owner.id }
44
+ )
45
+ await async_test(
46
+ "bulk_assign: care team unchanged without flag",
47
+ () => sdk.api.endusers.getOne(enduser1.id),
48
+ { onResult: e => !e.assignedTo?.includes(owner.id) }
49
+ )
50
+
51
+ // addToCareTeam: false behaves like omitted
52
+ await async_test(
53
+ "bulk_assign: addToCareTeam false leaves care team unchanged",
54
+ async () => {
55
+ await sdk.api.tickets.bulk_assign({ ids: [ticket1.id], userId: owner.id, addToCareTeam: false })
56
+ return sdk.api.endusers.getOne(enduser1.id)
57
+ },
58
+ { onResult: e => !e.assignedTo?.includes(owner.id) }
59
+ )
60
+
61
+ // addToCareTeam: true adds owner to each ticket's enduser care team,
62
+ // including tickets flagged skipCareTeamAssignment (explicit flag wins),
63
+ // and tolerates tickets with no enduser
64
+ await async_test(
65
+ "bulk_assign: addToCareTeam true assigns owner and updates care teams",
66
+ () => sdk.api.tickets.bulk_assign({
67
+ ids: [ticket1.id, ticket2.id, ticket3.id, ticketNoEnduser.id],
68
+ userId: owner.id,
69
+ addToCareTeam: true,
70
+ }),
71
+ { onResult: () => true }
72
+ )
73
+ await async_test(
74
+ "bulk_assign: owner added to care team (enduser1)",
75
+ () => sdk.api.endusers.getOne(enduser1.id),
76
+ { onResult: e => !!e.assignedTo?.includes(owner.id) }
77
+ )
78
+ await async_test(
79
+ "bulk_assign: owner added to care team despite skipCareTeamAssignment (enduser2)",
80
+ () => sdk.api.endusers.getOne(enduser2.id),
81
+ { onResult: e => !!e.assignedTo?.includes(owner.id) }
82
+ )
83
+ await async_test(
84
+ "bulk_assign: ticket without enduser still assigned",
85
+ () => sdk.api.tickets.getOne(ticketNoEnduser.id),
86
+ { onResult: t => t.owner === owner.id }
87
+ )
88
+
89
+ // Idempotent when owner already on care team
90
+ await async_test(
91
+ "bulk_assign: addToCareTeam is idempotent",
92
+ async () => {
93
+ await sdk.api.tickets.bulk_assign({ ids: [ticket1.id], userId: owner.id, addToCareTeam: true })
94
+ return sdk.api.endusers.getOne(enduser1.id)
95
+ },
96
+ { onResult: e => e.assignedTo?.filter(id => id === owner.id).length === 1 }
97
+ )
98
+ } finally {
99
+ // Cleanup
100
+ await Promise.all([
101
+ sdk.api.tickets.deleteOne(ticket1.id).catch(console.error),
102
+ sdk.api.tickets.deleteOne(ticket2.id).catch(console.error),
103
+ sdk.api.tickets.deleteOne(ticket3.id).catch(console.error),
104
+ sdk.api.tickets.deleteOne(ticketNoEnduser.id).catch(console.error),
105
+ sdk.api.endusers.deleteOne(enduser1.id).catch(console.error),
106
+ sdk.api.endusers.deleteOne(enduser2.id).catch(console.error),
107
+ sdk.api.users.deleteOne(owner.id).catch(console.error),
108
+ ])
109
+ }
110
+ }
111
+
112
+ // Allow running this test file independently
113
+ if (require.main === module) {
114
+ console.log(`🌐 Using API URL: ${host}`)
115
+ const sdk = new Session({ host })
116
+ const sdkNonAdmin = new Session({ host })
117
+
118
+ const runTests = async () => {
119
+ await setup_tests(sdk, sdkNonAdmin)
120
+ await tickets_bulk_assign_care_team_tests({ sdk, sdkNonAdmin })
121
+ }
122
+
123
+ runTests()
124
+ .then(() => {
125
+ console.log("✅ Tickets bulk assign care team test suite completed successfully")
126
+ process.exit(0)
127
+ })
128
+ .catch((error) => {
129
+ console.error("❌ Tickets bulk assign care team test suite failed:", error)
130
+ process.exit(1)
131
+ })
132
+ }
@@ -82,6 +82,7 @@ import {
82
82
  import fs from "fs"
83
83
  import { load_inbox_data_tests } from "./api_tests/load_inbox_data.test";
84
84
  import { phone_calls_cold_transfer_tests } from "./api_tests/phone_calls_cold_transfer.test";
85
+ import { phone_calls_conference_hold_tests } from "./api_tests/phone_calls_conference_hold.test";
85
86
  import { enduser_login_tests } from "./api_tests/enduser_login.test";
86
87
  import { enduser_login_rate_limits_tests } from "./api_tests/enduser_login_rate_limits.test";
87
88
  import { eom_procedure_codes_tests } from "./api_tests/eom_procedure_codes.test";
@@ -114,7 +115,12 @@ import { enduser_cross_create_tests } from "./api_tests/security/F-0116-F-0119-e
114
115
  import { globalunique_leak_tests } from "./api_tests/security/F-0145-globalunique-leak.test";
115
116
  import { load_inbox_redaction_tests } from "./api_tests/security/F-0151-load-inbox-redaction.test";
116
117
  import { webhook_timeout_tests } from "./api_tests/security/F-0155-webhook-timeout.test";
118
+ import { enduser_ai_summary_trust_gate_tests } from "./api_tests/security/enduser-ai-summary-trust-gate.test";
119
+ import { allowed_paths_confinement_tests } from "./api_tests/security/F-0166-allowed-paths-wildcard-bypass.test";
120
+ import { public_endpoint_auth_field_lock_tests } from "./api_tests/security/public_endpoint_auth_field_lock.test";
121
+ import { formsort_webhook_auth_field_lock_tests } from "./api_tests/security/formsort_webhook_auth_field_lock.test";
117
122
  import { bulk_assignment_tests } from "./api_tests/bulk_assignment.test";
123
+ import { tickets_bulk_assign_care_team_tests } from "./api_tests/tickets_bulk_assign_care_team.test";
118
124
  import { managed_content_enduser_access_tests } from "./api_tests/managed_content_enduser_access.test";
119
125
  import { managed_content_file_access_tests } from "./api_tests/managed_content_file_access.test";
120
126
  import { auto_merge_form_submission_tests } from "./api_tests/auto_merge_form_submission.test";
@@ -9560,6 +9566,10 @@ export const formsort_tests = async () => {
9560
9566
  if (!r.formsort?.length) { return false }
9561
9567
  if (!r.responses?.length) { return false }
9562
9568
  if (r.responses.length !== answers.length) { return false }
9569
+ // this response attached to a patient that already existed (created at the SDK call above), so
9570
+ // the webhook flags it and email/phone are withheld from the enduser update — see
9571
+ // authFieldIntakeDisabled in api.ts and formsort_webhook_auth_field_lock.test.ts
9572
+ if (!r.authFieldIntakeDisabled) { return false }
9563
9573
 
9564
9574
  if (!validateResponse(r, 'address', JSON.stringify(address, null, 2))) { return false }
9565
9575
  if (!validateResponse(r, 'email', answersEmail)) { return false }
@@ -9588,7 +9598,10 @@ export const formsort_tests = async () => {
9588
9598
  if (submissionEnduser.fname !== 'Fname') { return false }
9589
9599
  if (submissionEnduser.lname !== 'Lname') { return false }
9590
9600
  if (submissionEnduser.gender !== 'Male') { return false }
9591
- if (submissionEnduser.phone !== '+15555555555') { return false }
9601
+ // phone is an auth channel (OTP delivery), and this enduser was matched by a $or guess rather
9602
+ // than created by this submission, so the submitted phone must NOT land. Non-auth intake fields
9603
+ // above still flow through.
9604
+ if (submissionEnduser.phone) { return false }
9592
9605
  if (submissionEnduser.defaultFromEmail !== 'from@tellescope.com') { return false }
9593
9606
  if (submissionEnduser.useDefaultFromEmailInAutomations !== true) { return false }
9594
9607
  if (submissionEnduser.defaultFromPhone !== '+15555555555') { return false }
@@ -15052,6 +15065,9 @@ const ip_address_form_tests = async () => {
15052
15065
  await replace_form_field_template_values_tests()
15053
15066
  await mfa_tests()
15054
15067
  await setup_tests(sdk, sdkNonAdmin)
15068
+ await allowed_paths_confinement_tests({ sdk, sdkNonAdmin })
15069
+ await phone_calls_conference_hold_tests({ sdk, sdkNonAdmin })
15070
+ await tickets_bulk_assign_care_team_tests({ sdk, sdkNonAdmin })
15055
15071
  await custom_dashboards_tests({ sdk, sdkNonAdmin })
15056
15072
  await register_business_id_injection_tests({ sdk, sdkNonAdmin })
15057
15073
  await automation_trigger_tests()
@@ -15060,10 +15076,13 @@ const ip_address_form_tests = async () => {
15060
15076
  await beluga_pharmacy_mappings_tests({ sdk, sdkNonAdmin })
15061
15077
  await mdi_case_offerings_tests({ sdk, sdkNonAdmin })
15062
15078
  await enduser_write_restrictions_tests({ sdk, sdkNonAdmin })
15079
+ await enduser_ai_summary_trust_gate_tests({ sdk, sdkNonAdmin })
15063
15080
  await enduser_cross_create_tests({ sdk, sdkNonAdmin })
15064
15081
  await globalunique_leak_tests({ sdk, sdkNonAdmin })
15065
15082
  await load_inbox_redaction_tests({ sdk, sdkNonAdmin })
15066
15083
  await webhook_timeout_tests({ sdk, sdkNonAdmin })
15084
+ await public_endpoint_auth_field_lock_tests({ sdk, sdkNonAdmin })
15085
+ await formsort_webhook_auth_field_lock_tests({ sdk, sdkNonAdmin })
15067
15086
  await user_portal_settings_tests({ sdk, sdkNonAdmin })
15068
15087
  await invite_user_enumeration_tests({ sdk, sdkNonAdmin })
15069
15088
  await handle_incoming_communication_cross_tenant_tests({ sdk, sdkNonAdmin })
Binary file
package/.env DELETED
@@ -1,13 +0,0 @@
1
- TEST_EMAIL='sebastian.a.coates+test@gmail.com'
2
- MFA_EMAIL='sebass+mfa@tellescope.com'
3
- SUB_EMAIL='sebass+sub@tellescope.com'
4
- OTHER_SUB_EMAIL='sebass+othersub@tellescope.com'
5
- SUB_SUB_EMAIL='sebass+subsub@tellescope.com'
6
- TEST_PASSWORD='asdfGHJK1234!@#$'
7
- TEST_EMAIL_2='sebass192@gmail.com'
8
- TEST_PASSWORD_2='3009SwagSwag'
9
- NON_ADMIN_EMAIL='nonadmin@tellescope.com'
10
- NON_ADMIN_PASSWORD='3009SwagSwag'
11
- CROSS_ORG_API_KEY='cross-org-testing-api-key-manually-set'
12
- CROSS_ORG_TARGET_BUSINESS_ID='69efea9b0c4d5bd1da90ca77'
13
- CROSS_ORG_UNAPPROVED_BUSINESS_ID='63a0d6be40e38ba9e899a490'