@tellescope/sdk 1.256.13 → 1.256.14

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/tests/api_tests/organization_signup.test.d.ts +20 -0
  2. package/lib/cjs/tests/api_tests/organization_signup.test.d.ts.map +1 -0
  3. package/lib/cjs/tests/api_tests/organization_signup.test.js +272 -0
  4. package/lib/cjs/tests/api_tests/organization_signup.test.js.map +1 -0
  5. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts +30 -0
  6. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts.map +1 -0
  7. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js +336 -0
  8. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js.map +1 -0
  9. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts +6 -0
  10. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -0
  11. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js +354 -0
  12. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js.map +1 -0
  13. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts +46 -0
  14. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts.map +1 -0
  15. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js +389 -0
  16. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js.map +1 -0
  17. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts +43 -0
  18. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts.map +1 -0
  19. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js +324 -0
  20. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js.map +1 -0
  21. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts +43 -0
  22. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts.map +1 -0
  23. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js +282 -0
  24. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js.map +1 -0
  25. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts +5 -0
  26. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts.map +1 -0
  27. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.js +329 -0
  28. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.js.map +1 -0
  29. package/lib/cjs/tests/setup_isolated.d.ts +68 -0
  30. package/lib/cjs/tests/setup_isolated.d.ts.map +1 -0
  31. package/lib/cjs/tests/setup_isolated.js +232 -0
  32. package/lib/cjs/tests/setup_isolated.js.map +1 -0
  33. package/lib/cjs/tests/tests.d.ts.map +1 -1
  34. package/lib/cjs/tests/tests.js +257 -209
  35. package/lib/cjs/tests/tests.js.map +1 -1
  36. package/lib/cjs/tests/unit_tests/do_not_send_address.test.d.ts +2 -0
  37. package/lib/cjs/tests/unit_tests/do_not_send_address.test.d.ts.map +1 -0
  38. package/lib/cjs/tests/unit_tests/do_not_send_address.test.js +89 -0
  39. package/lib/cjs/tests/unit_tests/do_not_send_address.test.js.map +1 -0
  40. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.d.ts +17 -0
  41. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.d.ts.map +1 -0
  42. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.js +140 -0
  43. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.js.map +1 -0
  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 +3 -2
  47. package/lib/esm/sdk.d.ts.map +1 -1
  48. package/lib/esm/session.d.ts +1 -0
  49. package/lib/esm/session.d.ts.map +1 -1
  50. package/lib/esm/tests/api_tests/organization_signup.test.d.ts +20 -0
  51. package/lib/esm/tests/api_tests/organization_signup.test.d.ts.map +1 -0
  52. package/lib/esm/tests/api_tests/organization_signup.test.js +264 -0
  53. package/lib/esm/tests/api_tests/organization_signup.test.js.map +1 -0
  54. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts +30 -0
  55. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts.map +1 -0
  56. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js +332 -0
  57. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js.map +1 -0
  58. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts +6 -0
  59. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -0
  60. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js +350 -0
  61. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js.map +1 -0
  62. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts +46 -0
  63. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts.map +1 -0
  64. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js +382 -0
  65. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js.map +1 -0
  66. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts +43 -0
  67. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts.map +1 -0
  68. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js +317 -0
  69. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js.map +1 -0
  70. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts +43 -0
  71. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts.map +1 -0
  72. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js +277 -0
  73. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js.map +1 -0
  74. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts +5 -0
  75. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts.map +1 -0
  76. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.js +324 -0
  77. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.js.map +1 -0
  78. package/lib/esm/tests/setup_isolated.d.ts +68 -0
  79. package/lib/esm/tests/setup_isolated.d.ts.map +1 -0
  80. package/lib/esm/tests/setup_isolated.js +221 -0
  81. package/lib/esm/tests/setup_isolated.js.map +1 -0
  82. package/lib/esm/tests/tests.d.ts.map +1 -1
  83. package/lib/esm/tests/tests.js +257 -209
  84. package/lib/esm/tests/tests.js.map +1 -1
  85. package/lib/esm/tests/unit_tests/do_not_send_address.test.d.ts +2 -0
  86. package/lib/esm/tests/unit_tests/do_not_send_address.test.d.ts.map +1 -0
  87. package/lib/esm/tests/unit_tests/do_not_send_address.test.js +85 -0
  88. package/lib/esm/tests/unit_tests/do_not_send_address.test.js.map +1 -0
  89. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.d.ts +17 -0
  90. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.d.ts.map +1 -0
  91. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.js +113 -0
  92. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.js.map +1 -0
  93. package/lib/tsconfig.tsbuildinfo +1 -1
  94. package/package.json +10 -10
  95. package/src/tests/api_tests/organization_signup.test.ts +240 -0
  96. package/src/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.ts +225 -0
  97. package/src/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.ts +162 -0
  98. package/src/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.ts +288 -0
  99. package/src/tests/api_tests/security/F-0192-automated-actions-process-gate.test.ts +238 -0
  100. package/src/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.ts +208 -0
  101. package/src/tests/api_tests/tickets_bulk_assign_from_queue.test.ts +279 -0
  102. package/src/tests/setup_isolated.ts +170 -0
  103. package/src/tests/tests.ts +25 -0
  104. package/src/tests/unit_tests/do_not_send_address.test.ts +60 -0
  105. package/src/tests/unit_tests/openapi_spec_freshness.test.ts +88 -0
  106. package/test_generated.pdf +0 -0
