@tellescope/sdk 1.244.3 → 1.245.0

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 (37) hide show
  1. package/lib/cjs/sdk.d.ts +1 -0
  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/medication_added_trigger.test.d.ts +6 -0
  6. package/lib/cjs/tests/api_tests/medication_added_trigger.test.d.ts.map +1 -0
  7. package/lib/cjs/tests/api_tests/medication_added_trigger.test.js +452 -0
  8. package/lib/cjs/tests/api_tests/medication_added_trigger.test.js.map +1 -0
  9. package/lib/cjs/tests/api_tests/openloop_webhooks.test.d.ts +6 -0
  10. package/lib/cjs/tests/api_tests/openloop_webhooks.test.d.ts.map +1 -0
  11. package/lib/cjs/tests/api_tests/openloop_webhooks.test.js +833 -0
  12. package/lib/cjs/tests/api_tests/openloop_webhooks.test.js.map +1 -0
  13. package/lib/cjs/tests/tests.d.ts.map +1 -1
  14. package/lib/cjs/tests/tests.js +178 -137
  15. package/lib/cjs/tests/tests.js.map +1 -1
  16. package/lib/esm/sdk.d.ts +1 -0
  17. package/lib/esm/sdk.d.ts.map +1 -1
  18. package/lib/esm/sdk.js +1 -0
  19. package/lib/esm/sdk.js.map +1 -1
  20. package/lib/esm/tests/api_tests/medication_added_trigger.test.d.ts +6 -0
  21. package/lib/esm/tests/api_tests/medication_added_trigger.test.d.ts.map +1 -0
  22. package/lib/esm/tests/api_tests/medication_added_trigger.test.js +448 -0
  23. package/lib/esm/tests/api_tests/medication_added_trigger.test.js.map +1 -0
  24. package/lib/esm/tests/api_tests/openloop_webhooks.test.d.ts +6 -0
  25. package/lib/esm/tests/api_tests/openloop_webhooks.test.d.ts.map +1 -0
  26. package/lib/esm/tests/api_tests/openloop_webhooks.test.js +829 -0
  27. package/lib/esm/tests/api_tests/openloop_webhooks.test.js.map +1 -0
  28. package/lib/esm/tests/tests.d.ts.map +1 -1
  29. package/lib/esm/tests/tests.js +178 -137
  30. package/lib/esm/tests/tests.js.map +1 -1
  31. package/lib/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +10 -10
  33. package/src/sdk.ts +4 -0
  34. package/src/tests/api_tests/medication_added_trigger.test.ts +306 -0
  35. package/src/tests/api_tests/openloop_webhooks.test.ts +662 -0
  36. package/src/tests/tests.ts +56 -1
  37. package/test_generated.pdf +0 -0
@@ -86,7 +86,9 @@ import { database_cascade_delete_tests } from "./api_tests/database_cascade_dele
86
86
  import { ai_conversations_tests } from "./api_tests/ai_conversations.test";
87
87
  import { load_team_chat_tests } from "./api_tests/load_team_chat.test";
88
88
  import { form_started_trigger_tests } from "./api_tests/form_started_trigger.test";
89
+ import { medication_added_trigger_tests } from "./api_tests/medication_added_trigger.test";
89
90
  import { elation_user_id_tests } from "./api_tests/elation_user_id.test";
91
+ import { openloop_webhooks_tests } from "./api_tests/openloop_webhooks.test";
90
92
 
91
93
  const UniquenessViolationMessage = 'Uniqueness Violation'
92
94
 
