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