@@ -135,6 +135,10 @@ import { proxy_image_ssrf_tests } from "./api_tests/security/F-0025-proxy-image-
135
135
  import { webhook_outbound_ssrf_tests } from "./api_tests/security/F-0015-webhook-outbound-ssrf.test";
136
136
  import { public_endpoint_auth_field_lock_tests } from "./api_tests/security/public_endpoint_auth_field_lock.test";
137
137
  import { formsort_webhook_auth_field_lock_tests } from "./api_tests/security/formsort_webhook_auth_field_lock.test";
138
+ import { booking_info_idor_tests } from "./api_tests/security/F-0179-booking-info-idor-token-mint.test";
139
+ import { automated_actions_process_gate_tests } from "./api_tests/security/F-0192-automated-actions-process-gate.test";
140
+ import { schema_adminonly_enforcement_tests } from "./api_tests/security/F-0191-schema-adminonly-enforcement.test";
141
+ import { startlinktoken_escalation_tests } from "./api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test";
138
142
  import { bulk_assignment_tests } from "./api_tests/bulk_assignment.test";
139
143
  import { tickets_bulk_assign_care_team_tests } from "./api_tests/tickets_bulk_assign_care_team.test";
140
144
  import { managed_content_enduser_access_tests } from "./api_tests/managed_content_enduser_access.test";
@@ -152,6 +156,12 @@ import { dont_sync_to_elation_form_submission_tests } from "./api_tests/dont_syn
152
156
  import { medication_added_trigger_tests } from "./api_tests/medication_added_trigger.test";
153
157
  import { conditional_logic_medication_unit_tests } from "./unit_tests/conditional_logic_medication.test";
154
158
  import { phone_validation_unit_tests } from "./unit_tests/phone_validation.test";
159
+ import { openapi_spec_freshness_unit_tests } from "./unit_tests/openapi_spec_freshness.test";
160
+ import { do_not_send_address_unit_tests } from "./unit_tests/do_not_send_address.test";
161
+ import { organization_signup_checks } from "./api_tests/organization_signup.test";
162
+ import { add_to_journey_foreign_enduserid_checks } from "./api_tests/security/F-0196-add-to-journey-foreign-enduserid.test";
163
+ import { tickets_bulk_assign_from_queue_checks } from "./api_tests/tickets_bulk_assign_from_queue.test";
164
+ import { run_isolated_in_parallel } from "./setup_isolated";
155
165
  import { elation_user_id_tests } from "./api_tests/elation_user_id.test";
156
166
  import { organization_settings_duplicates_tests } from "./api_tests/organization_settings_duplicates.test";
157
167
  import { stedi_approval_tests } from "./api_tests/stedi_approval.test";