@@ -5010,6 +5012,7 @@ const trigger_events_api_tests = async () => {
5010
5012
  const automation_trigger_tests = async () => {
5011
5013
  log_header("Automation Trigger Tests")
5012
5014
 
5015
+ await medication_added_trigger_tests({ sdk, sdkNonAdmin })
5013
5016
  await order_status_equals_tests()
5014
5017
  await appointment_cancelled_tests()
5015
5018
  await set_fields_tests()
@@ -5026,7 +5029,7 @@ const automation_trigger_tests = async () => {
5026
5029
  await appointment_created_tests()
5027
5030
  await tag_added_tests()
5028
5031
  await order_created_tests()
5029
- await formSubmittedTriggerTests()
5032
+ await formSubmittedTriggerTests()
5030
5033
  }
5031
5034
 
5032
5035
  const form_response_tests = async () => {
@@ -12745,6 +12748,57 @@ const replace_enduser_template_values_tests = async () => {
12745
12748
  assert(replace_enduser_template_values('{{enduser.weight.unit}}', enduser) === '', 'fail undefined weight.unit', 'undefined weight.unit')
12746
12749
 
12747
12750
  await sdk.api.endusers.deleteOne(enduserWithVitals.id)
12751
+
12752
+ // Test objectToString options for object field serialization
12753
+ const enduserWithObjectField = await sdk.api.endusers.createOne({
12754
+ fname: "Object",
12755
+ lname: "Test",
12756
+ fields: {
12757
+ objectField: { name: "John", age: 30 } as any,
12758
+ stringField: "plain string",
12759
+ }
12760
+ })
12761
+
12762
+ // Backwards compatibility: no options — object fields produce [object Object]
12763
+ assert(
12764
+ replace_enduser_template_values('{{enduser.objectField}}', enduserWithObjectField) === '[object Object]',
12765
+ 'fail default object toString', 'default object toString'
12766
+ )
12767
+ // String fields still work normally without options
12768
+ assert(
12769
+ replace_enduser_template_values('{{enduser.stringField}}', enduserWithObjectField) === 'plain string',
12770
+ 'fail default string field', 'default string field'
12771
+ )
12772
+
12773
+ // objectToString: 'json' — for structured body, headers, URL
12774
+ assert(
12775
+ replace_enduser_template_values('{{enduser.objectField}}', enduserWithObjectField, { objectToString: 'json' }) === '{"name":"John","age":30}',
12776
+ 'fail json object', 'json object'
12777
+ )
12778
+ // String fields unaffected by json option
12779
+ assert(
12780
+ replace_enduser_template_values('{{enduser.stringField}}', enduserWithObjectField, { objectToString: 'json' }) === 'plain string',
12781
+ 'fail json string field', 'json string field'
12782
+ )
12783
+ // Top-level string field unaffected by json option
12784
+ assert(
12785
+ replace_enduser_template_values('{{enduser.fname}}', enduserWithObjectField, { objectToString: 'json' }) === 'Object',
12786
+ 'fail json fname', 'json fname'
12787
+ )
12788
+
12789
+ // objectToString: 'jsonEscaped' — for rawJSONBody templates
12790
+ // Full round-trip: rawJSONBody template with object field produces valid JSON
12791
+ const rawTemplate = '{"data": "{{enduser.objectField}}"}'
12792
+ const substituted = replace_enduser_template_values(rawTemplate, enduserWithObjectField, { objectToString: 'jsonEscaped' })
12793
+ const parsed = JSON.parse(substituted)
12794
+ assert(parsed.data === '{"name":"John","age":30}', 'fail jsonEscaped round-trip', 'jsonEscaped round-trip')
12795
+ // String fields unaffected by jsonEscaped option
12796
+ assert(
12797
+ replace_enduser_template_values('{{enduser.stringField}}', enduserWithObjectField, { objectToString: 'jsonEscaped' }) === 'plain string',
12798
+ 'fail jsonEscaped string field', 'jsonEscaped string field'
12799
+ )
12800
+
12801
+ await sdk.api.endusers.deleteOne(enduserWithObjectField.id)
12748
12802
  await sdk.api.endusers.deleteOne(enduser.id)
12749
12803
  }
12750
12804
 
@@ -14046,6 +14100,7 @@ const ip_address_form_tests = async () => {
14046
14100
  await replace_enduser_template_values_tests()
14047
14101
  await mfa_tests()
14048
14102
  await setup_tests(sdk, sdkNonAdmin)
14103
+ await openloop_webhooks_tests({ sdk, sdkNonAdmin })
14049
14104
  await automation_trigger_tests()
14050
14105
  await get_some_projection_tests({ sdk, sdkNonAdmin })
14051
14106
  await elation_user_id_tests({ sdk, sdkNonAdmin })
Binary file