@dereekb/zoho 13.10.9 → 13.11.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.
@@ -1,19 +1,17 @@
1
1
  import { Injectable, Inject, Logger, Post, Req, Controller, Module } from '@nestjs/common';
2
2
  import { zohoAccountsFactory, zohoAccountsAccessToken, zohoCrmFactory, zohoCrmInsertRecord, zohoCrmUpsertRecord, zohoCrmUpdateRecord, zohoCrmDeleteRecord, zohoCrmGetRecordById, zohoCrmGetRecords, zohoCrmSearchRecords, zohoCrmSearchRecordsPageFactory, zohoCrmGetRelatedRecordsFunctionFactory, zohoCrmGetEmailsForRecord, zohoCrmGetEmailsForRecordPageFactory, zohoCrmGetAttachmentsForRecord, zohoCrmGetAttachmentsForRecordPageFactory, zohoCrmUploadAttachmentForRecord, zohoCrmDownloadAttachmentForRecord, zohoCrmDeleteAttachmentFromRecord, zohoCrmCreateNotes, zohoCrmDeleteNotes, zohoCrmCreateNotesForRecord, zohoCrmGetNotesForRecord, zohoCrmGetNotesForRecordPageFactory, zohoCrmExecuteRestApiFunction, zohoCrmCreateTagsForModule, zohoCrmDeleteTag, zohoCrmGetTagsForModule, zohoCrmAddTagsToRecords, zohoCrmRemoveTagsFromRecords, ZOHO_CRM_SERVICE_NAME, zohoRecruitFactory, zohoRecruitInsertRecord, zohoRecruitUpsertRecord, zohoRecruitUpdateRecord, zohoRecruitDeleteRecord, zohoRecruitGetRecordById, zohoRecruitGetRecords, zohoRecruitSearchRecords, zohoRecruitSearchRecordsPageFactory, zohoRecruitGetRelatedRecordsFunctionFactory, zohoRecruitGetEmailsForRecord, zohoRecruitGetEmailsForRecordPageFactory, zohoRecruitGetAttachmentsForRecord, zohoRecruitGetAttachmentsForRecordPageFactory, zohoRecruitUploadAttachmentForRecord, zohoRecruitDownloadAttachmentForRecord, zohoRecruitDeleteAttachmentFromRecord, zohoRecruitCreateNotes, zohoRecruitDeleteNotes, zohoRecruitCreateNotesForRecord, zohoRecruitGetNotesForRecord, zohoRecruitGetNotesForRecordPageFactory, zohoRecruitExecuteRestApiFunction, zohoRecruitAssociateCandidateRecordsWithJobOpenings, zohoRecruitSearchCandidateAssociatedJobOpeningRecords, zohoRecruitSearchCandidateAssociatedJobOpeningRecordsPageFactory, zohoRecruitSearchJobOpeningAssociatedCandidateRecords, zohoRecruitSearchJobOpeningAssociatedCandidateRecordsPageFactory, zohoRecruitCreateTagsForModule, zohoRecruitGetTagsForModule, zohoRecruitAddTagsToRecords, zohoRecruitRemoveTagsFromRecords, ZOHO_RECRUIT_SERVICE_NAME, zohoSignFactory, zohoSignGetDocument, zohoSignGetDocuments, zohoSignGetDocumentsPageFactory, zohoSignGetDocumentFormData, zohoSignRetrieveFieldTypes, zohoSignDownloadPdf, zohoSignDownloadCompletionCertificate, zohoSignCreateDocument, zohoSignUpdateDocument, zohoSignSendDocumentForSignature, zohoSignExtendDocument, zohoSignDeleteDocument, ZOHO_SIGN_SERVICE_NAME, zohoDeskFactory, zohoDeskGetTickets, zohoDeskGetTicketById, zohoDeskSearchTickets, zohoDeskGetTicketsForContact, zohoDeskGetTicketsForProduct, zohoDeskGetTicketMetrics, zohoDeskGetAgentsTicketsCount, zohoDeskGetTicketsPageFactory, zohoDeskSearchTicketsPageFactory, zohoDeskGetDepartments, zohoDeskGetDepartmentById, zohoDeskGetContacts, zohoDeskGetContactById, zohoDeskGetContactsByIds, zohoDeskGetContactsPageFactory, zohoDeskGetTicketTags, zohoDeskAssociateTicketTags, zohoDeskDissociateTicketTag, zohoDeskSearchTags, zohoDeskGetAllTags, zohoDeskGetTicketFollowers, zohoDeskAddTicketFollowers, zohoDeskRemoveTicketFollowers, zohoDeskGetTicketAttachments, zohoDeskDeleteTicketAttachment, zohoDeskGetTicketComments, zohoDeskGetTicketCommentById, zohoDeskCreateTicketComment, zohoDeskDeleteTicketComment, zohoDeskGetTicketTimer, zohoDeskPerformTicketTimerAction, zohoDeskGetTicketTimeEntries, zohoDeskGetTicketTimeEntryById, zohoDeskGetTicketTimeEntrySummation, zohoDeskGetTicketThreads, zohoDeskGetTicketThreadById, zohoDeskGetTicketThreadsPageFactory, zohoDeskGetTicketActivities, zohoDeskGetTicketActivitiesPageFactory, zohoDeskGetAgents, zohoDeskGetAgentById, zohoDeskGetAgentsByIds, zohoDeskGetMyInfo, zohoDeskGetAgentsPageFactory, ZOHO_DESK_SERVICE_NAME } from '@dereekb/zoho';
3
- import { forEachKeyValue, tryWithPromiseFactoriesFunction, isPast, filterMaybeArrayValues, handlerFactory, handlerConfigurerFactory, handlerMappedSetFunctionFactory } from '@dereekb/util';
4
- import { dirname } from 'node:path';
5
- import { mkdirSync, readFile, writeFile, rm } from 'node:fs';
3
+ import { memoizeAsyncKeyedValueCache, inMemoryAsyncKeyedValueCache, mergeAsyncValueCaches, isExpired, filterMaybeArrayValues, handlerFactory, handlerConfigurerFactory, handlerMappedSetFunctionFactory } from '@dereekb/util';
4
+ import { createJsonFileAsyncKeyedValueCache, readJsonFile, RawBody } from '@dereekb/nestjs';
6
5
  import { ConfigService, ConfigModule } from '@nestjs/config';
7
- import { RawBody } from '@dereekb/nestjs';
8
6
  import { createHmac, timingSafeEqual } from 'node:crypto';
9
7
 