@@ -15363,11 +15373,22 @@ const ip_address_form_tests = async () => {
15363
15373
  await enduser_conditional_logic_tests()
15364
15374
  await conditional_logic_medication_unit_tests()
15365
15375
  await phone_validation_unit_tests()
15376
+ await openapi_spec_freshness_unit_tests()
15377
+ await do_not_send_address_unit_tests()
15366
15378
  await replace_enduser_template_values_tests()
15367
15379
  await safe_json_parse_template_tests()
15368
15380
  await replace_form_field_template_values_tests()
15369
15381
  await mfa_tests()
15370
15382
  await setup_tests(sdk, sdkNonAdmin)
15383
+ // Isolated, tenant-provisioned suites run first and CONCURRENTLY: each provisions its own
15384
+ // throwaway tenant via /test-support, so they cannot collide with each other or with the
15385
+ // shared fixture. Both collect Check[] and tear down before anything asserts — assert calls
15386
+ // process.exit, which would otherwise strand the other suite's tenants.
15387
+ await run_isolated_in_parallel([
15388
+ { name: 'Organization signup', run: organization_signup_checks },
15389
+ { name: 'F-0196 add_to_journey foreign enduserId', run: add_to_journey_foreign_enduserid_checks },
15390
+ { name: 'Tickets bulk assign from queue', run: tickets_bulk_assign_from_queue_checks },
15391
+ ])
15371
15392
  await embeddables_auth_token_tests({ sdk, sdkNonAdmin })
15372
15393
  await proxy_image_ssrf_tests({ sdk, sdkNonAdmin })
15373
15394
  await webhook_outbound_ssrf_tests({ sdk, sdkNonAdmin })
@@ -15387,6 +15408,10 @@ const ip_address_form_tests = async () => {
15387
15408
  await enduser_write_restrictions_tests({ sdk, sdkNonAdmin })
15388
15409
  await enduser_ai_summary_trust_gate_tests({ sdk, sdkNonAdmin })
15389
15410
  await enduser_cross_create_tests({ sdk, sdkNonAdmin })
15411
+ await booking_info_idor_tests({ sdk, sdkNonAdmin })
15412
+ await automated_actions_process_gate_tests({ sdk, sdkNonAdmin })
15413
+ await schema_adminonly_enforcement_tests({ sdk, sdkNonAdmin })
15414
+ await startlinktoken_escalation_tests({ sdk, sdkNonAdmin })
15390
15415
  await globalunique_leak_tests({ sdk, sdkNonAdmin })
15391
15416
  await load_inbox_redaction_tests({ sdk, sdkNonAdmin })
15392
15417
  await suggested_reply_redaction_tests({ sdk, sdkNonAdmin })
@@ -0,0 +1,60 @@
1
+ require('source-map-support').install();
2
+
3
+ import {
4
+ assert,
5
+ log_header,
6
+ } from "@tellescope/testing"
7
+
8
+ /**
9
+ * The email-suppression predicate from packages/private/api/api/modules/sqs.ts.
10
+ *
11
+ * Mirrored here rather than imported: the API is a private package the SDK does not depend on. The
12
+ * point of the test is to pin the CONTRACT — prefix AND domain both required — because the guard is
13
+ * otherwise unobservable from a test (a suppressed message simply never reaches SQS), and because
14
+ * loosening it in either direction would start suppressing real mail or start sending test mail.
15
+ *
16
+ * If this drifts from sqs.ts, that is the signal to look at why.
17
+ */
18
+ const is_do_not_send_address = (emailAddress?: string) => (
19
+ !!emailAddress && emailAddress.endsWith('@tellescope.com') && emailAddress.startsWith('dontsend')
20
+ )
21
+
22
+ export const do_not_send_address_unit_tests = async () => {
23
+ log_header("Do-not-send address predicate")
24
+
25
+ const cases: [string | undefined, boolean, string][] = [
26
+ ['dontsend@tellescope.com', true, 'exact prefix and domain'],
27
+ ['dontsend-signup-ab12@tellescope.com', true, 'suffixed local part (what provisioning generates)'],
28
+ ['dontsend3@tellescope.com', true, 'numbered variant already used by the suite'],
29
+
30
+ // near misses — both halves are load-bearing
31
+ ['dontsend@example.com', false, 'right prefix, wrong domain: must NOT suppress'],
32
+ ['realuser@tellescope.com', false, 'right domain, wrong prefix: must NOT suppress'],
33
+ ['notdontsend@tellescope.com', false, 'prefix must be at the START, not anywhere'],
34
+ ['dontsend@tellescope.com.evil.com', false, 'domain must be a suffix, not a substring'],
35
+
36
+ [undefined, false, 'undefined is not suppressed (and must not throw)'],
37
+ ['', false, 'empty string is not suppressed'],
38
+ ]
39
+
40
+ for (const [input, expected, why] of cases) {
41
+ assert(
42
+ is_do_not_send_address(input) === expected,
43
+ `${JSON.stringify(input)} should be ${expected ? 'suppressed' : 'sent'} — ${why}`,
44
+ `${JSON.stringify(input)} -> ${expected ? 'suppressed' : 'sent'} (${why})`,
45
+ )
46
+ }
47
+ }
48
+
49
+ // Allow running this test file independently
50
+ if (require.main === module) {
51
+ do_not_send_address_unit_tests()
52
+ .then(() => {
53
+ console.log("✅ Do-not-send address predicate tests completed successfully")
54
+ process.exit(0)
55
+ })
56
+ .catch((error) => {
57
+ console.error("❌ Do-not-send address predicate tests failed:", error)
58
+ process.exit(1)
59
+ })
60
+ }
@@ -0,0 +1,88 @@
1
+ require('source-map-support').install();
2
+
3
+ import * as fs from "fs"
4
+ import * as os from "os"
5
+ import * as path from "path"
6
+ import { execFileSync } from "child_process"
7
+
8
+ import {
9
+ assert,
10
+ log_header,
11
+ } from "@tellescope/testing"
12
+
13
+ /**
14
+ * Guard: packages/public/schema/openapi.json must match what the generator currently produces.
15
+ *
16
+ * The spec is git-tracked AND published inside @tellescope/schema (no `files` field, and the
17
+ * .npmignore covers only set_vars.sh), but nothing in the build or CI regenerates it. It had
18
+ * therefore drifted several commits behind schema.ts — which mattered because `adminOnly` is
19
+ * rendered into the spec as an "**Admin only.**" description prefix, so the published docs were
20
+ * advertising gates that had changed. That drift is the doc half of F-0191; the runtime half was
21
+ * fixed by making getCustomEndpointFields fall back to the schema flag.
22
+ *
23
+ * The generator is byte-deterministic (date `getExample`s are pinned in validation.ts precisely so
24
+ * this comparison is possible), so an exact match is a fair assertion.
25
+ *
26
+ * If this fails: cd packages/public/schema && node lib/cjs/generate-openapi.js ./openapi.json
27
+ */
28
+ export const openapi_spec_freshness_unit_tests = async () => {
29
+ log_header("OpenAPI spec freshness")
30
+
31
+ // resolve the schema package from its manifest, so this works regardless of hoisting
32
+ const schemaPkgJson = require.resolve('@tellescope/schema/package.json')
33
+ const schemaRoot = path.dirname(schemaPkgJson)
34
+ const generator = path.join(schemaRoot, 'lib', 'cjs', 'generate-openapi.js')
35
+ const committed = path.join(schemaRoot, 'openapi.json')
36
+
37
+ // Don't fail the suite for a stale/absent build — that is a build problem, not spec drift.
38
+ if (!fs.existsSync(generator)) {
39
+ console.log(` SKIPPED: generator not built at ${generator} (run ./build_cjs.sh)`)
40
+ return
41
+ }
42
+ assert(fs.existsSync(committed), `openapi.json missing at ${committed}`, 'openapi.json is present')
43
+
44
+ const tmp = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'openapi-freshness-')), 'openapi.json')
45
+ try {
46
+ execFileSync('node', [generator, tmp], { stdio: 'pipe' })
47
+
48
+ const regenerated = fs.readFileSync(tmp, 'utf8')
49
+ const onDisk = fs.readFileSync(committed, 'utf8')
50
+
51
+ if (regenerated !== onDisk) {
52
+ // a line count is far more useful than a 6000-line dump
53
+ const a = regenerated.split('\n')
54
+ const b = onDisk.split('\n')
55
+ const firstDiff = a.findIndex((line, i) => line !== b[i])
56
+ console.log(
57
+ ` regenerated ${a.length} lines vs committed ${b.length} lines;`
58
+ + ` first difference at line ${firstDiff + 1}`
59
+ )
60
+ if (firstDiff >= 0) {
61
+ console.log(` committed: ${(b[firstDiff] ?? '<missing>').trim().slice(0, 160)}`)
62
+ console.log(` regenerated: ${(a[firstDiff] ?? '<missing>').trim().slice(0, 160)}`)
63
+ }
64
+ }
65
+
66
+ assert(
67
+ regenerated === onDisk,
68
+ 'openapi.json is stale — regenerate it: '
69
+ + 'cd packages/public/schema && node lib/cjs/generate-openapi.js ./openapi.json',
70
+ 'openapi.json matches the generator output',
71
+ )
72
+ } finally {
73
+ try { fs.rmSync(path.dirname(tmp), { recursive: true, force: true }) } catch {}
74
+ }
75
+ }
76
+
77
+ // Allow running this test file independently
78
+ if (require.main === module) {
79
+ openapi_spec_freshness_unit_tests()
80
+ .then(() => {
81
+ console.log("✅ OpenAPI spec freshness test completed successfully")
82
+ process.exit(0)
83
+ })
84
+ .catch((error) => {
85
+ console.error("❌ OpenAPI spec freshness test failed:", error)
86
+ process.exit(1)
87
+ })
88
+ }
Binary file