@tellescope/sdk 1.237.0 → 1.237.2

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 (43) 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/inbox_thread_assignment_updates.test.d.ts.map +1 -1
  6. package/lib/cjs/tests/api_tests/inbox_thread_assignment_updates.test.js +227 -64
  7. package/lib/cjs/tests/api_tests/inbox_thread_assignment_updates.test.js.map +1 -1
  8. package/lib/cjs/tests/api_tests/inbox_thread_draft_scheduled.test.d.ts +6 -0
  9. package/lib/cjs/tests/api_tests/inbox_thread_draft_scheduled.test.d.ts.map +1 -0
  10. package/lib/cjs/tests/api_tests/inbox_thread_draft_scheduled.test.js +717 -0
  11. package/lib/cjs/tests/api_tests/inbox_thread_draft_scheduled.test.js.map +1 -0
  12. package/lib/cjs/tests/api_tests/inbox_thread_mdb_filter.test.d.ts +6 -0
  13. package/lib/cjs/tests/api_tests/inbox_thread_mdb_filter.test.d.ts.map +1 -0
  14. package/lib/cjs/tests/api_tests/inbox_thread_mdb_filter.test.js +372 -0
  15. package/lib/cjs/tests/api_tests/inbox_thread_mdb_filter.test.js.map +1 -0
  16. package/lib/cjs/tests/tests.d.ts.map +1 -1
  17. package/lib/cjs/tests/tests.js +575 -105
  18. package/lib/cjs/tests/tests.js.map +1 -1
  19. package/lib/esm/sdk.d.ts +1 -0
  20. package/lib/esm/sdk.d.ts.map +1 -1
  21. package/lib/esm/sdk.js +1 -0
  22. package/lib/esm/sdk.js.map +1 -1
  23. package/lib/esm/tests/api_tests/inbox_thread_assignment_updates.test.d.ts.map +1 -1
  24. package/lib/esm/tests/api_tests/inbox_thread_assignment_updates.test.js +227 -64
  25. package/lib/esm/tests/api_tests/inbox_thread_assignment_updates.test.js.map +1 -1
  26. package/lib/esm/tests/api_tests/inbox_thread_draft_scheduled.test.d.ts +6 -0
  27. package/lib/esm/tests/api_tests/inbox_thread_draft_scheduled.test.d.ts.map +1 -0
  28. package/lib/esm/tests/api_tests/inbox_thread_draft_scheduled.test.js +713 -0
  29. package/lib/esm/tests/api_tests/inbox_thread_draft_scheduled.test.js.map +1 -0
  30. package/lib/esm/tests/api_tests/inbox_thread_mdb_filter.test.d.ts +6 -0
  31. package/lib/esm/tests/api_tests/inbox_thread_mdb_filter.test.d.ts.map +1 -0
  32. package/lib/esm/tests/api_tests/inbox_thread_mdb_filter.test.js +368 -0
  33. package/lib/esm/tests/api_tests/inbox_thread_mdb_filter.test.js.map +1 -0
  34. package/lib/esm/tests/tests.d.ts.map +1 -1
  35. package/lib/esm/tests/tests.js +575 -105
  36. package/lib/esm/tests/tests.js.map +1 -1
  37. package/lib/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +10 -10
  39. package/src/sdk.ts +4 -0
  40. package/src/tests/api_tests/inbox_thread_assignment_updates.test.ts +149 -0
  41. package/src/tests/api_tests/inbox_thread_draft_scheduled.test.ts +625 -0
  42. package/src/tests/tests.ts +401 -1
  43. package/test_generated.pdf +0 -0
@@ -354,6 +354,155 @@ export const inbox_thread_assignment_updates_tests = async ({ sdk, sdkNonAdmin }
354
354
  sdk.api.sms_messages.deleteOne(upsertSMS.id),
355
355
  ])
356
356
 
