@dereekb/zoho 13.7.0 → 13.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/cli/LICENSE +21 -0
  2. package/cli/index.js +4 -0
  3. package/cli/package.json +20 -0
  4. package/index.cjs.js +2553 -242
  5. package/index.esm.js +2490 -243
  6. package/nestjs/index.cjs.js +864 -203
  7. package/nestjs/index.esm.js +861 -205
  8. package/nestjs/package.json +6 -6
  9. package/nestjs/src/lib/desk/desk.api.d.ts +213 -0
  10. package/nestjs/src/lib/desk/desk.config.d.ts +27 -0
  11. package/nestjs/src/lib/desk/desk.module.d.ts +62 -0
  12. package/nestjs/src/lib/desk/index.d.ts +3 -0
  13. package/nestjs/src/lib/index.d.ts +1 -0
  14. package/package.json +13 -6
  15. package/src/lib/desk/desk.agent.d.ts +45 -0
  16. package/src/lib/desk/desk.api.activities.d.ts +43 -0
  17. package/src/lib/desk/desk.api.agents.d.ts +91 -0
  18. package/src/lib/desk/desk.api.attachments.d.ts +47 -0
  19. package/src/lib/desk/desk.api.comments.d.ts +86 -0
  20. package/src/lib/desk/desk.api.contacts.d.ts +81 -0
  21. package/src/lib/desk/desk.api.departments.d.ts +47 -0
  22. package/src/lib/desk/desk.api.followers.d.ts +57 -0
  23. package/src/lib/desk/desk.api.page.d.ts +72 -0
  24. package/src/lib/desk/desk.api.tags.d.ts +102 -0
  25. package/src/lib/desk/desk.api.threads.d.ts +60 -0
  26. package/src/lib/desk/desk.api.tickets.d.ts +227 -0
  27. package/src/lib/desk/desk.api.time.d.ts +109 -0
  28. package/src/lib/desk/desk.config.d.ts +75 -0
  29. package/src/lib/desk/desk.contact.d.ts +50 -0
  30. package/src/lib/desk/desk.d.ts +44 -0
  31. package/src/lib/desk/desk.department.d.ts +27 -0
  32. package/src/lib/desk/desk.error.api.d.ts +33 -0
  33. package/src/lib/desk/desk.factory.d.ts +47 -0
  34. package/src/lib/desk/desk.limit.d.ts +39 -0
  35. package/src/lib/desk/desk.ticket.d.ts +308 -0
  36. package/src/lib/desk/index.d.ts +21 -0
  37. package/src/lib/index.d.ts +1 -0
  38. package/src/lib/zoho.limit.d.ts +66 -10
package/index.cjs.js CHANGED
@@ -4,7 +4,7 @@ var util = require('@dereekb/util');
4
4
  var fetch = require('@dereekb/util/fetch');
5
5
  var makeError = require('make-error');
6
6
 