10
- function _type_of(obj) {
8
+ function _type_of$1(obj) {
11
9
  "@swc/helpers - typeof";
12
10
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
13
11
  }
14
12
  function __decorate(decorators, target, key, desc) {
15
13
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
- if ((typeof Reflect === "undefined" ? "undefined" : _type_of(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14
+ if ((typeof Reflect === "undefined" ? "undefined" : _type_of$1(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
15
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
16
  return c > 3 && r && Object.defineProperty(target, key, r), r;
19
17
  }
@@ -241,6 +239,14 @@ function _define_property$d(obj, key, value) {
241
239
  }
242
240
  return obj;
243
241
  }
242
+ function _instanceof(left, right) {
243
+ "@swc/helpers - instanceof";
244
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
245
+ return !!right[Symbol.hasInstance](left);
246
+ } else {
247
+ return left instanceof right;
248
+ }
249
+ }
244
250
  function _iterable_to_array$4(iter) {
245
251
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
246
252
  }
@@ -289,12 +295,35 @@ function _object_spread$6(target) {
289
295
  }
290
296
  return target;
291
297
  }
298
+ function ownKeys$5(object, enumerableOnly) {
299
+ var keys = Object.keys(object);
300
+ if (Object.getOwnPropertySymbols) {
301
+ var symbols = Object.getOwnPropertySymbols(object);
302
+ keys.push.apply(keys, symbols);
303
+ }
304
+ return keys;
305
+ }
306
+ function _object_spread_props$5(target, source) {
307
+ source = source != null ? source : {};
308
+ if (Object.getOwnPropertyDescriptors) {
309
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
310
+ } else {
311
+ ownKeys$5(Object(source)).forEach(function(key) {
312
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
313
+ });
314
+ }
315
+ return target;
316
+ }
292
317
  function _sliced_to_array(arr, i) {
293
318
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest();
294
319
  }
295
320
  function _to_consumable_array$4(arr) {
296
321
  return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$4();
297
322
  }
323
+ function _type_of(obj) {
324
+ "@swc/helpers - typeof";
325
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
326
+ }
298
327
  function _unsupported_iterable_to_array$4(o, minLen) {
299
328
  if (!o) return;
300
329
  if (typeof o === "string") return _array_like_to_array$4(o, minLen);
@@ -410,6 +439,48 @@ function _ts_generator$3(thisArg, body) {
410
439
  ZohoAccountsAccessTokenCacheService = __decorate([
411
440
  Injectable()
412
441
  ], ZohoAccountsAccessTokenCacheService);
442
+ function buildZohoReadAdapter(cache) {
443
+ return {
444
+ load: function load() {
445
+ return _async_to_generator$3(function() {
446
+ var value;
447
+ return _ts_generator$3(this, function(_state) {
448
+ switch(_state.label){
449
+ case 0:
450
+ return [
451
+ 4,
452
+ cache.loadCachedToken().catch(function() {
453
+ return undefined;
454
+ })
455
+ ];
456
+ case 1:
457
+ value = _state.sent();
458
+ return [
459
+ 2,
460
+ value != null && !isExpired(value) ? value : undefined
461
+ ];
462
+ }
463
+ });
464
+ })();
465
+ },
466
+ update: function update(token) {
467
+ return cache.updateCachedToken(token);
468
+ },
469
+ clear: function clear() {
470
+ return cache.clearCachedToken();
471
+ }
472
+ };
473
+ }
474
+ function updateZohoCacheCapturingError(cache, accessToken) {
475
+ return cache.updateCachedToken(accessToken).then(function() {
476
+ return null;
477
+ }).catch(function(e) {
478
+ return [
479
+ cache,
480
+ e
481
+ ];
482
+ });
483
+ }
413
484
  /**
414
485
  * Default error logging function for merged Zoho access token cache services.
415
486
  *
@@ -428,6 +499,11 @@ ZohoAccountsAccessTokenCacheService = __decorate([
428
499
  *
429
500
  * When updating a cached token, it will update the token across all services.
430
501
  *
502
+ * Read fall-through is delegated to {@link mergeAsyncValueCaches} after wrapping each
503
+ * underlying cache with an {@link isExpired}-aware filter, so an expired cached token
504
+ * never short-circuits the lookup. Updates and clears run across all services in parallel
505
+ * via `Promise.allSettled`, mirroring the previous behavior, with optional error logging.
506
+ *
431
507
  * @param servicesToMerge Must include atleast one service. Empty arrays will throw an error.
432
508
  * @param inputServicesToMerge - cache services to merge in priority order
433
509
  * @param logError - optional error logging toggle or custom logging function
@@ -438,149 +514,187 @@ ZohoAccountsAccessTokenCacheService = __decorate([
438
514
  if (services.length === 0) {
439
515
  throw new Error('mergeZohoAccountsAccessTokenCacheServices() input cannot be empty.');
440
516
  }
441
- var service = {
442
- loadZohoAccessTokenCache: function loadZohoAccessTokenCache(service) {
443
- var accessCachesForServices = services.map(function(x) {
444
- return x.loadZohoAccessTokenCache(service);
445
- });
446
- var loadCachedTokenFromFirstService = tryWithPromiseFactoriesFunction({
447
- promiseFactories: accessCachesForServices.map(function(x) {
448
- return function() {
449
- return x.loadCachedToken().catch(function() {
450
- return null;
451
- }).then(function(x) {
452
- var result = undefined;
453
- if (x && !isPast(x.expiresAt)) {
454
- result = x; // only return from cache if it is not expired
455
- }
456
- return result;
457
- });
458
- };
459
- }),
460
- successOnMaybe: false,
461
- throwErrors: false
462
- });
463
- var cacheForService = {
464
- loadCachedToken: function loadCachedToken() {
465
- return loadCachedTokenFromFirstService();
466
- },
467
- updateCachedToken: function updateCachedToken(accessToken) {
468
- return _async_to_generator$3(function() {
469
- return _ts_generator$3(this, function(_state) {
470
- return [
471
- 2,
472
- Promise.allSettled(accessCachesForServices.map(function(x) {
473
- return x.updateCachedToken(accessToken).then(function() {
474
- return null;
475
- }).catch(function(e) {
476
- return [
477
- x,
478
- e
479
- ];
480
- });
481
- })).then(function(x) {
482
- // only find the failures if we're logging
483
- if (logErrorFunction != null) {
484
- var failedUpdates = filterMaybeArrayValues(x.map(function(y) {
485
- return y.value;
486
- }));
487
- if (failedUpdates.length) {
488
- logErrorFunction(failedUpdates);
489
- }
517
+ function loadZohoAccessTokenCache(service) {
518
+ var accessCachesForService = services.map(function(x) {
519
+ return x.loadZohoAccessTokenCache(service);
520
+ });
521
+ // Per-cache adapters with expiry filtering so reads fall through to the next tier when a cache holds an expired token.
522
+ var readAdapters = accessCachesForService.map(buildZohoReadAdapter);
523
+ var merged = mergeAsyncValueCaches(readAdapters);
524
+ return {
525
+ loadCachedToken: function loadCachedToken() {
526
+ return merged.load();
527
+ },
528
+ updateCachedToken: function updateCachedToken(accessToken) {
529
+ return _async_to_generator$3(function() {
530
+ var settled, failedUpdates;
531
+ return _ts_generator$3(this, function(_state) {
532
+ switch(_state.label){
533
+ case 0:
534
+ return [
535
+ 4,
536
+ Promise.allSettled(accessCachesForService.map(function(cache) {
537
+ return updateZohoCacheCapturingError(cache, accessToken);
538
+ }))
539
+ ];
540
+ case 1:
541
+ settled = _state.sent();
542
+ if (logErrorFunction != null) {
543
+ failedUpdates = filterMaybeArrayValues(settled.map(function(y) {
544
+ return y.value;
545
+ }));
546
+ if (failedUpdates.length) {
547
+ logErrorFunction(failedUpdates);
490
548
  }
491
- })
492
- ];
493
- });
494
- })();
495
- },
496
- clearCachedToken: function clearCachedToken() {
497
- return _async_to_generator$3(function() {
498
- return _ts_generator$3(this, function(_state) {
499
- switch(_state.label){
500
- case 0:
501
- return [
502
- 4,
503
- Promise.allSettled(accessCachesForServices.map(function(x) {
504
- return x.clearCachedToken();
505
- }))
506
- ];
507
- case 1:
508
- _state.sent();
509
- return [
510
- 2
511
- ];
512
- }
513
- });
514
- })();
515
- }
516
- };
517
- return cacheForService;
518
- }
549
+ }
550
+ return [
551
+ 2
552
+ ];
553
+ }
554
+ });
555
+ })();
556
+ },
557
+ clearCachedToken: function clearCachedToken() {
558
+ return _async_to_generator$3(function() {
559
+ return _ts_generator$3(this, function(_state) {
560
+ switch(_state.label){
561
+ case 0:
562
+ return [
563
+ 4,
564
+ Promise.allSettled(accessCachesForService.map(function(cache) {
565
+ return cache.clearCachedToken();
566
+ }))
567
+ ];
568
+ case 1:
569
+ _state.sent();
570
+ return [
571
+ 2
572
+ ];
573
+ }
574
+ });
575
+ })();
576
+ }
577
+ };
578
+ }
579
+ return {
580
+ loadZohoAccessTokenCache: loadZohoAccessTokenCache
519
581
  };
520
- return service;
521
582
  }
522
583
  // MARK: Memory Access Token Cache
523
584
  /**
524
585
  * Creates a ZohoAccountsAccessTokenCacheService that uses in-memory storage.
525
586
  *
587
+ * Backed by {@link inMemoryAsyncKeyedValueCache} so all per-service caches share the
588
+ * same record instance.
589
+ *
526
590
  * @param existingCache - optional pre-populated token cache record to use as initial state
527
591
  * @param logAccessToConsole - whether to log cache reads and writes to the console
528
592
  * @returns a ZohoAccountsAccessTokenCacheService backed by in-memory storage
529
593
  */ function memoryZohoAccountsAccessTokenCacheService(existingCache, logAccessToConsole) {
530
- var tokens = existingCache !== null && existingCache !== void 0 ? existingCache : {};
594
+ var initialEntries = {};
595
+ if (existingCache != null) {
596
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
597
+ try {
598
+ for(var _iterator = Object.keys(existingCache)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
599
+ var key = _step.value;
600
+ var value = existingCache[key];
601
+ if (value != null) {
602
+ initialEntries[key] = value;
603
+ }
604
+ }
605
+ } catch (err) {
606
+ _didIteratorError = true;
607
+ _iteratorError = err;
608
+ } finally{
609
+ try {
610
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
611
+ _iterator.return();
612
+ }
613
+ } finally{
614
+ if (_didIteratorError) {
615
+ throw _iteratorError;
616
+ }
617
+ }
618
+ }
619
+ }
620
+ var cache = inMemoryAsyncKeyedValueCache(initialEntries);
531
621
  function loadZohoAccessTokenCache(service) {
532
- var accessTokenCache = {
622
+ return {
533
623
  loadCachedToken: function loadCachedToken() {
534
624
  return _async_to_generator$3(function() {
535
625
  var token;
536
626
  return _ts_generator$3(this, function(_state) {
537
- token = tokens[service];
538
- if (logAccessToConsole) {
539
- console.log('retrieving access token from memory: ', {
540
- token: token,
541
- service: service
542
- });
627
+ switch(_state.label){
628
+ case 0:
629
+ return [
630
+ 4,
631
+ cache.get(service)
632
+ ];
633
+ case 1:
634
+ token = _state.sent();
635
+ if (logAccessToConsole) {
636
+ console.log('retrieving access token from memory: ', {
637
+ service: service,
638
+ hit: token != null,
639
+ expiresAt: token === null || token === void 0 ? void 0 : token.expiresAt
640
+ });
641
+ }
642
+ return [
643
+ 2,
644
+ token
645
+ ];
543
646
  }
544
- return [
545
- 2,
546
- token
547
- ];
548
647
  });
549
648
  })();
550
649
  },
551
650
  updateCachedToken: function updateCachedToken(accessToken) {
552
651
  return _async_to_generator$3(function() {
553
652
  return _ts_generator$3(this, function(_state) {
554
- tokens[service] = accessToken;
555
- if (logAccessToConsole) {
556
- console.log('updating access token in memory: ', {
557
- accessToken: accessToken,
558
- service: service
559
- });
653
+ switch(_state.label){
654
+ case 0:
655
+ return [
656
+ 4,
657
+ cache.set(service, accessToken)
658
+ ];
659
+ case 1:
660
+ _state.sent();
661
+ if (logAccessToConsole) {
662
+ console.log('updating access token in memory: ', {
663
+ service: service,
664
+ expiresAt: accessToken === null || accessToken === void 0 ? void 0 : accessToken.expiresAt
665
+ });
666
+ }
667
+ return [
668
+ 2
669
+ ];
560
670
  }
561
- return [
562
- 2
563
- ];
564
671
  });
565
672
  })();
566
673
  },
567
674
  clearCachedToken: function clearCachedToken() {
568
675
  return _async_to_generator$3(function() {
569
676
  return _ts_generator$3(this, function(_state) {
570
- delete tokens[service];
571
- if (logAccessToConsole) {
572
- console.log('clearing access token in memory: ', {
573
- service: service
574
- });
677
+ switch(_state.label){
678
+ case 0:
679
+ return [
680
+ 4,
681
+ cache.remove(service)
682
+ ];
683
+ case 1:
684
+ _state.sent();
685
+ if (logAccessToConsole) {
686
+ console.log('clearing access token in memory: ', {
687
+ service: service
688
+ });
689
+ }
690
+ return [
691
+ 2
692
+ ];
575
693
  }
576
- return [
577
- 2
578
- ];
579
694
  });
580
695
  })();
581
696
  }
582
697
  };
583
- return accessTokenCache;
584
698
  }
585
699
  return {
586
700
  loadZohoAccessTokenCache: loadZohoAccessTokenCache
@@ -588,9 +702,29 @@ ZohoAccountsAccessTokenCacheService = __decorate([
588
702
  }
589
703
  // MARK: File System Access Token Cache
590
704
  var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-access-tokens.json';
705
+ /**
706
+ * Reviver applied to each cached token entry on load so `expiresAt` is always a `Date`
707
+ * regardless of how it was serialized.
708
+ *
709
+ * @param raw - the raw value loaded from storage; expected to be an object shaped like a ZohoAccessToken with a serialized `expiresAt`
710
+ * @returns the parsed ZohoAccessToken with `expiresAt` coerced to a Date, or undefined when the input is not an object
711
+ */ function reviveZohoAccessToken(raw) {
712
+ if (raw == null || (typeof raw === "undefined" ? "undefined" : _type_of(raw)) !== 'object') {
713
+ return undefined;
714
+ }
715
+ var value = raw;
716
+ var rawExpiresAt = value.expiresAt;
717
+ var expiresAt = rawExpiresAt != null && !_instanceof(rawExpiresAt, Date) ? new Date(rawExpiresAt) : rawExpiresAt;
718
+ return _object_spread_props$5(_object_spread$6({}, value), {
719
+ expiresAt: expiresAt
720
+ });
721
+ }
591
722
  /**
592
723
  * Creates a ZohoAccountsAccessTokenCacheService that reads and writes the access token to the file system.
593
724
  *
725
+ * Composes {@link createJsonFileAsyncKeyedValueCache} (for the on-disk record) optionally with
726
+ * {@link memoizeAsyncKeyedValueCache} so reads after the first hit memory.
727
+ *
594
728
  * Useful for testing.
595
729
  *
596
730
  * @param filename - path to the JSON file used for token persistence
@@ -598,170 +732,46 @@ var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-acce
598
732
  * @returns a FileSystemZohoAccountsAccessTokenCacheService backed by file storage
599
733
  */ function fileZohoAccountsAccessTokenCacheService() {
600
734
  var filename = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH, useMemoryCache = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
601
- var loadedTokens = null;
602
- function loadTokens() {
603
- return _async_to_generator$3(function() {
604
- var _ref, _tmp;
605
- return _ts_generator$3(this, function(_state) {
606
- switch(_state.label){
607
- case 0:
608
- if (!(loadedTokens !== null && loadedTokens !== void 0)) return [
609
- 3,
610
- 1
611
- ];
612
- _tmp = loadedTokens;
613
- return [
614
- 3,
615
- 3
616
- ];
617
- case 1:
618
- return [
619
- 4,
620
- readTokenFile()
621
- ];
622
- case 2:
623
- _tmp = _state.sent();
624
- _state.label = 3;
625
- case 3:
626
- return [
627
- 2,
628
- (_ref = _tmp) !== null && _ref !== void 0 ? _ref : {}
629
- ];
630
- }
631
- });
632
- })();
633
- }
634
- function readTokenFile() {
635
- return new Promise(function(resolve) {
636
- mkdirSync(dirname(filename), {
637
- recursive: true
638
- }); // make the directory first
639
- readFile(filename, {}, function(x, data) {
640
- var result = undefined;
641
- if (!x) {
642
- try {
643
- result = JSON.parse(data.toString());
644
- forEachKeyValue(result, {
645
- forEach: function forEach(x) {
646
- if (x[1]) {
647
- x[1].expiresAt = new Date(x[1].expiresAt);
648
- }
649
- }
650
- });
651
- } catch (e) {
652
- console.error('Failed reading token file: ', e);
653
- }
654
- }
655
- resolve(result);
656
- });
657
- }).then(function(x) {
658
- // update loaded tokens
659
- if (useMemoryCache) {
660
- loadedTokens = _object_spread$6({}, loadedTokens, x);
661
- }
662
- return x;
663
- });
664
- }
665
- function writeTokenFile(tokens) {
666
- return _async_to_generator$3(function() {
667
- return _ts_generator$3(this, function(_state) {
668
- return [
669
- 2,
670
- new Promise(function(resolve, reject) {
671
- writeFile(filename, JSON.stringify(tokens), {}, function(x) {
672
- if (!x) {
673
- resolve();
674
- } else {
675
- reject(x);
676
- }
677
- });
678
- })
679
- ];
680
- });
681
- })();
682
- }
683
- function deleteTokenFile() {
684
- return _async_to_generator$3(function() {
685
- return _ts_generator$3(this, function(_state) {
686
- return [
687
- 2,
688
- new Promise(function(resolve, reject) {
689
- rm(filename, function(x) {
690
- if (!x) {
691
- resolve();
692
- } else {
693
- reject(x);
694
- }
695
- });
696
- })
697
- ];
698
- });
699
- })();
700
- }
735
+ var fileCache = createJsonFileAsyncKeyedValueCache({
736
+ filePath: filename,
737
+ reviver: reviveZohoAccessToken
738
+ });
739
+ var cache = useMemoryCache ? memoizeAsyncKeyedValueCache(fileCache) : fileCache;
701
740
  function loadZohoAccessTokenCache(service) {
702
- var accessTokenCache = {
741
+ return {
703
742
  loadCachedToken: function loadCachedToken() {
704
- return _async_to_generator$3(function() {
705
- var tokens;
706
- return _ts_generator$3(this, function(_state) {
707
- switch(_state.label){
708
- case 0:
709
- return [
710
- 4,
711
- loadTokens()
712
- ];
713
- case 1:
714
- tokens = _state.sent();
715
- // console.log('retrieving access token from file: ', { token, service });
716
- return [
717
- 2,
718
- tokens[service]
719
- ];
720
- }
721
- });
722
- })();
743
+ return cache.get(service);
723
744
  },
724
745
  updateCachedToken: function updateCachedToken(accessToken) {
725
746
  return _async_to_generator$3(function() {
726
- var tokens, e;
747
+ var e;
727
748
  return _ts_generator$3(this, function(_state) {
728
749
  switch(_state.label){
729
750
  case 0:
730
- return [
731
- 4,
732
- loadTokens()
733
- ];
734
- case 1:
735
- tokens = _state.sent();
736
- if (tokens) {
737
- tokens[service] = accessToken;
738
- }
739
- _state.label = 2;
740
- case 2:
741
751
  _state.trys.push([
752
+ 0,
742
753
  2,
743
- 4,
744
754
  ,
745
- 5
755
+ 3
746
756
  ]);
747
757
  return [
748
758
  4,
749
- writeTokenFile(tokens)
759
+ cache.set(service, accessToken)
750
760
  ];
751
- case 3:
761
+ case 1:
752
762
  _state.sent();
753
763
  return [
754
764
  3,
755
- 5
765
+ 3
756
766
  ];
757
- case 4:
767
+ case 2:
758
768
  e = _state.sent();
759
769
  console.error('Failed updating access token in file: ', e);
760
770
  return [
761
771
  3,
762
- 5
772
+ 3
763
773
  ];
764
- case 5:
774
+ case 3:
765
775
  return [
766
776
  2
767
777
  ];
@@ -783,7 +793,7 @@ var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-acce
783
793
  ]);
784
794
  return [
785
795
  4,
786
- writeTokenFile({})
796
+ cache.remove(service)
787
797
  ];
788
798
  case 1:
789
799
  _state.sent();
@@ -807,7 +817,155 @@ var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-acce
807
817
  })();
808
818
  }
809
819
  };
810
- return accessTokenCache;
820
+ }
821
+ function readTokenFile() {
822
+ return _async_to_generator$3(function() {
823
+ var raw, result, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, key;
824
+ return _ts_generator$3(this, function(_state) {
825
+ switch(_state.label){
826
+ case 0:
827
+ return [
828
+ 4,
829
+ readJsonFile(filename)
830
+ ];
831
+ case 1:
832
+ raw = _state.sent();
833
+ if (raw == null) {
834
+ return [
835
+ 2,
836
+ undefined
837
+ ];
838
+ }
839
+ result = {};
840
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
841
+ try {
842
+ for(_iterator = Object.keys(raw)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
843
+ key = _step.value;
844
+ result[key] = reviveZohoAccessToken(raw[key]);
845
+ }
846
+ } catch (err) {
847
+ _didIteratorError = true;
848
+ _iteratorError = err;
849
+ } finally{
850
+ try {
851
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
852
+ _iterator.return();
853
+ }
854
+ } finally{
855
+ if (_didIteratorError) {
856
+ throw _iteratorError;
857
+ }
858
+ }
859
+ }
860
+ return [
861
+ 2,
862
+ result
863
+ ];
864
+ }
865
+ });
866
+ })();
867
+ }
868
+ // Route the file-mutation helpers through the same `cache` instance used by
869
+ // loadZohoAccessTokenCache so the memoized in-memory layer (when useMemoryCache=true) stays
870
+ // consistent with disk. Direct writeJsonFile / removeFile would otherwise leave the memo
871
+ // holding stale entries that no future read could refresh.
872
+ function writeTokenFile(tokens) {
873
+ return _async_to_generator$3(function() {
874
+ var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, err;
875
+ return _ts_generator$3(this, function(_state) {
876
+ switch(_state.label){
877
+ case 0:
878
+ return [
879
+ 4,
880
+ cache.clear()
881
+ ];
882
+ case 1:
883
+ _state.sent();
884
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
885
+ _state.label = 2;
886
+ case 2:
887
+ _state.trys.push([
888
+ 2,
889
+ 7,
890
+ 8,
891
+ 9
892
+ ]);
893
+ _iterator = Object.entries(tokens)[Symbol.iterator]();
894
+ _state.label = 3;
895
+ case 3:
896
+ if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
897
+ 3,
898
+ 6
899
+ ];
900
+ _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
901
+ if (!(value != null)) return [
902
+ 3,
903
+ 5
904
+ ];
905
+ return [
906
+ 4,
907
+ cache.set(key, value)
908
+ ];
909
+ case 4:
910
+ _state.sent();
911
+ _state.label = 5;
912
+ case 5:
913
+ _iteratorNormalCompletion = true;
914
+ return [
915
+ 3,
916
+ 3
917
+ ];
918
+ case 6:
919
+ return [
920
+ 3,
921
+ 9
922
+ ];
923
+ case 7:
924
+ err = _state.sent();
925
+ _didIteratorError = true;
926
+ _iteratorError = err;
927
+ return [
928
+ 3,
929
+ 9
930
+ ];
931
+ case 8:
932
+ try {
933
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
934
+ _iterator.return();
935
+ }
936
+ } finally{
937
+ if (_didIteratorError) {
938
+ throw _iteratorError;
939
+ }
940
+ }
941
+ return [
942
+ 7
943
+ ];
944
+ case 9:
945
+ return [
946
+ 2
947
+ ];
948
+ }
949
+ });
950
+ })();
951
+ }
952
+ function deleteTokenFile() {
953
+ return _async_to_generator$3(function() {
954
+ return _ts_generator$3(this, function(_state) {
955
+ switch(_state.label){
956
+ case 0:
957
+ return [
958
+ 4,
959
+ cache.clear()
960
+ ];
961
+ case 1:
962
+ _state.sent();
963
+ return [
964
+ 2
965
+ ];
966
+ }
967
+ });
968
+ })();
811
969
  }
812
970
  return {
813
971
  loadZohoAccessTokenCache: loadZohoAccessTokenCache,
@@ -3565,6 +3723,8 @@ function _object_spread_props(target, source) {
3565
3723
  get: // MARK: Ticket Accessors
3566
3724
  /**
3567
3725
  * Configured pass-through for {@link zohoDeskGetTickets}.
3726
+ *
3727
+ * @returns a function that lists Desk tickets matching the supplied filter/pagination input
3568
3728
  */ function get() {
3569
3729
  return zohoDeskGetTickets(this.deskContext);
3570
3730
  }
@@ -3573,6 +3733,8 @@ function _object_spread_props(target, source) {
3573
3733
  key: "getTicketById",
3574
3734
  get: /**
3575
3735
  * Configured pass-through for {@link zohoDeskGetTicketById}.
3736
+ *
3737
+ * @returns a function that fetches a single Desk ticket by its identifier
3576
3738
  */ function get() {
3577
3739
  return zohoDeskGetTicketById(this.deskContext);
3578
3740
  }
@@ -3581,6 +3743,8 @@ function _object_spread_props(target, source) {
3581
3743
  key: "searchTickets",
3582
3744
  get: /**
3583
3745
  * Configured pass-through for {@link zohoDeskSearchTickets}.
3746
+ *
3747
+ * @returns a function that runs a Desk ticket search with the provided criteria
3584
3748
  */ function get() {
3585
3749
  return zohoDeskSearchTickets(this.deskContext);
3586
3750
  }
@@ -3589,6 +3753,8 @@ function _object_spread_props(target, source) {
3589
3753
  key: "getTicketsForContact",
3590
3754
  get: /**
3591
3755
  * Configured pass-through for {@link zohoDeskGetTicketsForContact}.
3756
+ *
3757
+ * @returns a function that lists Desk tickets associated with the given contact id
3592
3758
  */ function get() {
3593
3759
  return zohoDeskGetTicketsForContact(this.deskContext);
3594
3760
  }
@@ -3597,6 +3763,8 @@ function _object_spread_props(target, source) {
3597
3763
  key: "getTicketsForProduct",
3598
3764
  get: /**
3599
3765
  * Configured pass-through for {@link zohoDeskGetTicketsForProduct}.
3766
+ *
3767
+ * @returns a function that lists Desk tickets associated with the given product id
3600
3768
  */ function get() {
3601
3769
  return zohoDeskGetTicketsForProduct(this.deskContext);
3602
3770
  }
@@ -3605,6 +3773,8 @@ function _object_spread_props(target, source) {
3605
3773
  key: "getTicketMetrics",
3606
3774
  get: /**
3607
3775
  * Configured pass-through for {@link zohoDeskGetTicketMetrics}.
3776
+ *
3777
+ * @returns a function that fetches aggregated metrics for the requested Desk tickets
3608
3778
  */ function get() {
3609
3779
  return zohoDeskGetTicketMetrics(this.deskContext);
3610
3780
  }
@@ -3613,6 +3783,8 @@ function _object_spread_props(target, source) {
3613
3783
  key: "getAgentsTicketsCount",
3614
3784
  get: /**
3615
3785
  * Configured pass-through for {@link zohoDeskGetAgentsTicketsCount}.
3786
+ *
3787
+ * @returns a function that returns ticket counts grouped by agent for the requested filter
3616
3788
  */ function get() {
3617
3789
  return zohoDeskGetAgentsTicketsCount(this.deskContext);
3618
3790
  }
@@ -3621,6 +3793,8 @@ function _object_spread_props(target, source) {
3621
3793
  key: "getTicketsPageFactory",
3622
3794
  get: /**
3623
3795
  * Configured pass-through for {@link zohoDeskGetTicketsPageFactory}.
3796
+ *
3797
+ * @returns a paged result factory for iterating over Desk ticket list responses
3624
3798
  */ function get() {
3625
3799
  return zohoDeskGetTicketsPageFactory(this.deskContext);
3626
3800
  }
@@ -3629,6 +3803,8 @@ function _object_spread_props(target, source) {
3629
3803
  key: "searchTicketsPageFactory",
3630
3804
  get: /**
3631
3805
  * Configured pass-through for {@link zohoDeskSearchTicketsPageFactory}.
3806
+ *
3807
+ * @returns a paged result factory for iterating over Desk ticket search responses
3632
3808
  */ function get() {
3633
3809
  return zohoDeskSearchTicketsPageFactory(this.deskContext);
3634
3810
  }
@@ -3638,6 +3814,8 @@ function _object_spread_props(target, source) {
3638
3814
  get: // MARK: Department Accessors
3639
3815
  /**
3640
3816
  * Configured pass-through for {@link zohoDeskGetDepartments}.
3817
+ *
3818
+ * @returns a function that lists Desk departments visible to the authenticated portal
3641
3819
  */ function get() {
3642
3820
  return zohoDeskGetDepartments(this.deskContext);
3643
3821
  }
@@ -3646,6 +3824,8 @@ function _object_spread_props(target, source) {
3646
3824
  key: "getDepartmentById",
3647
3825
  get: /**
3648
3826
  * Configured pass-through for {@link zohoDeskGetDepartmentById}.
3827
+ *
3828
+ * @returns a function that fetches a single Desk department by its identifier
3649
3829
  */ function get() {
3650
3830
  return zohoDeskGetDepartmentById(this.deskContext);
3651
3831
  }
@@ -3655,6 +3835,8 @@ function _object_spread_props(target, source) {
3655
3835
  get: // MARK: Contact Accessors
3656
3836
  /**
3657
3837
  * Configured pass-through for {@link zohoDeskGetContacts}.
3838
+ *
3839
+ * @returns a function that lists Desk contacts matching the supplied filter/pagination input
3658
3840
  */ function get() {
3659
3841
  return zohoDeskGetContacts(this.deskContext);
3660
3842
  }
@@ -3663,6 +3845,8 @@ function _object_spread_props(target, source) {
3663
3845
  key: "getContactById",
3664
3846
  get: /**
3665
3847
  * Configured pass-through for {@link zohoDeskGetContactById}.
3848
+ *
3849
+ * @returns a function that fetches a single Desk contact by its identifier
3666
3850
  */ function get() {
3667
3851
  return zohoDeskGetContactById(this.deskContext);
3668
3852
  }
@@ -3671,6 +3855,8 @@ function _object_spread_props(target, source) {
3671
3855
  key: "getContactsByIds",
3672
3856
  get: /**
3673
3857
  * Configured pass-through for {@link zohoDeskGetContactsByIds}.
3858
+ *
3859
+ * @returns a function that fetches multiple Desk contacts in a single request by their identifiers
3674
3860
  */ function get() {
3675
3861
  return zohoDeskGetContactsByIds(this.deskContext);
3676
3862
  }
@@ -3679,6 +3865,8 @@ function _object_spread_props(target, source) {
3679
3865
  key: "getContactsPageFactory",
3680
3866
  get: /**
3681
3867
  * Configured pass-through for {@link zohoDeskGetContactsPageFactory}.
3868
+ *
3869
+ * @returns a paged result factory for iterating over Desk contact list responses
3682
3870
  */ function get() {
3683
3871
  return zohoDeskGetContactsPageFactory(this.deskContext);
3684
3872
  }
@@ -3688,6 +3876,8 @@ function _object_spread_props(target, source) {
3688
3876
  get: // MARK: Tag Accessors
3689
3877
  /**
3690
3878
  * Configured pass-through for {@link zohoDeskGetTicketTags}.
3879
+ *
3880
+ * @returns a function that lists the tags currently associated with a given Desk ticket
3691
3881
  */ function get() {
3692
3882
  return zohoDeskGetTicketTags(this.deskContext);
3693
3883
  }
@@ -3696,6 +3886,8 @@ function _object_spread_props(target, source) {
3696
3886
  key: "associateTicketTags",
3697
3887
  get: /**
3698
3888
  * Configured pass-through for {@link zohoDeskAssociateTicketTags}.
3889
+ *
3890
+ * @returns a function that associates one or more tags with a Desk ticket
3699
3891
  */ function get() {
3700
3892
  return zohoDeskAssociateTicketTags(this.deskContext);
3701
3893
  }
@@ -3704,6 +3896,8 @@ function _object_spread_props(target, source) {
3704
3896
  key: "dissociateTicketTag",
3705
3897
  get: /**
3706
3898
  * Configured pass-through for {@link zohoDeskDissociateTicketTag}.
3899
+ *
3900
+ * @returns a function that removes a single tag association from a Desk ticket
3707
3901
  */ function get() {
3708
3902
  return zohoDeskDissociateTicketTag(this.deskContext);
3709
3903
  }
@@ -3712,6 +3906,8 @@ function _object_spread_props(target, source) {
3712
3906
  key: "searchTags",
3713
3907
  get: /**
3714
3908
  * Configured pass-through for {@link zohoDeskSearchTags}.
3909
+ *
3910
+ * @returns a function that searches the Desk tag catalog by the supplied criteria
3715
3911
  */ function get() {
3716
3912
  return zohoDeskSearchTags(this.deskContext);
3717
3913
  }
@@ -3720,6 +3916,8 @@ function _object_spread_props(target, source) {
3720
3916
  key: "getAllTags",
3721
3917
  get: /**
3722
3918
  * Configured pass-through for {@link zohoDeskGetAllTags}.
3919
+ *
3920
+ * @returns a function that lists every tag defined on the Desk portal
3723
3921
  */ function get() {
3724
3922
  return zohoDeskGetAllTags(this.deskContext);
3725
3923
  }
@@ -3729,6 +3927,8 @@ function _object_spread_props(target, source) {
3729
3927
  get: // MARK: Follower Accessors
3730
3928
  /**
3731
3929
  * Configured pass-through for {@link zohoDeskGetTicketFollowers}.
3930
+ *
3931
+ * @returns a function that lists the agents following a given Desk ticket
3732
3932
  */ function get() {
3733
3933
  return zohoDeskGetTicketFollowers(this.deskContext);
3734
3934
  }
@@ -3737,6 +3937,8 @@ function _object_spread_props(target, source) {
3737
3937
  key: "addTicketFollowers",
3738
3938
  get: /**
3739
3939
  * Configured pass-through for {@link zohoDeskAddTicketFollowers}.
3940
+ *
3941
+ * @returns a function that adds one or more agents as followers of a Desk ticket
3740
3942
  */ function get() {
3741
3943
  return zohoDeskAddTicketFollowers(this.deskContext);
3742
3944
  }
@@ -3745,6 +3947,8 @@ function _object_spread_props(target, source) {
3745
3947
  key: "removeTicketFollowers",
3746
3948
  get: /**
3747
3949
  * Configured pass-through for {@link zohoDeskRemoveTicketFollowers}.
3950
+ *
3951
+ * @returns a function that removes one or more agents from a Desk ticket's follower list
3748
3952
  */ function get() {
3749
3953
  return zohoDeskRemoveTicketFollowers(this.deskContext);
3750
3954
  }
@@ -3754,6 +3958,8 @@ function _object_spread_props(target, source) {
3754
3958
  get: // MARK: Attachment Accessors
3755
3959
  /**
3756
3960
  * Configured pass-through for {@link zohoDeskGetTicketAttachments}.
3961
+ *
3962
+ * @returns a function that lists the file attachments on a given Desk ticket
3757
3963
  */ function get() {
3758
3964
  return zohoDeskGetTicketAttachments(this.deskContext);
3759
3965
  }
@@ -3762,6 +3968,8 @@ function _object_spread_props(target, source) {
3762
3968
  key: "deleteTicketAttachment",
3763
3969
  get: /**
3764
3970
  * Configured pass-through for {@link zohoDeskDeleteTicketAttachment}.
3971
+ *
3972
+ * @returns a function that deletes a single attachment from a Desk ticket by attachment id
3765
3973
  */ function get() {
3766
3974
  return zohoDeskDeleteTicketAttachment(this.deskContext);
3767
3975
  }
@@ -3771,6 +3979,8 @@ function _object_spread_props(target, source) {
3771
3979
  get: // MARK: Comment Accessors
3772
3980
  /**
3773
3981
  * Configured pass-through for {@link zohoDeskGetTicketComments}.
3982
+ *
3983
+ * @returns a function that lists the comments on a given Desk ticket
3774
3984
  */ function get() {
3775
3985
  return zohoDeskGetTicketComments(this.deskContext);
3776
3986
  }
@@ -3779,6 +3989,8 @@ function _object_spread_props(target, source) {
3779
3989
  key: "getTicketCommentById",
3780
3990
  get: /**
3781
3991
  * Configured pass-through for {@link zohoDeskGetTicketCommentById}.
3992
+ *
3993
+ * @returns a function that fetches a single comment on a Desk ticket by comment id
3782
3994
  */ function get() {
3783
3995
  return zohoDeskGetTicketCommentById(this.deskContext);
3784
3996
  }
@@ -3787,6 +3999,8 @@ function _object_spread_props(target, source) {
3787
3999
  key: "createTicketComment",
3788
4000
  get: /**
3789
4001
  * Configured pass-through for {@link zohoDeskCreateTicketComment}.
4002
+ *
4003
+ * @returns a function that creates a new comment on a Desk ticket from the supplied body
3790
4004
  */ function get() {
3791
4005
  return zohoDeskCreateTicketComment(this.deskContext);
3792
4006
  }
@@ -3795,6 +4009,8 @@ function _object_spread_props(target, source) {
3795
4009
  key: "deleteTicketComment",
3796
4010
  get: /**
3797
4011
  * Configured pass-through for {@link zohoDeskDeleteTicketComment}.
4012
+ *
4013
+ * @returns a function that deletes a single comment from a Desk ticket by comment id
3798
4014
  */ function get() {
3799
4015
  return zohoDeskDeleteTicketComment(this.deskContext);
3800
4016
  }
@@ -3804,6 +4020,8 @@ function _object_spread_props(target, source) {
3804
4020
  get: // MARK: Time Tracking Accessors
3805
4021
  /**
3806
4022
  * Configured pass-through for {@link zohoDeskGetTicketTimer}.
4023
+ *
4024
+ * @returns a function that fetches the current timer state for a Desk ticket
3807
4025
  */ function get() {
3808
4026
  return zohoDeskGetTicketTimer(this.deskContext);
3809
4027
  }
@@ -3812,6 +4030,8 @@ function _object_spread_props(target, source) {
3812
4030
  key: "performTicketTimerAction",
3813
4031
  get: /**
3814
4032
  * Configured pass-through for {@link zohoDeskPerformTicketTimerAction}.
4033
+ *
4034
+ * @returns a function that performs a timer action (start/pause/stop) on a Desk ticket
3815
4035
  */ function get() {
3816
4036
  return zohoDeskPerformTicketTimerAction(this.deskContext);
3817
4037
  }
@@ -3820,6 +4040,8 @@ function _object_spread_props(target, source) {
3820
4040
  key: "getTicketTimeEntries",
3821
4041
  get: /**
3822
4042
  * Configured pass-through for {@link zohoDeskGetTicketTimeEntries}.
4043
+ *
4044
+ * @returns a function that lists the time entries logged against a Desk ticket
3823
4045
  */ function get() {
3824
4046
  return zohoDeskGetTicketTimeEntries(this.deskContext);
3825
4047
  }
@@ -3828,6 +4050,8 @@ function _object_spread_props(target, source) {
3828
4050
  key: "getTicketTimeEntryById",
3829
4051
  get: /**
3830
4052
  * Configured pass-through for {@link zohoDeskGetTicketTimeEntryById}.
4053
+ *
4054
+ * @returns a function that fetches a single time entry on a Desk ticket by entry id
3831
4055
  */ function get() {
3832
4056
  return zohoDeskGetTicketTimeEntryById(this.deskContext);
3833
4057
  }
@@ -3836,6 +4060,8 @@ function _object_spread_props(target, source) {
3836
4060
  key: "getTicketTimeEntrySummation",
3837
4061
  get: /**
3838
4062
  * Configured pass-through for {@link zohoDeskGetTicketTimeEntrySummation}.
4063
+ *
4064
+ * @returns a function that fetches the aggregated time-entry totals for a Desk ticket
3839
4065
  */ function get() {
3840
4066
  return zohoDeskGetTicketTimeEntrySummation(this.deskContext);
3841
4067
  }
@@ -3845,6 +4071,8 @@ function _object_spread_props(target, source) {
3845
4071
  get: // MARK: Thread Accessors
3846
4072
  /**
3847
4073
  * Configured pass-through for {@link zohoDeskGetTicketThreads}.
4074
+ *
4075
+ * @returns a function that lists the conversation threads on a given Desk ticket
3848
4076
  */ function get() {
3849
4077
  return zohoDeskGetTicketThreads(this.deskContext);
3850
4078
  }
@@ -3853,6 +4081,8 @@ function _object_spread_props(target, source) {
3853
4081
  key: "getTicketThreadById",
3854
4082
  get: /**
3855
4083
  * Configured pass-through for {@link zohoDeskGetTicketThreadById}.
4084
+ *
4085
+ * @returns a function that fetches a single thread on a Desk ticket by thread id
3856
4086
  */ function get() {
3857
4087
  return zohoDeskGetTicketThreadById(this.deskContext);
3858
4088
  }
@@ -3861,6 +4091,8 @@ function _object_spread_props(target, source) {
3861
4091
  key: "getTicketThreadsPageFactory",
3862
4092
  get: /**
3863
4093
  * Configured pass-through for {@link zohoDeskGetTicketThreadsPageFactory}.
4094
+ *
4095
+ * @returns a paged result factory for iterating over Desk ticket thread responses
3864
4096
  */ function get() {
3865
4097
  return zohoDeskGetTicketThreadsPageFactory(this.deskContext);
3866
4098
  }
@@ -3870,6 +4102,8 @@ function _object_spread_props(target, source) {
3870
4102
  get: // MARK: Activity Accessors
3871
4103
  /**
3872
4104
  * Configured pass-through for {@link zohoDeskGetTicketActivities}.
4105
+ *
4106
+ * @returns a function that lists the activity log entries for a given Desk ticket
3873
4107
  */ function get() {
3874
4108
  return zohoDeskGetTicketActivities(this.deskContext);
3875
4109
  }
@@ -3878,6 +4112,8 @@ function _object_spread_props(target, source) {
3878
4112
  key: "getTicketActivitiesPageFactory",
3879
4113
  get: /**
3880
4114
  * Configured pass-through for {@link zohoDeskGetTicketActivitiesPageFactory}.
4115
+ *
4116
+ * @returns a paged result factory for iterating over Desk ticket activity responses
3881
4117
  */ function get() {
3882
4118
  return zohoDeskGetTicketActivitiesPageFactory(this.deskContext);
3883
4119
  }
@@ -3887,6 +4123,8 @@ function _object_spread_props(target, source) {
3887
4123
  get: // MARK: Agent Accessors
3888
4124
  /**
3889
4125
  * Configured pass-through for {@link zohoDeskGetAgents}.
4126
+ *
4127
+ * @returns a function that lists Desk agents matching the supplied filter/pagination input
3890
4128
  */ function get() {
3891
4129
  return zohoDeskGetAgents(this.deskContext);
3892
4130
  }
@@ -3895,6 +4133,8 @@ function _object_spread_props(target, source) {
3895
4133
  key: "getAgentById",
3896
4134
  get: /**
3897
4135
  * Configured pass-through for {@link zohoDeskGetAgentById}.
4136
+ *
4137
+ * @returns a function that fetches a single Desk agent by agent id
3898
4138
  */ function get() {
3899
4139
  return zohoDeskGetAgentById(this.deskContext);
3900
4140
  }
@@ -3903,6 +4143,8 @@ function _object_spread_props(target, source) {
3903
4143
  key: "getAgentsByIds",
3904
4144
  get: /**
3905
4145
  * Configured pass-through for {@link zohoDeskGetAgentsByIds}.
4146
+ *
4147
+ * @returns a function that fetches multiple Desk agents in a single request by their identifiers
3906
4148
  */ function get() {
3907
4149
  return zohoDeskGetAgentsByIds(this.deskContext);
3908
4150
  }
@@ -3911,6 +4153,8 @@ function _object_spread_props(target, source) {
3911
4153
  key: "getMyInfo",
3912
4154
  get: /**
3913
4155
  * Configured pass-through for {@link zohoDeskGetMyInfo}.
4156
+ *
4157
+ * @returns a function that fetches the profile information for the currently authenticated agent
3914
4158
  */ function get() {
3915
4159
  return zohoDeskGetMyInfo(this.deskContext);
3916
4160
  }
@@ -3919,6 +4163,8 @@ function _object_spread_props(target, source) {
3919
4163
  key: "getAgentsPageFactory",
3920
4164
  get: /**
3921
4165
  * Configured pass-through for {@link zohoDeskGetAgentsPageFactory}.
4166
+ *
4167
+ * @returns a paged result factory for iterating over Desk agent list responses
3922
4168
  */ function get() {
3923
4169
  return zohoDeskGetAgentsPageFactory(this.deskContext);
3924
4170
  }