357
+ // Test 10: returnCount parameter - basic count
358
+ console.log("Testing load_threads returnCount parameter...")
359
+
360
+ const countResult = await sdk.api.inbox_threads.load_threads({ returnCount: true })
361
+ assert(typeof countResult.count === 'number', "returnCount should return a count field with a number")
362
+ assert(countResult.threads === undefined, "returnCount should not return threads array")
363
+
364
+ // Verify count matches actual thread count
365
+ const allThreads = await sdk.api.inbox_threads.load_threads({})
366
+ assert(countResult.count === allThreads.threads.length, `Count (${countResult.count}) should match threads length (${allThreads.threads.length})`)
367
+
368
+ console.log("✅ returnCount basic test passed")
369
+
370
+ // Test 11: returnCount with enduserIds filter
371
+ console.log("Testing returnCount with enduserIds filter...")
372
+
373
+ const filteredThreads = await sdk.api.inbox_threads.load_threads({ enduserIds: [testEnduser.id] })
374
+ const filteredCount = await sdk.api.inbox_threads.load_threads({ enduserIds: [testEnduser.id], returnCount: true })
375
+
376
+ assert(typeof filteredCount.count === 'number', "Filtered returnCount should return a count")
377
+ assert(filteredCount.count === filteredThreads.threads.length, `Filtered count (${filteredCount.count}) should match filtered threads length (${filteredThreads.threads.length})`)
378
+
379
+ console.log("✅ returnCount with enduserIds filter test passed")
380
+
381
+ // Test 12: returnCount returns 0 for non-matching filters
382
+ console.log("Testing returnCount returns 0 for non-matching filters...")
383
+
384
+ const nonMatchingCount = await sdk.api.inbox_threads.load_threads({
385
+ enduserIds: ['000000000000000000000000'], // Non-existent enduser ID
386
+ returnCount: true
387
+ })
388
+
389
+ assert(nonMatchingCount.count === 0, `Non-matching filter count should be 0, got ${nonMatchingCount.count}`)
390
+
391
+ console.log("✅ returnCount with non-matching filter test passed")
392
+
393
+ // Test 13: mdbFilter - filter by type
394
+ console.log("Testing mdbFilter - filter by type...")
395
+ const emailTypeFilter = await sdk.api.inbox_threads.load_threads({
396
+ mdbFilter: { type: 'Email' }
397
+ })
398
+ const foundEmailByType = emailTypeFilter.threads.find(t => t.id === emailThread.id)
399
+ const foundSmsByType = emailTypeFilter.threads.find(t => t.id === smsThread.id)
400
+ assert(!!foundEmailByType, 'Email thread should be found when filtering by Email type')
401
+ assert(!foundSmsByType, 'SMS thread should not be found when filtering by Email type')
402
+ console.log("✅ mdbFilter type filter test passed")
403
+
404
+ // Test 14: mdbFilter - filter by multiple types ($in)
405
+ console.log("Testing mdbFilter - filter by multiple types...")
406
+ const multiTypeFilter = await sdk.api.inbox_threads.load_threads({
407
+ mdbFilter: { type: { $in: ['Email', 'SMS'] } }
408
+ })
409
+ const foundEmailMulti = multiTypeFilter.threads.find(t => t.id === emailThread.id)
410
+ const foundSmsMulti = multiTypeFilter.threads.find(t => t.id === smsThread.id)
411
+ const foundChatMulti = multiTypeFilter.threads.find(t => t.id === chatThread.id)
412
+ assert(!!foundEmailMulti, 'Email thread should be found')
413
+ assert(!!foundSmsMulti, 'SMS thread should be found')
414
+ assert(!foundChatMulti, 'Chat thread should not be found when filtering Email/SMS')
415
+ console.log("✅ mdbFilter multiple types filter test passed")
416
+
417
+ // Test 15: mdbFilter - filter by assignedTo
418
+ console.log("Testing mdbFilter - filter by assignedTo...")
419
+ // First assign the email thread (may already be assigned from earlier tests)
420
+ await sdk.api.inbox_threads.updateOne(emailThread.id, { assignedTo: [testUser.id] })
421
+ const assigneeFilter = await sdk.api.inbox_threads.load_threads({
422
+ mdbFilter: { assignedTo: testUser.id }
423
+ })
424
+ const foundAssigned = assigneeFilter.threads.find(t => t.id === emailThread.id)
425
+ assert(!!foundAssigned, 'Email thread should be found when filtering by assignee')
426
+ console.log("✅ mdbFilter assignedTo filter test passed")
427
+
428
+ // Test 16: mdbFilter - combined with existing params
429
+ console.log("Testing mdbFilter combined with enduserIds...")
430
+ const combinedFilter = await sdk.api.inbox_threads.load_threads({
431
+ enduserIds: [testEnduser.id],
432
+ mdbFilter: { type: 'Email' }
433
+ })
434
+ const foundCombined = combinedFilter.threads.find(t => t.id === emailThread.id)
435
+ assert(!!foundCombined, 'Email thread should be found with combined filters')
436
+ console.log("✅ mdbFilter combined filter test passed")
437
+
438
+ // Test 17: mdbFilter with returnCount
439
+ console.log("Testing mdbFilter with returnCount...")
440
+ const mdbFilterCount = await sdk.api.inbox_threads.load_threads({
441
+ mdbFilter: { type: 'Email' },
442
+ returnCount: true
443
+ })
444
+ assert(typeof mdbFilterCount.count === 'number', 'mdbFilter with returnCount should return count')
445
+ assert((mdbFilterCount.count ?? 0) >= 1, 'Count should be at least 1 for Email type')
446
+ console.log("✅ mdbFilter with returnCount test passed")
447
+
448
+ // Test 18: mdbFilter with empty object (should return all)
449
+ console.log("Testing mdbFilter with empty object...")
450
+ const emptyMdbFilter = await sdk.api.inbox_threads.load_threads({
451
+ mdbFilter: {}
452
+ })
453
+ assert(emptyMdbFilter.threads.length > 0, 'Empty mdbFilter should return threads')
454
+ console.log("✅ mdbFilter empty object test passed")
455
+
456
+ // Test 19: ids filter - filter by specific thread ids
457
+ console.log("Testing ids filter - filter by specific thread ids...")
458
+ const idsFilterResult = await sdk.api.inbox_threads.load_threads({
459
+ ids: [emailThread.id, smsThread.id]
460
+ })
461
+ assert(idsFilterResult.threads.length === 2, `ids filter should return exactly 2 threads, got ${idsFilterResult.threads.length}`)
462
+ const foundEmailById = idsFilterResult.threads.find(t => t.id === emailThread.id)
463
+ const foundSmsById = idsFilterResult.threads.find(t => t.id === smsThread.id)
464
+ const foundChatById = idsFilterResult.threads.find(t => t.id === chatThread.id)
465
+ assert(!!foundEmailById, 'Email thread should be found when filtering by ids')
466
+ assert(!!foundSmsById, 'SMS thread should be found when filtering by ids')
467
+ assert(!foundChatById, 'Chat thread should not be found when not in ids list')
468
+ console.log("✅ ids filter test passed")
469
+
470
+ // Test 20: ids filter - single id
471
+ console.log("Testing ids filter - single id...")
472
+ const singleIdResult = await sdk.api.inbox_threads.load_threads({
473
+ ids: [emailThread.id]
474
+ })
475
+ assert(singleIdResult.threads.length === 1, `Single id filter should return exactly 1 thread, got ${singleIdResult.threads.length}`)
476
+ assert(singleIdResult.threads[0].id === emailThread.id, 'Should return the correct thread')
477
+ console.log("✅ ids filter single id test passed")
478
+
479
+ // Test 21: ids filter combined with other filters
480
+ console.log("Testing ids filter combined with mdbFilter...")
481
+ const idsCombinedResult = await sdk.api.inbox_threads.load_threads({
482
+ ids: [emailThread.id, smsThread.id],
483
+ mdbFilter: { type: 'Email' }
484
+ })
485
+ assert(idsCombinedResult.threads.length === 1, `Combined ids + mdbFilter should return 1 thread, got ${idsCombinedResult.threads.length}`)
486
+ assert(idsCombinedResult.threads[0].id === emailThread.id, 'Should return only the email thread')
487
+ console.log("✅ ids filter combined with mdbFilter test passed")
488
+
489
+ // Test 22: ids filter with returnCount
490
+ console.log("Testing ids filter with returnCount...")
491
+ const idsCountResult = await sdk.api.inbox_threads.load_threads({
492
+ ids: [emailThread.id, smsThread.id, chatThread.id],
493
+ returnCount: true
494
+ })
495
+ assert(idsCountResult.count === 3, `ids filter with returnCount should return 3, got ${idsCountResult.count}`)
496
+ console.log("✅ ids filter with returnCount test passed")
497
+
498
+ // Test 23: ids filter with empty array (should return all)
499
+ console.log("Testing ids filter with empty array...")
500
+ const emptyIdsResult = await sdk.api.inbox_threads.load_threads({
501
+ ids: []
502
+ })
503
+ assert(emptyIdsResult.threads.length >= 3, 'Empty ids array should not filter (return all threads)')
504
+ console.log("✅ ids filter empty array test passed")
505
+
357
506
  console.log("🎉 All InboxThread assignment update tests passed!")
358
507
 
359
508
  } finally {