7
- function _define_property$h(obj, key, value) {
7
+ function _define_property$s(obj, key, value) {
8
8
  if (key in obj) {
9
9
  Object.defineProperty(obj, key, {
10
10
  value: value,
@@ -17,7 +17,7 @@ function _define_property$h(obj, key, value) {
17
17
  }
18
18
  return obj;
19
19
  }
20
- function _object_spread$d(target) {
20
+ function _object_spread$o(target) {
21
21
  for(var i = 1; i < arguments.length; i++){
22
22
  var source = arguments[i] != null ? arguments[i] : {};
23
23
  var ownKeys = Object.keys(source);
@@ -27,12 +27,12 @@ function _object_spread$d(target) {
27
27
  }));
28
28
  }
29
29
  ownKeys.forEach(function(key) {
30
- _define_property$h(target, key, source[key]);
30
+ _define_property$s(target, key, source[key]);
31
31
  });
32
32
  }
33
33
  return target;
34
34
  }
35
- function ownKeys$c(object, enumerableOnly) {
35
+ function ownKeys$n(object, enumerableOnly) {
36
36
  var keys = Object.keys(object);
37
37
  if (Object.getOwnPropertySymbols) {
38
38
  var symbols = Object.getOwnPropertySymbols(object);
@@ -40,12 +40,12 @@ function ownKeys$c(object, enumerableOnly) {
40
40
  }
41
41
  return keys;
42
42
  }
43
- function _object_spread_props$c(target, source) {
43
+ function _object_spread_props$n(target, source) {
44
44
  source = source != null ? source : {};
45
45
  if (Object.getOwnPropertyDescriptors) {
46
46
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47
47
  } else {
48
- ownKeys$c(Object(source)).forEach(function(key) {
48
+ ownKeys$n(Object(source)).forEach(function(key) {
49
49
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50
50
  });
51
51
  }
@@ -89,7 +89,7 @@ function _object_spread_props$c(target, source) {
89
89
  * }
90
90
  * ```
91
91
  */ function zohoFetchPageFactory(fetch$1, defaults) {
92
- return fetch.fetchPageFactory(_object_spread_props$c(_object_spread$d({}, defaults), {
92
+ return fetch.fetchPageFactory(_object_spread_props$n(_object_spread$o({}, defaults), {
93
93
  fetch: fetch$1,
94
94
  readFetchPageResultInfo: function readFetchPageResultInfo(result) {
95
95
  var _ref;
@@ -100,7 +100,7 @@ function _object_spread_props$c(target, source) {
100
100
  },
101
101
  buildInputForNextPage: function buildInputForNextPage(pageResult, input, options) {
102
102
  var _options_maxItemsPerPage;
103
- return _object_spread_props$c(_object_spread$d({}, input), {
103
+ return _object_spread_props$n(_object_spread$o({}, input), {
104
104
  page: util.getNextPageNumber(pageResult),
105
105
  per_page: (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.per_page
106
106
  });
@@ -325,7 +325,7 @@ function _assert_this_initialized$5(self) {
325
325
  }
326
326
  return self;
327
327
  }
328
- function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
328
+ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
329
329
  try {
330
330
  var info = gen[key](arg);
331
331
  var value = info.value;
@@ -339,16 +339,16 @@ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
339
339
  Promise.resolve(value).then(_next, _throw);
340
340
  }
341
341
  }
342
- function _async_to_generator$9(fn) {
342
+ function _async_to_generator$b(fn) {
343
343
  return function() {
344
344
  var self = this, args = arguments;
345
345
  return new Promise(function(resolve, reject) {
346
346
  var gen = fn.apply(self, args);
347
347
  function _next(value) {
348
- asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
348
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
349
349
  }
350
350
  function _throw(err) {
351
- asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
351
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
352
352
  }
353
353
  _next(undefined);
354
354
  });
@@ -376,7 +376,7 @@ function _create_class$2(Constructor, protoProps, staticProps) {
376
376
  if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
377
377
  return Constructor;
378
378
  }
379
- function _define_property$g(obj, key, value) {
379
+ function _define_property$r(obj, key, value) {
380
380
  if (key in obj) {
381
381
  Object.defineProperty(obj, key, {
382
382
  value: value,
@@ -408,7 +408,7 @@ function _inherits$5(subClass, superClass) {
408
408
  });
409
409
  if (superClass) _set_prototype_of$5(subClass, superClass);
410
410
  }
411
- function _instanceof$5(left, right) {
411
+ function _instanceof$6(left, right) {
412
412
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
413
413
  return !!right[Symbol.hasInstance](left);
414
414
  } else {
@@ -440,7 +440,7 @@ function _is_native_reflect_construct$5() {
440
440
  return !!result;
441
441
  })();
442
442
  }
443
- function _ts_generator$9(thisArg, body) {
443
+ function _ts_generator$b(thisArg, body) {
444
444
  var f, y, t, _ = {
445
445
  label: 0,
446
446
  sent: function() {
@@ -586,7 +586,7 @@ function _ts_generator$9(thisArg, body) {
586
586
  var _this;
587
587
  _this = _call_super$5(this, ZohoServerError, [
588
588
  error.message
589
- ]), _define_property$g(_this, "error", void 0);
589
+ ]), _define_property$r(_this, "error", void 0);
590
590
  _this.error = error;
591
591
  return _this;
592
592
  }
@@ -609,7 +609,7 @@ function _ts_generator$9(thisArg, body) {
609
609
  var _this;
610
610
  _this = _call_super$5(this, ZohoServerFetchResponseError, [
611
611
  data
612
- ]), _define_property$g(_this, "data", void 0), _define_property$g(_this, "errorResponseData", void 0), _define_property$g(_this, "responseError", void 0);
612
+ ]), _define_property$r(_this, "data", void 0), _define_property$r(_this, "errorResponseData", void 0), _define_property$r(_this, "responseError", void 0);
613
613
  _this.data = data;
614
614
  _this.errorResponseData = errorResponseData;
615
615
  _this.responseError = responseError;
@@ -654,12 +654,12 @@ function _ts_generator$9(thisArg, body) {
654
654
  */ function logZohoServerErrorFunction(zohoApiNamePrefix, options) {
655
655
  var _ref = options !== null && options !== void 0 ? options : {}, _ref_logDataArrayErrors = _ref.logDataArrayErrors, logDataArrayErrors = _ref_logDataArrayErrors === void 0 ? false : _ref_logDataArrayErrors;
656
656
  return function(error) {
657
- if (_instanceof$5(error, ZohoServerFetchResponseDataArrayError) && !logDataArrayErrors) ; else if (_instanceof$5(error, ZohoServerFetchResponseError)) {
657
+ if (_instanceof$6(error, ZohoServerFetchResponseDataArrayError) && !logDataArrayErrors) ; else if (_instanceof$6(error, ZohoServerFetchResponseError)) {
658
658
  console.log("".concat(zohoApiNamePrefix, "Error(").concat(error.responseError.response.status, "): "), {
659
659
  error: error,
660
660
  errorData: error.data
661
661
  });
662
- } else if (_instanceof$5(error, ZohoServerError)) {
662
+ } else if (_instanceof$6(error, ZohoServerError)) {
663
663
  console.log("".concat(zohoApiNamePrefix, "Error(code:").concat(error.code, "): "), {
664
664
  error: error
665
665
  });
@@ -680,9 +680,9 @@ function _ts_generator$9(thisArg, body) {
680
680
  return function(fetch$1) {
681
681
  var logError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultLogError, onError = arguments.length > 2 ? arguments[2] : void 0;
682
682
  return function(x, y) {
683
- return _async_to_generator$9(function() {
683
+ return _async_to_generator$b(function() {
684
684
  var e, error;
685
- return _ts_generator$9(this, function(_state) {
685
+ return _ts_generator$b(this, function(_state) {
686
686
  switch(_state.label){
687
687
  case 0:
688
688
  _state.trys.push([
@@ -702,7 +702,7 @@ function _ts_generator$9(thisArg, body) {
702
702
  ]; // await to catch thrown errors
703
703
  case 2:
704
704
  e = _state.sent();
705
- if (!_instanceof$5(e, fetch.FetchResponseError)) return [
705
+ if (!_instanceof$6(e, fetch.FetchResponseError)) return [
706
706
  3,
707
707
  4
708
708
  ];
@@ -931,7 +931,7 @@ function _assert_this_initialized$4(self) {
931
931
  }
932
932
  return self;
933
933
  }
934
- function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
934
+ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
935
935
  try {
936
936
  var info = gen[key](arg);
937
937
  var value = info.value;
@@ -945,16 +945,16 @@ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
945
945
  Promise.resolve(value).then(_next, _throw);
946
946
  }
947
947
  }
948
- function _async_to_generator$8(fn) {
948
+ function _async_to_generator$a(fn) {
949
949
  return function() {
950
950
  var self = this, args = arguments;
951
951
  return new Promise(function(resolve, reject) {
952
952
  var gen = fn.apply(self, args);
953
953
  function _next(value) {
954
- asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
954
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
955
955
  }
956
956
  function _throw(err) {
957
- asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
957
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
958
958
  }
959
959
  _next(undefined);
960
960
  });
@@ -982,7 +982,7 @@ function _create_class$1(Constructor, protoProps, staticProps) {
982
982
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
983
983
  return Constructor;
984
984
  }
985
- function _define_property$f(obj, key, value) {
985
+ function _define_property$q(obj, key, value) {
986
986
  if (key in obj) {
987
987
  Object.defineProperty(obj, key, {
988
988
  value: value,
@@ -1039,7 +1039,7 @@ function _is_native_reflect_construct$4() {
1039
1039
  return !!result;
1040
1040
  })();
1041
1041
  }
1042
- function _ts_generator$8(thisArg, body) {
1042
+ function _ts_generator$a(thisArg, body) {
1043
1043
  var f, y, t, _ = {
1044
1044
  label: 0,
1045
1045
  sent: function() {
@@ -1152,7 +1152,7 @@ function _ts_generator$8(thisArg, body) {
1152
1152
  var _this;
1153
1153
  _this = _call_super$4(this, ZohoRecruitRecordNoContentError, [
1154
1154
  "There was no content or matching records for the content. It may not exist."
1155
- ]), _define_property$f(_this, "moduleName", void 0), _define_property$f(_this, "recordId", void 0);
1155
+ ]), _define_property$q(_this, "moduleName", void 0), _define_property$q(_this, "recordId", void 0);
1156
1156
  _this.moduleName = moduleName;
1157
1157
  _this.recordId = recordId;
1158
1158
  return _this;
@@ -1272,9 +1272,9 @@ function _ts_generator$8(thisArg, body) {
1272
1272
  * @param responseError - The fetch response error to parse
1273
1273
  * @returns Parsed Zoho server error, or undefined if parsing fails
1274
1274
  */ function parseZohoRecruitError(responseError) {
1275
- return _async_to_generator$8(function() {
1275
+ return _async_to_generator$a(function() {
1276
1276
  var data, result;
1277
- return _ts_generator$8(this, function(_state) {
1277
+ return _ts_generator$a(this, function(_state) {
1278
1278
  switch(_state.label){
1279
1279
  case 0:
1280
1280
  return [
@@ -1342,7 +1342,7 @@ function _class_call_check$3(instance, Constructor) {
1342
1342
  throw new TypeError("Cannot call a class as a function");
1343
1343
  }
1344
1344
  }
1345
- function _define_property$e(obj, key, value) {
1345
+ function _define_property$p(obj, key, value) {
1346
1346
  if (key in obj) {
1347
1347
  Object.defineProperty(obj, key, {
1348
1348
  value: value,
@@ -1374,7 +1374,7 @@ function _inherits$3(subClass, superClass) {
1374
1374
  });
1375
1375
  if (superClass) _set_prototype_of$3(subClass, superClass);
1376
1376
  }
1377
- function _object_spread$c(target) {
1377
+ function _object_spread$n(target) {
1378
1378
  for(var i = 1; i < arguments.length; i++){
1379
1379
  var source = arguments[i] != null ? arguments[i] : {};
1380
1380
  var ownKeys = Object.keys(source);
@@ -1384,12 +1384,12 @@ function _object_spread$c(target) {
1384
1384
  }));
1385
1385
  }
1386
1386
  ownKeys.forEach(function(key) {
1387
- _define_property$e(target, key, source[key]);
1387
+ _define_property$p(target, key, source[key]);
1388
1388
  });
1389
1389
  }
1390
1390
  return target;
1391
1391
  }
1392
- function ownKeys$b(object, enumerableOnly) {
1392
+ function ownKeys$m(object, enumerableOnly) {
1393
1393
  var keys = Object.keys(object);
1394
1394
  if (Object.getOwnPropertySymbols) {
1395
1395
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1397,12 +1397,12 @@ function ownKeys$b(object, enumerableOnly) {
1397
1397
  }
1398
1398
  return keys;
1399
1399
  }
1400
- function _object_spread_props$b(target, source) {
1400
+ function _object_spread_props$m(target, source) {
1401
1401
  source = source != null ? source : {};
1402
1402
  if (Object.getOwnPropertyDescriptors) {
1403
1403
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1404
1404
  } else {
1405
- ownKeys$b(Object(source)).forEach(function(key) {
1405
+ ownKeys$m(Object(source)).forEach(function(key) {
1406
1406
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1407
1407
  });
1408
1408
  }
@@ -1457,16 +1457,17 @@ function _is_native_reflect_construct$3() {
1457
1457
  })).then(function(x) {
1458
1458
  var isInputMultipleItems = Array.isArray(data);
1459
1459
  var result = zohoRecruitMultiRecordResult(util.asArray(data), x.data);
1460
+ var finalResult;
1460
1461
  if (isInputMultipleItems) {
1461
- return result;
1462
+ finalResult = result;
1462
1463
  } else {
1463
1464
  var successItems = result.successItems, errorItems = result.errorItems;
1464
1465
  if (errorItems[0] != null) {
1465
1466
  throw zohoRecruitRecordCrudError(errorItems[0].result);
1466
- } else {
1467
- return successItems[0].result.details;
1468
1467
  }
1468
+ finalResult = successItems[0].result.details;
1469
1469
  }
1470
+ return finalResult;
1470
1471
  });
1471
1472
  };
1472
1473
  }
@@ -1703,7 +1704,7 @@ function _is_native_reflect_construct$3() {
1703
1704
  * @see https://www.zoho.com/recruit/developer-guide/apiv2/search-records.html
1704
1705
  */ function zohoRecruitSearchRecords(context) {
1705
1706
  function searchRecordsUrlSearchParams(input) {
1706
- var baseInput = _object_spread$c({}, input);
1707
+ var baseInput = _object_spread$n({}, input);
1707
1708
  delete baseInput.criteria;
1708
1709
  if (input.criteria != null) {
1709
1710
  var criteriaString = zohoRecruitSearchRecordsCriteriaString(input.criteria);
@@ -1965,11 +1966,12 @@ function _is_native_reflect_construct$3() {
1965
1966
  throw new Error('attachmentCategoryId or attachmentCategoryName must be provided and not empty.');
1966
1967
  }
1967
1968
  var url = "/v2/".concat(input.module, "/").concat(input.id, "/").concat(ZOHO_RECRUIT_ATTACHMENTS_MODULE, "?").concat(fetch.makeUrlSearchParams(urlParams).toString());
1969
+ var result;
1968
1970
  if (file != null) {
1969
1971
  var body = new FormData();
1970
1972
  body.append('file', file);
1971
1973
  // Clear the base Content-Type header (empty string removes it via mergeRequestHeaders) so fetch auto-detects multipart/form-data with the correct boundary from the FormData body.
1972
- return context.fetch(url, {
1974
+ result = context.fetch(url, {
1973
1975
  method: 'POST',
1974
1976
  headers: {
1975
1977
  'Content-Type': ''
@@ -1980,12 +1982,13 @@ function _is_native_reflect_construct$3() {
1980
1982
  var urlWithAttachment = "".concat(url, "&").concat(fetch.makeUrlSearchParams({
1981
1983
  attachment_url: attachmentUrl
1982
1984
  }).toString());
1983
- return context.fetch(urlWithAttachment, {
1985
+ result = context.fetch(urlWithAttachment, {
1984
1986
  method: 'POST'
1985
1987
  });
1986
1988
  } else {
1987
1989
  throw new Error('file or attachmentUrl must be provided.');
1988
1990
  }
1991
+ return result;
1989
1992
  };
1990
1993
  }
1991
1994
  /**
@@ -2054,7 +2057,7 @@ function _is_native_reflect_construct$3() {
2054
2057
  var _this;
2055
2058
  _this = _call_super$3(this, ZohoRecruitExecuteRestApiFunctionError, [
2056
2059
  "An error occured during the execution of the function. Code: ".concat(error.code, ", Message: ").concat(error.message)
2057
- ]), _define_property$e(_this, "error", void 0);
2060
+ ]), _define_property$p(_this, "error", void 0);
2058
2061
  _this.error = error;
2059
2062
  return _this;
2060
2063
  }
@@ -2104,11 +2107,10 @@ function _is_native_reflect_construct$3() {
2104
2107
  var baseUrl = isSpecificRequest && input.apiUrl != null ? zohoRecruitConfigApiUrl(input.apiUrl) : '';
2105
2108
  var url = "".concat(baseUrl).concat(relativeUrl);
2106
2109
  return context.fetchJson(url, zohoRecruitApiFetchJsonInput('POST')).then(function(x) {
2107
- if (x.code === 'success') {
2108
- return x.details;
2109
- } else {
2110
+ if (x.code !== 'success') {
2110
2111
  throw new ZohoRecruitExecuteRestApiFunctionError(x);
2111
2112
  }
2113
+ return x.details;
2112
2114
  });
2113
2115
  };
2114
2116
  }
@@ -2189,7 +2191,7 @@ function _is_native_reflect_construct$3() {
2189
2191
  errorItems.push(x);
2190
2192
  }
2191
2193
  });
2192
- var result = _object_spread_props$b(_object_spread$c({}, response), {
2194
+ var result = _object_spread_props$m(_object_spread$n({}, response), {
2193
2195
  successItems: successItems,
2194
2196
  errorItems: errorItems
2195
2197
  });
@@ -2283,7 +2285,7 @@ function _is_native_reflect_construct$3() {
2283
2285
  * @deprecated Use zohoRecruitExecuteRestApiFunction instead.
2284
2286
  */ var executeRestApiFunction = zohoRecruitExecuteRestApiFunction;
2285
2287
 
2286
- function _define_property$d(obj, key, value) {
2288
+ function _define_property$o(obj, key, value) {
2287
2289
  if (key in obj) {
2288
2290
  Object.defineProperty(obj, key, {
2289
2291
  value: value,
@@ -2296,7 +2298,7 @@ function _define_property$d(obj, key, value) {
2296
2298
  }
2297
2299
  return obj;
2298
2300
  }
2299
- function _object_spread$b(target) {
2301
+ function _object_spread$m(target) {
2300
2302
  for(var i = 1; i < arguments.length; i++){
2301
2303
  var source = arguments[i] != null ? arguments[i] : {};
2302
2304
  var ownKeys = Object.keys(source);
@@ -2306,12 +2308,12 @@ function _object_spread$b(target) {
2306
2308
  }));
2307
2309
  }
2308
2310
  ownKeys.forEach(function(key) {
2309
- _define_property$d(target, key, source[key]);
2311
+ _define_property$o(target, key, source[key]);
2310
2312
  });
2311
2313
  }
2312
2314
  return target;
2313
2315
  }
2314
- function ownKeys$a(object, enumerableOnly) {
2316
+ function ownKeys$l(object, enumerableOnly) {
2315
2317
  var keys = Object.keys(object);
2316
2318
  if (Object.getOwnPropertySymbols) {
2317
2319
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2319,12 +2321,12 @@ function ownKeys$a(object, enumerableOnly) {
2319
2321
  }
2320
2322
  return keys;
2321
2323
  }
2322
- function _object_spread_props$a(target, source) {
2324
+ function _object_spread_props$l(target, source) {
2323
2325
  source = source != null ? source : {};
2324
2326
  if (Object.getOwnPropertyDescriptors) {
2325
2327
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2326
2328
  } else {
2327
- ownKeys$a(Object(source)).forEach(function(key) {
2329
+ ownKeys$l(Object(source)).forEach(function(key) {
2328
2330
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2329
2331
  });
2330
2332
  }
@@ -2351,7 +2353,7 @@ function _object_spread_props$a(target, source) {
2351
2353
  var _separateValues = util.separateValues(result.errorItems, function(x) {
2352
2354
  return x.result.code === ZOHO_FAILURE_ERROR_CODE && x.result.details.error[0].code === ZOHO_RECRUIT_ALREADY_ASSOCIATED_ERROR_CODE;
2353
2355
  }), alreadyAssociatedErrorItems = _separateValues.included, otherErrorItems = _separateValues.excluded;
2354
- return _object_spread_props$a(_object_spread$b({}, result), {
2356
+ return _object_spread_props$l(_object_spread$m({}, result), {
2355
2357
  errorItems: otherErrorItems,
2356
2358
  alreadyAssociatedErrorItems: alreadyAssociatedErrorItems,
2357
2359
  allErrorItems: result.errorItems
@@ -2380,7 +2382,7 @@ function _object_spread_props$a(target, source) {
2380
2382
  */ function zohoRecruitSearchCandidateAssociatedJobOpeningRecords(context) {
2381
2383
  var searchAssociatedRecordsFactory = zohoRecruitSearchAssociatedRecords(context);
2382
2384
  return function(input) {
2383
- return searchAssociatedRecordsFactory(_object_spread_props$a(_object_spread$b({}, input), {
2385
+ return searchAssociatedRecordsFactory(_object_spread_props$l(_object_spread$m({}, input), {
2384
2386
  module: ZOHO_RECRUIT_CANDIDATES_MODULE
2385
2387
  }));
2386
2388
  };
@@ -2403,7 +2405,7 @@ function _object_spread_props$a(target, source) {
2403
2405
  var jobOpeningModuleName = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZOHO_RECRUIT_JOB_OPENINGS_MODULE;
2404
2406
  var searchAssociatedRecordsFactory = zohoRecruitSearchAssociatedRecords(context);
2405
2407
  return function(input) {
2406
- return searchAssociatedRecordsFactory(_object_spread_props$a(_object_spread$b({}, input), {
2408
+ return searchAssociatedRecordsFactory(_object_spread_props$l(_object_spread$m({}, input), {
2407
2409
  module: jobOpeningModuleName
2408
2410
  }));
2409
2411
  };
@@ -2417,7 +2419,7 @@ function _object_spread_props$a(target, source) {
2417
2419
  return zohoFetchPageFactory(zohoRecruitSearchJobOpeningAssociatedCandidateRecords(context));
2418
2420
  }
2419
2421
 
2420
- function _define_property$c(obj, key, value) {
2422
+ function _define_property$n(obj, key, value) {
2421
2423
  if (key in obj) {
2422
2424
  Object.defineProperty(obj, key, {
2423
2425
  value: value,
@@ -2430,7 +2432,7 @@ function _define_property$c(obj, key, value) {
2430
2432
  }
2431
2433
  return obj;
2432
2434
  }
2433
- function _object_spread$a(target) {
2435
+ function _object_spread$l(target) {
2434
2436
  for(var i = 1; i < arguments.length; i++){
2435
2437
  var source = arguments[i] != null ? arguments[i] : {};
2436
2438
  var ownKeys = Object.keys(source);
@@ -2440,12 +2442,12 @@ function _object_spread$a(target) {
2440
2442
  }));
2441
2443
  }
2442
2444
  ownKeys.forEach(function(key) {
2443
- _define_property$c(target, key, source[key]);
2445
+ _define_property$n(target, key, source[key]);
2444
2446
  });
2445
2447
  }
2446
2448
  return target;
2447
2449
  }
2448
- function ownKeys$9(object, enumerableOnly) {
2450
+ function ownKeys$k(object, enumerableOnly) {
2449
2451
  var keys = Object.keys(object);
2450
2452
  if (Object.getOwnPropertySymbols) {
2451
2453
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2453,12 +2455,12 @@ function ownKeys$9(object, enumerableOnly) {
2453
2455
  }
2454
2456
  return keys;
2455
2457
  }
2456
- function _object_spread_props$9(target, source) {
2458
+ function _object_spread_props$k(target, source) {
2457
2459
  source = source != null ? source : {};
2458
2460
  if (Object.getOwnPropertyDescriptors) {
2459
2461
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2460
2462
  } else {
2461
- ownKeys$9(Object(source)).forEach(function(key) {
2463
+ ownKeys$k(Object(source)).forEach(function(key) {
2462
2464
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2463
2465
  });
2464
2466
  }
@@ -2586,7 +2588,7 @@ function _object_spread_props$9(target, source) {
2586
2588
  var se_module = input.module, Parent_Id = input.id, notes = input.notes;
2587
2589
  var createNotesRequest = {
2588
2590
  data: util.asArray(notes).map(function(x) {
2589
- return _object_spread_props$9(_object_spread$a({}, x), {
2591
+ return _object_spread_props$k(_object_spread$l({}, x), {
2590
2592
  se_module: se_module,
2591
2593
  Parent_Id: Parent_Id
2592
2594
  });
@@ -2612,7 +2614,7 @@ function _object_spread_props$9(target, source) {
2612
2614
  * @deprecated Use zohoRecruitCreateNotesForRecord instead.
2613
2615
  */ var createNotesForRecord = zohoRecruitCreateNotesForRecord;
2614
2616
 
2615
- function _define_property$b(obj, key, value) {
2617
+ function _define_property$m(obj, key, value) {
2616
2618
  if (key in obj) {
2617
2619
  Object.defineProperty(obj, key, {
2618
2620
  value: value,
@@ -2625,7 +2627,7 @@ function _define_property$b(obj, key, value) {
2625
2627
  }
2626
2628
  return obj;
2627
2629
  }
2628
- function _object_spread$9(target) {
2630
+ function _object_spread$k(target) {
2629
2631
  for(var i = 1; i < arguments.length; i++){
2630
2632
  var source = arguments[i] != null ? arguments[i] : {};
2631
2633
  var ownKeys = Object.keys(source);
@@ -2635,12 +2637,12 @@ function _object_spread$9(target) {
2635
2637
  }));
2636
2638
  }
2637
2639
  ownKeys.forEach(function(key) {
2638
- _define_property$b(target, key, source[key]);
2640
+ _define_property$m(target, key, source[key]);
2639
2641
  });
2640
2642
  }
2641
2643
  return target;
2642
2644
  }
2643
- function ownKeys$8(object, enumerableOnly) {
2645
+ function ownKeys$j(object, enumerableOnly) {
2644
2646
  var keys = Object.keys(object);
2645
2647
  if (Object.getOwnPropertySymbols) {
2646
2648
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2648,12 +2650,12 @@ function ownKeys$8(object, enumerableOnly) {
2648
2650
  }
2649
2651
  return keys;
2650
2652
  }
2651
- function _object_spread_props$8(target, source) {
2653
+ function _object_spread_props$j(target, source) {
2652
2654
  source = source != null ? source : {};
2653
2655
  if (Object.getOwnPropertyDescriptors) {
2654
2656
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2655
2657
  } else {
2656
- ownKeys$8(Object(source)).forEach(function(key) {
2658
+ ownKeys$j(Object(source)).forEach(function(key) {
2657
2659
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2658
2660
  });
2659
2661
  }
@@ -2693,7 +2695,7 @@ function _object_spread_props$8(target, source) {
2693
2695
  var _separateValues = util.separateValues(result.errorItems, function(x) {
2694
2696
  return x.result.code === ZOHO_DUPLICATE_DATA_ERROR_CODE;
2695
2697
  }), duplicateErrorItems = _separateValues.included, otherErrorItems = _separateValues.excluded;
2696
- return _object_spread_props$8(_object_spread$9({}, result), {
2698
+ return _object_spread_props$j(_object_spread$k({}, result), {
2697
2699
  errorItems: otherErrorItems,
2698
2700
  duplicateErrorItems: duplicateErrorItems,
2699
2701
  allErrorItems: result.errorItems
@@ -2727,7 +2729,7 @@ function _object_spread_props$8(target, source) {
2727
2729
  my_tags: input.my_tags
2728
2730
  })), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
2729
2731
  // NOTE: This doesn't follow the api documentation, and instead is a normal page result except it has "tags" instead of "data".
2730
- return _object_spread_props$8(_object_spread$9({}, x), {
2732
+ return _object_spread_props$j(_object_spread$k({}, x), {
2731
2733
  data: x.tags
2732
2734
  });
2733
2735
  });
@@ -2851,7 +2853,7 @@ function _assert_this_initialized$2(self) {
2851
2853
  }
2852
2854
  return self;
2853
2855
  }
2854
- function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
2856
+ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
2855
2857
  try {
2856
2858
  var info = gen[key](arg);
2857
2859
  var value = info.value;
@@ -2865,16 +2867,16 @@ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
2865
2867
  Promise.resolve(value).then(_next, _throw);
2866
2868
  }
2867
2869
  }
2868
- function _async_to_generator$7(fn) {
2870
+ function _async_to_generator$9(fn) {
2869
2871
  return function() {
2870
2872
  var self = this, args = arguments;
2871
2873
  return new Promise(function(resolve, reject) {
2872
2874
  var gen = fn.apply(self, args);
2873
2875
  function _next(value) {
2874
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
2876
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
2875
2877
  }
2876
2878
  function _throw(err) {
2877
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
2879
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
2878
2880
  }
2879
2881
  _next(undefined);
2880
2882
  });
@@ -2889,7 +2891,7 @@ function _class_call_check$2(instance, Constructor) {
2889
2891
  throw new TypeError("Cannot call a class as a function");
2890
2892
  }
2891
2893
  }
2892
- function _define_property$a(obj, key, value) {
2894
+ function _define_property$l(obj, key, value) {
2893
2895
  if (key in obj) {
2894
2896
  Object.defineProperty(obj, key, {
2895
2897
  value: value,
@@ -2946,7 +2948,7 @@ function _is_native_reflect_construct$2() {
2946
2948
  return !!result;
2947
2949
  })();
2948
2950
  }
2949
- function _ts_generator$7(thisArg, body) {
2951
+ function _ts_generator$9(thisArg, body) {
2950
2952
  var f, y, t, _ = {
2951
2953
  label: 0,
2952
2954
  sent: function() {
@@ -3059,7 +3061,7 @@ var ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = 'invalid_client';
3059
3061
  var _this;
3060
3062
  _this = _call_super$2(this, ZohoAccountsAccessTokenError, [
3061
3063
  "ZohoAccountsAccessTokenError: ".concat(errorCode)
3062
- ]), _define_property$a(_this, "errorCode", void 0);
3064
+ ]), _define_property$l(_this, "errorCode", void 0);
3063
3065
  _this.errorCode = errorCode;
3064
3066
  return _this;
3065
3067
  }
@@ -3074,7 +3076,7 @@ var ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = 'invalid_client';
3074
3076
  var _this;
3075
3077
  _this = _call_super$2(this, ZohoAccountsAuthFailureError, [
3076
3078
  "Failed to retrieve proper authentication for the API call. Reason: ".concat(reason)
3077
- ]), _define_property$a(_this, "reason", void 0);
3079
+ ]), _define_property$l(_this, "reason", void 0);
3078
3080
  _this.reason = reason;
3079
3081
  return _this;
3080
3082
  }
@@ -3087,9 +3089,9 @@ var logZohoAccountsErrorToConsole = logZohoServerErrorFunction('ZohoAccounts');
3087
3089
  * @param responseError - The fetch response error to parse
3088
3090
  * @returns The parsed Zoho server error, or undefined if the response could not be parsed
3089
3091
  */ function parseZohoAccountsError(responseError) {
3090
- return _async_to_generator$7(function() {
3092
+ return _async_to_generator$9(function() {
3091
3093
  var data, result;
3092
- return _ts_generator$7(this, function(_state) {
3094
+ return _ts_generator$9(this, function(_state) {
3093
3095
  switch(_state.label){
3094
3096
  case 0:
3095
3097
  return [
@@ -3137,7 +3139,7 @@ var logZohoAccountsErrorToConsole = logZohoServerErrorFunction('ZohoAccounts');
3137
3139
  var interceptZohoAccounts200StatusWithErrorResponse = interceptZohoErrorResponseFactory(parseZohoAccountsServerErrorResponseData);
3138
3140
  var handleZohoAccountsErrorFetch = handleZohoErrorFetchFactory(parseZohoAccountsError, logZohoAccountsErrorToConsole);
3139
3141
 
3140
- function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
3142
+ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
3141
3143
  try {
3142
3144
  var info = gen[key](arg);
3143
3145
  var value = info.value;
@@ -3151,22 +3153,22 @@ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
3151
3153
  Promise.resolve(value).then(_next, _throw);
3152
3154
  }
3153
3155
  }
3154
- function _async_to_generator$6(fn) {
3156
+ function _async_to_generator$8(fn) {
3155
3157
  return function() {
3156
3158
  var self = this, args = arguments;
3157
3159
  return new Promise(function(resolve, reject) {
3158
3160
  var gen = fn.apply(self, args);
3159
3161
  function _next(value) {
3160
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
3162
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
3161
3163
  }
3162
3164
  function _throw(err) {
3163
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
3165
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
3164
3166
  }
3165
3167
  _next(undefined);
3166
3168
  });
3167
3169
  };
3168
3170
  }
3169
- function _ts_generator$6(thisArg, body) {
3171
+ function _ts_generator$8(thisArg, body) {
3170
3172
  var f, y, t, _ = {
3171
3173
  label: 0,
3172
3174
  sent: function() {
@@ -3272,9 +3274,9 @@ function _ts_generator$6(thisArg, body) {
3272
3274
  * @returns A factory function that resolves to the access token string
3273
3275
  */ function zohoAccessTokenStringFactory(zohoAccessTokenFactory) {
3274
3276
  return function() {
3275
- return _async_to_generator$6(function() {
3277
+ return _async_to_generator$8(function() {
3276
3278
  var token;
3277
- return _ts_generator$6(this, function(_state) {
3279
+ return _ts_generator$8(this, function(_state) {
3278
3280
  switch(_state.label){
3279
3281
  case 0:
3280
3282
  return [
@@ -3296,36 +3298,88 @@ function _ts_generator$6(thisArg, body) {
3296
3298
  };
3297
3299
  }
3298
3300
 
3301
+ function _define_property$k(obj, key, value) {
3302
+ if (key in obj) {
3303
+ Object.defineProperty(obj, key, {
3304
+ value: value,
3305
+ enumerable: true,
3306
+ configurable: true,
3307
+ writable: true
3308
+ });
3309
+ } else {
3310
+ obj[key] = value;
3311
+ }
3312
+ return obj;
3313
+ }
3314
+ function _object_spread$j(target) {
3315
+ for(var i = 1; i < arguments.length; i++){
3316
+ var source = arguments[i] != null ? arguments[i] : {};
3317
+ var ownKeys = Object.keys(source);
3318
+ if (typeof Object.getOwnPropertySymbols === "function") {
3319
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3320
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3321
+ }));
3322
+ }
3323
+ ownKeys.forEach(function(key) {
3324
+ _define_property$k(target, key, source[key]);
3325
+ });
3326
+ }
3327
+ return target;
3328
+ }
3329
+ function ownKeys$i(object, enumerableOnly) {
3330
+ var keys = Object.keys(object);
3331
+ if (Object.getOwnPropertySymbols) {
3332
+ var symbols = Object.getOwnPropertySymbols(object);
3333
+ keys.push.apply(keys, symbols);
3334
+ }
3335
+ return keys;
3336
+ }
3337
+ function _object_spread_props$i(target, source) {
3338
+ source = source != null ? source : {};
3339
+ if (Object.getOwnPropertyDescriptors) {
3340
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3341
+ } else {
3342
+ ownKeys$i(Object(source)).forEach(function(key) {
3343
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3344
+ });
3345
+ }
3346
+ return target;
3347
+ }
3299
3348
  /**
3300
3349
  * Default handler that logs a warning to the console when the Zoho API rate limit is exceeded.
3301
3350
  *
3302
- * @param headers - Rate limit details extracted from the Zoho API response headers
3303
- */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = function DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION(headers) {
3304
- console.warn("zohoRateLimitedFetchHandler(): Too many requests made. The limit is ".concat(headers.limit, " requests per reset period. Will be reset at ").concat(headers.resetAt, "."));
3351
+ * @param details - Rate limit details extracted from the Zoho API response headers
3352
+ */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = function DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION(details) {
3353
+ var limit = 'limit' in details ? details.limit : undefined;
3354
+ var resetAt = 'resetAt' in details ? details.resetAt : undefined;
3355
+ var limitMessage = limit != null ? ' The limit is ' + String(limit) + ' requests per reset period.' : '';
3356
+ var resetMessage = resetAt != null ? ' Will be reset at ' + String(resetAt) + '.' : '';
3357
+ console.warn('zohoRateLimitedFetchHandler(): Too many requests made.' + limitMessage + resetMessage);
3305
3358
  };
3306
3359
  /**
3307
- * Creates a {@link ZohoRateLimitedFetchHandler} that throttles outgoing requests based on
3308
- * Zoho's rate limit headers (`X-RATELIMIT-LIMIT`, `X-RATELIMIT-REMAINING`, `X-RATELIMIT-RESET`).
3360
+ * Creates a {@link ZohoRateLimitedFetchHandler} using a configurable header reader function.
3309
3361
  *
3362
+ * This is the core rate limiter factory that all service-specific wrappers delegate to.
3310
3363
  * The handler uses an exponential backoff strategy with the following behavior:
3311
3364
  * - Rate limiting begins after 10% of the allowed requests have been made (`startLimitAt`)
3312
3365
  * - Wait times increase exponentially (rate 1.08) as more requests are made, capped at 10 seconds
3313
- * - On each response, the limiter updates its remaining count and reset time from headers
3314
- * - When the API returns a different limit than configured, the limiter dynamically adjusts
3366
+ * - On each response, the limiter updates its remaining count and reset time via the provided reader
3367
+ * - When the API reports a different limit than configured, the limiter dynamically adjusts
3315
3368
  * - On 429 responses, the request is automatically retried after the rate limiter delay
3316
3369
  * - The limiter is disabled when responses lack rate limit headers (e.g., error responses)
3317
3370
  *
3318
- * @param config - Optional configuration for rate limit, reset period, and 429 handling
3371
+ * @param config - Configuration including the service-specific header reader, rate limit, reset period, and 429 handling
3319
3372
  * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
3320
- */ function zohoRateLimitedFetchHandler(config) {
3321
- var _ref, _ref1, _ref2;
3322
- var onTooManyRequests = (config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== false ? (_ref = config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== null && _ref !== void 0 ? _ref : DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION : undefined;
3323
- var defaultLimit = (_ref1 = config === null || config === void 0 ? void 0 : config.maxRateLimit) !== null && _ref1 !== void 0 ? _ref1 : DEFAULT_ZOHO_API_RATE_LIMIT;
3324
- var defaultResetPeriod = (_ref2 = config === null || config === void 0 ? void 0 : config.resetPeriod) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD;
3373
+ */ function makeZohoRateLimitedFetchHandler(config) {
3374
+ var _config_onTooManyRequests, _config_maxRateLimit, _config_resetPeriod;
3375
+ var readRateLimitDetails = config.readRateLimitDetails;
3376
+ var onTooManyRequests = config.onTooManyRequests !== false ? (_config_onTooManyRequests = config.onTooManyRequests) !== null && _config_onTooManyRequests !== void 0 ? _config_onTooManyRequests : DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION : undefined;
3377
+ var defaultLimit = (_config_maxRateLimit = config.maxRateLimit) !== null && _config_maxRateLimit !== void 0 ? _config_maxRateLimit : DEFAULT_ZOHO_API_RATE_LIMIT;
3378
+ var defaultResetPeriod = (_config_resetPeriod = config.resetPeriod) !== null && _config_resetPeriod !== void 0 ? _config_resetPeriod : DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD;
3325
3379
  /**
3326
3380
  * Builds a rate limiter config derived from the given limit.
3327
3381
  * Called once at initialization with `defaultLimit`, and again dynamically
3328
- * when the API's `X-RATELIMIT-LIMIT` header reports a different value.
3382
+ * when the API's response headers report a different limit value.
3329
3383
  *
3330
3384
  * @param limit - Maximum number of requests allowed per reset period
3331
3385
  * @param resetAt - Optional date when the rate limit window resets
@@ -3345,37 +3399,36 @@ function _ts_generator$6(thisArg, body) {
3345
3399
  var rateLimiter = util.resetPeriodPromiseRateLimiter(defaultConfig);
3346
3400
  return fetch.rateLimitedFetchHandler({
3347
3401
  rateLimiter: rateLimiter,
3348
- maxRetries: config === null || config === void 0 ? void 0 : config.maxRetries,
3402
+ maxRetries: config.maxRetries,
3349
3403
  /**
3350
- * Inspects each response for Zoho rate limit headers and updates the limiter accordingly.
3351
- * Returns `true` to signal a retry when a 429 status is received.
3404
+ * Inspects each response for rate limit headers via the configured reader and updates
3405
+ * the limiter accordingly. Returns `true` to signal a retry when a 429 status is received.
3352
3406
  *
3353
3407
  * @param response - The HTTP response to inspect for rate limit headers
3354
3408
  * @param fetchResponseError - Optional fetch error if the response was an error
3355
3409
  * @returns Whether the request should be retried
3356
3410
  */ updateWithResponse: function updateWithResponse(response, fetchResponseError) {
3357
- var hasLimitHeader = response.headers.has(ZOHO_RATE_LIMIT_REMAINING_HEADER);
3411
+ var details = readRateLimitDetails(response.headers);
3358
3412
  var shouldRetry = false;
3359
3413
  var enabled = false;
3360
- if (hasLimitHeader) {
3361
- var headerDetails = zohoRateLimitHeaderDetails(response.headers);
3362
- if (headerDetails) {
3363
- var limit = headerDetails.limit, resetAt = headerDetails.resetAt, remaining = headerDetails.remaining;
3364
- if (limit && limit !== defaultLimit) {
3365
- var newConfig = configForLimit(limit, resetAt);
3366
- rateLimiter.setConfig(newConfig, false);
3367
- }
3368
- rateLimiter.setRemainingLimit(remaining);
3414
+ if (details) {
3415
+ var remaining = details.remaining, limit = details.limit, resetAt = details.resetAt;
3416
+ if (limit != null && limit !== defaultLimit) {
3417
+ var newConfig = configForLimit(limit, resetAt !== null && resetAt !== void 0 ? resetAt : undefined);
3418
+ rateLimiter.setConfig(newConfig, false);
3419
+ }
3420
+ rateLimiter.setRemainingLimit(remaining);
3421
+ if (resetAt) {
3369
3422
  rateLimiter.setNextResetAt(resetAt);
3370
- enabled = true;
3371
- // only retry if it's a TOO MANY REQUESTS error
3372
- if (response.status === ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3373
- shouldRetry = true;
3374
- try {
3375
- void (onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(headerDetails, response, fetchResponseError));
3376
- } catch (unused) {
3377
- /* ignored */ }
3378
- }
3423
+ }
3424
+ enabled = true;
3425
+ // only retry if it's a TOO MANY REQUESTS error
3426
+ if (response.status === ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3427
+ shouldRetry = true;
3428
+ try {
3429
+ void (onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(details, response, fetchResponseError));
3430
+ } catch (unused) {
3431
+ /* ignored */ }
3379
3432
  }
3380
3433
  }
3381
3434
  rateLimiter.setEnabled(enabled);
@@ -3383,12 +3436,44 @@ function _ts_generator$6(thisArg, body) {
3383
3436
  }
3384
3437
  });
3385
3438
  }
3439
+ /**
3440
+ * Creates a {@link ZohoRateLimitedFetchHandler} that throttles outgoing requests based on
3441
+ * Zoho's CRM/Recruit/Sign rate limit headers (`X-RATELIMIT-LIMIT`, `X-RATELIMIT-REMAINING`, `X-RATELIMIT-RESET`).
3442
+ *
3443
+ * This is a convenience wrapper around {@link makeZohoRateLimitedFetchHandler} pre-configured
3444
+ * with the standard Zoho rate limit header reader.
3445
+ *
3446
+ * @param config - Optional configuration for rate limit, reset period, and 429 handling
3447
+ * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
3448
+ */ function zohoRateLimitedFetchHandler(config) {
3449
+ return makeZohoRateLimitedFetchHandler(_object_spread_props$i(_object_spread$j({}, config), {
3450
+ readRateLimitDetails: zohoStandardRateLimitDetailsReader
3451
+ }));
3452
+ }
3453
+ /**
3454
+ * Reads rate limit details from standard Zoho API response headers (`X-RATELIMIT-*`).
3455
+ * Used by CRM, Recruit, and Sign services.
3456
+ *
3457
+ * @param headers - HTTP response headers
3458
+ * @returns Parsed rate limit details, or null if headers are absent
3459
+ */ function zohoStandardRateLimitDetailsReader(headers) {
3460
+ var details = zohoRateLimitHeaderDetails(headers);
3461
+ var result;
3462
+ if (details) {
3463
+ result = {
3464
+ remaining: details.remaining,
3465
+ limit: details.limit,
3466
+ resetAt: details.resetAt
3467
+ };
3468
+ }
3469
+ return result;
3470
+ }
3386
3471
  // MARK: Compat
3387
3472
  /**
3388
3473
  * @deprecated use DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION instead.
3389
3474
  */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
3390
3475
 
3391
- function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3476
+ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
3392
3477
  try {
3393
3478
  var info = gen[key](arg);
3394
3479
  var value = info.value;
@@ -3402,22 +3487,22 @@ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3402
3487
  Promise.resolve(value).then(_next, _throw);
3403
3488
  }
3404
3489
  }
3405
- function _async_to_generator$5(fn) {
3490
+ function _async_to_generator$7(fn) {
3406
3491
  return function() {
3407
3492
  var self = this, args = arguments;
3408
3493
  return new Promise(function(resolve, reject) {
3409
3494
  var gen = fn.apply(self, args);
3410
3495
  function _next(value) {
3411
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
3496
+ asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
3412
3497
  }
3413
3498
  function _throw(err) {
3414
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
3499
+ asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
3415
3500
  }
3416
3501
  _next(undefined);
3417
3502
  });
3418
3503
  };
3419
3504
  }
3420
- function _define_property$9(obj, key, value) {
3505
+ function _define_property$j(obj, key, value) {
3421
3506
  if (key in obj) {
3422
3507
  Object.defineProperty(obj, key, {
3423
3508
  value: value,
@@ -3430,14 +3515,14 @@ function _define_property$9(obj, key, value) {
3430
3515
  }
3431
3516
  return obj;
3432
3517
  }
3433
- function _instanceof$4(left, right) {
3518
+ function _instanceof$5(left, right) {
3434
3519
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
3435
3520
  return !!right[Symbol.hasInstance](left);
3436
3521
  } else {
3437
3522
  return left instanceof right;
3438
3523
  }
3439
3524
  }
3440
- function _object_spread$8(target) {
3525
+ function _object_spread$i(target) {
3441
3526
  for(var i = 1; i < arguments.length; i++){
3442
3527
  var source = arguments[i] != null ? arguments[i] : {};
3443
3528
  var ownKeys = Object.keys(source);
@@ -3447,12 +3532,12 @@ function _object_spread$8(target) {
3447
3532
  }));
3448
3533
  }
3449
3534
  ownKeys.forEach(function(key) {
3450
- _define_property$9(target, key, source[key]);
3535
+ _define_property$j(target, key, source[key]);
3451
3536
  });
3452
3537
  }
3453
3538
  return target;
3454
3539
  }
3455
- function ownKeys$7(object, enumerableOnly) {
3540
+ function ownKeys$h(object, enumerableOnly) {
3456
3541
  var keys = Object.keys(object);
3457
3542
  if (Object.getOwnPropertySymbols) {
3458
3543
  var symbols = Object.getOwnPropertySymbols(object);
@@ -3460,18 +3545,18 @@ function ownKeys$7(object, enumerableOnly) {
3460
3545
  }
3461
3546
  return keys;
3462
3547
  }
3463
- function _object_spread_props$7(target, source) {
3548
+ function _object_spread_props$h(target, source) {
3464
3549
  source = source != null ? source : {};
3465
3550
  if (Object.getOwnPropertyDescriptors) {
3466
3551
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3467
3552
  } else {
3468
- ownKeys$7(Object(source)).forEach(function(key) {
3553
+ ownKeys$h(Object(source)).forEach(function(key) {
3469
3554
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3470
3555
  });
3471
3556
  }
3472
3557
  return target;
3473
3558
  }
3474
- function _ts_generator$5(thisArg, body) {
3559
+ function _ts_generator$7(thisArg, body) {
3475
3560
  var f, y, t, _ = {
3476
3561
  label: 0,
3477
3562
  sent: function() {
@@ -3602,9 +3687,9 @@ function _ts_generator$5(thisArg, body) {
3602
3687
  return fetch.fetchApiFetchService.makeFetch({
3603
3688
  baseUrl: input.apiUrl,
3604
3689
  baseRequest: function baseRequest() {
3605
- return _async_to_generator$5(function() {
3690
+ return _async_to_generator$7(function() {
3606
3691
  var _tmp, _tmp1, _, _1;
3607
- return _ts_generator$5(this, function(_state) {
3692
+ return _ts_generator$7(this, function(_state) {
3608
3693
  switch(_state.label){
3609
3694
  case 0:
3610
3695
  _tmp = {};
@@ -3642,7 +3727,7 @@ function _ts_generator$5(thisArg, body) {
3642
3727
  apiUrl: apiUrl
3643
3728
  });
3644
3729
  var fetch$1 = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
3645
- if (_instanceof$4(x, ZohoInvalidTokenError)) {
3730
+ if (_instanceof$5(x, ZohoInvalidTokenError)) {
3646
3731
  void accountsContext.loadAccessToken.resetAccessToken();
3647
3732
  }
3648
3733
  });
@@ -3654,7 +3739,7 @@ function _ts_generator$5(thisArg, body) {
3654
3739
  fetch: fetch$1,
3655
3740
  fetchJson: fetchJson,
3656
3741
  accessTokenStringFactory: accessTokenStringFactory,
3657
- config: _object_spread_props$7(_object_spread$8({}, config), {
3742
+ config: _object_spread_props$h(_object_spread$i({}, config), {
3658
3743
  apiUrl: apiUrl
3659
3744
  }),
3660
3745
  zohoRateLimiter: fetchHandler._rateLimiter
@@ -3751,7 +3836,7 @@ function _assert_this_initialized$1(self) {
3751
3836
  }
3752
3837
  return self;
3753
3838
  }
3754
- function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
3839
+ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
3755
3840
  try {
3756
3841
  var info = gen[key](arg);
3757
3842
  var value = info.value;
@@ -3765,16 +3850,16 @@ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
3765
3850
  Promise.resolve(value).then(_next, _throw);
3766
3851
  }
3767
3852
  }
3768
- function _async_to_generator$4(fn) {
3853
+ function _async_to_generator$6(fn) {
3769
3854
  return function() {
3770
3855
  var self = this, args = arguments;
3771
3856
  return new Promise(function(resolve, reject) {
3772
3857
  var gen = fn.apply(self, args);
3773
3858
  function _next(value) {
3774
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
3859
+ asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
3775
3860
  }
3776
3861
  function _throw(err) {
3777
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
3862
+ asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
3778
3863
  }
3779
3864
  _next(undefined);
3780
3865
  });
@@ -3802,7 +3887,7 @@ function _create_class(Constructor, protoProps, staticProps) {
3802
3887
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3803
3888
  return Constructor;
3804
3889
  }
3805
- function _define_property$8(obj, key, value) {
3890
+ function _define_property$i(obj, key, value) {
3806
3891
  if (key in obj) {
3807
3892
  Object.defineProperty(obj, key, {
3808
3893
  value: value,
@@ -3859,7 +3944,7 @@ function _is_native_reflect_construct$1() {
3859
3944
  return !!result;
3860
3945
  })();
3861
3946
  }
3862
- function _ts_generator$4(thisArg, body) {
3947
+ function _ts_generator$6(thisArg, body) {
3863
3948
  var f, y, t, _ = {
3864
3949
  label: 0,
3865
3950
  sent: function() {
@@ -3972,7 +4057,7 @@ function _ts_generator$4(thisArg, body) {
3972
4057
  var _this;
3973
4058
  _this = _call_super$1(this, ZohoCrmRecordNoContentError, [
3974
4059
  "There was no content or matching records for the content. It may not exist."
3975
- ]), _define_property$8(_this, "moduleName", void 0), _define_property$8(_this, "recordId", void 0);
4060
+ ]), _define_property$i(_this, "moduleName", void 0), _define_property$i(_this, "recordId", void 0);
3976
4061
  _this.moduleName = moduleName;
3977
4062
  _this.recordId = recordId;
3978
4063
  return _this;
@@ -4094,9 +4179,9 @@ function _ts_generator$4(thisArg, body) {
4094
4179
  * @param responseError - The fetch response error to parse
4095
4180
  * @returns The parsed Zoho server error, or undefined if the response could not be parsed
4096
4181
  */ function parseZohoCrmError(responseError) {
4097
- return _async_to_generator$4(function() {
4182
+ return _async_to_generator$6(function() {
4098
4183
  var data, result;
4099
- return _ts_generator$4(this, function(_state) {
4184
+ return _ts_generator$6(this, function(_state) {
4100
4185
  switch(_state.label){
4101
4186
  case 0:
4102
4187
  return [
@@ -4160,7 +4245,7 @@ function _class_call_check(instance, Constructor) {
4160
4245
  throw new TypeError("Cannot call a class as a function");
4161
4246
  }
4162
4247
  }
4163
- function _define_property$7(obj, key, value) {
4248
+ function _define_property$h(obj, key, value) {
4164
4249
  if (key in obj) {
4165
4250
  Object.defineProperty(obj, key, {
4166
4251
  value: value,
@@ -4192,14 +4277,14 @@ function _inherits(subClass, superClass) {
4192
4277
  });
4193
4278
  if (superClass) _set_prototype_of(subClass, superClass);
4194
4279
  }
4195
- function _instanceof$3(left, right) {
4280
+ function _instanceof$4(left, right) {
4196
4281
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
4197
4282
  return !!right[Symbol.hasInstance](left);
4198
4283
  } else {
4199
4284
  return left instanceof right;
4200
4285
  }
4201
4286
  }
4202
- function _object_spread$7(target) {
4287
+ function _object_spread$h(target) {
4203
4288
  for(var i = 1; i < arguments.length; i++){
4204
4289
  var source = arguments[i] != null ? arguments[i] : {};
4205
4290
  var ownKeys = Object.keys(source);
@@ -4209,12 +4294,12 @@ function _object_spread$7(target) {
4209
4294
  }));
4210
4295
  }
4211
4296
  ownKeys.forEach(function(key) {
4212
- _define_property$7(target, key, source[key]);
4297
+ _define_property$h(target, key, source[key]);
4213
4298
  });
4214
4299
  }
4215
4300
  return target;
4216
4301
  }
4217
- function ownKeys$6(object, enumerableOnly) {
4302
+ function ownKeys$g(object, enumerableOnly) {
4218
4303
  var keys = Object.keys(object);
4219
4304
  if (Object.getOwnPropertySymbols) {
4220
4305
  var symbols = Object.getOwnPropertySymbols(object);
@@ -4222,12 +4307,12 @@ function ownKeys$6(object, enumerableOnly) {
4222
4307
  }
4223
4308
  return keys;
4224
4309
  }
4225
- function _object_spread_props$6(target, source) {
4310
+ function _object_spread_props$g(target, source) {
4226
4311
  source = source != null ? source : {};
4227
4312
  if (Object.getOwnPropertyDescriptors) {
4228
4313
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4229
4314
  } else {
4230
- ownKeys$6(Object(source)).forEach(function(key) {
4315
+ ownKeys$g(Object(source)).forEach(function(key) {
4231
4316
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4232
4317
  });
4233
4318
  }
@@ -4282,16 +4367,17 @@ function _is_native_reflect_construct() {
4282
4367
  })).catch(zohoCrmCatchZohoCrmChangeObjectLikeResponseError).then(function(x) {
4283
4368
  var isInputMultipleItems = Array.isArray(data);
4284
4369
  var result = zohoCrmMultiRecordResult(util.asArray(data), x.data);
4370
+ var finalResult;
4285
4371
  if (isInputMultipleItems) {
4286
- return result;
4372
+ finalResult = result;
4287
4373
  } else {
4288
4374
  var successItems = result.successItems, errorItems = result.errorItems;
4289
4375
  if (errorItems[0] != null) {
4290
4376
  throw zohoCrmRecordCrudError(errorItems[0].result);
4291
- } else {
4292
- return successItems[0].result.details;
4293
4377
  }
4378
+ finalResult = successItems[0].result.details;
4294
4379
  }
4380
+ return finalResult;
4295
4381
  });
4296
4382
  };
4297
4383
  }
@@ -4529,7 +4615,7 @@ function _is_native_reflect_construct() {
4529
4615
  * @see https://www.zoho.com/crm/developer-guide/apiv2/search-records.html
4530
4616
  */ function zohoCrmSearchRecords(context) {
4531
4617
  function searchRecordsUrlSearchParams(input) {
4532
- var baseInput = _object_spread$7({}, input);
4618
+ var baseInput = _object_spread$h({}, input);
4533
4619
  delete baseInput.criteria;
4534
4620
  if (input.criteria != null) {
4535
4621
  var criteriaString = zohoCrmSearchRecordsCriteriaString(input.criteria);
@@ -4645,7 +4731,7 @@ function _is_native_reflect_construct() {
4645
4731
  return getEmailsFactory(input).then(function(x) {
4646
4732
  var _x_data;
4647
4733
  var data = (_x_data = x.data) !== null && _x_data !== void 0 ? _x_data : x.Emails;
4648
- return _object_spread_props$6(_object_spread$7({}, x), {
4734
+ return _object_spread_props$g(_object_spread$h({}, x), {
4649
4735
  data: data
4650
4736
  });
4651
4737
  });
@@ -4862,7 +4948,7 @@ function _is_native_reflect_construct() {
4862
4948
  var _this;
4863
4949
  _this = _call_super(this, ZohoCrmExecuteRestApiFunctionError, [
4864
4950
  "An error occured during the execution of the function. Code: ".concat(error.code, ", Message: ").concat(error.message)
4865
- ]), _define_property$7(_this, "error", void 0);
4951
+ ]), _define_property$h(_this, "error", void 0);
4866
4952
  _this.error = error;
4867
4953
  return _this;
4868
4954
  }
@@ -4914,11 +5000,10 @@ function _is_native_reflect_construct() {
4914
5000
  var baseUrl = isSpecificRequest && input.apiUrl != null ? zohoCrmConfigApiUrl(input.apiUrl) : '';
4915
5001
  var url = "".concat(baseUrl).concat(relativeUrl);
4916
5002
  return context.fetchJson(url, zohoCrmApiFetchJsonInput('POST')).then(function(x) {
4917
- if (x.code === 'success') {
4918
- return x.details;
4919
- } else {
5003
+ if (x.code !== 'success') {
4920
5004
  throw new ZohoCrmExecuteRestApiFunctionError(x);
4921
5005
  }
5006
+ return x.details;
4922
5007
  });
4923
5008
  };
4924
5009
  }
@@ -4977,7 +5062,7 @@ function _is_native_reflect_construct() {
4977
5062
  * @returns The error data array wrapped as a change object response
4978
5063
  */ function zohoCrmCatchZohoCrmChangeObjectLikeResponseError(e) {
4979
5064
  var result;
4980
- if (_instanceof$3(e, ZohoServerFetchResponseDataArrayError)) {
5065
+ if (_instanceof$4(e, ZohoServerFetchResponseDataArrayError)) {
4981
5066
  result = {
4982
5067
  data: e.errorDataArray
4983
5068
  };
@@ -5018,7 +5103,7 @@ function _is_native_reflect_construct() {
5018
5103
  errorItems.push(x);
5019
5104
  }
5020
5105
  });
5021
- var result = _object_spread_props$6(_object_spread$7({}, response), {
5106
+ var result = _object_spread_props$g(_object_spread$h({}, response), {
5022
5107
  successItems: successItems,
5023
5108
  errorItems: errorItems
5024
5109
  });
@@ -5061,7 +5146,7 @@ function _is_native_reflect_construct() {
5061
5146
  return result;
5062
5147
  }
5063
5148
 
5064
- function _define_property$6(obj, key, value) {
5149
+ function _define_property$g(obj, key, value) {
5065
5150
  if (key in obj) {
5066
5151
  Object.defineProperty(obj, key, {
5067
5152
  value: value,
@@ -5074,7 +5159,7 @@ function _define_property$6(obj, key, value) {
5074
5159
  }
5075
5160
  return obj;
5076
5161
  }
5077
- function _object_spread$6(target) {
5162
+ function _object_spread$g(target) {
5078
5163
  for(var i = 1; i < arguments.length; i++){
5079
5164
  var source = arguments[i] != null ? arguments[i] : {};
5080
5165
  var ownKeys = Object.keys(source);
@@ -5084,12 +5169,12 @@ function _object_spread$6(target) {
5084
5169
  }));
5085
5170
  }
5086
5171
  ownKeys.forEach(function(key) {
5087
- _define_property$6(target, key, source[key]);
5172
+ _define_property$g(target, key, source[key]);
5088
5173
  });
5089
5174
  }
5090
5175
  return target;
5091
5176
  }
5092
- function ownKeys$5(object, enumerableOnly) {
5177
+ function ownKeys$f(object, enumerableOnly) {
5093
5178
  var keys = Object.keys(object);
5094
5179
  if (Object.getOwnPropertySymbols) {
5095
5180
  var symbols = Object.getOwnPropertySymbols(object);
@@ -5097,12 +5182,12 @@ function ownKeys$5(object, enumerableOnly) {
5097
5182
  }
5098
5183
  return keys;
5099
5184
  }
5100
- function _object_spread_props$5(target, source) {
5185
+ function _object_spread_props$f(target, source) {
5101
5186
  source = source != null ? source : {};
5102
5187
  if (Object.getOwnPropertyDescriptors) {
5103
5188
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5104
5189
  } else {
5105
- ownKeys$5(Object(source)).forEach(function(key) {
5190
+ ownKeys$f(Object(source)).forEach(function(key) {
5106
5191
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5107
5192
  });
5108
5193
  }
@@ -5169,7 +5254,7 @@ function _object_spread_props$5(target, source) {
5169
5254
  var se_module = input.module, Parent_Id = input.id, notes = input.notes;
5170
5255
  var createNotesRequest = {
5171
5256
  data: util.asArray(notes).map(function(x) {
5172
- return _object_spread_props$5(_object_spread$6({}, x), {
5257
+ return _object_spread_props$f(_object_spread$g({}, x), {
5173
5258
  se_module: se_module,
5174
5259
  Parent_Id: Parent_Id
5175
5260
  });
@@ -5187,7 +5272,7 @@ function _array_like_to_array(arr, len) {
5187
5272
  function _array_without_holes(arr) {
5188
5273
  if (Array.isArray(arr)) return _array_like_to_array(arr);
5189
5274
  }
5190
- function _define_property$5(obj, key, value) {
5275
+ function _define_property$f(obj, key, value) {
5191
5276
  if (key in obj) {
5192
5277
  Object.defineProperty(obj, key, {
5193
5278
  value: value,
@@ -5200,7 +5285,7 @@ function _define_property$5(obj, key, value) {
5200
5285
  }
5201
5286
  return obj;
5202
5287
  }
5203
- function _instanceof$2(left, right) {
5288
+ function _instanceof$3(left, right) {
5204
5289
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
5205
5290
  return !!right[Symbol.hasInstance](left);
5206
5291
  } else {
@@ -5213,7 +5298,7 @@ function _iterable_to_array(iter) {
5213
5298
  function _non_iterable_spread() {
5214
5299
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5215
5300
  }
5216
- function _object_spread$5(target) {
5301
+ function _object_spread$f(target) {
5217
5302
  for(var i = 1; i < arguments.length; i++){
5218
5303
  var source = arguments[i] != null ? arguments[i] : {};
5219
5304
  var ownKeys = Object.keys(source);
@@ -5223,12 +5308,12 @@ function _object_spread$5(target) {
5223
5308
  }));
5224
5309
  }
5225
5310
  ownKeys.forEach(function(key) {
5226
- _define_property$5(target, key, source[key]);
5311
+ _define_property$f(target, key, source[key]);
5227
5312
  });
5228
5313
  }
5229
5314
  return target;
5230
5315
  }
5231
- function ownKeys$4(object, enumerableOnly) {
5316
+ function ownKeys$e(object, enumerableOnly) {
5232
5317
  var keys = Object.keys(object);
5233
5318
  if (Object.getOwnPropertySymbols) {
5234
5319
  var symbols = Object.getOwnPropertySymbols(object);
@@ -5236,12 +5321,12 @@ function ownKeys$4(object, enumerableOnly) {
5236
5321
  }
5237
5322
  return keys;
5238
5323
  }
5239
- function _object_spread_props$4(target, source) {
5324
+ function _object_spread_props$e(target, source) {
5240
5325
  source = source != null ? source : {};
5241
5326
  if (Object.getOwnPropertyDescriptors) {
5242
5327
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5243
5328
  } else {
5244
- ownKeys$4(Object(source)).forEach(function(key) {
5329
+ ownKeys$e(Object(source)).forEach(function(key) {
5245
5330
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5246
5331
  });
5247
5332
  }
@@ -5271,7 +5356,7 @@ function _unsupported_iterable_to_array(o, minLen) {
5271
5356
  tags: util.asArray(input.tags)
5272
5357
  })).catch(function(e) {
5273
5358
  var result;
5274
- if (_instanceof$2(e, ZohoServerFetchResponseError)) {
5359
+ if (_instanceof$3(e, ZohoServerFetchResponseError)) {
5275
5360
  var _e_data;
5276
5361
  var tags = (_e_data = e.data) === null || _e_data === void 0 ? void 0 : _e_data.tags;
5277
5362
  if (Array.isArray(tags)) {
@@ -5289,7 +5374,7 @@ function _unsupported_iterable_to_array(o, minLen) {
5289
5374
  var _separateValues = util.separateValues(result.errorItems, function(x) {
5290
5375
  return x.result.code === ZOHO_DUPLICATE_DATA_ERROR_CODE;
5291
5376
  }), duplicateErrorItems = _separateValues.included, otherErrorItems = _separateValues.excluded;
5292
- return _object_spread_props$4(_object_spread$5({}, result), {
5377
+ return _object_spread_props$e(_object_spread$f({}, result), {
5293
5378
  errorItems: otherErrorItems,
5294
5379
  duplicateErrorItems: duplicateErrorItems,
5295
5380
  allErrorItems: result.errorItems
@@ -5327,7 +5412,7 @@ function _unsupported_iterable_to_array(o, minLen) {
5327
5412
  my_tags: input.my_tags
5328
5413
  })), zohoCrmApiFetchJsonInput('GET')).then(function(x) {
5329
5414
  // NOTE: This doesn't follow the api documentation, and instead is a normal page result except it has "tags" instead of "data".
5330
- return _object_spread_props$4(_object_spread$5({}, x), {
5415
+ return _object_spread_props$e(_object_spread$f({}, x), {
5331
5416
  data: x.tags
5332
5417
  });
5333
5418
  });
@@ -5412,7 +5497,7 @@ function _unsupported_iterable_to_array(o, minLen) {
5412
5497
  };
5413
5498
  }
5414
5499
 
5415
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
5500
+ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
5416
5501
  try {
5417
5502
  var info = gen[key](arg);
5418
5503
  var value = info.value;
@@ -5426,22 +5511,22 @@ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
5426
5511
  Promise.resolve(value).then(_next, _throw);
5427
5512
  }
5428
5513
  }
5429
- function _async_to_generator$3(fn) {
5514
+ function _async_to_generator$5(fn) {
5430
5515
  return function() {
5431
5516
  var self = this, args = arguments;
5432
5517
  return new Promise(function(resolve, reject) {
5433
5518
  var gen = fn.apply(self, args);
5434
5519
  function _next(value) {
5435
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
5520
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
5436
5521
  }
5437
5522
  function _throw(err) {
5438
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
5523
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
5439
5524
  }
5440
5525
  _next(undefined);
5441
5526
  });
5442
5527
  };
5443
5528
  }
5444
- function _define_property$4(obj, key, value) {
5529
+ function _define_property$e(obj, key, value) {
5445
5530
  if (key in obj) {
5446
5531
  Object.defineProperty(obj, key, {
5447
5532
  value: value,
@@ -5454,14 +5539,14 @@ function _define_property$4(obj, key, value) {
5454
5539
  }
5455
5540
  return obj;
5456
5541
  }
5457
- function _instanceof$1(left, right) {
5542
+ function _instanceof$2(left, right) {
5458
5543
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
5459
5544
  return !!right[Symbol.hasInstance](left);
5460
5545
  } else {
5461
5546
  return left instanceof right;
5462
5547
  }
5463
5548
  }
5464
- function _object_spread$4(target) {
5549
+ function _object_spread$e(target) {
5465
5550
  for(var i = 1; i < arguments.length; i++){
5466
5551
  var source = arguments[i] != null ? arguments[i] : {};
5467
5552
  var ownKeys = Object.keys(source);
@@ -5471,12 +5556,12 @@ function _object_spread$4(target) {
5471
5556
  }));
5472
5557
  }
5473
5558
  ownKeys.forEach(function(key) {
5474
- _define_property$4(target, key, source[key]);
5559
+ _define_property$e(target, key, source[key]);
5475
5560
  });
5476
5561
  }
5477
5562
  return target;
5478
5563
  }
5479
- function ownKeys$3(object, enumerableOnly) {
5564
+ function ownKeys$d(object, enumerableOnly) {
5480
5565
  var keys = Object.keys(object);
5481
5566
  if (Object.getOwnPropertySymbols) {
5482
5567
  var symbols = Object.getOwnPropertySymbols(object);
@@ -5484,18 +5569,18 @@ function ownKeys$3(object, enumerableOnly) {
5484
5569
  }
5485
5570
  return keys;
5486
5571
  }
5487
- function _object_spread_props$3(target, source) {
5572
+ function _object_spread_props$d(target, source) {
5488
5573
  source = source != null ? source : {};
5489
5574
  if (Object.getOwnPropertyDescriptors) {
5490
5575
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5491
5576
  } else {
5492
- ownKeys$3(Object(source)).forEach(function(key) {
5577
+ ownKeys$d(Object(source)).forEach(function(key) {
5493
5578
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5494
5579
  });
5495
5580
  }
5496
5581
  return target;
5497
5582
  }
5498
- function _ts_generator$3(thisArg, body) {
5583
+ function _ts_generator$5(thisArg, body) {
5499
5584
  var f, y, t, _ = {
5500
5585
  label: 0,
5501
5586
  sent: function() {
@@ -5626,9 +5711,9 @@ function _ts_generator$3(thisArg, body) {
5626
5711
  return fetch.fetchApiFetchService.makeFetch({
5627
5712
  baseUrl: input.apiUrl,
5628
5713
  baseRequest: function baseRequest() {
5629
- return _async_to_generator$3(function() {
5714
+ return _async_to_generator$5(function() {
5630
5715
  var _tmp, _tmp1, _, _1;
5631
- return _ts_generator$3(this, function(_state) {
5716
+ return _ts_generator$5(this, function(_state) {
5632
5717
  switch(_state.label){
5633
5718
  case 0:
5634
5719
  _tmp = {};
@@ -5666,7 +5751,7 @@ function _ts_generator$3(thisArg, body) {
5666
5751
  apiUrl: apiUrl
5667
5752
  });
5668
5753
  var fetch$1 = handleZohoCrmErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
5669
- if (_instanceof$1(x, ZohoInvalidTokenError)) {
5754
+ if (_instanceof$2(x, ZohoInvalidTokenError)) {
5670
5755
  void accountsContext.loadAccessToken.resetAccessToken();
5671
5756
  }
5672
5757
  });
@@ -5678,7 +5763,7 @@ function _ts_generator$3(thisArg, body) {
5678
5763
  fetch: fetch$1,
5679
5764
  fetchJson: fetchJson,
5680
5765
  accessTokenStringFactory: accessTokenStringFactory,
5681
- config: _object_spread_props$3(_object_spread$4({}, config), {
5766
+ config: _object_spread_props$d(_object_spread$e({}, config), {
5682
5767
  apiUrl: apiUrl
5683
5768
  }),
5684
5769
  zohoRateLimiter: fetchHandler._rateLimiter
@@ -5694,7 +5779,7 @@ function _ts_generator$3(thisArg, body) {
5694
5779
  * Maximum length of ZohoCrmTagName
5695
5780
  */ var ZOHO_CRM_TAG_NAME_MAX_LENGTH = 25;
5696
5781
 
5697
- function _define_property$3(obj, key, value) {
5782
+ function _define_property$d(obj, key, value) {
5698
5783
  if (key in obj) {
5699
5784
  Object.defineProperty(obj, key, {
5700
5785
  value: value,
@@ -5707,7 +5792,7 @@ function _define_property$3(obj, key, value) {
5707
5792
  }
5708
5793
  return obj;
5709
5794
  }
5710
- function _object_spread$3(target) {
5795
+ function _object_spread$d(target) {
5711
5796
  for(var i = 1; i < arguments.length; i++){
5712
5797
  var source = arguments[i] != null ? arguments[i] : {};
5713
5798
  var ownKeys = Object.keys(source);
@@ -5717,12 +5802,12 @@ function _object_spread$3(target) {
5717
5802
  }));
5718
5803
  }
5719
5804
  ownKeys.forEach(function(key) {
5720
- _define_property$3(target, key, source[key]);
5805
+ _define_property$d(target, key, source[key]);
5721
5806
  });
5722
5807
  }
5723
5808
  return target;
5724
5809
  }
5725
- function ownKeys$2(object, enumerableOnly) {
5810
+ function ownKeys$c(object, enumerableOnly) {
5726
5811
  var keys = Object.keys(object);
5727
5812
  if (Object.getOwnPropertySymbols) {
5728
5813
  var symbols = Object.getOwnPropertySymbols(object);
@@ -5730,12 +5815,12 @@ function ownKeys$2(object, enumerableOnly) {
5730
5815
  }
5731
5816
  return keys;
5732
5817
  }
5733
- function _object_spread_props$2(target, source) {
5818
+ function _object_spread_props$c(target, source) {
5734
5819
  source = source != null ? source : {};
5735
5820
  if (Object.getOwnPropertyDescriptors) {
5736
5821
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5737
5822
  } else {
5738
- ownKeys$2(Object(source)).forEach(function(key) {
5823
+ ownKeys$c(Object(source)).forEach(function(key) {
5739
5824
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5740
5825
  });
5741
5826
  }
@@ -5763,7 +5848,7 @@ function _object_spread_props$2(target, source) {
5763
5848
  * }
5764
5849
  * ```
5765
5850
  */ function zohoSignFetchPageFactory(fetch$1, defaults) {
5766
- return fetch.fetchPageFactory(_object_spread_props$2(_object_spread$3({}, defaults), {
5851
+ return fetch.fetchPageFactory(_object_spread_props$c(_object_spread$d({}, defaults), {
5767
5852
  fetch: fetch$1,
5768
5853
  readFetchPageResultInfo: function readFetchPageResultInfo(result) {
5769
5854
  var _ref;
@@ -5778,7 +5863,7 @@ function _object_spread_props$2(target, source) {
5778
5863
  var previousPageContext = previousResult === null || previousResult === void 0 ? void 0 : previousResult.page_context;
5779
5864
  var rowCount = (_ref = (_ref1 = (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.row_count) !== null && _ref1 !== void 0 ? _ref1 : previousPageContext === null || previousPageContext === void 0 ? void 0 : previousPageContext.row_count) !== null && _ref !== void 0 ? _ref : 20;
5780
5865
  var nextStartIndex = ((_ref2 = (_ref3 = previousPageContext === null || previousPageContext === void 0 ? void 0 : previousPageContext.start_index) !== null && _ref3 !== void 0 ? _ref3 : input.start_index) !== null && _ref2 !== void 0 ? _ref2 : 1) + rowCount;
5781
- return _object_spread_props$2(_object_spread$3({}, input), {
5866
+ return _object_spread_props$c(_object_spread$d({}, input), {
5782
5867
  start_index: nextStartIndex,
5783
5868
  row_count: rowCount
5784
5869
  });
@@ -5786,7 +5871,7 @@ function _object_spread_props$2(target, source) {
5786
5871
  }));
5787
5872
  }
5788
5873
 
5789
- function _define_property$2(obj, key, value) {
5874
+ function _define_property$c(obj, key, value) {
5790
5875
  if (key in obj) {
5791
5876
  Object.defineProperty(obj, key, {
5792
5877
  value: value,
@@ -5799,7 +5884,7 @@ function _define_property$2(obj, key, value) {
5799
5884
  }
5800
5885
  return obj;
5801
5886
  }
5802
- function _object_spread$2(target) {
5887
+ function _object_spread$c(target) {
5803
5888
  for(var i = 1; i < arguments.length; i++){
5804
5889
  var source = arguments[i] != null ? arguments[i] : {};
5805
5890
  var ownKeys = Object.keys(source);
@@ -5809,12 +5894,12 @@ function _object_spread$2(target) {
5809
5894
  }));
5810
5895
  }
5811
5896
  ownKeys.forEach(function(key) {
5812
- _define_property$2(target, key, source[key]);
5897
+ _define_property$c(target, key, source[key]);
5813
5898
  });
5814
5899
  }
5815
5900
  return target;
5816
5901
  }
5817
- function _object_without_properties(source, excluded) {
5902
+ function _object_without_properties$8(source, excluded) {
5818
5903
  if (source == null) return {};
5819
5904
  var target = {}, sourceKeys, key, i;
5820
5905
  if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
@@ -5827,7 +5912,7 @@ function _object_without_properties(source, excluded) {
5827
5912
  }
5828
5913
  return target;
5829
5914
  }
5830
- target = _object_without_properties_loose(source, excluded);
5915
+ target = _object_without_properties_loose$8(source, excluded);
5831
5916
  if (Object.getOwnPropertySymbols) {
5832
5917
  sourceKeys = Object.getOwnPropertySymbols(source);
5833
5918
  for(i = 0; i < sourceKeys.length; i++){
@@ -5839,7 +5924,7 @@ function _object_without_properties(source, excluded) {
5839
5924
  }
5840
5925
  return target;
5841
5926
  }
5842
- function _object_without_properties_loose(source, excluded) {
5927
+ function _object_without_properties_loose$8(source, excluded) {
5843
5928
  if (source == null) return {};
5844
5929
  var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
5845
5930
  for(i = 0; i < sourceKeys.length; i++){
@@ -5905,11 +5990,11 @@ function _object_without_properties_loose(source, excluded) {
5905
5990
  * @see https://www.zoho.com/sign/api/document-managment/get-document-list.html
5906
5991
  */ function zohoSignGetDocuments(context) {
5907
5992
  return function(input) {
5908
- var search_columns = input.search_columns, pageFilter = _object_without_properties(input, [
5993
+ var search_columns = input.search_columns, pageFilter = _object_without_properties$8(input, [
5909
5994
  "search_columns"
5910
5995
  ]);
5911
5996
  var data = {
5912
- page_context: _object_spread$2({}, pageFilter, search_columns ? {
5997
+ page_context: _object_spread$c({}, pageFilter, search_columns ? {
5913
5998
  search_columns: search_columns
5914
5999
  } : {})
5915
6000
  };
@@ -6017,7 +6102,7 @@ function _object_without_properties_loose(source, excluded) {
6017
6102
  * @see https://www.zoho.com/sign/api/document-managment/download-pdf.html
6018
6103
  */ function zohoSignDownloadPdf(context) {
6019
6104
  return function(_0) {
6020
- var requestId = _0.requestId, params = _object_without_properties(_0, [
6105
+ var requestId = _0.requestId, params = _object_without_properties$8(_0, [
6021
6106
  "requestId"
6022
6107
  ]);
6023
6108
  var searchParams = fetch.makeUrlSearchParams(params);
@@ -6241,7 +6326,7 @@ function _object_without_properties_loose(source, excluded) {
6241
6326
  }
6242
6327
  var form = fetch.makeUrlSearchParams(params);
6243
6328
  var hasForm = form.toString().length > 0;
6244
- return context.fetchJson("/requests/".concat(requestId, "/delete"), _object_spread$2({
6329
+ return context.fetchJson("/requests/".concat(requestId, "/delete"), _object_spread$c({
6245
6330
  method: 'PUT'
6246
6331
  }, hasForm ? {
6247
6332
  headers: {
@@ -6269,7 +6354,7 @@ var ZOHO_SIGN_SERVICE_NAME = 'sign';
6269
6354
  }
6270
6355
  }
6271
6356
 
6272
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
6357
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
6273
6358
  try {
6274
6359
  var info = gen[key](arg);
6275
6360
  var value = info.value;
@@ -6283,22 +6368,22 @@ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
6283
6368
  Promise.resolve(value).then(_next, _throw);
6284
6369
  }
6285
6370
  }
6286
- function _async_to_generator$2(fn) {
6371
+ function _async_to_generator$4(fn) {
6287
6372
  return function() {
6288
6373
  var self = this, args = arguments;
6289
6374
  return new Promise(function(resolve, reject) {
6290
6375
  var gen = fn.apply(self, args);
6291
6376
  function _next(value) {
6292
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
6377
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
6293
6378
  }
6294
6379
  function _throw(err) {
6295
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
6380
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
6296
6381
  }
6297
6382
  _next(undefined);
6298
6383
  });
6299
6384
  };
6300
6385
  }
6301
- function _ts_generator$2(thisArg, body) {
6386
+ function _ts_generator$4(thisArg, body) {
6302
6387
  var f, y, t, _ = {
6303
6388
  label: 0,
6304
6389
  sent: function() {
@@ -6406,9 +6491,9 @@ var logZohoSignErrorToConsole = logZohoServerErrorFunction('ZohoSign', {
6406
6491
  * @param responseError - The fetch response error to parse
6407
6492
  * @returns Parsed Zoho server error, or undefined if parsing fails
6408
6493
  */ function parseZohoSignError(responseError) {
6409
- return _async_to_generator$2(function() {
6494
+ return _async_to_generator$4(function() {
6410
6495
  var data, result;
6411
- return _ts_generator$2(this, function(_state) {
6496
+ return _ts_generator$4(this, function(_state) {
6412
6497
  switch(_state.label){
6413
6498
  case 0:
6414
6499
  return [
@@ -6453,7 +6538,7 @@ var logZohoSignErrorToConsole = logZohoServerErrorFunction('ZohoSign', {
6453
6538
  var interceptZohoSign200StatusWithErrorResponse = interceptZohoErrorResponseFactory(parseZohoSignServerErrorResponseData);
6454
6539
  var handleZohoSignErrorFetch = handleZohoErrorFetchFactory(parseZohoSignError, logZohoSignErrorToConsole);
6455
6540
 
6456
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
6541
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
6457
6542
  try {
6458
6543
  var info = gen[key](arg);
6459
6544
  var value = info.value;
@@ -6467,22 +6552,22 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
6467
6552
  Promise.resolve(value).then(_next, _throw);
6468
6553
  }
6469
6554
  }
6470
- function _async_to_generator$1(fn) {
6555
+ function _async_to_generator$3(fn) {
6471
6556
  return function() {
6472
6557
  var self = this, args = arguments;
6473
6558
  return new Promise(function(resolve, reject) {
6474
6559
  var gen = fn.apply(self, args);
6475
6560
  function _next(value) {
6476
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
6561
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
6477
6562
  }
6478
6563
  function _throw(err) {
6479
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
6564
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
6480
6565
  }
6481
6566
  _next(undefined);
6482
6567
  });
6483
6568
  };
6484
6569
  }
6485
- function _define_property$1(obj, key, value) {
6570
+ function _define_property$b(obj, key, value) {
6486
6571
  if (key in obj) {
6487
6572
  Object.defineProperty(obj, key, {
6488
6573
  value: value,
@@ -6495,14 +6580,14 @@ function _define_property$1(obj, key, value) {
6495
6580
  }
6496
6581
  return obj;
6497
6582
  }
6498
- function _instanceof(left, right) {
6583
+ function _instanceof$1(left, right) {
6499
6584
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
6500
6585
  return !!right[Symbol.hasInstance](left);
6501
6586
  } else {
6502
6587
  return left instanceof right;
6503
6588
  }
6504
6589
  }
6505
- function _object_spread$1(target) {
6590
+ function _object_spread$b(target) {
6506
6591
  for(var i = 1; i < arguments.length; i++){
6507
6592
  var source = arguments[i] != null ? arguments[i] : {};
6508
6593
  var ownKeys = Object.keys(source);
@@ -6512,12 +6597,12 @@ function _object_spread$1(target) {
6512
6597
  }));
6513
6598
  }
6514
6599
  ownKeys.forEach(function(key) {
6515
- _define_property$1(target, key, source[key]);
6600
+ _define_property$b(target, key, source[key]);
6516
6601
  });
6517
6602
  }
6518
6603
  return target;
6519
6604
  }
6520
- function ownKeys$1(object, enumerableOnly) {
6605
+ function ownKeys$b(object, enumerableOnly) {
6521
6606
  var keys = Object.keys(object);
6522
6607
  if (Object.getOwnPropertySymbols) {
6523
6608
  var symbols = Object.getOwnPropertySymbols(object);
@@ -6525,18 +6610,18 @@ function ownKeys$1(object, enumerableOnly) {
6525
6610
  }
6526
6611
  return keys;
6527
6612
  }
6528
- function _object_spread_props$1(target, source) {
6613
+ function _object_spread_props$b(target, source) {
6529
6614
  source = source != null ? source : {};
6530
6615
  if (Object.getOwnPropertyDescriptors) {
6531
6616
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6532
6617
  } else {
6533
- ownKeys$1(Object(source)).forEach(function(key) {
6618
+ ownKeys$b(Object(source)).forEach(function(key) {
6534
6619
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6535
6620
  });
6536
6621
  }
6537
6622
  return target;
6538
6623
  }
6539
- function _ts_generator$1(thisArg, body) {
6624
+ function _ts_generator$3(thisArg, body) {
6540
6625
  var f, y, t, _ = {
6541
6626
  label: 0,
6542
6627
  sent: function() {
@@ -6667,9 +6752,9 @@ function _ts_generator$1(thisArg, body) {
6667
6752
  return fetch.fetchApiFetchService.makeFetch({
6668
6753
  baseUrl: input.apiUrl,
6669
6754
  baseRequest: function baseRequest() {
6670
- return _async_to_generator$1(function() {
6755
+ return _async_to_generator$3(function() {
6671
6756
  var _tmp, _tmp1, _, _1;
6672
- return _ts_generator$1(this, function(_state) {
6757
+ return _ts_generator$3(this, function(_state) {
6673
6758
  switch(_state.label){
6674
6759
  case 0:
6675
6760
  _tmp = {};
@@ -6707,7 +6792,7 @@ function _ts_generator$1(thisArg, body) {
6707
6792
  apiUrl: apiUrl
6708
6793
  });
6709
6794
  var fetch$1 = handleZohoSignErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
6710
- if (_instanceof(x, ZohoInvalidTokenError)) {
6795
+ if (_instanceof$1(x, ZohoInvalidTokenError)) {
6711
6796
  void accountsContext.loadAccessToken.resetAccessToken();
6712
6797
  }
6713
6798
  });
@@ -6719,7 +6804,7 @@ function _ts_generator$1(thisArg, body) {
6719
6804
  fetch: fetch$1,
6720
6805
  fetchJson: fetchJson,
6721
6806
  accessTokenStringFactory: accessTokenStringFactory,
6722
- config: _object_spread_props$1(_object_spread$1({}, config), {
6807
+ config: _object_spread_props$b(_object_spread$b({}, config), {
6723
6808
  apiUrl: apiUrl
6724
6809
  }),
6725
6810
  zohoRateLimiter: fetchHandler._rateLimiter
@@ -6731,6 +6816,2168 @@ function _ts_generator$1(thisArg, body) {
6731
6816
  };
6732
6817
  }
6733
6818
 
6819
+ /**
6820
+ * Service identifier used for Zoho Desk API access token resolution and service routing.
6821
+ */ var ZOHO_DESK_SERVICE_NAME = 'desk';
6822
+ /**
6823
+ * Resolves a Desk API URL input to its full base URL. The 'production' key maps to the
6824
+ * primary Zoho Desk endpoint; custom URLs pass through unchanged.
6825
+ *
6826
+ * @param input - A well-known environment key or a custom Desk API URL
6827
+ * @returns The resolved full Zoho Desk API base URL
6828
+ */ function zohoDeskConfigApiUrl(input) {
6829
+ var result;
6830
+ switch(input){
6831
+ case 'sandbox':
6832
+ case 'production':
6833
+ result = 'https://desk.zoho.com/api/v1';
6834
+ break;
6835
+ default:
6836
+ result = input;
6837
+ break;
6838
+ }
6839
+ return result;
6840
+ }
6841
+
6842
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
6843
+ try {
6844
+ var info = gen[key](arg);
6845
+ var value = info.value;
6846
+ } catch (error) {
6847
+ reject(error);
6848
+ return;
6849
+ }
6850
+ if (info.done) {
6851
+ resolve(value);
6852
+ } else {
6853
+ Promise.resolve(value).then(_next, _throw);
6854
+ }
6855
+ }
6856
+ function _async_to_generator$2(fn) {
6857
+ return function() {
6858
+ var self = this, args = arguments;
6859
+ return new Promise(function(resolve, reject) {
6860
+ var gen = fn.apply(self, args);
6861
+ function _next(value) {
6862
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
6863
+ }
6864
+ function _throw(err) {
6865
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
6866
+ }
6867
+ _next(undefined);
6868
+ });
6869
+ };
6870
+ }
6871
+ function _ts_generator$2(thisArg, body) {
6872
+ var f, y, t, _ = {
6873
+ label: 0,
6874
+ sent: function() {
6875
+ if (t[0] & 1) throw t[1];
6876
+ return t[1];
6877
+ },
6878
+ trys: [],
6879
+ ops: []
6880
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
6881
+ return d(g, "next", {
6882
+ value: verb(0)
6883
+ }), d(g, "throw", {
6884
+ value: verb(1)
6885
+ }), d(g, "return", {
6886
+ value: verb(2)
6887
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
6888
+ value: function() {
6889
+ return this;
6890
+ }
6891
+ }), g;
6892
+ function verb(n) {
6893
+ return function(v) {
6894
+ return step([
6895
+ n,
6896
+ v
6897
+ ]);
6898
+ };
6899
+ }
6900
+ function step(op) {
6901
+ if (f) throw new TypeError("Generator is already executing.");
6902
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
6903
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
6904
+ if (y = 0, t) op = [
6905
+ op[0] & 2,
6906
+ t.value
6907
+ ];
6908
+ switch(op[0]){
6909
+ case 0:
6910
+ case 1:
6911
+ t = op;
6912
+ break;
6913
+ case 4:
6914
+ _.label++;
6915
+ return {
6916
+ value: op[1],
6917
+ done: false
6918
+ };
6919
+ case 5:
6920
+ _.label++;
6921
+ y = op[1];
6922
+ op = [
6923
+ 0
6924
+ ];
6925
+ continue;
6926
+ case 7:
6927
+ op = _.ops.pop();
6928
+ _.trys.pop();
6929
+ continue;
6930
+ default:
6931
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
6932
+ _ = 0;
6933
+ continue;
6934
+ }
6935
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
6936
+ _.label = op[1];
6937
+ break;
6938
+ }
6939
+ if (op[0] === 6 && _.label < t[1]) {
6940
+ _.label = t[1];
6941
+ t = op;
6942
+ break;
6943
+ }
6944
+ if (t && _.label < t[2]) {
6945
+ _.label = t[2];
6946
+ _.ops.push(op);
6947
+ break;
6948
+ }
6949
+ if (t[2]) _.ops.pop();
6950
+ _.trys.pop();
6951
+ continue;
6952
+ }
6953
+ op = body.call(thisArg, _);
6954
+ } catch (e) {
6955
+ op = [
6956
+ 6,
6957
+ e
6958
+ ];
6959
+ y = 0;
6960
+ } finally{
6961
+ f = t = 0;
6962
+ }
6963
+ if (op[0] & 5) throw op[1];
6964
+ return {
6965
+ value: op[0] ? op[1] : void 0,
6966
+ done: true
6967
+ };
6968
+ }
6969
+ }
6970
+ /**
6971
+ * Pre-configured console logger for Zoho Desk server errors.
6972
+ * Data array errors are suppressed since they are handled separately.
6973
+ */ var logZohoDeskErrorToConsole = logZohoServerErrorFunction('ZohoDesk', {
6974
+ logDataArrayErrors: false
6975
+ });
6976
+ /**
6977
+ * Parses a fetch response error into a typed Zoho Desk server error by extracting and interpreting the JSON error body.
6978
+ *
6979
+ * @param responseError - The fetch response error to parse
6980
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
6981
+ */ function parseZohoDeskError(responseError) {
6982
+ return _async_to_generator$2(function() {
6983
+ var data, result;
6984
+ return _ts_generator$2(this, function(_state) {
6985
+ switch(_state.label){
6986
+ case 0:
6987
+ return [
6988
+ 4,
6989
+ responseError.response.json().catch(function() {
6990
+ return undefined;
6991
+ })
6992
+ ];
6993
+ case 1:
6994
+ data = _state.sent();
6995
+ if (data) {
6996
+ result = parseZohoDeskServerErrorResponseData(data, responseError);
6997
+ }
6998
+ return [
6999
+ 2,
7000
+ result
7001
+ ];
7002
+ }
7003
+ });
7004
+ })();
7005
+ }
7006
+ /**
7007
+ * Parses a Zoho Desk error response body into a typed error. Delegates to Desk-specific
7008
+ * error code handling before falling back to the generic Zoho error parser.
7009
+ *
7010
+ * @param errorResponseData - The raw error response data from the Zoho Desk API
7011
+ * @param responseError - The original fetch response error for context
7012
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
7013
+ */ function parseZohoDeskServerErrorResponseData(errorResponseData, responseError) {
7014
+ var result;
7015
+ var error = tryFindZohoServerErrorData(errorResponseData, responseError);
7016
+ if (error) {
7017
+ var errorData = zohoServerErrorData(error);
7018
+ switch(errorData.code){
7019
+ // TODO: Add Desk-specific error codes here as we encounter them.
7020
+ default:
7021
+ result = parseZohoServerErrorResponseData(errorResponseData, responseError);
7022
+ break;
7023
+ }
7024
+ }
7025
+ return result;
7026
+ }
7027
+ /**
7028
+ * Fetch response interceptor that detects Zoho Desk error payloads hidden within HTTP 200 responses
7029
+ * and converts them into proper errors.
7030
+ */ var interceptZohoDesk200StatusWithErrorResponse = interceptZohoErrorResponseFactory(parseZohoDeskServerErrorResponseData);
7031
+ /**
7032
+ * Wraps a fetch function with Zoho Desk error parsing and console logging,
7033
+ * ensuring all Desk API errors are surfaced as typed exceptions.
7034
+ */ var handleZohoDeskErrorFetch = handleZohoErrorFetchFactory(parseZohoDeskError, logZohoDeskErrorToConsole);
7035
+
7036
+ function _define_property$a(obj, key, value) {
7037
+ if (key in obj) {
7038
+ Object.defineProperty(obj, key, {
7039
+ value: value,
7040
+ enumerable: true,
7041
+ configurable: true,
7042
+ writable: true
7043
+ });
7044
+ } else {
7045
+ obj[key] = value;
7046
+ }
7047
+ return obj;
7048
+ }
7049
+ function _object_spread$a(target) {
7050
+ for(var i = 1; i < arguments.length; i++){
7051
+ var source = arguments[i] != null ? arguments[i] : {};
7052
+ var ownKeys = Object.keys(source);
7053
+ if (typeof Object.getOwnPropertySymbols === "function") {
7054
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7055
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7056
+ }));
7057
+ }
7058
+ ownKeys.forEach(function(key) {
7059
+ _define_property$a(target, key, source[key]);
7060
+ });
7061
+ }
7062
+ return target;
7063
+ }
7064
+ function ownKeys$a(object, enumerableOnly) {
7065
+ var keys = Object.keys(object);
7066
+ if (Object.getOwnPropertySymbols) {
7067
+ var symbols = Object.getOwnPropertySymbols(object);
7068
+ keys.push.apply(keys, symbols);
7069
+ }
7070
+ return keys;
7071
+ }
7072
+ function _object_spread_props$a(target, source) {
7073
+ source = source != null ? source : {};
7074
+ if (Object.getOwnPropertyDescriptors) {
7075
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7076
+ } else {
7077
+ ownKeys$a(Object(source)).forEach(function(key) {
7078
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7079
+ });
7080
+ }
7081
+ return target;
7082
+ }
7083
+ // MARK: Desk Rate Limit Headers
7084
+ /**
7085
+ * Header name for the credit weight consumed by the last Zoho Desk API request.
7086
+ */ var ZOHO_DESK_RATE_LIMIT_WEIGHT_HEADER = 'X-Rate-Limit-Request-Weight-v3';
7087
+ /**
7088
+ * Header name for the remaining API credits in the current Zoho Desk rate limit window.
7089
+ */ var ZOHO_DESK_RATE_LIMIT_REMAINING_HEADER = 'X-Rate-Limit-Remaining-v3';
7090
+ /**
7091
+ * Header name indicating how many seconds to wait before retrying after a Zoho Desk 429 response.
7092
+ */ var ZOHO_DESK_RETRY_AFTER_HEADER = 'Retry-After';
7093
+ /**
7094
+ * Default rate limit for Zoho Desk API requests (credits per minute).
7095
+ */ var DEFAULT_ZOHO_DESK_API_RATE_LIMIT = 200;
7096
+ /**
7097
+ * Reads rate limit details from Zoho Desk v3 response headers.
7098
+ *
7099
+ * Desk uses a credit-based system with `X-Rate-Limit-Remaining-v3` and `Retry-After` (in seconds)
7100
+ * rather than the `X-RATELIMIT-*` headers used by CRM/Recruit/Sign.
7101
+ *
7102
+ * @param headers - HTTP response headers from a Zoho Desk API call
7103
+ * @returns Parsed rate limit details, or null if the Desk rate limit headers are absent
7104
+ */ function zohoDeskRateLimitDetailsReader(headers) {
7105
+ var remainingHeader = headers.get(ZOHO_DESK_RATE_LIMIT_REMAINING_HEADER);
7106
+ var result;
7107
+ if (remainingHeader != null) {
7108
+ var remaining = Number(remainingHeader);
7109
+ var resetAt;
7110
+ var retryAfterHeader = headers.get(ZOHO_DESK_RETRY_AFTER_HEADER);
7111
+ if (retryAfterHeader != null) {
7112
+ var retryAfterSeconds = Number(retryAfterHeader);
7113
+ if (!isNaN(retryAfterSeconds)) {
7114
+ resetAt = new Date(Date.now() + retryAfterSeconds * util.MS_IN_SECOND);
7115
+ }
7116
+ }
7117
+ if (!isNaN(remaining)) {
7118
+ result = {
7119
+ remaining: remaining,
7120
+ resetAt: resetAt
7121
+ };
7122
+ }
7123
+ }
7124
+ return result;
7125
+ }
7126
+ /**
7127
+ * Creates a {@link ZohoRateLimitedFetchHandler} configured for Zoho Desk's v3 rate limit headers.
7128
+ *
7129
+ * This is a convenience wrapper around {@link makeZohoRateLimitedFetchHandler} pre-configured
7130
+ * with the Desk-specific header reader. Unlike CRM, Desk does not provide a total limit header,
7131
+ * so the configured `maxRateLimit` (defaulting to {@link DEFAULT_ZOHO_DESK_API_RATE_LIMIT}) is used throughout.
7132
+ *
7133
+ * @param config - Optional configuration for rate limit, reset period, and 429 handling
7134
+ * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
7135
+ */ function zohoDeskRateLimitedFetchHandler(config) {
7136
+ return makeZohoRateLimitedFetchHandler(_object_spread_props$a(_object_spread$a({
7137
+ maxRateLimit: DEFAULT_ZOHO_DESK_API_RATE_LIMIT
7138
+ }, config), {
7139
+ readRateLimitDetails: zohoDeskRateLimitDetailsReader
7140
+ }));
7141
+ }
7142
+
7143
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
7144
+ try {
7145
+ var info = gen[key](arg);
7146
+ var value = info.value;
7147
+ } catch (error) {
7148
+ reject(error);
7149
+ return;
7150
+ }
7151
+ if (info.done) {
7152
+ resolve(value);
7153
+ } else {
7154
+ Promise.resolve(value).then(_next, _throw);
7155
+ }
7156
+ }
7157
+ function _async_to_generator$1(fn) {
7158
+ return function() {
7159
+ var self = this, args = arguments;
7160
+ return new Promise(function(resolve, reject) {
7161
+ var gen = fn.apply(self, args);
7162
+ function _next(value) {
7163
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
7164
+ }
7165
+ function _throw(err) {
7166
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
7167
+ }
7168
+ _next(undefined);
7169
+ });
7170
+ };
7171
+ }
7172
+ function _define_property$9(obj, key, value) {
7173
+ if (key in obj) {
7174
+ Object.defineProperty(obj, key, {
7175
+ value: value,
7176
+ enumerable: true,
7177
+ configurable: true,
7178
+ writable: true
7179
+ });
7180
+ } else {
7181
+ obj[key] = value;
7182
+ }
7183
+ return obj;
7184
+ }
7185
+ function _instanceof(left, right) {
7186
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
7187
+ return !!right[Symbol.hasInstance](left);
7188
+ } else {
7189
+ return left instanceof right;
7190
+ }
7191
+ }
7192
+ function _object_spread$9(target) {
7193
+ for(var i = 1; i < arguments.length; i++){
7194
+ var source = arguments[i] != null ? arguments[i] : {};
7195
+ var ownKeys = Object.keys(source);
7196
+ if (typeof Object.getOwnPropertySymbols === "function") {
7197
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7198
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7199
+ }));
7200
+ }
7201
+ ownKeys.forEach(function(key) {
7202
+ _define_property$9(target, key, source[key]);
7203
+ });
7204
+ }
7205
+ return target;
7206
+ }
7207
+ function ownKeys$9(object, enumerableOnly) {
7208
+ var keys = Object.keys(object);
7209
+ if (Object.getOwnPropertySymbols) {
7210
+ var symbols = Object.getOwnPropertySymbols(object);
7211
+ keys.push.apply(keys, symbols);
7212
+ }
7213
+ return keys;
7214
+ }
7215
+ function _object_spread_props$9(target, source) {
7216
+ source = source != null ? source : {};
7217
+ if (Object.getOwnPropertyDescriptors) {
7218
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7219
+ } else {
7220
+ ownKeys$9(Object(source)).forEach(function(key) {
7221
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7222
+ });
7223
+ }
7224
+ return target;
7225
+ }
7226
+ function _ts_generator$1(thisArg, body) {
7227
+ var f, y, t, _ = {
7228
+ label: 0,
7229
+ sent: function() {
7230
+ if (t[0] & 1) throw t[1];
7231
+ return t[1];
7232
+ },
7233
+ trys: [],
7234
+ ops: []
7235
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
7236
+ return d(g, "next", {
7237
+ value: verb(0)
7238
+ }), d(g, "throw", {
7239
+ value: verb(1)
7240
+ }), d(g, "return", {
7241
+ value: verb(2)
7242
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
7243
+ value: function() {
7244
+ return this;
7245
+ }
7246
+ }), g;
7247
+ function verb(n) {
7248
+ return function(v) {
7249
+ return step([
7250
+ n,
7251
+ v
7252
+ ]);
7253
+ };
7254
+ }
7255
+ function step(op) {
7256
+ if (f) throw new TypeError("Generator is already executing.");
7257
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
7258
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
7259
+ if (y = 0, t) op = [
7260
+ op[0] & 2,
7261
+ t.value
7262
+ ];
7263
+ switch(op[0]){
7264
+ case 0:
7265
+ case 1:
7266
+ t = op;
7267
+ break;
7268
+ case 4:
7269
+ _.label++;
7270
+ return {
7271
+ value: op[1],
7272
+ done: false
7273
+ };
7274
+ case 5:
7275
+ _.label++;
7276
+ y = op[1];
7277
+ op = [
7278
+ 0
7279
+ ];
7280
+ continue;
7281
+ case 7:
7282
+ op = _.ops.pop();
7283
+ _.trys.pop();
7284
+ continue;
7285
+ default:
7286
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
7287
+ _ = 0;
7288
+ continue;
7289
+ }
7290
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
7291
+ _.label = op[1];
7292
+ break;
7293
+ }
7294
+ if (op[0] === 6 && _.label < t[1]) {
7295
+ _.label = t[1];
7296
+ t = op;
7297
+ break;
7298
+ }
7299
+ if (t && _.label < t[2]) {
7300
+ _.label = t[2];
7301
+ _.ops.push(op);
7302
+ break;
7303
+ }
7304
+ if (t[2]) _.ops.pop();
7305
+ _.trys.pop();
7306
+ continue;
7307
+ }
7308
+ op = body.call(thisArg, _);
7309
+ } catch (e) {
7310
+ op = [
7311
+ 6,
7312
+ e
7313
+ ];
7314
+ y = 0;
7315
+ } finally{
7316
+ f = t = 0;
7317
+ }
7318
+ if (op[0] & 5) throw op[1];
7319
+ return {
7320
+ value: op[0] ? op[1] : void 0,
7321
+ done: true
7322
+ };
7323
+ }
7324
+ }
7325
+ /**
7326
+ * Creates a {@link ZohoDeskFactory} from the given configuration.
7327
+ *
7328
+ * The factory pre-initializes shared resources (access token provider, rate limiter)
7329
+ * once, then produces {@link ZohoDesk} client instances for each {@link ZohoDeskConfig}.
7330
+ * Each client handles OAuth token refresh on {@link ZohoInvalidTokenError}, rate limiting,
7331
+ * and Zoho Desk's non-standard error responses (200 status with error body).
7332
+ *
7333
+ * Unlike CRM/Recruit/Sign, the Desk API requires an `orgId` header on every request.
7334
+ * This is injected automatically from the config.
7335
+ *
7336
+ * @param factoryConfig - Configuration providing account credentials and optional overrides
7337
+ * @returns A factory function that creates authenticated Zoho Desk clients
7338
+ */ function zohoDeskFactory(factoryConfig) {
7339
+ var accountsContext = factoryConfig.accountsContext;
7340
+ var accessTokenStringFactory = zohoAccessTokenStringFactory(accountsContext.loadAccessToken);
7341
+ var fetchHandler = zohoDeskRateLimitedFetchHandler(factoryConfig.rateLimiterConfig);
7342
+ var logZohoServerErrorFunction = factoryConfig.logZohoServerErrorFunction, _factoryConfig_fetchFactory = factoryConfig.fetchFactory, fetchFactory = _factoryConfig_fetchFactory === void 0 ? function(input) {
7343
+ return fetch.fetchApiFetchService.makeFetch({
7344
+ baseUrl: input.apiUrl,
7345
+ baseRequest: function baseRequest() {
7346
+ return _async_to_generator$1(function() {
7347
+ var _tmp, _tmp1, _, _1;
7348
+ return _ts_generator$1(this, function(_state) {
7349
+ switch(_state.label){
7350
+ case 0:
7351
+ _tmp = {};
7352
+ _tmp1 = {
7353
+ 'Content-Type': 'application/json'
7354
+ };
7355
+ _1 = (_ = "Bearer ").concat;
7356
+ return [
7357
+ 4,
7358
+ accessTokenStringFactory()
7359
+ ];
7360
+ case 1:
7361
+ return [
7362
+ 2,
7363
+ (_tmp.headers = (_tmp1.Authorization = _1.apply(_, [
7364
+ _state.sent()
7365
+ ]), _tmp1.orgId = input.orgId, _tmp1), _tmp)
7366
+ ];
7367
+ }
7368
+ });
7369
+ })();
7370
+ },
7371
+ fetchHandler: fetchHandler,
7372
+ timeout: 20 * 1000,
7373
+ requireOkResponse: true,
7374
+ useTimeout: true // use timeout
7375
+ });
7376
+ } : _factoryConfig_fetchFactory;
7377
+ return function(config) {
7378
+ if (!config.apiUrl) {
7379
+ throw new Error('ZohoDeskConfig missing api url.');
7380
+ }
7381
+ if (!config.orgId) {
7382
+ throw new Error('ZohoDeskConfig missing orgId.');
7383
+ }
7384
+ var apiUrl = zohoDeskConfigApiUrl(config.apiUrl);
7385
+ var baseFetch = fetchFactory({
7386
+ apiUrl: apiUrl,
7387
+ orgId: config.orgId
7388
+ });
7389
+ var fetch$1 = handleZohoDeskErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
7390
+ if (_instanceof(x, ZohoInvalidTokenError)) {
7391
+ void accountsContext.loadAccessToken.resetAccessToken();
7392
+ }
7393
+ });
7394
+ var fetchJson = fetch.fetchJsonFunction(fetch$1, {
7395
+ interceptJsonResponse: interceptZohoDesk200StatusWithErrorResponse,
7396
+ handleFetchJsonParseErrorFunction: fetch.returnNullHandleFetchJsonParseErrorFunction
7397
+ });
7398
+ var deskContext = {
7399
+ fetch: fetch$1,
7400
+ fetchJson: fetchJson,
7401
+ accessTokenStringFactory: accessTokenStringFactory,
7402
+ config: _object_spread_props$9(_object_spread$9({}, config), {
7403
+ apiUrl: apiUrl
7404
+ }),
7405
+ zohoRateLimiter: fetchHandler._rateLimiter
7406
+ };
7407
+ var zohoDesk = {
7408
+ deskContext: deskContext
7409
+ };
7410
+ return zohoDesk;
7411
+ };
7412
+ }
7413
+
7414
+ function _define_property$8(obj, key, value) {
7415
+ if (key in obj) {
7416
+ Object.defineProperty(obj, key, {
7417
+ value: value,
7418
+ enumerable: true,
7419
+ configurable: true,
7420
+ writable: true
7421
+ });
7422
+ } else {
7423
+ obj[key] = value;
7424
+ }
7425
+ return obj;
7426
+ }
7427
+ function _object_spread$8(target) {
7428
+ for(var i = 1; i < arguments.length; i++){
7429
+ var source = arguments[i] != null ? arguments[i] : {};
7430
+ var ownKeys = Object.keys(source);
7431
+ if (typeof Object.getOwnPropertySymbols === "function") {
7432
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7433
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7434
+ }));
7435
+ }
7436
+ ownKeys.forEach(function(key) {
7437
+ _define_property$8(target, key, source[key]);
7438
+ });
7439
+ }
7440
+ return target;
7441
+ }
7442
+ function ownKeys$8(object, enumerableOnly) {
7443
+ var keys = Object.keys(object);
7444
+ if (Object.getOwnPropertySymbols) {
7445
+ var symbols = Object.getOwnPropertySymbols(object);
7446
+ keys.push.apply(keys, symbols);
7447
+ }
7448
+ return keys;
7449
+ }
7450
+ function _object_spread_props$8(target, source) {
7451
+ source = source != null ? source : {};
7452
+ if (Object.getOwnPropertyDescriptors) {
7453
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7454
+ } else {
7455
+ ownKeys$8(Object(source)).forEach(function(key) {
7456
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7457
+ });
7458
+ }
7459
+ return target;
7460
+ }
7461
+ // MARK: Page Filter
7462
+ /**
7463
+ * Maximum number of records per page for Zoho Desk list endpoints.
7464
+ */ var ZOHO_DESK_MAX_PAGE_LIMIT = 50;
7465
+ /**
7466
+ * Default number of records per page for Zoho Desk list endpoints.
7467
+ */ var ZOHO_DESK_DEFAULT_PAGE_LIMIT = 25;
7468
+ /**
7469
+ * Creates a page factory that wraps a Zoho Desk fetch function with automatic offset-based pagination.
7470
+ *
7471
+ * The factory determines whether additional pages exist by comparing the number of returned records
7472
+ * against the requested `limit`. If `data.length >= limit`, more records are assumed to exist.
7473
+ * The `from` offset is automatically advanced by `limit` for subsequent requests.
7474
+ *
7475
+ * @param fetch - The Zoho Desk fetch function to paginate over
7476
+ * @param defaults - Optional default configuration for the page factory
7477
+ * @returns A page factory that produces iterable page fetchers
7478
+ *
7479
+ * @example
7480
+ * ```typescript
7481
+ * const pageFactory = zohoDeskFetchPageFactory(zohoDeskGetTickets(context));
7482
+ *
7483
+ * const fetchPage = pageFactory({ limit: 25 });
7484
+ * const firstPage = await fetchPage.fetchNext();
7485
+ *
7486
+ * if (firstPage.result.data.length >= 25) {
7487
+ * const secondPage = await firstPage.fetchNext();
7488
+ * }
7489
+ * ```
7490
+ */ function zohoDeskFetchPageFactory(fetch$1, defaults) {
7491
+ return fetch.fetchPageFactory(_object_spread_props$8(_object_spread$8({}, defaults), {
7492
+ fetch: fetch$1,
7493
+ readFetchPageResultInfo: function readFetchPageResultInfo(result) {
7494
+ var _ref;
7495
+ var _result_data;
7496
+ var dataLength = (_ref = (_result_data = result.data) === null || _result_data === void 0 ? void 0 : _result_data.length) !== null && _ref !== void 0 ? _ref : 0;
7497
+ return {
7498
+ hasNext: dataLength > 0 && dataLength >= ZOHO_DESK_DEFAULT_PAGE_LIMIT
7499
+ };
7500
+ },
7501
+ buildInputForNextPage: function buildInputForNextPage(pageResult, input, options) {
7502
+ var _ref, _options_maxItemsPerPage, _input_from;
7503
+ var limit = (_ref = (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.limit) !== null && _ref !== void 0 ? _ref : ZOHO_DESK_DEFAULT_PAGE_LIMIT;
7504
+ var previousFrom = (_input_from = input.from) !== null && _input_from !== void 0 ? _input_from : 1;
7505
+ var nextFrom = previousFrom + limit;
7506
+ return _object_spread_props$8(_object_spread$8({}, input), {
7507
+ from: nextFrom,
7508
+ limit: limit
7509
+ });
7510
+ }
7511
+ }));
7512
+ }
7513
+
7514
+ function _define_property$7(obj, key, value) {
7515
+ if (key in obj) {
7516
+ Object.defineProperty(obj, key, {
7517
+ value: value,
7518
+ enumerable: true,
7519
+ configurable: true,
7520
+ writable: true
7521
+ });
7522
+ } else {
7523
+ obj[key] = value;
7524
+ }
7525
+ return obj;
7526
+ }
7527
+ function _object_spread$7(target) {
7528
+ for(var i = 1; i < arguments.length; i++){
7529
+ var source = arguments[i] != null ? arguments[i] : {};
7530
+ var ownKeys = Object.keys(source);
7531
+ if (typeof Object.getOwnPropertySymbols === "function") {
7532
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7533
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7534
+ }));
7535
+ }
7536
+ ownKeys.forEach(function(key) {
7537
+ _define_property$7(target, key, source[key]);
7538
+ });
7539
+ }
7540
+ return target;
7541
+ }
7542
+ function ownKeys$7(object, enumerableOnly) {
7543
+ var keys = Object.keys(object);
7544
+ if (Object.getOwnPropertySymbols) {
7545
+ var symbols = Object.getOwnPropertySymbols(object);
7546
+ keys.push.apply(keys, symbols);
7547
+ }
7548
+ return keys;
7549
+ }
7550
+ function _object_spread_props$7(target, source) {
7551
+ source = source != null ? source : {};
7552
+ if (Object.getOwnPropertyDescriptors) {
7553
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7554
+ } else {
7555
+ ownKeys$7(Object(source)).forEach(function(key) {
7556
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7557
+ });
7558
+ }
7559
+ return target;
7560
+ }
7561
+ function _object_without_properties$7(source, excluded) {
7562
+ if (source == null) return {};
7563
+ var target = {}, sourceKeys, key, i;
7564
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
7565
+ sourceKeys = Reflect.ownKeys(Object(source));
7566
+ for(i = 0; i < sourceKeys.length; i++){
7567
+ key = sourceKeys[i];
7568
+ if (excluded.indexOf(key) >= 0) continue;
7569
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7570
+ target[key] = source[key];
7571
+ }
7572
+ return target;
7573
+ }
7574
+ target = _object_without_properties_loose$7(source, excluded);
7575
+ if (Object.getOwnPropertySymbols) {
7576
+ sourceKeys = Object.getOwnPropertySymbols(source);
7577
+ for(i = 0; i < sourceKeys.length; i++){
7578
+ key = sourceKeys[i];
7579
+ if (excluded.indexOf(key) >= 0) continue;
7580
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7581
+ target[key] = source[key];
7582
+ }
7583
+ }
7584
+ return target;
7585
+ }
7586
+ function _object_without_properties_loose$7(source, excluded) {
7587
+ if (source == null) return {};
7588
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
7589
+ for(i = 0; i < sourceKeys.length; i++){
7590
+ key = sourceKeys[i];
7591
+ if (excluded.indexOf(key) >= 0) continue;
7592
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7593
+ target[key] = source[key];
7594
+ }
7595
+ return target;
7596
+ }
7597
+ // MARK: Utility
7598
+ /**
7599
+ * Constructs the standard FetchJsonInput used by Desk API calls, pairing the HTTP method with an optional body.
7600
+ *
7601
+ * @param method - HTTP method to use for the request
7602
+ * @param body - Optional request body to include
7603
+ * @returns Configured fetch input for the Zoho Desk API call
7604
+ */ function zohoDeskApiFetchJsonInput(method, body) {
7605
+ return {
7606
+ method: method,
7607
+ body: body !== null && body !== void 0 ? body : undefined
7608
+ };
7609
+ }
7610
+ /**
7611
+ * Builds URL search params from the input objects, omitting keys that are used in the URL path.
7612
+ *
7613
+ * @param input - One or more objects to convert into URL search parameters
7614
+ * @param omitKeys - Keys to exclude from the search params
7615
+ * @returns URL search params string
7616
+ */ function zohoDeskUrlSearchParams(input, omitKeys) {
7617
+ return fetch.makeUrlSearchParams(input, {
7618
+ omitKeys: omitKeys
7619
+ });
7620
+ }
7621
+ /**
7622
+ * Joins include values into a comma-separated string.
7623
+ *
7624
+ * @param include - Single or array of include values
7625
+ * @returns Comma-separated string, or undefined if no values provided
7626
+ */ function joinInclude(include) {
7627
+ var result;
7628
+ if (include) {
7629
+ result = util.joinStringsWithCommas(util.asArray(include));
7630
+ }
7631
+ return result;
7632
+ }
7633
+ /**
7634
+ * Creates a {@link ZohoDeskGetTicketsFunction} bound to the given context.
7635
+ *
7636
+ * Retrieves a paginated list of tickets from Zoho Desk, with optional filtering by
7637
+ * department, status, priority, channel, assignee, and view.
7638
+ *
7639
+ * @param context - Authenticated Zoho Desk context
7640
+ * @returns Function that retrieves paginated tickets
7641
+ */ function zohoDeskGetTickets(context) {
7642
+ return function(input) {
7643
+ var include = input.include, rest = _object_without_properties$7(input, [
7644
+ "include"
7645
+ ]);
7646
+ var params = zohoDeskUrlSearchParams([
7647
+ _object_spread_props$7(_object_spread$7({}, rest), {
7648
+ include: joinInclude(include)
7649
+ })
7650
+ ]);
7651
+ return context.fetchJson("/tickets?".concat(params), zohoDeskApiFetchJsonInput('GET')).then(function(x) {
7652
+ return x !== null && x !== void 0 ? x : {
7653
+ data: []
7654
+ };
7655
+ });
7656
+ };
7657
+ }
7658
+ /**
7659
+ * Creates a {@link ZohoDeskGetTicketByIdFunction} bound to the given context.
7660
+ *
7661
+ * Retrieves a single ticket by its ID, with optional inline expansion of related entities.
7662
+ *
7663
+ * @param context - Authenticated Zoho Desk context
7664
+ * @returns Function that retrieves a single ticket
7665
+ */ function zohoDeskGetTicketById(context) {
7666
+ return function(input) {
7667
+ var ticketId = input.ticketId, include = input.include;
7668
+ var params = zohoDeskUrlSearchParams([
7669
+ {
7670
+ include: joinInclude(include)
7671
+ }
7672
+ ]);
7673
+ var queryString = params.toString();
7674
+ return context.fetchJson("/tickets/".concat(ticketId).concat(queryString ? "?".concat(queryString) : ''), zohoDeskApiFetchJsonInput('GET'));
7675
+ };
7676
+ }
7677
+ /**
7678
+ * Creates a {@link ZohoDeskSearchTicketsFunction} bound to the given context.
7679
+ *
7680
+ * Searches for tickets matching the given filter criteria. Supports filtering by
7681
+ * many fields including subject, email, status, priority, date ranges, and custom fields.
7682
+ *
7683
+ * @param context - Authenticated Zoho Desk context
7684
+ * @returns Function that searches for tickets
7685
+ */ function zohoDeskSearchTickets(context) {
7686
+ return function(input) {
7687
+ var params = zohoDeskUrlSearchParams([
7688
+ input
7689
+ ]);
7690
+ return context.fetchJson("/tickets/search?".concat(params), zohoDeskApiFetchJsonInput('GET')).then(function(x) {
7691
+ return x !== null && x !== void 0 ? x : {
7692
+ data: []
7693
+ };
7694
+ });
7695
+ };
7696
+ }
7697
+ /**
7698
+ * Creates a {@link ZohoDeskGetTicketsForContactFunction} bound to the given context.
7699
+ *
7700
+ * @param context - Authenticated Zoho Desk context
7701
+ * @returns Function that retrieves tickets for a contact
7702
+ */ function zohoDeskGetTicketsForContact(context) {
7703
+ return function(input) {
7704
+ var contactId = input.contactId, include = input.include, rest = _object_without_properties$7(input, [
7705
+ "contactId",
7706
+ "include"
7707
+ ]);
7708
+ var params = zohoDeskUrlSearchParams([
7709
+ _object_spread_props$7(_object_spread$7({}, rest), {
7710
+ include: joinInclude(include)
7711
+ })
7712
+ ]);
7713
+ return context.fetchJson("/contacts/".concat(contactId, "/tickets?").concat(params), zohoDeskApiFetchJsonInput('GET')).then(function(x) {
7714
+ return x !== null && x !== void 0 ? x : {
7715
+ data: []
7716
+ };
7717
+ });
7718
+ };
7719
+ }
7720
+ /**
7721
+ * Creates a {@link ZohoDeskGetTicketsForProductFunction} bound to the given context.
7722
+ *
7723
+ * @param context - Authenticated Zoho Desk context
7724
+ * @returns Function that retrieves tickets for a product
7725
+ */ function zohoDeskGetTicketsForProduct(context) {
7726
+ return function(input) {
7727
+ var productId = input.productId, include = input.include, rest = _object_without_properties$7(input, [
7728
+ "productId",
7729
+ "include"
7730
+ ]);
7731
+ var params = zohoDeskUrlSearchParams([
7732
+ _object_spread_props$7(_object_spread$7({}, rest), {
7733
+ include: joinInclude(include)
7734
+ })
7735
+ ]);
7736
+ return context.fetchJson("/products/".concat(productId, "/tickets?").concat(params), zohoDeskApiFetchJsonInput('GET')).then(function(x) {
7737
+ return x !== null && x !== void 0 ? x : {
7738
+ data: []
7739
+ };
7740
+ });
7741
+ };
7742
+ }
7743
+ /**
7744
+ * Creates a {@link ZohoDeskGetTicketMetricsFunction} bound to the given context.
7745
+ *
7746
+ * @param context - Authenticated Zoho Desk context
7747
+ * @returns Function that retrieves ticket metrics
7748
+ */ function zohoDeskGetTicketMetrics(context) {
7749
+ return function(input) {
7750
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/metrics"), zohoDeskApiFetchJsonInput('GET'));
7751
+ };
7752
+ }
7753
+ /**
7754
+ * Creates a {@link ZohoDeskGetAgentsTicketsCountFunction} bound to the given context.
7755
+ *
7756
+ * @param context - Authenticated Zoho Desk context
7757
+ * @returns Function that retrieves agent ticket counts
7758
+ */ function zohoDeskGetAgentsTicketsCount(context) {
7759
+ return function(input) {
7760
+ var params = zohoDeskUrlSearchParams([
7761
+ {
7762
+ agentIds: util.joinStringsWithCommas(util.asArray(input.agentIds)),
7763
+ departmentId: input.departmentId
7764
+ }
7765
+ ]);
7766
+ return context.fetchJson("/agentsTicketsCount?".concat(params), zohoDeskApiFetchJsonInput('GET'));
7767
+ };
7768
+ }
7769
+ /**
7770
+ * Creates a {@link ZohoDeskGetTicketsPageFactory} bound to the given context.
7771
+ *
7772
+ * Returns a page factory that automatically handles Zoho Desk's offset-based pagination,
7773
+ * making it easy to iterate through all tickets across multiple pages.
7774
+ *
7775
+ * @param context - Authenticated Zoho Desk context
7776
+ * @returns Page factory for iterating over ticket results
7777
+ */ function zohoDeskGetTicketsPageFactory(context) {
7778
+ return zohoDeskFetchPageFactory(zohoDeskGetTickets(context));
7779
+ }
7780
+ /**
7781
+ * Creates a {@link ZohoDeskSearchTicketsPageFactory} bound to the given context.
7782
+ *
7783
+ * @param context - Authenticated Zoho Desk context
7784
+ * @returns Page factory for iterating over search results
7785
+ */ function zohoDeskSearchTicketsPageFactory(context) {
7786
+ return zohoDeskFetchPageFactory(zohoDeskSearchTickets(context));
7787
+ }
7788
+
7789
+ // MARK: Utility
7790
+ function zohoDeskDepartmentApiFetchJsonInput(method) {
7791
+ return {
7792
+ method: method
7793
+ };
7794
+ }
7795
+ /**
7796
+ * Creates a {@link ZohoDeskGetDepartmentsFunction} bound to the given context.
7797
+ *
7798
+ * Retrieves a paginated list of departments from Zoho Desk, with optional filtering
7799
+ * by chat status, search string, and enabled state.
7800
+ *
7801
+ * @param context - Authenticated Zoho Desk context
7802
+ * @returns Function that retrieves paginated departments
7803
+ */ function zohoDeskGetDepartments(context) {
7804
+ return function(input) {
7805
+ var params = fetch.makeUrlSearchParams([
7806
+ input
7807
+ ]);
7808
+ return context.fetchJson("/departments?".concat(params), zohoDeskDepartmentApiFetchJsonInput('GET')).then(function(x) {
7809
+ return x !== null && x !== void 0 ? x : {
7810
+ data: []
7811
+ };
7812
+ });
7813
+ };
7814
+ }
7815
+ /**
7816
+ * Creates a {@link ZohoDeskGetDepartmentByIdFunction} bound to the given context.
7817
+ *
7818
+ * @param context - Authenticated Zoho Desk context
7819
+ * @returns Function that retrieves a single department
7820
+ */ function zohoDeskGetDepartmentById(context) {
7821
+ return function(input) {
7822
+ return context.fetchJson("/departments/".concat(input.departmentId), zohoDeskDepartmentApiFetchJsonInput('GET'));
7823
+ };
7824
+ }
7825
+
7826
+ function _define_property$6(obj, key, value) {
7827
+ if (key in obj) {
7828
+ Object.defineProperty(obj, key, {
7829
+ value: value,
7830
+ enumerable: true,
7831
+ configurable: true,
7832
+ writable: true
7833
+ });
7834
+ } else {
7835
+ obj[key] = value;
7836
+ }
7837
+ return obj;
7838
+ }
7839
+ function _object_spread$6(target) {
7840
+ for(var i = 1; i < arguments.length; i++){
7841
+ var source = arguments[i] != null ? arguments[i] : {};
7842
+ var ownKeys = Object.keys(source);
7843
+ if (typeof Object.getOwnPropertySymbols === "function") {
7844
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7845
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7846
+ }));
7847
+ }
7848
+ ownKeys.forEach(function(key) {
7849
+ _define_property$6(target, key, source[key]);
7850
+ });
7851
+ }
7852
+ return target;
7853
+ }
7854
+ function ownKeys$6(object, enumerableOnly) {
7855
+ var keys = Object.keys(object);
7856
+ if (Object.getOwnPropertySymbols) {
7857
+ var symbols = Object.getOwnPropertySymbols(object);
7858
+ keys.push.apply(keys, symbols);
7859
+ }
7860
+ return keys;
7861
+ }
7862
+ function _object_spread_props$6(target, source) {
7863
+ source = source != null ? source : {};
7864
+ if (Object.getOwnPropertyDescriptors) {
7865
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7866
+ } else {
7867
+ ownKeys$6(Object(source)).forEach(function(key) {
7868
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7869
+ });
7870
+ }
7871
+ return target;
7872
+ }
7873
+ function _object_without_properties$6(source, excluded) {
7874
+ if (source == null) return {};
7875
+ var target = {}, sourceKeys, key, i;
7876
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
7877
+ sourceKeys = Reflect.ownKeys(Object(source));
7878
+ for(i = 0; i < sourceKeys.length; i++){
7879
+ key = sourceKeys[i];
7880
+ if (excluded.indexOf(key) >= 0) continue;
7881
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7882
+ target[key] = source[key];
7883
+ }
7884
+ return target;
7885
+ }
7886
+ target = _object_without_properties_loose$6(source, excluded);
7887
+ if (Object.getOwnPropertySymbols) {
7888
+ sourceKeys = Object.getOwnPropertySymbols(source);
7889
+ for(i = 0; i < sourceKeys.length; i++){
7890
+ key = sourceKeys[i];
7891
+ if (excluded.indexOf(key) >= 0) continue;
7892
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7893
+ target[key] = source[key];
7894
+ }
7895
+ }
7896
+ return target;
7897
+ }
7898
+ function _object_without_properties_loose$6(source, excluded) {
7899
+ if (source == null) return {};
7900
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
7901
+ for(i = 0; i < sourceKeys.length; i++){
7902
+ key = sourceKeys[i];
7903
+ if (excluded.indexOf(key) >= 0) continue;
7904
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7905
+ target[key] = source[key];
7906
+ }
7907
+ return target;
7908
+ }
7909
+ // MARK: Utility
7910
+ function zohoDeskContactApiFetchJsonInput(method) {
7911
+ return {
7912
+ method: method
7913
+ };
7914
+ }
7915
+ /**
7916
+ * Joins include values into a comma-separated string.
7917
+ *
7918
+ * @param include - Single or array of include values
7919
+ * @returns Comma-separated string, or undefined if no values provided
7920
+ */ function joinContactInclude(include) {
7921
+ var result;
7922
+ if (include) {
7923
+ result = util.joinStringsWithCommas(util.asArray(include));
7924
+ }
7925
+ return result;
7926
+ }
7927
+ /**
7928
+ * Creates a {@link ZohoDeskGetContactsFunction} bound to the given context.
7929
+ *
7930
+ * Retrieves a paginated list of contacts from Zoho Desk, with optional sorting,
7931
+ * inline expansion of related entities, and custom view filtering.
7932
+ *
7933
+ * @param context - Authenticated Zoho Desk context
7934
+ * @returns Function that retrieves paginated contacts
7935
+ */ function zohoDeskGetContacts(context) {
7936
+ return function(input) {
7937
+ var include = input.include, rest = _object_without_properties$6(input, [
7938
+ "include"
7939
+ ]);
7940
+ var params = fetch.makeUrlSearchParams([
7941
+ _object_spread_props$6(_object_spread$6({}, rest), {
7942
+ include: joinContactInclude(include)
7943
+ })
7944
+ ]);
7945
+ return context.fetchJson("/contacts?".concat(params), zohoDeskContactApiFetchJsonInput('GET')).then(function(x) {
7946
+ return x !== null && x !== void 0 ? x : {
7947
+ data: []
7948
+ };
7949
+ });
7950
+ };
7951
+ }
7952
+ /**
7953
+ * Creates a {@link ZohoDeskGetContactByIdFunction} bound to the given context.
7954
+ *
7955
+ * @param context - Authenticated Zoho Desk context
7956
+ * @returns Function that retrieves a single contact
7957
+ */ function zohoDeskGetContactById(context) {
7958
+ return function(input) {
7959
+ var contactId = input.contactId, include = input.include;
7960
+ var params = fetch.makeUrlSearchParams([
7961
+ {
7962
+ include: joinContactInclude(include)
7963
+ }
7964
+ ]);
7965
+ var queryString = params.toString();
7966
+ return context.fetchJson("/contacts/".concat(contactId).concat(queryString ? "?".concat(queryString) : ''), zohoDeskContactApiFetchJsonInput('GET'));
7967
+ };
7968
+ }
7969
+ /**
7970
+ * Creates a {@link ZohoDeskGetContactsByIdsFunction} bound to the given context.
7971
+ *
7972
+ * Retrieves multiple contacts in a single request by providing their IDs.
7973
+ *
7974
+ * @param context - Authenticated Zoho Desk context
7975
+ * @returns Function that retrieves contacts by IDs
7976
+ */ function zohoDeskGetContactsByIds(context) {
7977
+ return function(input) {
7978
+ var params = fetch.makeUrlSearchParams([
7979
+ {
7980
+ contactIds: util.joinStringsWithCommas(util.asArray(input.contactIds))
7981
+ }
7982
+ ]);
7983
+ return context.fetchJson("/contacts/contactsByIds?".concat(params), zohoDeskContactApiFetchJsonInput('GET')).then(function(x) {
7984
+ return x !== null && x !== void 0 ? x : [];
7985
+ });
7986
+ };
7987
+ }
7988
+ /**
7989
+ * Creates a {@link ZohoDeskGetContactsPageFactory} bound to the given context.
7990
+ *
7991
+ * @param context - Authenticated Zoho Desk context
7992
+ * @returns Page factory for iterating over contact results
7993
+ */ function zohoDeskGetContactsPageFactory(context) {
7994
+ return zohoDeskFetchPageFactory(zohoDeskGetContacts(context));
7995
+ }
7996
+
7997
+ // MARK: Utility
7998
+ function zohoDeskTagApiFetchJsonInput(method, body) {
7999
+ return {
8000
+ method: method,
8001
+ body: body !== null && body !== void 0 ? body : undefined
8002
+ };
8003
+ }
8004
+ /**
8005
+ * Creates a {@link ZohoDeskGetTicketTagsFunction} bound to the given context.
8006
+ *
8007
+ * @param context - Authenticated Zoho Desk context
8008
+ * @returns Function that retrieves tags for a ticket
8009
+ */ function zohoDeskGetTicketTags(context) {
8010
+ return function(input) {
8011
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/tags"), zohoDeskTagApiFetchJsonInput('GET')).then(function(x) {
8012
+ return x !== null && x !== void 0 ? x : [];
8013
+ });
8014
+ };
8015
+ }
8016
+ /**
8017
+ * Creates a {@link ZohoDeskAssociateTicketTagsFunction} bound to the given context.
8018
+ *
8019
+ * Associates one or more tags with a ticket. If the tag does not exist, it will be created.
8020
+ *
8021
+ * @param context - Authenticated Zoho Desk context
8022
+ * @returns Function that associates tags with a ticket
8023
+ */ function zohoDeskAssociateTicketTags(context) {
8024
+ return function(input) {
8025
+ var body = {
8026
+ tags: util.asArray(input.tags).map(function(name) {
8027
+ return {
8028
+ name: name
8029
+ };
8030
+ })
8031
+ };
8032
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/tags"), zohoDeskTagApiFetchJsonInput('POST', body)).then(function(x) {
8033
+ return x !== null && x !== void 0 ? x : [];
8034
+ });
8035
+ };
8036
+ }
8037
+ /**
8038
+ * Creates a {@link ZohoDeskDissociateTicketTagFunction} bound to the given context.
8039
+ *
8040
+ * @param context - Authenticated Zoho Desk context
8041
+ * @returns Function that removes a tag from a ticket
8042
+ */ function zohoDeskDissociateTicketTag(context) {
8043
+ return function(input) {
8044
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/tags/").concat(input.tagId), zohoDeskTagApiFetchJsonInput('DELETE'));
8045
+ };
8046
+ }
8047
+ /**
8048
+ * Creates a {@link ZohoDeskSearchTagsFunction} bound to the given context.
8049
+ *
8050
+ * @param context - Authenticated Zoho Desk context
8051
+ * @returns Function that searches for tags
8052
+ */ function zohoDeskSearchTags(context) {
8053
+ return function(input) {
8054
+ var params = fetch.makeUrlSearchParams([
8055
+ input
8056
+ ]);
8057
+ return context.fetchJson("/tags/search?".concat(params), zohoDeskTagApiFetchJsonInput('GET')).then(function(x) {
8058
+ return x !== null && x !== void 0 ? x : {
8059
+ data: []
8060
+ };
8061
+ });
8062
+ };
8063
+ }
8064
+ /**
8065
+ * Creates a {@link ZohoDeskGetAllTagsFunction} bound to the given context.
8066
+ *
8067
+ * @param context - Authenticated Zoho Desk context
8068
+ * @returns Function that retrieves all tags
8069
+ */ function zohoDeskGetAllTags(context) {
8070
+ return function(input) {
8071
+ var params = fetch.makeUrlSearchParams([
8072
+ input
8073
+ ]);
8074
+ return context.fetchJson("/ticketTags?".concat(params), zohoDeskTagApiFetchJsonInput('GET')).then(function(x) {
8075
+ return x !== null && x !== void 0 ? x : {
8076
+ data: []
8077
+ };
8078
+ });
8079
+ };
8080
+ }
8081
+
8082
+ // MARK: Utility
8083
+ function zohoDeskFollowerApiFetchJsonInput(method, body) {
8084
+ return {
8085
+ method: method,
8086
+ body: body !== null && body !== void 0 ? body : undefined
8087
+ };
8088
+ }
8089
+ /**
8090
+ * Creates a {@link ZohoDeskGetTicketFollowersFunction} bound to the given context.
8091
+ *
8092
+ * @param context - Authenticated Zoho Desk context
8093
+ * @returns Function that retrieves followers for a ticket
8094
+ */ function zohoDeskGetTicketFollowers(context) {
8095
+ return function(input) {
8096
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/followers"), zohoDeskFollowerApiFetchJsonInput('GET')).then(function(x) {
8097
+ return x !== null && x !== void 0 ? x : [];
8098
+ });
8099
+ };
8100
+ }
8101
+ /**
8102
+ * Creates a {@link ZohoDeskAddTicketFollowersFunction} bound to the given context.
8103
+ *
8104
+ * @param context - Authenticated Zoho Desk context
8105
+ * @returns Function that adds followers to a ticket
8106
+ */ function zohoDeskAddTicketFollowers(context) {
8107
+ return function(input) {
8108
+ var body = {
8109
+ ids: util.asArray(input.agentIds)
8110
+ };
8111
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/followers"), zohoDeskFollowerApiFetchJsonInput('POST', body));
8112
+ };
8113
+ }
8114
+ /**
8115
+ * Creates a {@link ZohoDeskRemoveTicketFollowersFunction} bound to the given context.
8116
+ *
8117
+ * @param context - Authenticated Zoho Desk context
8118
+ * @returns Function that removes followers from a ticket
8119
+ */ function zohoDeskRemoveTicketFollowers(context) {
8120
+ return function(input) {
8121
+ var body = {
8122
+ ids: util.asArray(input.agentIds)
8123
+ };
8124
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/followers"), zohoDeskFollowerApiFetchJsonInput('DELETE', body));
8125
+ };
8126
+ }
8127
+
8128
+ function _define_property$5(obj, key, value) {
8129
+ if (key in obj) {
8130
+ Object.defineProperty(obj, key, {
8131
+ value: value,
8132
+ enumerable: true,
8133
+ configurable: true,
8134
+ writable: true
8135
+ });
8136
+ } else {
8137
+ obj[key] = value;
8138
+ }
8139
+ return obj;
8140
+ }
8141
+ function _object_spread$5(target) {
8142
+ for(var i = 1; i < arguments.length; i++){
8143
+ var source = arguments[i] != null ? arguments[i] : {};
8144
+ var ownKeys = Object.keys(source);
8145
+ if (typeof Object.getOwnPropertySymbols === "function") {
8146
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
8147
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
8148
+ }));
8149
+ }
8150
+ ownKeys.forEach(function(key) {
8151
+ _define_property$5(target, key, source[key]);
8152
+ });
8153
+ }
8154
+ return target;
8155
+ }
8156
+ function ownKeys$5(object, enumerableOnly) {
8157
+ var keys = Object.keys(object);
8158
+ if (Object.getOwnPropertySymbols) {
8159
+ var symbols = Object.getOwnPropertySymbols(object);
8160
+ keys.push.apply(keys, symbols);
8161
+ }
8162
+ return keys;
8163
+ }
8164
+ function _object_spread_props$5(target, source) {
8165
+ source = source != null ? source : {};
8166
+ if (Object.getOwnPropertyDescriptors) {
8167
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8168
+ } else {
8169
+ ownKeys$5(Object(source)).forEach(function(key) {
8170
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8171
+ });
8172
+ }
8173
+ return target;
8174
+ }
8175
+ function _object_without_properties$5(source, excluded) {
8176
+ if (source == null) return {};
8177
+ var target = {}, sourceKeys, key, i;
8178
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
8179
+ sourceKeys = Reflect.ownKeys(Object(source));
8180
+ for(i = 0; i < sourceKeys.length; i++){
8181
+ key = sourceKeys[i];
8182
+ if (excluded.indexOf(key) >= 0) continue;
8183
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8184
+ target[key] = source[key];
8185
+ }
8186
+ return target;
8187
+ }
8188
+ target = _object_without_properties_loose$5(source, excluded);
8189
+ if (Object.getOwnPropertySymbols) {
8190
+ sourceKeys = Object.getOwnPropertySymbols(source);
8191
+ for(i = 0; i < sourceKeys.length; i++){
8192
+ key = sourceKeys[i];
8193
+ if (excluded.indexOf(key) >= 0) continue;
8194
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8195
+ target[key] = source[key];
8196
+ }
8197
+ }
8198
+ return target;
8199
+ }
8200
+ function _object_without_properties_loose$5(source, excluded) {
8201
+ if (source == null) return {};
8202
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
8203
+ for(i = 0; i < sourceKeys.length; i++){
8204
+ key = sourceKeys[i];
8205
+ if (excluded.indexOf(key) >= 0) continue;
8206
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8207
+ target[key] = source[key];
8208
+ }
8209
+ return target;
8210
+ }
8211
+ // MARK: Utility
8212
+ function zohoDeskAttachmentApiFetchJsonInput(method, body) {
8213
+ return {
8214
+ method: method,
8215
+ body: body !== null && body !== void 0 ? body : undefined
8216
+ };
8217
+ }
8218
+ function joinAttachmentInclude(include) {
8219
+ var result;
8220
+ if (include) {
8221
+ result = util.joinStringsWithCommas(util.asArray(include));
8222
+ }
8223
+ return result;
8224
+ }
8225
+ /**
8226
+ * Creates a {@link ZohoDeskGetTicketAttachmentsFunction} bound to the given context.
8227
+ *
8228
+ * @param context - Authenticated Zoho Desk context
8229
+ * @returns Function that retrieves attachments for a ticket
8230
+ */ function zohoDeskGetTicketAttachments(context) {
8231
+ return function(input) {
8232
+ var ticketId = input.ticketId, include = input.include, rest = _object_without_properties$5(input, [
8233
+ "ticketId",
8234
+ "include"
8235
+ ]);
8236
+ var params = fetch.makeUrlSearchParams([
8237
+ _object_spread_props$5(_object_spread$5({}, rest), {
8238
+ include: joinAttachmentInclude(include)
8239
+ })
8240
+ ]);
8241
+ return context.fetchJson("/tickets/".concat(ticketId, "/attachments?").concat(params), zohoDeskAttachmentApiFetchJsonInput('GET')).then(function(x) {
8242
+ return x !== null && x !== void 0 ? x : {
8243
+ data: []
8244
+ };
8245
+ });
8246
+ };
8247
+ }
8248
+ /**
8249
+ * Creates a {@link ZohoDeskDeleteTicketAttachmentFunction} bound to the given context.
8250
+ *
8251
+ * @param context - Authenticated Zoho Desk context
8252
+ * @returns Function that deletes a ticket attachment
8253
+ */ function zohoDeskDeleteTicketAttachment(context) {
8254
+ return function(input) {
8255
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/attachments/").concat(input.attachmentId), zohoDeskAttachmentApiFetchJsonInput('DELETE'));
8256
+ };
8257
+ }
8258
+
8259
+ function _define_property$4(obj, key, value) {
8260
+ if (key in obj) {
8261
+ Object.defineProperty(obj, key, {
8262
+ value: value,
8263
+ enumerable: true,
8264
+ configurable: true,
8265
+ writable: true
8266
+ });
8267
+ } else {
8268
+ obj[key] = value;
8269
+ }
8270
+ return obj;
8271
+ }
8272
+ function _object_spread$4(target) {
8273
+ for(var i = 1; i < arguments.length; i++){
8274
+ var source = arguments[i] != null ? arguments[i] : {};
8275
+ var ownKeys = Object.keys(source);
8276
+ if (typeof Object.getOwnPropertySymbols === "function") {
8277
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
8278
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
8279
+ }));
8280
+ }
8281
+ ownKeys.forEach(function(key) {
8282
+ _define_property$4(target, key, source[key]);
8283
+ });
8284
+ }
8285
+ return target;
8286
+ }
8287
+ function ownKeys$4(object, enumerableOnly) {
8288
+ var keys = Object.keys(object);
8289
+ if (Object.getOwnPropertySymbols) {
8290
+ var symbols = Object.getOwnPropertySymbols(object);
8291
+ keys.push.apply(keys, symbols);
8292
+ }
8293
+ return keys;
8294
+ }
8295
+ function _object_spread_props$4(target, source) {
8296
+ source = source != null ? source : {};
8297
+ if (Object.getOwnPropertyDescriptors) {
8298
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8299
+ } else {
8300
+ ownKeys$4(Object(source)).forEach(function(key) {
8301
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8302
+ });
8303
+ }
8304
+ return target;
8305
+ }
8306
+ function _object_without_properties$4(source, excluded) {
8307
+ if (source == null) return {};
8308
+ var target = {}, sourceKeys, key, i;
8309
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
8310
+ sourceKeys = Reflect.ownKeys(Object(source));
8311
+ for(i = 0; i < sourceKeys.length; i++){
8312
+ key = sourceKeys[i];
8313
+ if (excluded.indexOf(key) >= 0) continue;
8314
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8315
+ target[key] = source[key];
8316
+ }
8317
+ return target;
8318
+ }
8319
+ target = _object_without_properties_loose$4(source, excluded);
8320
+ if (Object.getOwnPropertySymbols) {
8321
+ sourceKeys = Object.getOwnPropertySymbols(source);
8322
+ for(i = 0; i < sourceKeys.length; i++){
8323
+ key = sourceKeys[i];
8324
+ if (excluded.indexOf(key) >= 0) continue;
8325
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8326
+ target[key] = source[key];
8327
+ }
8328
+ }
8329
+ return target;
8330
+ }
8331
+ function _object_without_properties_loose$4(source, excluded) {
8332
+ if (source == null) return {};
8333
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
8334
+ for(i = 0; i < sourceKeys.length; i++){
8335
+ key = sourceKeys[i];
8336
+ if (excluded.indexOf(key) >= 0) continue;
8337
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8338
+ target[key] = source[key];
8339
+ }
8340
+ return target;
8341
+ }
8342
+ // MARK: Utility
8343
+ function zohoDeskCommentApiFetchJsonInput(method, body) {
8344
+ return {
8345
+ method: method,
8346
+ body: body !== null && body !== void 0 ? body : undefined
8347
+ };
8348
+ }
8349
+ function joinCommentInclude(include) {
8350
+ var result;
8351
+ if (include) {
8352
+ result = util.joinStringsWithCommas(util.asArray(include));
8353
+ }
8354
+ return result;
8355
+ }
8356
+ /**
8357
+ * Creates a {@link ZohoDeskGetTicketCommentsFunction} bound to the given context.
8358
+ *
8359
+ * @param context - Authenticated Zoho Desk context
8360
+ * @returns Function that retrieves comments for a ticket
8361
+ */ function zohoDeskGetTicketComments(context) {
8362
+ return function(input) {
8363
+ var ticketId = input.ticketId, include = input.include, rest = _object_without_properties$4(input, [
8364
+ "ticketId",
8365
+ "include"
8366
+ ]);
8367
+ var params = fetch.makeUrlSearchParams([
8368
+ _object_spread_props$4(_object_spread$4({}, rest), {
8369
+ include: joinCommentInclude(include)
8370
+ })
8371
+ ]);
8372
+ return context.fetchJson("/tickets/".concat(ticketId, "/comments?").concat(params), zohoDeskCommentApiFetchJsonInput('GET')).then(function(x) {
8373
+ return x !== null && x !== void 0 ? x : {
8374
+ data: []
8375
+ };
8376
+ });
8377
+ };
8378
+ }
8379
+ /**
8380
+ * Creates a {@link ZohoDeskGetTicketCommentByIdFunction} bound to the given context.
8381
+ *
8382
+ * @param context - Authenticated Zoho Desk context
8383
+ * @returns Function that retrieves a single comment
8384
+ */ function zohoDeskGetTicketCommentById(context) {
8385
+ return function(input) {
8386
+ var ticketId = input.ticketId, commentId = input.commentId, include = input.include;
8387
+ var params = fetch.makeUrlSearchParams([
8388
+ {
8389
+ include: joinCommentInclude(include)
8390
+ }
8391
+ ]);
8392
+ var queryString = params.toString();
8393
+ return context.fetchJson("/tickets/".concat(ticketId, "/comments/").concat(commentId).concat(queryString ? "?".concat(queryString) : ''), zohoDeskCommentApiFetchJsonInput('GET'));
8394
+ };
8395
+ }
8396
+ /**
8397
+ * Creates a {@link ZohoDeskCreateTicketCommentFunction} bound to the given context.
8398
+ *
8399
+ * @param context - Authenticated Zoho Desk context
8400
+ * @returns Function that creates a comment on a ticket
8401
+ */ function zohoDeskCreateTicketComment(context) {
8402
+ return function(input) {
8403
+ var ticketId = input.ticketId, body = _object_without_properties$4(input, [
8404
+ "ticketId"
8405
+ ]);
8406
+ return context.fetchJson("/tickets/".concat(ticketId, "/comments"), zohoDeskCommentApiFetchJsonInput('POST', body));
8407
+ };
8408
+ }
8409
+ /**
8410
+ * Creates a {@link ZohoDeskDeleteTicketCommentFunction} bound to the given context.
8411
+ *
8412
+ * @param context - Authenticated Zoho Desk context
8413
+ * @returns Function that deletes a comment from a ticket
8414
+ */ function zohoDeskDeleteTicketComment(context) {
8415
+ return function(input) {
8416
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/comments/").concat(input.commentId), zohoDeskCommentApiFetchJsonInput('DELETE'));
8417
+ };
8418
+ }
8419
+
8420
+ function _object_without_properties$3(source, excluded) {
8421
+ if (source == null) return {};
8422
+ var target = {}, sourceKeys, key, i;
8423
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
8424
+ sourceKeys = Reflect.ownKeys(Object(source));
8425
+ for(i = 0; i < sourceKeys.length; i++){
8426
+ key = sourceKeys[i];
8427
+ if (excluded.indexOf(key) >= 0) continue;
8428
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8429
+ target[key] = source[key];
8430
+ }
8431
+ return target;
8432
+ }
8433
+ target = _object_without_properties_loose$3(source, excluded);
8434
+ if (Object.getOwnPropertySymbols) {
8435
+ sourceKeys = Object.getOwnPropertySymbols(source);
8436
+ for(i = 0; i < sourceKeys.length; i++){
8437
+ key = sourceKeys[i];
8438
+ if (excluded.indexOf(key) >= 0) continue;
8439
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8440
+ target[key] = source[key];
8441
+ }
8442
+ }
8443
+ return target;
8444
+ }
8445
+ function _object_without_properties_loose$3(source, excluded) {
8446
+ if (source == null) return {};
8447
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
8448
+ for(i = 0; i < sourceKeys.length; i++){
8449
+ key = sourceKeys[i];
8450
+ if (excluded.indexOf(key) >= 0) continue;
8451
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8452
+ target[key] = source[key];
8453
+ }
8454
+ return target;
8455
+ }
8456
+ // MARK: Utility
8457
+ function zohoDeskTimeApiFetchJsonInput(method, body) {
8458
+ return {
8459
+ method: method,
8460
+ body: body !== null && body !== void 0 ? body : undefined
8461
+ };
8462
+ }
8463
+ /**
8464
+ * Creates a {@link ZohoDeskGetTicketTimerFunction} bound to the given context.
8465
+ *
8466
+ * @param context - Authenticated Zoho Desk context
8467
+ * @returns Function that retrieves the ticket timer
8468
+ */ function zohoDeskGetTicketTimer(context) {
8469
+ return function(input) {
8470
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/timer"), zohoDeskTimeApiFetchJsonInput('GET'));
8471
+ };
8472
+ }
8473
+ /**
8474
+ * Creates a {@link ZohoDeskPerformTicketTimerActionFunction} bound to the given context.
8475
+ *
8476
+ * @param context - Authenticated Zoho Desk context
8477
+ * @returns Function that performs a timer action on a ticket
8478
+ */ function zohoDeskPerformTicketTimerAction(context) {
8479
+ return function(input) {
8480
+ var ticketId = input.ticketId, body = _object_without_properties$3(input, [
8481
+ "ticketId"
8482
+ ]);
8483
+ return context.fetchJson("/tickets/".concat(ticketId, "/timer"), zohoDeskTimeApiFetchJsonInput('POST', body));
8484
+ };
8485
+ }
8486
+ /**
8487
+ * Creates a {@link ZohoDeskGetTicketTimeEntriesFunction} bound to the given context.
8488
+ *
8489
+ * @param context - Authenticated Zoho Desk context
8490
+ * @returns Function that retrieves time entries for a ticket
8491
+ */ function zohoDeskGetTicketTimeEntries(context) {
8492
+ return function(input) {
8493
+ var ticketId = input.ticketId, rest = _object_without_properties$3(input, [
8494
+ "ticketId"
8495
+ ]);
8496
+ var params = fetch.makeUrlSearchParams([
8497
+ rest
8498
+ ]);
8499
+ return context.fetchJson("/tickets/".concat(ticketId, "/timeEntries?").concat(params), zohoDeskTimeApiFetchJsonInput('GET')).then(function(x) {
8500
+ return x !== null && x !== void 0 ? x : {
8501
+ data: []
8502
+ };
8503
+ });
8504
+ };
8505
+ }
8506
+ /**
8507
+ * Creates a {@link ZohoDeskGetTicketTimeEntryByIdFunction} bound to the given context.
8508
+ *
8509
+ * @param context - Authenticated Zoho Desk context
8510
+ * @returns Function that retrieves a single time entry
8511
+ */ function zohoDeskGetTicketTimeEntryById(context) {
8512
+ return function(input) {
8513
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/timeEntries/").concat(input.timeEntryId), zohoDeskTimeApiFetchJsonInput('GET'));
8514
+ };
8515
+ }
8516
+ /**
8517
+ * Creates a {@link ZohoDeskGetTicketTimeEntrySummationFunction} bound to the given context.
8518
+ *
8519
+ * @param context - Authenticated Zoho Desk context
8520
+ * @returns Function that retrieves time entry summation
8521
+ */ function zohoDeskGetTicketTimeEntrySummation(context) {
8522
+ return function(input) {
8523
+ return context.fetchJson("/tickets/".concat(input.ticketId, "/timeEntries/summation"), zohoDeskTimeApiFetchJsonInput('GET'));
8524
+ };
8525
+ }
8526
+
8527
+ function _define_property$3(obj, key, value) {
8528
+ if (key in obj) {
8529
+ Object.defineProperty(obj, key, {
8530
+ value: value,
8531
+ enumerable: true,
8532
+ configurable: true,
8533
+ writable: true
8534
+ });
8535
+ } else {
8536
+ obj[key] = value;
8537
+ }
8538
+ return obj;
8539
+ }
8540
+ function _object_spread$3(target) {
8541
+ for(var i = 1; i < arguments.length; i++){
8542
+ var source = arguments[i] != null ? arguments[i] : {};
8543
+ var ownKeys = Object.keys(source);
8544
+ if (typeof Object.getOwnPropertySymbols === "function") {
8545
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
8546
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
8547
+ }));
8548
+ }
8549
+ ownKeys.forEach(function(key) {
8550
+ _define_property$3(target, key, source[key]);
8551
+ });
8552
+ }
8553
+ return target;
8554
+ }
8555
+ function ownKeys$3(object, enumerableOnly) {
8556
+ var keys = Object.keys(object);
8557
+ if (Object.getOwnPropertySymbols) {
8558
+ var symbols = Object.getOwnPropertySymbols(object);
8559
+ keys.push.apply(keys, symbols);
8560
+ }
8561
+ return keys;
8562
+ }
8563
+ function _object_spread_props$3(target, source) {
8564
+ source = source != null ? source : {};
8565
+ if (Object.getOwnPropertyDescriptors) {
8566
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8567
+ } else {
8568
+ ownKeys$3(Object(source)).forEach(function(key) {
8569
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8570
+ });
8571
+ }
8572
+ return target;
8573
+ }
8574
+ function _object_without_properties$2(source, excluded) {
8575
+ if (source == null) return {};
8576
+ var target = {}, sourceKeys, key, i;
8577
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
8578
+ sourceKeys = Reflect.ownKeys(Object(source));
8579
+ for(i = 0; i < sourceKeys.length; i++){
8580
+ key = sourceKeys[i];
8581
+ if (excluded.indexOf(key) >= 0) continue;
8582
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8583
+ target[key] = source[key];
8584
+ }
8585
+ return target;
8586
+ }
8587
+ target = _object_without_properties_loose$2(source, excluded);
8588
+ if (Object.getOwnPropertySymbols) {
8589
+ sourceKeys = Object.getOwnPropertySymbols(source);
8590
+ for(i = 0; i < sourceKeys.length; i++){
8591
+ key = sourceKeys[i];
8592
+ if (excluded.indexOf(key) >= 0) continue;
8593
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8594
+ target[key] = source[key];
8595
+ }
8596
+ }
8597
+ return target;
8598
+ }
8599
+ function _object_without_properties_loose$2(source, excluded) {
8600
+ if (source == null) return {};
8601
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
8602
+ for(i = 0; i < sourceKeys.length; i++){
8603
+ key = sourceKeys[i];
8604
+ if (excluded.indexOf(key) >= 0) continue;
8605
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8606
+ target[key] = source[key];
8607
+ }
8608
+ return target;
8609
+ }
8610
+ // MARK: Utility
8611
+ function zohoDeskThreadApiFetchJsonInput(method) {
8612
+ return {
8613
+ method: method
8614
+ };
8615
+ }
8616
+ function joinThreadInclude(include) {
8617
+ var result;
8618
+ if (include) {
8619
+ result = util.joinStringsWithCommas(util.asArray(include));
8620
+ }
8621
+ return result;
8622
+ }
8623
+ /**
8624
+ * Creates a {@link ZohoDeskGetTicketThreadsFunction} bound to the given context.
8625
+ *
8626
+ * Retrieves a paginated list of conversation threads (emails, replies, notes) for a ticket.
8627
+ *
8628
+ * @param context - Authenticated Zoho Desk context
8629
+ * @returns Function that retrieves threads for a ticket
8630
+ */ function zohoDeskGetTicketThreads(context) {
8631
+ return function(input) {
8632
+ var ticketId = input.ticketId, include = input.include, rest = _object_without_properties$2(input, [
8633
+ "ticketId",
8634
+ "include"
8635
+ ]);
8636
+ var params = fetch.makeUrlSearchParams([
8637
+ _object_spread_props$3(_object_spread$3({}, rest), {
8638
+ include: joinThreadInclude(include)
8639
+ })
8640
+ ]);
8641
+ return context.fetchJson("/tickets/".concat(ticketId, "/threads?").concat(params), zohoDeskThreadApiFetchJsonInput('GET')).then(function(x) {
8642
+ return x !== null && x !== void 0 ? x : {
8643
+ data: []
8644
+ };
8645
+ });
8646
+ };
8647
+ }
8648
+ /**
8649
+ * Creates a {@link ZohoDeskGetTicketThreadByIdFunction} bound to the given context.
8650
+ *
8651
+ * @param context - Authenticated Zoho Desk context
8652
+ * @returns Function that retrieves a single thread
8653
+ */ function zohoDeskGetTicketThreadById(context) {
8654
+ return function(input) {
8655
+ var ticketId = input.ticketId, threadId = input.threadId, include = input.include;
8656
+ var params = fetch.makeUrlSearchParams([
8657
+ {
8658
+ include: joinThreadInclude(include)
8659
+ }
8660
+ ]);
8661
+ var queryString = params.toString();
8662
+ return context.fetchJson("/tickets/".concat(ticketId, "/threads/").concat(threadId).concat(queryString ? "?".concat(queryString) : ''), zohoDeskThreadApiFetchJsonInput('GET'));
8663
+ };
8664
+ }
8665
+ /**
8666
+ * Creates a {@link ZohoDeskGetTicketThreadsPageFactory} bound to the given context.
8667
+ *
8668
+ * @param context - Authenticated Zoho Desk context
8669
+ * @returns Page factory for iterating over thread results
8670
+ */ function zohoDeskGetTicketThreadsPageFactory(context) {
8671
+ return zohoDeskFetchPageFactory(zohoDeskGetTicketThreads(context));
8672
+ }
8673
+
8674
+ function _define_property$2(obj, key, value) {
8675
+ if (key in obj) {
8676
+ Object.defineProperty(obj, key, {
8677
+ value: value,
8678
+ enumerable: true,
8679
+ configurable: true,
8680
+ writable: true
8681
+ });
8682
+ } else {
8683
+ obj[key] = value;
8684
+ }
8685
+ return obj;
8686
+ }
8687
+ function _object_spread$2(target) {
8688
+ for(var i = 1; i < arguments.length; i++){
8689
+ var source = arguments[i] != null ? arguments[i] : {};
8690
+ var ownKeys = Object.keys(source);
8691
+ if (typeof Object.getOwnPropertySymbols === "function") {
8692
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
8693
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
8694
+ }));
8695
+ }
8696
+ ownKeys.forEach(function(key) {
8697
+ _define_property$2(target, key, source[key]);
8698
+ });
8699
+ }
8700
+ return target;
8701
+ }
8702
+ function ownKeys$2(object, enumerableOnly) {
8703
+ var keys = Object.keys(object);
8704
+ if (Object.getOwnPropertySymbols) {
8705
+ var symbols = Object.getOwnPropertySymbols(object);
8706
+ keys.push.apply(keys, symbols);
8707
+ }
8708
+ return keys;
8709
+ }
8710
+ function _object_spread_props$2(target, source) {
8711
+ source = source != null ? source : {};
8712
+ if (Object.getOwnPropertyDescriptors) {
8713
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8714
+ } else {
8715
+ ownKeys$2(Object(source)).forEach(function(key) {
8716
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8717
+ });
8718
+ }
8719
+ return target;
8720
+ }
8721
+ function _object_without_properties$1(source, excluded) {
8722
+ if (source == null) return {};
8723
+ var target = {}, sourceKeys, key, i;
8724
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
8725
+ sourceKeys = Reflect.ownKeys(Object(source));
8726
+ for(i = 0; i < sourceKeys.length; i++){
8727
+ key = sourceKeys[i];
8728
+ if (excluded.indexOf(key) >= 0) continue;
8729
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8730
+ target[key] = source[key];
8731
+ }
8732
+ return target;
8733
+ }
8734
+ target = _object_without_properties_loose$1(source, excluded);
8735
+ if (Object.getOwnPropertySymbols) {
8736
+ sourceKeys = Object.getOwnPropertySymbols(source);
8737
+ for(i = 0; i < sourceKeys.length; i++){
8738
+ key = sourceKeys[i];
8739
+ if (excluded.indexOf(key) >= 0) continue;
8740
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8741
+ target[key] = source[key];
8742
+ }
8743
+ }
8744
+ return target;
8745
+ }
8746
+ function _object_without_properties_loose$1(source, excluded) {
8747
+ if (source == null) return {};
8748
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
8749
+ for(i = 0; i < sourceKeys.length; i++){
8750
+ key = sourceKeys[i];
8751
+ if (excluded.indexOf(key) >= 0) continue;
8752
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8753
+ target[key] = source[key];
8754
+ }
8755
+ return target;
8756
+ }
8757
+ // MARK: Utility
8758
+ function zohoDeskActivityApiFetchJsonInput(method) {
8759
+ return {
8760
+ method: method
8761
+ };
8762
+ }
8763
+ function joinActivityInclude(include) {
8764
+ var result;
8765
+ if (include) {
8766
+ result = util.joinStringsWithCommas(util.asArray(include));
8767
+ }
8768
+ return result;
8769
+ }
8770
+ /**
8771
+ * Creates a {@link ZohoDeskGetTicketActivitiesFunction} bound to the given context.
8772
+ *
8773
+ * Retrieves a paginated list of activities (tasks, events, calls) associated with a ticket.
8774
+ *
8775
+ * @param context - Authenticated Zoho Desk context
8776
+ * @returns Function that retrieves activities for a ticket
8777
+ */ function zohoDeskGetTicketActivities(context) {
8778
+ return function(input) {
8779
+ var ticketId = input.ticketId, include = input.include, rest = _object_without_properties$1(input, [
8780
+ "ticketId",
8781
+ "include"
8782
+ ]);
8783
+ var params = fetch.makeUrlSearchParams([
8784
+ _object_spread_props$2(_object_spread$2({}, rest), {
8785
+ include: joinActivityInclude(include)
8786
+ })
8787
+ ]);
8788
+ return context.fetchJson("/tickets/".concat(ticketId, "/activities?").concat(params), zohoDeskActivityApiFetchJsonInput('GET')).then(function(x) {
8789
+ return x !== null && x !== void 0 ? x : {
8790
+ data: []
8791
+ };
8792
+ });
8793
+ };
8794
+ }
8795
+ /**
8796
+ * Creates a {@link ZohoDeskGetTicketActivitiesPageFactory} bound to the given context.
8797
+ *
8798
+ * @param context - Authenticated Zoho Desk context
8799
+ * @returns Page factory for iterating over activity results
8800
+ */ function zohoDeskGetTicketActivitiesPageFactory(context) {
8801
+ return zohoDeskFetchPageFactory(zohoDeskGetTicketActivities(context));
8802
+ }
8803
+
8804
+ function _define_property$1(obj, key, value) {
8805
+ if (key in obj) {
8806
+ Object.defineProperty(obj, key, {
8807
+ value: value,
8808
+ enumerable: true,
8809
+ configurable: true,
8810
+ writable: true
8811
+ });
8812
+ } else {
8813
+ obj[key] = value;
8814
+ }
8815
+ return obj;
8816
+ }
8817
+ function _object_spread$1(target) {
8818
+ for(var i = 1; i < arguments.length; i++){
8819
+ var source = arguments[i] != null ? arguments[i] : {};
8820
+ var ownKeys = Object.keys(source);
8821
+ if (typeof Object.getOwnPropertySymbols === "function") {
8822
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
8823
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
8824
+ }));
8825
+ }
8826
+ ownKeys.forEach(function(key) {
8827
+ _define_property$1(target, key, source[key]);
8828
+ });
8829
+ }
8830
+ return target;
8831
+ }
8832
+ function ownKeys$1(object, enumerableOnly) {
8833
+ var keys = Object.keys(object);
8834
+ if (Object.getOwnPropertySymbols) {
8835
+ var symbols = Object.getOwnPropertySymbols(object);
8836
+ keys.push.apply(keys, symbols);
8837
+ }
8838
+ return keys;
8839
+ }
8840
+ function _object_spread_props$1(target, source) {
8841
+ source = source != null ? source : {};
8842
+ if (Object.getOwnPropertyDescriptors) {
8843
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8844
+ } else {
8845
+ ownKeys$1(Object(source)).forEach(function(key) {
8846
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8847
+ });
8848
+ }
8849
+ return target;
8850
+ }
8851
+ function _object_without_properties(source, excluded) {
8852
+ if (source == null) return {};
8853
+ var target = {}, sourceKeys, key, i;
8854
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
8855
+ sourceKeys = Reflect.ownKeys(Object(source));
8856
+ for(i = 0; i < sourceKeys.length; i++){
8857
+ key = sourceKeys[i];
8858
+ if (excluded.indexOf(key) >= 0) continue;
8859
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8860
+ target[key] = source[key];
8861
+ }
8862
+ return target;
8863
+ }
8864
+ target = _object_without_properties_loose(source, excluded);
8865
+ if (Object.getOwnPropertySymbols) {
8866
+ sourceKeys = Object.getOwnPropertySymbols(source);
8867
+ for(i = 0; i < sourceKeys.length; i++){
8868
+ key = sourceKeys[i];
8869
+ if (excluded.indexOf(key) >= 0) continue;
8870
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8871
+ target[key] = source[key];
8872
+ }
8873
+ }
8874
+ return target;
8875
+ }
8876
+ function _object_without_properties_loose(source, excluded) {
8877
+ if (source == null) return {};
8878
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
8879
+ for(i = 0; i < sourceKeys.length; i++){
8880
+ key = sourceKeys[i];
8881
+ if (excluded.indexOf(key) >= 0) continue;
8882
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8883
+ target[key] = source[key];
8884
+ }
8885
+ return target;
8886
+ }
8887
+ // MARK: Utility
8888
+ function zohoDeskAgentApiFetchJsonInput(method) {
8889
+ return {
8890
+ method: method
8891
+ };
8892
+ }
8893
+ function joinAgentInclude(include) {
8894
+ var result;
8895
+ if (include) {
8896
+ result = util.joinStringsWithCommas(util.asArray(include));
8897
+ }
8898
+ return result;
8899
+ }
8900
+ /**
8901
+ * Creates a {@link ZohoDeskGetAgentsFunction} bound to the given context.
8902
+ *
8903
+ * Retrieves a paginated list of agents, with optional filtering by department and status,
8904
+ * and inline expansion of related entities (role, profile, departments).
8905
+ *
8906
+ * @param context - Authenticated Zoho Desk context
8907
+ * @returns Function that retrieves paginated agents
8908
+ */ function zohoDeskGetAgents(context) {
8909
+ return function(input) {
8910
+ var include = input.include, rest = _object_without_properties(input, [
8911
+ "include"
8912
+ ]);
8913
+ var params = fetch.makeUrlSearchParams([
8914
+ _object_spread_props$1(_object_spread$1({}, rest), {
8915
+ include: joinAgentInclude(include)
8916
+ })
8917
+ ]);
8918
+ return context.fetchJson("/agents?".concat(params), zohoDeskAgentApiFetchJsonInput('GET')).then(function(x) {
8919
+ return x !== null && x !== void 0 ? x : {
8920
+ data: []
8921
+ };
8922
+ });
8923
+ };
8924
+ }
8925
+ /**
8926
+ * Creates a {@link ZohoDeskGetAgentByIdFunction} bound to the given context.
8927
+ *
8928
+ * @param context - Authenticated Zoho Desk context
8929
+ * @returns Function that retrieves a single agent
8930
+ */ function zohoDeskGetAgentById(context) {
8931
+ return function(input) {
8932
+ var agentId = input.agentId, include = input.include;
8933
+ var params = fetch.makeUrlSearchParams([
8934
+ {
8935
+ include: joinAgentInclude(include)
8936
+ }
8937
+ ]);
8938
+ var queryString = params.toString();
8939
+ return context.fetchJson("/agents/".concat(agentId).concat(queryString ? "?".concat(queryString) : ''), zohoDeskAgentApiFetchJsonInput('GET'));
8940
+ };
8941
+ }
8942
+ /**
8943
+ * Creates a {@link ZohoDeskGetAgentsByIdsFunction} bound to the given context.
8944
+ *
8945
+ * @param context - Authenticated Zoho Desk context
8946
+ * @returns Function that retrieves agents by IDs
8947
+ */ function zohoDeskGetAgentsByIds(context) {
8948
+ return function(input) {
8949
+ var params = fetch.makeUrlSearchParams([
8950
+ {
8951
+ agentIds: util.joinStringsWithCommas(util.asArray(input.agentIds))
8952
+ }
8953
+ ]);
8954
+ return context.fetchJson("/agentsByIds?".concat(params), zohoDeskAgentApiFetchJsonInput('GET')).then(function(x) {
8955
+ var _ref;
8956
+ return (_ref = x === null || x === void 0 ? void 0 : x.data) !== null && _ref !== void 0 ? _ref : [];
8957
+ });
8958
+ };
8959
+ }
8960
+ /**
8961
+ * Creates a {@link ZohoDeskGetMyInfoFunction} bound to the given context.
8962
+ *
8963
+ * Retrieves the profile of the agent associated with the current OAuth token.
8964
+ *
8965
+ * @param context - Authenticated Zoho Desk context
8966
+ * @returns Function that retrieves the current agent's info
8967
+ */ function zohoDeskGetMyInfo(context) {
8968
+ return function() {
8969
+ return context.fetchJson('/myinfo', zohoDeskAgentApiFetchJsonInput('GET'));
8970
+ };
8971
+ }
8972
+ /**
8973
+ * Creates a {@link ZohoDeskGetAgentsPageFactory} bound to the given context.
8974
+ *
8975
+ * @param context - Authenticated Zoho Desk context
8976
+ * @returns Page factory for iterating over agent results
8977
+ */ function zohoDeskGetAgentsPageFactory(context) {
8978
+ return zohoDeskFetchPageFactory(zohoDeskGetAgents(context));
8979
+ }
8980
+
6734
8981
  /**
6735
8982
  * Creates a function that exchanges a refresh token for a new short-lived access token
6736
8983
  * via the Zoho OAuth `/oauth/v2/token` endpoint.
@@ -7287,6 +9534,7 @@ function safeZohoDateTimeString(date) {
7287
9534
 
7288
9535
  exports.DEFAULT_ZOHO_API_RATE_LIMIT = DEFAULT_ZOHO_API_RATE_LIMIT;
7289
9536
  exports.DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD = DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD;
9537
+ exports.DEFAULT_ZOHO_DESK_API_RATE_LIMIT = DEFAULT_ZOHO_DESK_API_RATE_LIMIT;
7290
9538
  exports.DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
7291
9539
  exports.DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION;
7292
9540
  exports.MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA = MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA;
@@ -7309,6 +9557,12 @@ exports.ZOHO_CRM_SERVICE_NAME = ZOHO_CRM_SERVICE_NAME;
7309
9557
  exports.ZOHO_CRM_TAG_NAME_MAX_LENGTH = ZOHO_CRM_TAG_NAME_MAX_LENGTH;
7310
9558
  exports.ZOHO_CRM_TASKS_MODULE = ZOHO_CRM_TASKS_MODULE;
7311
9559
  exports.ZOHO_DATA_ARRAY_BLANK_ERROR_CODE = ZOHO_DATA_ARRAY_BLANK_ERROR_CODE;
9560
+ exports.ZOHO_DESK_DEFAULT_PAGE_LIMIT = ZOHO_DESK_DEFAULT_PAGE_LIMIT;
9561
+ exports.ZOHO_DESK_MAX_PAGE_LIMIT = ZOHO_DESK_MAX_PAGE_LIMIT;
9562
+ exports.ZOHO_DESK_RATE_LIMIT_REMAINING_HEADER = ZOHO_DESK_RATE_LIMIT_REMAINING_HEADER;
9563
+ exports.ZOHO_DESK_RATE_LIMIT_WEIGHT_HEADER = ZOHO_DESK_RATE_LIMIT_WEIGHT_HEADER;
9564
+ exports.ZOHO_DESK_RETRY_AFTER_HEADER = ZOHO_DESK_RETRY_AFTER_HEADER;
9565
+ exports.ZOHO_DESK_SERVICE_NAME = ZOHO_DESK_SERVICE_NAME;
7312
9566
  exports.ZOHO_DUPLICATE_DATA_ERROR_CODE = ZOHO_DUPLICATE_DATA_ERROR_CODE;
7313
9567
  exports.ZOHO_ERROR_STATUS = ZOHO_ERROR_STATUS;
7314
9568
  exports.ZOHO_FAILURE_ERROR_CODE = ZOHO_FAILURE_ERROR_CODE;
@@ -7390,12 +9644,14 @@ exports.getTagsForModule = getTagsForModule;
7390
9644
  exports.getTagsForModulePageFactory = getTagsForModulePageFactory;
7391
9645
  exports.handleZohoAccountsErrorFetch = handleZohoAccountsErrorFetch;
7392
9646
  exports.handleZohoCrmErrorFetch = handleZohoCrmErrorFetch;
9647
+ exports.handleZohoDeskErrorFetch = handleZohoDeskErrorFetch;
7393
9648
  exports.handleZohoErrorFetchFactory = handleZohoErrorFetchFactory;
7394
9649
  exports.handleZohoRecruitErrorFetch = handleZohoRecruitErrorFetch;
7395
9650
  exports.handleZohoSignErrorFetch = handleZohoSignErrorFetch;
7396
9651
  exports.insertRecord = insertRecord;
7397
9652
  exports.interceptZohoAccounts200StatusWithErrorResponse = interceptZohoAccounts200StatusWithErrorResponse;
7398
9653
  exports.interceptZohoCrm200StatusWithErrorResponse = interceptZohoCrm200StatusWithErrorResponse;
9654
+ exports.interceptZohoDesk200StatusWithErrorResponse = interceptZohoDesk200StatusWithErrorResponse;
7399
9655
  exports.interceptZohoErrorResponseFactory = interceptZohoErrorResponseFactory;
7400
9656
  exports.interceptZohoRecruit200StatusWithErrorResponse = interceptZohoRecruit200StatusWithErrorResponse;
7401
9657
  exports.interceptZohoSign200StatusWithErrorResponse = interceptZohoSign200StatusWithErrorResponse;
@@ -7404,13 +9660,17 @@ exports.isZohoRecruitValidUrl = isZohoRecruitValidUrl;
7404
9660
  exports.isZohoServerErrorResponseDataArrayRef = isZohoServerErrorResponseDataArrayRef;
7405
9661
  exports.logZohoAccountsErrorToConsole = logZohoAccountsErrorToConsole;
7406
9662
  exports.logZohoCrmErrorToConsole = logZohoCrmErrorToConsole;
9663
+ exports.logZohoDeskErrorToConsole = logZohoDeskErrorToConsole;
7407
9664
  exports.logZohoRecruitErrorToConsole = logZohoRecruitErrorToConsole;
7408
9665
  exports.logZohoServerErrorFunction = logZohoServerErrorFunction;
7409
9666
  exports.logZohoSignErrorToConsole = logZohoSignErrorToConsole;
9667
+ exports.makeZohoRateLimitedFetchHandler = makeZohoRateLimitedFetchHandler;
7410
9668
  exports.parseZohoAccountsError = parseZohoAccountsError;
7411
9669
  exports.parseZohoAccountsServerErrorResponseData = parseZohoAccountsServerErrorResponseData;
7412
9670
  exports.parseZohoCrmError = parseZohoCrmError;
7413
9671
  exports.parseZohoCrmServerErrorResponseData = parseZohoCrmServerErrorResponseData;
9672
+ exports.parseZohoDeskError = parseZohoDeskError;
9673
+ exports.parseZohoDeskServerErrorResponseData = parseZohoDeskServerErrorResponseData;
7414
9674
  exports.parseZohoRecruitError = parseZohoRecruitError;
7415
9675
  exports.parseZohoRecruitServerErrorResponseData = parseZohoRecruitServerErrorResponseData;
7416
9676
  exports.parseZohoServerErrorResponseData = parseZohoServerErrorResponseData;
@@ -7474,6 +9734,56 @@ exports.zohoCrmUrlSearchParams = zohoCrmUrlSearchParams;
7474
9734
  exports.zohoCrmUrlSearchParamsMinusIdAndModule = zohoCrmUrlSearchParamsMinusIdAndModule;
7475
9735
  exports.zohoCrmUrlSearchParamsMinusModule = zohoCrmUrlSearchParamsMinusModule;
7476
9736
  exports.zohoDateTimeString = zohoDateTimeString;
9737
+ exports.zohoDeskAddTicketFollowers = zohoDeskAddTicketFollowers;
9738
+ exports.zohoDeskApiFetchJsonInput = zohoDeskApiFetchJsonInput;
9739
+ exports.zohoDeskAssociateTicketTags = zohoDeskAssociateTicketTags;
9740
+ exports.zohoDeskConfigApiUrl = zohoDeskConfigApiUrl;
9741
+ exports.zohoDeskCreateTicketComment = zohoDeskCreateTicketComment;
9742
+ exports.zohoDeskDeleteTicketAttachment = zohoDeskDeleteTicketAttachment;
9743
+ exports.zohoDeskDeleteTicketComment = zohoDeskDeleteTicketComment;
9744
+ exports.zohoDeskDissociateTicketTag = zohoDeskDissociateTicketTag;
9745
+ exports.zohoDeskFactory = zohoDeskFactory;
9746
+ exports.zohoDeskFetchPageFactory = zohoDeskFetchPageFactory;
9747
+ exports.zohoDeskGetAgentById = zohoDeskGetAgentById;
9748
+ exports.zohoDeskGetAgents = zohoDeskGetAgents;
9749
+ exports.zohoDeskGetAgentsByIds = zohoDeskGetAgentsByIds;
9750
+ exports.zohoDeskGetAgentsPageFactory = zohoDeskGetAgentsPageFactory;
9751
+ exports.zohoDeskGetAgentsTicketsCount = zohoDeskGetAgentsTicketsCount;
9752
+ exports.zohoDeskGetAllTags = zohoDeskGetAllTags;
9753
+ exports.zohoDeskGetContactById = zohoDeskGetContactById;
9754
+ exports.zohoDeskGetContacts = zohoDeskGetContacts;
9755
+ exports.zohoDeskGetContactsByIds = zohoDeskGetContactsByIds;
9756
+ exports.zohoDeskGetContactsPageFactory = zohoDeskGetContactsPageFactory;
9757
+ exports.zohoDeskGetDepartmentById = zohoDeskGetDepartmentById;
9758
+ exports.zohoDeskGetDepartments = zohoDeskGetDepartments;
9759
+ exports.zohoDeskGetMyInfo = zohoDeskGetMyInfo;
9760
+ exports.zohoDeskGetTicketActivities = zohoDeskGetTicketActivities;
9761
+ exports.zohoDeskGetTicketActivitiesPageFactory = zohoDeskGetTicketActivitiesPageFactory;
9762
+ exports.zohoDeskGetTicketAttachments = zohoDeskGetTicketAttachments;
9763
+ exports.zohoDeskGetTicketById = zohoDeskGetTicketById;
9764
+ exports.zohoDeskGetTicketCommentById = zohoDeskGetTicketCommentById;
9765
+ exports.zohoDeskGetTicketComments = zohoDeskGetTicketComments;
9766
+ exports.zohoDeskGetTicketFollowers = zohoDeskGetTicketFollowers;
9767
+ exports.zohoDeskGetTicketMetrics = zohoDeskGetTicketMetrics;
9768
+ exports.zohoDeskGetTicketTags = zohoDeskGetTicketTags;
9769
+ exports.zohoDeskGetTicketThreadById = zohoDeskGetTicketThreadById;
9770
+ exports.zohoDeskGetTicketThreads = zohoDeskGetTicketThreads;
9771
+ exports.zohoDeskGetTicketThreadsPageFactory = zohoDeskGetTicketThreadsPageFactory;
9772
+ exports.zohoDeskGetTicketTimeEntries = zohoDeskGetTicketTimeEntries;
9773
+ exports.zohoDeskGetTicketTimeEntryById = zohoDeskGetTicketTimeEntryById;
9774
+ exports.zohoDeskGetTicketTimeEntrySummation = zohoDeskGetTicketTimeEntrySummation;
9775
+ exports.zohoDeskGetTicketTimer = zohoDeskGetTicketTimer;
9776
+ exports.zohoDeskGetTickets = zohoDeskGetTickets;
9777
+ exports.zohoDeskGetTicketsForContact = zohoDeskGetTicketsForContact;
9778
+ exports.zohoDeskGetTicketsForProduct = zohoDeskGetTicketsForProduct;
9779
+ exports.zohoDeskGetTicketsPageFactory = zohoDeskGetTicketsPageFactory;
9780
+ exports.zohoDeskPerformTicketTimerAction = zohoDeskPerformTicketTimerAction;
9781
+ exports.zohoDeskRateLimitDetailsReader = zohoDeskRateLimitDetailsReader;
9782
+ exports.zohoDeskRateLimitedFetchHandler = zohoDeskRateLimitedFetchHandler;
9783
+ exports.zohoDeskRemoveTicketFollowers = zohoDeskRemoveTicketFollowers;
9784
+ exports.zohoDeskSearchTags = zohoDeskSearchTags;
9785
+ exports.zohoDeskSearchTickets = zohoDeskSearchTickets;
9786
+ exports.zohoDeskSearchTicketsPageFactory = zohoDeskSearchTicketsPageFactory;
7477
9787
  exports.zohoFetchPageFactory = zohoFetchPageFactory;
7478
9788
  exports.zohoRateLimitHeaderDetails = zohoRateLimitHeaderDetails;
7479
9789
  exports.zohoRateLimitedFetchHandler = zohoRateLimitedFetchHandler;
@@ -7538,3 +9848,4 @@ exports.zohoSignGetDocumentsPageFactory = zohoSignGetDocumentsPageFactory;
7538
9848
  exports.zohoSignRetrieveFieldTypes = zohoSignRetrieveFieldTypes;
7539
9849
  exports.zohoSignSendDocumentForSignature = zohoSignSendDocumentForSignature;
7540
9850
  exports.zohoSignUpdateDocument = zohoSignUpdateDocument;
9851
+ exports.zohoStandardRateLimitDetailsReader = zohoStandardRateLimitDetailsReader;