@dereekb/zoho 13.4.0 → 13.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/index.cjs.js +292 -95
  2. package/index.esm.js +292 -96
  3. package/nestjs/index.cjs.js +407 -89
  4. package/nestjs/index.esm.js +407 -89
  5. package/nestjs/package.json +4 -4
  6. package/nestjs/src/lib/accounts/accounts.service.d.ts +14 -2
  7. package/nestjs/src/lib/crm/crm.api.d.ts +142 -27
  8. package/nestjs/src/lib/crm/crm.config.d.ts +2 -0
  9. package/nestjs/src/lib/recruit/recruit.api.d.ts +162 -31
  10. package/nestjs/src/lib/recruit/recruit.config.d.ts +2 -0
  11. package/nestjs/src/lib/sign/sign.api.d.ts +67 -12
  12. package/nestjs/src/lib/sign/webhook/webhook.zoho.sign.d.ts +3 -0
  13. package/nestjs/src/lib/zoho.config.d.ts +26 -2
  14. package/package.json +3 -3
  15. package/src/lib/accounts/accounts.api.d.ts +9 -5
  16. package/src/lib/accounts/accounts.config.d.ts +12 -2
  17. package/src/lib/accounts/accounts.d.ts +6 -3
  18. package/src/lib/accounts/accounts.error.api.d.ts +13 -0
  19. package/src/lib/accounts/accounts.factory.d.ts +2 -2
  20. package/src/lib/crm/crm.api.d.ts +13 -0
  21. package/src/lib/crm/crm.api.notes.d.ts +15 -0
  22. package/src/lib/crm/crm.api.tags.d.ts +17 -8
  23. package/src/lib/crm/crm.config.d.ts +9 -2
  24. package/src/lib/crm/crm.d.ts +12 -12
  25. package/src/lib/crm/crm.error.api.d.ts +14 -0
  26. package/src/lib/crm/crm.factory.d.ts +3 -3
  27. package/src/lib/crm/crm.notes.d.ts +23 -23
  28. package/src/lib/crm/crm.tags.d.ts +3 -3
  29. package/src/lib/recruit/recruit.api.candidates.d.ts +19 -0
  30. package/src/lib/recruit/recruit.api.d.ts +10 -0
  31. package/src/lib/recruit/recruit.config.d.ts +9 -2
  32. package/src/lib/recruit/recruit.d.ts +12 -12
  33. package/src/lib/recruit/recruit.error.api.d.ts +14 -0
  34. package/src/lib/recruit/recruit.factory.d.ts +3 -3
  35. package/src/lib/sign/sign.config.d.ts +12 -2
  36. package/src/lib/sign/sign.d.ts +14 -14
  37. package/src/lib/sign/sign.error.api.d.ts +13 -0
  38. package/src/lib/sign/sign.factory.d.ts +3 -3
  39. package/src/lib/zoho.error.api.d.ts +25 -8
  40. package/src/lib/zoho.limit.d.ts +8 -1
package/index.cjs.js CHANGED
@@ -88,13 +88,15 @@ function _object_spread_props$c(target, source) {
88
88
  * const secondPage = await firstPage.fetchNext();
89
89
  * }
90
90
  * ```
91
- */ function zohoFetchPageFactory(fetch$1, defaults) {
91
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic constraint requires any
92
+ function zohoFetchPageFactory(fetch$1, defaults) {
92
93
  return fetch.fetchPageFactory(_object_spread_props$c(_object_spread$d({}, defaults), {
93
94
  fetch: fetch$1,
94
95
  readFetchPageResultInfo: function readFetchPageResultInfo(result) {
95
96
  var _ref;
96
97
  var _result_info;
97
98
  return {
99
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- info may be missing in malformed responses
98
100
  hasNext: (_ref = (_result_info = result.info) === null || _result_info === void 0 ? void 0 : _result_info.more_records) !== null && _ref !== void 0 ? _ref : false // if no info is returned, assume something wrong and there are no more records
99
101
  };
100
102
  },
@@ -113,6 +115,9 @@ function _object_spread_props$c(target, source) {
113
115
  */ var ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
114
116
  /**
115
117
  * Resolves an environment key or passthrough URL to the full Zoho Recruit API URL.
118
+ *
119
+ * @param input - An environment key ('sandbox' or 'production') or a full API URL
120
+ * @returns The resolved Zoho Recruit API URL
116
121
  */ function zohoRecruitConfigApiUrl(input) {
117
122
  switch(input){
118
123
  case 'sandbox':
@@ -187,23 +192,26 @@ function _type_of$6(obj) {
187
192
  */ function zohoSearchRecordsCriteriaString(input) {
188
193
  var result;
189
194
  if (input != null) {
195
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- only string and object are valid for criteria input
190
196
  switch(typeof input === "undefined" ? "undefined" : _type_of$6(input)){
191
197
  case 'string':
192
198
  result = input;
193
199
  break;
194
200
  case 'object':
195
- var tree;
196
- if (Array.isArray(input)) {
197
- tree = {
198
- and: [
199
- input
200
- ]
201
- };
202
- } else {
203
- tree = input;
201
+ {
202
+ var tree;
203
+ if (Array.isArray(input)) {
204
+ tree = {
205
+ and: [
206
+ input
207
+ ]
208
+ };
209
+ } else {
210
+ tree = input;
211
+ }
212
+ result = zohoSearchRecordsCriteriaStringForTree(tree);
213
+ break;
204
214
  }
205
- result = zohoSearchRecordsCriteriaStringForTree(tree);
206
- break;
207
215
  }
208
216
  }
209
217
  return result;
@@ -543,6 +551,7 @@ function _ts_generator$9(thisArg, body) {
543
551
  * @param value
544
552
  * @returns
545
553
  */ function isZohoServerErrorResponseDataArrayRef(value) {
554
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- value is unknown at runtime, optional chain needed for safety
546
555
  return Array.isArray(value === null || value === void 0 ? void 0 : value.data);
547
556
  }
548
557
  /**
@@ -554,7 +563,12 @@ function _ts_generator$9(thisArg, body) {
554
563
  /**
555
564
  * Set in the status field
556
565
  */ var ZOHO_ERROR_STATUS = 'error';
557
- function zohoServerErrorData(error) {
566
+ /**
567
+ * Normalizes a Zoho error response entry into a consistent {@link ZohoServerErrorData} shape, handling both object and string error formats.
568
+ *
569
+ * @param error - The raw error entry, either a structured object or a plain error code string
570
+ * @returns Normalized error data with code and message fields
571
+ */ function zohoServerErrorData(error) {
558
572
  var errorType = typeof error === "undefined" ? "undefined" : _type_of$5(error);
559
573
  var errorData;
560
574
  if (errorType === 'object') {
@@ -638,8 +652,9 @@ function zohoServerErrorData(error) {
638
652
  /**
639
653
  * Creates a logZohoServerErrorFunction that logs the error to console.
640
654
  *
641
- * @param zohoApiNamePrefix Prefix to use when logging. I.E. ZohoRecruitError, etc.
642
- * @returns
655
+ * @param zohoApiNamePrefix - Prefix to use when logging (e.g. 'ZohoRecruit', 'ZohoSign')
656
+ * @param options - Optional configuration for controlling which error types are logged
657
+ * @returns A function that logs Zoho server errors to the console
643
658
  */ function logZohoServerErrorFunction(zohoApiNamePrefix, options) {
644
659
  var _ref = options !== null && options !== void 0 ? options : {}, _ref_logDataArrayErrors = _ref.logDataArrayErrors, logDataArrayErrors = _ref_logDataArrayErrors === void 0 ? false : _ref_logDataArrayErrors;
645
660
  return function(error) {
@@ -662,8 +677,9 @@ function zohoServerErrorData(error) {
662
677
  /**
663
678
  * Wraps a ConfiguredFetch to support handling errors returned by fetch.
664
679
  *
665
- * @param fetch
666
- * @returns
680
+ * @param parseZohoError - Function that parses a fetch response error into a Zoho-specific error
681
+ * @param defaultLogError - Default error logging function used when no custom logger is provided
682
+ * @returns Factory that wraps a ConfiguredFetch with Zoho error handling
667
683
  */ function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
668
684
  return function(fetch$1) {
669
685
  var logError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultLogError, onError = arguments.length > 2 ? arguments[2] : void 0;
@@ -720,16 +736,19 @@ function zohoServerErrorData(error) {
720
736
  }
721
737
  /**
722
738
  * FetchJsonInterceptJsonResponseFunction that intercepts a 200 response that actually contains a ZohoServerError and throws a ZohoServerError for the error handling to catch.
739
+ *
740
+ * @param parseZohoServerErrorResponseData - Function that parses raw error response data into a structured error
741
+ * @returns Interceptor function that detects and throws hidden errors in 200 responses
723
742
  */ function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData) {
724
743
  return function(json, response) {
744
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- json is typed as unknown union, optional chain needed for runtime safety
725
745
  var error = json === null || json === void 0 ? void 0 : json.error;
746
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- error may be undefined at runtime despite cast
726
747
  if (error != null) {
727
748
  var responseError = new fetch.FetchResponseError(response);
728
- if (responseError) {
729
- var parsedError = parseZohoServerErrorResponseData(json, responseError);
730
- if (parsedError) {
731
- throw parsedError;
732
- }
749
+ var parsedError = parseZohoServerErrorResponseData(json, responseError);
750
+ if (parsedError) {
751
+ throw parsedError;
733
752
  }
734
753
  }
735
754
  return json;
@@ -819,7 +838,12 @@ var ZOHO_RATE_LIMIT_REMAINING_HEADER = 'X-RATELIMIT-REMAINING';
819
838
  var ZOHO_RATE_LIMIT_RESET_HEADER = 'X-RATELIMIT-RESET';
820
839
  var DEFAULT_ZOHO_API_RATE_LIMIT = 100;
821
840
  var DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD = util.MS_IN_MINUTE;
822
- function zohoRateLimitHeaderDetails(headers) {
841
+ /**
842
+ * Extracts rate limit details from Zoho API response headers, returning null if the headers are absent.
843
+ *
844
+ * @param headers - HTTP response headers from a Zoho API call
845
+ * @returns Parsed rate limit details, or null if rate limit headers are missing
846
+ */ function zohoRateLimitHeaderDetails(headers) {
823
847
  var limitHeader = headers.get(ZOHO_RATE_LIMIT_LIMIT_HEADER);
824
848
  var remainingHeader = headers.get(ZOHO_RATE_LIMIT_REMAINING_HEADER);
825
849
  var resetHeader = headers.get(ZOHO_RATE_LIMIT_RESET_HEADER);
@@ -857,9 +881,9 @@ var ZohoTooManyRequestsError = /*#__PURE__*/ function(ZohoServerFetchResponseErr
857
881
  /**
858
882
  * Function that parses/transforms a ZohoServerErrorResponseData into a general ZohoServerError or other known error type.
859
883
  *
860
- * @param errorResponseData
861
- * @param responseError
862
- * @returns
884
+ * @param errorResponseData - Raw error response data from the Zoho API
885
+ * @param responseError - The underlying fetch response error
886
+ * @returns A typed Zoho server error, or undefined if no error is found
863
887
  */ function parseZohoServerErrorResponseData(errorResponseData, responseError) {
864
888
  var result;
865
889
  if (isZohoServerErrorResponseDataArrayRef(errorResponseData)) {
@@ -904,8 +928,8 @@ var ZohoTooManyRequestsError = /*#__PURE__*/ function(ZohoServerFetchResponseErr
904
928
  */ function tryFindZohoServerErrorData(errorResponseData, responseError) {
905
929
  var _ref, _errorResponseData_error;
906
930
  var _errorResponseData_data;
907
- var error = (_ref = (_errorResponseData_error = errorResponseData.error) !== null && _errorResponseData_error !== void 0 ? _errorResponseData_error : (_errorResponseData_data = errorResponseData.data) === null || _errorResponseData_data === void 0 ? void 0 : _errorResponseData_data[0]) !== null && _ref !== void 0 ? _ref : !responseError.response.ok ? errorResponseData : undefined;
908
- return error;
931
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- errorResponseData shape is unknown at runtime, fallthrough chain needed
932
+ return (_ref = (_errorResponseData_error = errorResponseData.error) !== null && _errorResponseData_error !== void 0 ? _errorResponseData_error : (_errorResponseData_data = errorResponseData.data) === null || _errorResponseData_data === void 0 ? void 0 : _errorResponseData_data[0]) !== null && _ref !== void 0 ? _ref : !responseError.response.ok ? errorResponseData : undefined;
909
933
  }
910
934
 
911
935
  function _assert_this_initialized$4(self) {
@@ -1202,17 +1226,22 @@ function _ts_generator$8(thisArg, body) {
1202
1226
  }(ZohoRecruitRecordCrudInvalidDataError);
1203
1227
  /**
1204
1228
  * Creates a typed CRUD error subclass based on the error code returned by the Zoho Recruit API, enabling callers to catch specific failure modes.
1229
+ *
1230
+ * @param error - Structured error data from the Zoho Recruit API response
1231
+ * @returns A specific CRUD error subclass matching the error code
1205
1232
  */ function zohoRecruitRecordCrudError(error) {
1206
1233
  var result;
1207
1234
  switch(error.code){
1208
1235
  case ZOHO_INVALID_DATA_ERROR_CODE:
1209
- var invalidDataError = new ZohoRecruitRecordCrudInvalidDataError(error);
1210
- if (invalidDataError.invalidFieldDetails['id']) {
1211
- result = new ZohoRecruitRecordCrudNoMatchingRecordError(error);
1212
- } else {
1213
- result = invalidDataError;
1236
+ {
1237
+ var invalidDataError = new ZohoRecruitRecordCrudInvalidDataError(error);
1238
+ if (invalidDataError.invalidFieldDetails['id']) {
1239
+ result = new ZohoRecruitRecordCrudNoMatchingRecordError(error);
1240
+ } else {
1241
+ result = invalidDataError;
1242
+ }
1243
+ break;
1214
1244
  }
1215
- break;
1216
1245
  case ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE:
1217
1246
  result = new ZohoRecruitRecordCrudMandatoryFieldNotFoundError(error);
1218
1247
  break;
@@ -1227,9 +1256,14 @@ function _ts_generator$8(thisArg, body) {
1227
1256
  }
1228
1257
  /**
1229
1258
  * Returns an assertion function that throws {@link ZohoRecruitRecordNoContentError} when the data array result is empty or null, indicating the requested record does not exist.
1259
+ *
1260
+ * @param moduleName - Optional module name for the error context
1261
+ * @param recordId - Optional record ID for the error context
1262
+ * @returns Assertion function that validates the data array is non-empty
1230
1263
  */ function assertZohoRecruitRecordDataArrayResultHasContent(moduleName, recordId) {
1231
1264
  return function(x) {
1232
1265
  var _x_data;
1266
+ // eslint-disable-next-line eqeqeq -- fetchJson may return null for empty results despite type
1233
1267
  if (x == null || !((_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.length)) {
1234
1268
  throw new ZohoRecruitRecordNoContentError(moduleName, recordId);
1235
1269
  } else {
@@ -1242,6 +1276,9 @@ function _ts_generator$8(thisArg, body) {
1242
1276
  */ var logZohoRecruitErrorToConsole = logZohoServerErrorFunction('ZohoRecruit');
1243
1277
  /**
1244
1278
  * Parses the JSON body of a failed Zoho Recruit fetch response into a structured error, returning undefined if the body cannot be parsed.
1279
+ *
1280
+ * @param responseError - The fetch response error to parse
1281
+ * @returns Parsed Zoho server error, or undefined if parsing fails
1245
1282
  */ function parseZohoRecruitError(responseError) {
1246
1283
  return _async_to_generator$8(function() {
1247
1284
  var data, result;
@@ -1250,7 +1287,7 @@ function _ts_generator$8(thisArg, body) {
1250
1287
  case 0:
1251
1288
  return [
1252
1289
  4,
1253
- responseError.response.json().catch(function(x) {
1290
+ responseError.response.json().catch(function() {
1254
1291
  return undefined;
1255
1292
  })
1256
1293
  ];
@@ -1269,6 +1306,10 @@ function _ts_generator$8(thisArg, body) {
1269
1306
  }
1270
1307
  /**
1271
1308
  * Converts raw Zoho Recruit error response data into a parsed error, delegating to Recruit-specific handlers for known error codes and falling back to the shared Zoho parser.
1309
+ *
1310
+ * @param errorResponseData - Raw error response data from the Zoho Recruit API
1311
+ * @param responseError - The underlying fetch response error
1312
+ * @returns Parsed Zoho server error, or undefined if the data contains no recognizable error
1272
1313
  */ function parseZohoRecruitServerErrorResponseData(errorResponseData, responseError) {
1273
1314
  var result;
1274
1315
  var error = tryFindZohoServerErrorData(errorResponseData, responseError);
@@ -1411,6 +1452,11 @@ function _is_native_reflect_construct$3() {
1411
1452
  *
1412
1453
  * When a single record is provided, the function returns the change details directly or throws on error.
1413
1454
  * When multiple records are provided, it returns a paired success/error result.
1455
+ *
1456
+ * @param context - Zoho Recruit API context providing fetch and authentication
1457
+ * @param fetchUrlPrefix - URL path suffix for the endpoint (empty for insert/update, '/upsert' for upsert)
1458
+ * @param fetchMethod - HTTP method to use for the request
1459
+ * @returns Factory function that inserts, updates, or upserts records
1414
1460
  */ function updateRecordLikeFunction$1(context, fetchUrlPrefix, fetchMethod) {
1415
1461
  return function(param) {
1416
1462
  var data = param.data, module = param.module;
@@ -1423,6 +1469,7 @@ function _is_native_reflect_construct$3() {
1423
1469
  return result;
1424
1470
  } else {
1425
1471
  var successItems = result.successItems, errorItems = result.errorItems;
1472
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- array may be empty at runtime
1426
1473
  if (errorItems[0] != null) {
1427
1474
  throw zohoRecruitRecordCrudError(errorItems[0].result);
1428
1475
  } else {
@@ -1671,12 +1718,13 @@ function _is_native_reflect_construct$3() {
1671
1718
  var criteriaString = zohoRecruitSearchRecordsCriteriaString(input.criteria);
1672
1719
  baseInput.criteria = criteriaString;
1673
1720
  }
1721
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Zoho API migration pending
1674
1722
  if (!baseInput.word && !input.criteria && !input.email && !input.phone) {
1675
1723
  throw new Error('At least one of word, criteria, email, or phone must be provided');
1676
1724
  }
1677
- var urlParams = zohoRecruitUrlSearchParamsMinusModule(baseInput);
1678
- return urlParams;
1725
+ return zohoRecruitUrlSearchParamsMinusModule(baseInput);
1679
1726
  }
1727
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- fetchJson may return null for empty results
1680
1728
  return function(input) {
1681
1729
  return context.fetchJson("/v2/".concat(input.module, "/search?").concat(searchRecordsUrlSearchParams(input).toString()), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
1682
1730
  return x !== null && x !== void 0 ? x : {
@@ -1744,11 +1792,12 @@ function _is_native_reflect_construct$3() {
1744
1792
  */ function zohoRecruitGetRelatedRecordsFunctionFactory(context) {
1745
1793
  return function(config) {
1746
1794
  var targetModule = config.targetModule, _config_returnEmptyRecordsInsteadOfNull = config.returnEmptyRecordsInsteadOfNull, returnEmptyRecordsInsteadOfNull = _config_returnEmptyRecordsInsteadOfNull === void 0 ? true : _config_returnEmptyRecordsInsteadOfNull;
1795
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Zoho API migration pending
1747
1796
  return function(input) {
1748
1797
  return context.fetchJson("/v2/".concat(input.module, "/").concat(input.id, "/").concat(targetModule, "?").concat(zohoRecruitUrlSearchParamsMinusIdAndModule(input, input.filter).toString()), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
1749
1798
  return x !== null && x !== void 0 ? x : returnEmptyRecordsInsteadOfNull !== false ? emptyZohoPageResult() : x;
1750
1799
  });
1751
- };
1800
+ }; // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- fetchJson may return null for empty results
1752
1801
  };
1753
1802
  }
1754
1803
  /**
@@ -2076,6 +2125,9 @@ function _is_native_reflect_construct$3() {
2076
2125
  // MARK: Util
2077
2126
  /**
2078
2127
  * Builds URL search params from input objects, omitting the `module` key since it is used in the URL path rather than query string.
2128
+ *
2129
+ * @param input - One or more objects whose key-value pairs become query parameters
2130
+ * @returns URLSearchParams with the `module` key excluded
2079
2131
  */ function zohoRecruitUrlSearchParamsMinusModule() {
2080
2132
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
2081
2133
  input[_key] = arguments[_key];
@@ -2086,6 +2138,9 @@ function _is_native_reflect_construct$3() {
2086
2138
  }
2087
2139
  /**
2088
2140
  * Builds URL search params from input objects, omitting both `id` and `module` keys since they are used in the URL path.
2141
+ *
2142
+ * @param input - One or more objects whose key-value pairs become query parameters
2143
+ * @returns URLSearchParams with `id` and `module` keys excluded
2089
2144
  */ function zohoRecruitUrlSearchParamsMinusIdAndModule() {
2090
2145
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
2091
2146
  input[_key] = arguments[_key];
@@ -2102,12 +2157,15 @@ function _is_native_reflect_construct$3() {
2102
2157
  */ var zohoRecruitUrlSearchParams = fetch.makeUrlSearchParams;
2103
2158
  /**
2104
2159
  * Constructs a standard {@link FetchJsonInput} for Zoho Recruit API calls with the given HTTP method and optional body.
2160
+ *
2161
+ * @param method - HTTP method for the request
2162
+ * @param body - Optional JSON body to include in the request
2163
+ * @returns Configured fetch JSON input
2105
2164
  */ function zohoRecruitApiFetchJsonInput(method, body) {
2106
- var result = {
2165
+ return {
2107
2166
  method: method,
2108
2167
  body: body !== null && body !== void 0 ? body : undefined
2109
2168
  };
2110
- return result;
2111
2169
  }
2112
2170
  /**
2113
2171
  * Separates a change response's entries into success and error arrays based on their status.
@@ -2287,6 +2345,9 @@ function _object_spread_props$a(target, source) {
2287
2345
  *
2288
2346
  * The result separates "already associated" errors from other errors, allowing callers to treat duplicate associations as non-fatal.
2289
2347
  *
2348
+ * @param context - Zoho Recruit API context providing fetch and authentication
2349
+ * @returns Factory function that associates candidates with job openings
2350
+ *
2290
2351
  * https://www.zoho.com/recruit/developer-guide/apiv2/associate-candidate.html
2291
2352
  */ function zohoRecruitAssociateCandidateRecordsWithJobOpenings(context) {
2292
2353
  return function(input) {
@@ -2310,6 +2371,9 @@ function _object_spread_props$a(target, source) {
2310
2371
  }
2311
2372
  /**
2312
2373
  * Searches for records associated with a given candidate or job opening. Returns an empty page result when no records are found.
2374
+ *
2375
+ * @param context - Zoho Recruit API context providing fetch and authentication
2376
+ * @returns Factory function that searches for associated records
2313
2377
  */ function zohoRecruitSearchAssociatedRecords(context) {
2314
2378
  return function(input) {
2315
2379
  return context.fetchJson("/v2/".concat(input.module, "/").concat(input.id, "/associate?").concat(zohoRecruitUrlSearchParamsMinusIdAndModule(input).toString()), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
@@ -2320,6 +2384,9 @@ function _object_spread_props$a(target, source) {
2320
2384
  }
2321
2385
  /**
2322
2386
  * Searches for job openings associated with a specific candidate.
2387
+ *
2388
+ * @param context - Zoho Recruit API context providing fetch and authentication
2389
+ * @returns Factory function that searches for job openings associated with a candidate
2323
2390
  */ function zohoRecruitSearchCandidateAssociatedJobOpeningRecords(context) {
2324
2391
  var searchAssociatedRecordsFactory = zohoRecruitSearchAssociatedRecords(context);
2325
2392
  return function(input) {
@@ -2330,11 +2397,18 @@ function _object_spread_props$a(target, source) {
2330
2397
  }
2331
2398
  /**
2332
2399
  * Creates a page factory for paginating over job openings associated with a candidate.
2400
+ *
2401
+ * @param context - Zoho Recruit API context providing fetch and authentication
2402
+ * @returns Page factory for iterating through associated job openings
2333
2403
  */ function zohoRecruitSearchCandidateAssociatedJobOpeningRecordsPageFactory(context) {
2334
2404
  return zohoFetchPageFactory(zohoRecruitSearchCandidateAssociatedJobOpeningRecords(context));
2335
2405
  }
2336
2406
  /**
2337
2407
  * Searches for candidates associated with a specific job opening.
2408
+ *
2409
+ * @param context - Zoho Recruit API context providing fetch and authentication
2410
+ * @param jobOpeningModuleName - Module name for job openings, defaults to the standard module
2411
+ * @returns Factory function that searches for candidates associated with a job opening
2338
2412
  */ function zohoRecruitSearchJobOpeningAssociatedCandidateRecords(context) {
2339
2413
  var jobOpeningModuleName = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZOHO_RECRUIT_JOB_OPENINGS_MODULE;
2340
2414
  var searchAssociatedRecordsFactory = zohoRecruitSearchAssociatedRecords(context);
@@ -2346,6 +2420,9 @@ function _object_spread_props$a(target, source) {
2346
2420
  }
2347
2421
  /**
2348
2422
  * Creates a page factory for paginating over candidates associated with a job opening.
2423
+ *
2424
+ * @param context - Zoho Recruit API context providing fetch and authentication
2425
+ * @returns Page factory for iterating through associated candidates
2349
2426
  */ function zohoRecruitSearchJobOpeningAssociatedCandidateRecordsPageFactory(context) {
2350
2427
  return zohoFetchPageFactory(zohoRecruitSearchJobOpeningAssociatedCandidateRecords(context));
2351
2428
  }
@@ -3014,7 +3091,12 @@ var ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = 'invalid_client';
3014
3091
  return ZohoAccountsAuthFailureError;
3015
3092
  }(fetch.FetchRequestFactoryError);
3016
3093
  var logZohoAccountsErrorToConsole = logZohoServerErrorFunction('ZohoAccounts');
3017
- function parseZohoAccountsError(responseError) {
3094
+ /**
3095
+ * Parses a fetch response error into a typed Zoho Accounts server error by extracting and interpreting the JSON error body.
3096
+ *
3097
+ * @param responseError - The fetch response error to parse
3098
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
3099
+ */ function parseZohoAccountsError(responseError) {
3018
3100
  return _async_to_generator$7(function() {
3019
3101
  var data, result;
3020
3102
  return _ts_generator$7(this, function(_state) {
@@ -3022,7 +3104,7 @@ function parseZohoAccountsError(responseError) {
3022
3104
  case 0:
3023
3105
  return [
3024
3106
  4,
3025
- responseError.response.json().catch(function(x) {
3107
+ responseError.response.json().catch(function() {
3026
3108
  return undefined;
3027
3109
  })
3028
3110
  ];
@@ -3039,7 +3121,13 @@ function parseZohoAccountsError(responseError) {
3039
3121
  });
3040
3122
  })();
3041
3123
  }
3042
- function parseZohoAccountsServerErrorResponseData(errorResponseData, responseError) {
3124
+ /**
3125
+ * Parses a Zoho Accounts error response body into a typed error. Handles account-specific error codes before falling back to the generic Zoho error parser.
3126
+ *
3127
+ * @param errorResponseData - The raw error response data from the Zoho Accounts API
3128
+ * @param responseError - The original fetch response error for context
3129
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
3130
+ */ function parseZohoAccountsServerErrorResponseData(errorResponseData, responseError) {
3043
3131
  var result;
3044
3132
  var error = errorResponseData.error;
3045
3133
  if (error) {
@@ -3189,6 +3277,9 @@ function _ts_generator$6(thisArg, body) {
3189
3277
  }
3190
3278
  /**
3191
3279
  * Generates a new ZohoAccessTokenStringFactory.
3280
+ *
3281
+ * @param zohoAccessTokenFactory - Factory that produces ZohoAccessToken instances
3282
+ * @returns A factory function that resolves to the access token string
3192
3283
  */ function zohoAccessTokenStringFactory(zohoAccessTokenFactory) {
3193
3284
  return function() {
3194
3285
  return _async_to_generator$6(function() {
@@ -3202,7 +3293,7 @@ function _ts_generator$6(thisArg, body) {
3202
3293
  ];
3203
3294
  case 1:
3204
3295
  token = _state.sent();
3205
- if (!(token === null || token === void 0 ? void 0 : token.accessToken)) {
3296
+ if (!token.accessToken) {
3206
3297
  throw new ZohoAccountsAuthFailureError();
3207
3298
  }
3208
3299
  return [
@@ -3217,7 +3308,9 @@ function _ts_generator$6(thisArg, body) {
3217
3308
 
3218
3309
  /**
3219
3310
  * Default handler that logs a warning to the console when the Zoho API rate limit is exceeded.
3220
- */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = function DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION(headers) {
3311
+ *
3312
+ * @param headers - Rate limit details extracted from the Zoho API response headers
3313
+ */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = function DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION(headers) {
3221
3314
  console.warn("zohoRateLimitedFetchHandler(): Too many requests made. The limit is ".concat(headers.limit, " requests per reset period. Will be reset at ").concat(headers.resetAt, "."));
3222
3315
  };
3223
3316
  /**
@@ -3236,13 +3329,17 @@ function _ts_generator$6(thisArg, body) {
3236
3329
  * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
3237
3330
  */ function zohoRateLimitedFetchHandler(config) {
3238
3331
  var _ref, _ref1, _ref2;
3239
- 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_REQUETS_LOG_FUNCTION : undefined;
3332
+ 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;
3240
3333
  var defaultLimit = (_ref1 = config === null || config === void 0 ? void 0 : config.maxRateLimit) !== null && _ref1 !== void 0 ? _ref1 : DEFAULT_ZOHO_API_RATE_LIMIT;
3241
3334
  var defaultResetPeriod = (_ref2 = config === null || config === void 0 ? void 0 : config.resetPeriod) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD;
3242
3335
  /**
3243
3336
  * Builds a rate limiter config derived from the given limit.
3244
3337
  * Called once at initialization with `defaultLimit`, and again dynamically
3245
3338
  * when the API's `X-RATELIMIT-LIMIT` header reports a different value.
3339
+ *
3340
+ * @param limit - Maximum number of requests allowed per reset period
3341
+ * @param resetAt - Optional date when the rate limit window resets
3342
+ * @returns Rate limiter configuration scaled to the given limit
3246
3343
  */ function configForLimit(limit, resetAt) {
3247
3344
  return {
3248
3345
  limit: limit,
@@ -3261,6 +3358,10 @@ function _ts_generator$6(thisArg, body) {
3261
3358
  /**
3262
3359
  * Inspects each response for Zoho rate limit headers and updates the limiter accordingly.
3263
3360
  * Returns `true` to signal a retry when a 429 status is received.
3361
+ *
3362
+ * @param response - The HTTP response to inspect for rate limit headers
3363
+ * @param fetchResponseError - Optional fetch error if the response was an error
3364
+ * @returns Whether the request should be retried
3264
3365
  */ updateWithResponse: function updateWithResponse(response, fetchResponseError) {
3265
3366
  var hasLimitHeader = response.headers.has(ZOHO_RATE_LIMIT_REMAINING_HEADER);
3266
3367
  var shouldRetry = false;
@@ -3280,8 +3381,9 @@ function _ts_generator$6(thisArg, body) {
3280
3381
  if (response.status === ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3281
3382
  shouldRetry = true;
3282
3383
  try {
3283
- onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(headerDetails, response, fetchResponseError);
3284
- } catch (e) {}
3384
+ void (onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(headerDetails, response, fetchResponseError));
3385
+ } catch (unused) {
3386
+ /* ignored */ }
3285
3387
  }
3286
3388
  }
3287
3389
  }
@@ -3290,6 +3392,10 @@ function _ts_generator$6(thisArg, body) {
3290
3392
  }
3291
3393
  });
3292
3394
  }
3395
+ // MARK: Compat
3396
+ /**
3397
+ * @deprecated use DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION instead.
3398
+ */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
3293
3399
 
3294
3400
  function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3295
3401
  try {
@@ -3546,7 +3652,7 @@ function _ts_generator$5(thisArg, body) {
3546
3652
  });
3547
3653
  var fetch$1 = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
3548
3654
  if (_instanceof$4(x, ZohoInvalidTokenError)) {
3549
- accountsContext.loadAccessToken.resetAccessToken();
3655
+ void accountsContext.loadAccessToken.resetAccessToken();
3550
3656
  }
3551
3657
  });
3552
3658
  var fetchJson = fetch.fetchJsonFunction(fetch$1, {
@@ -3578,6 +3684,9 @@ function _ts_generator$5(thisArg, body) {
3578
3684
  */ var ZOHO_CRM_SERVICE_NAME = 'crm';
3579
3685
  /**
3580
3686
  * Resolves a CRM API URL input to its full base URL. Well-known keys ('sandbox', 'production') map to their respective Zoho CRM endpoints; custom URLs pass through unchanged.
3687
+ *
3688
+ * @param input - A well-known environment key or a custom CRM API URL
3689
+ * @returns The resolved full Zoho CRM API base URL
3581
3690
  */ function zohoCrmConfigApiUrl(input) {
3582
3691
  switch(input){
3583
3692
  case 'sandbox':
@@ -3939,17 +4048,22 @@ function _ts_generator$4(thisArg, body) {
3939
4048
  }(ZohoCrmRecordCrudInvalidDataError);
3940
4049
  /**
3941
4050
  * Maps a Zoho CRM server error to the appropriate typed {@link ZohoCrmRecordCrudError} subclass based on the error code and affected field.
4051
+ *
4052
+ * @param error - The server error data containing the error code and field details
4053
+ * @returns The appropriate typed CRM CRUD error instance
3942
4054
  */ function zohoCrmRecordCrudError(error) {
3943
4055
  var result;
3944
4056
  switch(error.code){
3945
4057
  case ZOHO_INVALID_DATA_ERROR_CODE:
3946
- var invalidDataError = new ZohoCrmRecordCrudInvalidDataError(error);
3947
- if (invalidDataError.invalidFieldDetails.api_name === 'id') {
3948
- result = new ZohoCrmRecordCrudNoMatchingRecordError(error);
3949
- } else {
3950
- result = invalidDataError;
4058
+ {
4059
+ var invalidDataError = new ZohoCrmRecordCrudInvalidDataError(error);
4060
+ if (invalidDataError.invalidFieldDetails.api_name === 'id') {
4061
+ result = new ZohoCrmRecordCrudNoMatchingRecordError(error);
4062
+ } else {
4063
+ result = invalidDataError;
4064
+ }
4065
+ break;
3951
4066
  }
3952
- break;
3953
4067
  case ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE:
3954
4068
  result = new ZohoCrmRecordCrudMandatoryFieldNotFoundError(error);
3955
4069
  break;
@@ -3964,9 +4078,14 @@ function _ts_generator$4(thisArg, body) {
3964
4078
  }
3965
4079
  /**
3966
4080
  * Returns an assertion function that throws {@link ZohoCrmRecordNoContentError} when a data array result is empty or null, typically indicating a missing record.
4081
+ *
4082
+ * @param moduleName - Optional CRM module name for the error context
4083
+ * @param recordId - Optional record ID for the error context
4084
+ * @returns Assertion function that throws if the data array is empty
3967
4085
  */ function assertZohoCrmRecordDataArrayResultHasContent(moduleName, recordId) {
3968
4086
  return function(x) {
3969
4087
  var _x_data;
4088
+ // eslint-disable-next-line eqeqeq -- fetchJson may return null for empty results despite type
3970
4089
  if (x == null || !((_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.length)) {
3971
4090
  throw new ZohoCrmRecordNoContentError(moduleName, recordId);
3972
4091
  } else {
@@ -3981,6 +4100,9 @@ function _ts_generator$4(thisArg, body) {
3981
4100
  });
3982
4101
  /**
3983
4102
  * Parses a fetch response error into a typed Zoho CRM server error by extracting and interpreting the JSON error body.
4103
+ *
4104
+ * @param responseError - The fetch response error to parse
4105
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
3984
4106
  */ function parseZohoCrmError(responseError) {
3985
4107
  return _async_to_generator$4(function() {
3986
4108
  var data, result;
@@ -3989,7 +4111,7 @@ function _ts_generator$4(thisArg, body) {
3989
4111
  case 0:
3990
4112
  return [
3991
4113
  4,
3992
- responseError.response.json().catch(function(x) {
4114
+ responseError.response.json().catch(function() {
3993
4115
  return undefined;
3994
4116
  })
3995
4117
  ];
@@ -4008,6 +4130,10 @@ function _ts_generator$4(thisArg, body) {
4008
4130
  }
4009
4131
  /**
4010
4132
  * Parses a Zoho CRM error response body into a typed error. Delegates to CRM-specific error code handling before falling back to the generic Zoho error parser.
4133
+ *
4134
+ * @param errorResponseData - The raw error response data from the Zoho CRM API
4135
+ * @param responseError - The original fetch response error for context
4136
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
4011
4137
  */ function parseZohoCrmServerErrorResponseData(errorResponseData, responseError) {
4012
4138
  var result;
4013
4139
  var error = tryFindZohoServerErrorData(errorResponseData, responseError);
@@ -4153,6 +4279,11 @@ function _is_native_reflect_construct() {
4153
4279
  *
4154
4280
  * When a single record is provided, the function returns the change details directly or throws on error.
4155
4281
  * When multiple records are provided, it returns a paired success/error result.
4282
+ *
4283
+ * @param context - Authenticated Zoho CRM context for making API calls
4284
+ * @param fetchUrlPrefix - URL path segment appended after the module name (empty string for insert/update, '/upsert' for upsert)
4285
+ * @param fetchMethod - HTTP method to use for the request (POST for insert/upsert, PUT for update)
4286
+ * @returns Overloaded function handling both single and multi-record operations
4156
4287
  */ function updateRecordLikeFunction(context, fetchUrlPrefix, fetchMethod) {
4157
4288
  return function(param) {
4158
4289
  var data = param.data, module = param.module;
@@ -4165,6 +4296,7 @@ function _is_native_reflect_construct() {
4165
4296
  return result;
4166
4297
  } else {
4167
4298
  var successItems = result.successItems, errorItems = result.errorItems;
4299
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- array may be empty at runtime
4168
4300
  if (errorItems[0] != null) {
4169
4301
  throw zohoCrmRecordCrudError(errorItems[0].result);
4170
4302
  } else {
@@ -4417,9 +4549,9 @@ function _is_native_reflect_construct() {
4417
4549
  if (!baseInput.word && !input.cvid && !input.criteria && !input.email && !input.phone) {
4418
4550
  throw new Error('At least one of word, cvid, criteria, email, or phone must be provided');
4419
4551
  }
4420
- var urlParams = zohoCrmUrlSearchParamsMinusModule(baseInput);
4421
- return urlParams;
4552
+ return zohoCrmUrlSearchParamsMinusModule(baseInput);
4422
4553
  }
4554
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- fetchJson may return null for empty results
4423
4555
  return function(input) {
4424
4556
  return context.fetchJson("/v8/".concat(input.module, "/search?").concat(searchRecordsUrlSearchParams(input).toString()), zohoCrmApiFetchJsonInput('GET')).then(function(x) {
4425
4557
  return x !== null && x !== void 0 ? x : {
@@ -4487,11 +4619,12 @@ function _is_native_reflect_construct() {
4487
4619
  */ function zohoCrmGetRelatedRecordsFunctionFactory(context) {
4488
4620
  return function(config) {
4489
4621
  var targetModule = config.targetModule, _config_returnEmptyRecordsInsteadOfNull = config.returnEmptyRecordsInsteadOfNull, returnEmptyRecordsInsteadOfNull = _config_returnEmptyRecordsInsteadOfNull === void 0 ? true : _config_returnEmptyRecordsInsteadOfNull;
4622
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Zoho API migration pending
4490
4623
  return function(input) {
4491
4624
  return context.fetchJson("/v8/".concat(input.module, "/").concat(input.id, "/").concat(targetModule, "?").concat(zohoCrmUrlSearchParamsMinusIdAndModule(input, input.filter).toString()), zohoCrmApiFetchJsonInput('GET')).then(function(x) {
4492
4625
  return x !== null && x !== void 0 ? x : returnEmptyRecordsInsteadOfNull !== false ? emptyZohoPageResult() : x;
4493
4626
  });
4494
- };
4627
+ }; // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- fetchJson may return null for empty results
4495
4628
  };
4496
4629
  }
4497
4630
  /**
@@ -4523,6 +4656,7 @@ function _is_native_reflect_construct() {
4523
4656
  return function(input) {
4524
4657
  return getEmailsFactory(input).then(function(x) {
4525
4658
  var _x_data;
4659
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Zoho API may return Emails instead of data
4526
4660
  var data = (_x_data = x.data) !== null && _x_data !== void 0 ? _x_data : x.Emails;
4527
4661
  return _object_spread_props$6(_object_spread$7({}, x), {
4528
4662
  data: data
@@ -4804,6 +4938,9 @@ function _is_native_reflect_construct() {
4804
4938
  // MARK: Util
4805
4939
  /**
4806
4940
  * Builds URL search params from the input objects, omitting the `module` key since it is used in the URL path rather than as a query parameter.
4941
+ *
4942
+ * @param input - One or more objects to convert into URL search parameters
4943
+ * @returns URL search params string with the `module` key excluded
4807
4944
  */ function zohoCrmUrlSearchParamsMinusModule() {
4808
4945
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
4809
4946
  input[_key] = arguments[_key];
@@ -4814,6 +4951,9 @@ function _is_native_reflect_construct() {
4814
4951
  }
4815
4952
  /**
4816
4953
  * Builds URL search params from the input objects, omitting both `id` and `module` keys since they are used in the URL path.
4954
+ *
4955
+ * @param input - One or more objects to convert into URL search parameters
4956
+ * @returns URL search params string with `id` and `module` keys excluded
4817
4957
  */ function zohoCrmUrlSearchParamsMinusIdAndModule() {
4818
4958
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
4819
4959
  input[_key] = arguments[_key];
@@ -4830,19 +4970,26 @@ function _is_native_reflect_construct() {
4830
4970
  */ var zohoCrmUrlSearchParams = fetch.makeUrlSearchParams;
4831
4971
  /**
4832
4972
  * Constructs the standard FetchJsonInput used by CRM API calls, pairing the HTTP method with an optional body.
4973
+ *
4974
+ * @param method - HTTP method to use for the request
4975
+ * @param body - Optional request body to include
4976
+ * @returns Configured fetch input for the Zoho CRM API call
4833
4977
  */ function zohoCrmApiFetchJsonInput(method, body) {
4834
- var result = {
4978
+ return {
4835
4979
  method: method,
4836
4980
  body: body !== null && body !== void 0 ? body : undefined
4837
4981
  };
4838
- return result;
4839
4982
  }
4840
4983
  // MARK: Results
4841
4984
  /**
4842
4985
  * Catches ZohoServerFetchResponseDataArrayError and returns the error data array as the response data, as each data element will have the error details.
4843
4986
  *
4844
4987
  * Use to catch errors from functions that return ZohoCrmChangeObjectLikeResponse and pass the result to zohoCrmChangeObjectLikeResponseSuccessAndErrorPairs.
4845
- */ function zohoCrmCatchZohoCrmChangeObjectLikeResponseError(e) {
4988
+ *
4989
+ * @param e - The error to catch and potentially convert
4990
+ * @returns The error data array wrapped as a change object response
4991
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic constraint requires any
4992
+ function zohoCrmCatchZohoCrmChangeObjectLikeResponseError(e) {
4846
4993
  var result;
4847
4994
  if (_instanceof$3(e, ZohoServerFetchResponseDataArrayError)) {
4848
4995
  result = {
@@ -4979,6 +5126,9 @@ function _object_spread_props$5(target, source) {
4979
5126
  * Creates notes directly in the CRM Notes module. Each note must include the parent record reference and module name.
4980
5127
  *
4981
5128
  * For creating notes associated with a specific record, prefer {@link zohoCrmCreateNotesForRecord} which handles parent binding automatically.
5129
+ *
5130
+ * @param context - Authenticated Zoho CRM context for making API calls
5131
+ * @returns Function that creates notes in the CRM Notes module
4982
5132
  */ function zohoCrmCreateNotes(context) {
4983
5133
  return function(input) {
4984
5134
  return context.fetchJson("/v2/".concat(ZOHO_CRM_NOTES_MODULE), zohoCrmApiFetchJsonInput('POST', {
@@ -4990,6 +5140,9 @@ function _object_spread_props$5(target, source) {
4990
5140
  }
4991
5141
  /**
4992
5142
  * Deletes one or more notes from the CRM Notes module by their IDs.
5143
+ *
5144
+ * @param context - Authenticated Zoho CRM context for making API calls
5145
+ * @returns Function that deletes notes by their IDs
4993
5146
  */ function zohoCrmDeleteNotes(context) {
4994
5147
  return function(input) {
4995
5148
  return context.fetchJson("/v2/".concat(ZOHO_CRM_NOTES_MODULE, "?").concat(fetch.makeUrlSearchParams({
@@ -5001,6 +5154,9 @@ function _object_spread_props$5(target, source) {
5001
5154
  }
5002
5155
  /**
5003
5156
  * Retrieves paginated notes associated with a specific CRM record using the related records API.
5157
+ *
5158
+ * @param context - Authenticated Zoho CRM context for making API calls
5159
+ * @returns Function that retrieves notes for a specific record
5004
5160
  */ function zohoCrmGetNotesForRecord(context) {
5005
5161
  return zohoCrmGetRelatedRecordsFunctionFactory(context)({
5006
5162
  targetModule: ZOHO_CRM_NOTES_MODULE
@@ -5008,6 +5164,9 @@ function _object_spread_props$5(target, source) {
5008
5164
  }
5009
5165
  /**
5010
5166
  * Creates a page factory for iterating through all notes for a record across multiple pages.
5167
+ *
5168
+ * @param context - Authenticated Zoho CRM context for making API calls
5169
+ * @returns Page factory for paginating through notes for a record
5011
5170
  */ function zohoCrmGetNotesForRecordPageFactory(context) {
5012
5171
  return zohoFetchPageFactory(zohoCrmGetNotesForRecord(context));
5013
5172
  }
@@ -5015,6 +5174,9 @@ function _object_spread_props$5(target, source) {
5015
5174
  * Creates notes for a specific record, automatically binding the parent module and record ID to each note entry.
5016
5175
  *
5017
5176
  * https://www.zoho.com/crm/developer/docs/api/v8/create-notes.html
5177
+ *
5178
+ * @param context - Authenticated Zoho CRM context for making API calls
5179
+ * @returns Function that creates notes bound to a specific record
5018
5180
  */ function zohoCrmCreateNotesForRecord(context) {
5019
5181
  var createNotesInstance = zohoCrmCreateNotes(context);
5020
5182
  return function(input) {
@@ -5112,6 +5274,9 @@ function _unsupported_iterable_to_array(o, minLen) {
5112
5274
  }
5113
5275
  /**
5114
5276
  * Creates one or more tags for a CRM module. Duplicate tag errors are separated from other errors in the result to simplify idempotent workflows.
5277
+ *
5278
+ * @param context - Authenticated Zoho CRM context for making API calls
5279
+ * @returns Function that creates tags for a module
5115
5280
  */ function zohoCrmCreateTagsForModule(context) {
5116
5281
  return function(input) {
5117
5282
  return context.fetchJson("/v8/settings/tags?".concat(fetch.makeUrlSearchParams({
@@ -5153,8 +5318,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5153
5318
  *
5154
5319
  * https://www.zoho.com/crm/developer/docs/api/v8/delete-tag.html
5155
5320
  *
5156
- * @param context
5157
- * @returns
5321
+ * @param context - Authenticated Zoho CRM context for making API calls
5322
+ * @returns Function that deletes a tag by ID
5158
5323
  */ function zohoCrmDeleteTag(context) {
5159
5324
  return function(input) {
5160
5325
  return context.fetchJson("/v8/settings/tags/".concat(input.id), zohoCrmApiFetchJsonInput('DELETE')).then(function(x) {
@@ -5167,8 +5332,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5167
5332
  *
5168
5333
  * https://www.zoho.com/crm/developer-guide/apiv2/get-tag-list.html
5169
5334
  *
5170
- * @param context
5171
- * @returns
5335
+ * @param context - Authenticated Zoho CRM context for making API calls
5336
+ * @returns Function that retrieves tags for a module
5172
5337
  */ function zohoCrmGetTagsForModule(context) {
5173
5338
  return function(input) {
5174
5339
  return context.fetchJson("/v8/settings/tags?".concat(fetch.makeUrlSearchParams({
@@ -5184,6 +5349,9 @@ function _unsupported_iterable_to_array(o, minLen) {
5184
5349
  }
5185
5350
  /**
5186
5351
  * Creates a page factory for iterating through all tags in a module across multiple pages.
5352
+ *
5353
+ * @param context - Authenticated Zoho CRM context for making API calls
5354
+ * @returns Page factory for paginating through tags in a module
5187
5355
  */ function zohoCrmGetTagsForModulePageFactory(context) {
5188
5356
  return zohoFetchPageFactory(zohoCrmGetTagsForModule(context));
5189
5357
  }
@@ -5196,8 +5364,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5196
5364
  *
5197
5365
  * https://www.zoho.com/crm/developer-guide/apiv2/add-tags.html
5198
5366
  *
5199
- * @param context
5200
- * @returns
5367
+ * @param context - Authenticated Zoho CRM context for making API calls
5368
+ * @returns Function that adds tags to records
5201
5369
  */ function zohoCrmAddTagsToRecords(context) {
5202
5370
  return function(input) {
5203
5371
  return context.fetchJson("/v8/".concat(input.module, "/actions/add_tags"), zohoCrmApiFetchJsonInput('POST', zohoCrmAddTagsToRecordsRequestBody(input))).then(function(x) {
@@ -5210,6 +5378,9 @@ function _unsupported_iterable_to_array(o, minLen) {
5210
5378
  }
5211
5379
  /**
5212
5380
  * Builds the request body for the add/remove tags endpoints, merging `tag_names` into `tags` and enforcing the max ID limit.
5381
+ *
5382
+ * @param input - The add/remove tags request containing tag names, tag objects, and record IDs
5383
+ * @returns The formatted request body with merged tags and record IDs
5213
5384
  */ function zohoCrmAddTagsToRecordsRequestBody(input) {
5214
5385
  if (Array.isArray(input.ids) && input.ids.length > ZOHO_CRM_ADD_TAGS_TO_RECORDS_MAX_IDS_ALLOWED) {
5215
5386
  throw new Error("Cannot add/remove tags from more than ".concat(ZOHO_CRM_ADD_TAGS_TO_RECORDS_MAX_IDS_ALLOWED, " records at once."));
@@ -5242,8 +5413,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5242
5413
  *
5243
5414
  * https://www.zoho.com/crm/developer-guide/apiv2/remove-tags.html
5244
5415
  *
5245
- * @param context
5246
- * @returns
5416
+ * @param context - Authenticated Zoho CRM context for making API calls
5417
+ * @returns Function that removes tags from records
5247
5418
  */ function zohoCrmRemoveTagsFromRecords(context) {
5248
5419
  return function(input) {
5249
5420
  return context.fetchJson("/v8/".concat(input.module, "/actions/remove_tags"), zohoCrmApiFetchJsonInput('POST', zohoCrmAddTagsToRecordsRequestBody(input))).then(function(x) {
@@ -5510,7 +5681,7 @@ function _ts_generator$3(thisArg, body) {
5510
5681
  });
5511
5682
  var fetch$1 = handleZohoCrmErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
5512
5683
  if (_instanceof$1(x, ZohoInvalidTokenError)) {
5513
- accountsContext.loadAccessToken.resetAccessToken();
5684
+ void accountsContext.loadAccessToken.resetAccessToken();
5514
5685
  }
5515
5686
  });
5516
5687
  var fetchJson = fetch.fetchJsonFunction(fetch$1, {
@@ -5605,13 +5776,15 @@ function _object_spread_props$2(target, source) {
5605
5776
  * const secondPage = await firstPage.fetchNext();
5606
5777
  * }
5607
5778
  * ```
5608
- */ function zohoSignFetchPageFactory(fetch$1, defaults) {
5779
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic constraint requires any
5780
+ function zohoSignFetchPageFactory(fetch$1, defaults) {
5609
5781
  return fetch.fetchPageFactory(_object_spread_props$2(_object_spread$3({}, defaults), {
5610
5782
  fetch: fetch$1,
5611
5783
  readFetchPageResultInfo: function readFetchPageResultInfo(result) {
5612
5784
  var _ref;
5613
5785
  var _result_page_context;
5614
5786
  return {
5787
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- page_context may be missing in malformed responses
5615
5788
  hasNext: (_ref = (_result_page_context = result.page_context) === null || _result_page_context === void 0 ? void 0 : _result_page_context.has_more_rows) !== null && _ref !== void 0 ? _ref : false
5616
5789
  };
5617
5790
  },
@@ -5696,6 +5869,10 @@ function _object_without_properties_loose(source, excluded) {
5696
5869
  // MARK: Utility
5697
5870
  /**
5698
5871
  * Builds a {@link FetchJsonInput} for Zoho Sign API calls.
5872
+ *
5873
+ * @param method - HTTP method for the request
5874
+ * @param body - Optional JSON body to include in the request
5875
+ * @returns Configured fetch JSON input
5699
5876
  */ function zohoSignApiFetchJsonInput(method, body) {
5700
5877
  return {
5701
5878
  method: method,
@@ -5861,7 +6038,8 @@ function _object_without_properties_loose(source, excluded) {
5861
6038
  ]);
5862
6039
  var searchParams = fetch.makeUrlSearchParams(params);
5863
6040
  var queryString = searchParams.toString();
5864
- var url = "/requests/".concat(requestId, "/pdf").concat(queryString ? "?".concat(queryString) : '');
6041
+ var suffix = queryString ? "?".concat(queryString) : '';
6042
+ var url = "/requests/".concat(requestId, "/pdf").concat(suffix);
5865
6043
  return context.fetch(url, {
5866
6044
  method: 'GET'
5867
6045
  });
@@ -6091,7 +6269,12 @@ function _object_without_properties_loose(source, excluded) {
6091
6269
  }
6092
6270
 
6093
6271
  var ZOHO_SIGN_SERVICE_NAME = 'sign';
6094
- function zohoSignConfigApiUrl(input) {
6272
+ /**
6273
+ * Resolves an environment key or passthrough URL to the full Zoho Sign API URL.
6274
+ *
6275
+ * @param input - An environment key ('sandbox' or 'production') or a full API URL
6276
+ * @returns The resolved Zoho Sign API URL
6277
+ */ function zohoSignConfigApiUrl(input) {
6095
6278
  switch(input){
6096
6279
  case 'sandbox':
6097
6280
  return 'https://signsandbox.zoho.com/api/v1';
@@ -6233,7 +6416,12 @@ function _ts_generator$2(thisArg, body) {
6233
6416
  var logZohoSignErrorToConsole = logZohoServerErrorFunction('ZohoSign', {
6234
6417
  logDataArrayErrors: false
6235
6418
  });
6236
- function parseZohoSignError(responseError) {
6419
+ /**
6420
+ * Parses the JSON body of a failed Zoho Sign fetch response into a structured error, returning undefined if the body cannot be parsed.
6421
+ *
6422
+ * @param responseError - The fetch response error to parse
6423
+ * @returns Parsed Zoho server error, or undefined if parsing fails
6424
+ */ function parseZohoSignError(responseError) {
6237
6425
  return _async_to_generator$2(function() {
6238
6426
  var data, result;
6239
6427
  return _ts_generator$2(this, function(_state) {
@@ -6258,7 +6446,13 @@ function parseZohoSignError(responseError) {
6258
6446
  });
6259
6447
  })();
6260
6448
  }
6261
- function parseZohoSignServerErrorResponseData(errorResponseData, responseError) {
6449
+ /**
6450
+ * Converts raw Zoho Sign error response data into a parsed error, delegating to Sign-specific handlers for known error codes and falling back to the shared Zoho parser.
6451
+ *
6452
+ * @param errorResponseData - Raw error response data from the Zoho Sign API
6453
+ * @param responseError - The underlying fetch response error
6454
+ * @returns Parsed Zoho server error, or undefined if the data contains no recognizable error
6455
+ */ function parseZohoSignServerErrorResponseData(errorResponseData, responseError) {
6262
6456
  var result;
6263
6457
  var error = tryFindZohoServerErrorData(errorResponseData, responseError);
6264
6458
  if (error) {
@@ -6530,7 +6724,7 @@ function _ts_generator$1(thisArg, body) {
6530
6724
  });
6531
6725
  var fetch$1 = handleZohoSignErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
6532
6726
  if (_instanceof(x, ZohoInvalidTokenError)) {
6533
- accountsContext.loadAccessToken.resetAccessToken();
6727
+ void accountsContext.loadAccessToken.resetAccessToken();
6534
6728
  }
6535
6729
  });
6536
6730
  var fetchJson = fetch.fetchJsonFunction(fetch$1, {
@@ -6641,18 +6835,26 @@ function _ts_generator$1(thisArg, body) {
6641
6835
  }
6642
6836
  /**
6643
6837
  * Constructs a standard {@link FetchJsonInput} for Zoho Accounts API calls with the given HTTP method and optional body.
6838
+ *
6839
+ * @param method - HTTP method to use for the request
6840
+ * @param body - Optional request body to include
6841
+ * @returns Configured fetch input for the Zoho Accounts API call
6644
6842
  */ function zohoAccountsApiFetchJsonInput(method, body) {
6645
- var result = {
6843
+ return {
6646
6844
  method: method,
6647
6845
  body: body
6648
6846
  };
6649
- return result;
6650
6847
  }
6651
6848
 
6652
6849
  /**
6653
6850
  * The Zoho Accounts API URL for the US datacenter.
6654
6851
  */ var ZOHO_ACCOUNTS_US_API_URL = 'https://accounts.zoho.com';
6655
- function zohoAccountsConfigApiUrl(input) {
6852
+ /**
6853
+ * Resolves a Zoho Accounts API URL input to the full base URL. The 'us' key maps to the US datacenter; custom URLs pass through unchanged.
6854
+ *
6855
+ * @param input - A well-known datacenter key or a custom Zoho Accounts API URL
6856
+ * @returns The resolved full Zoho Accounts API base URL
6857
+ */ function zohoAccountsConfigApiUrl(input) {
6656
6858
  switch(input){
6657
6859
  case 'us':
6658
6860
  return ZOHO_ACCOUNTS_US_API_URL;
@@ -7019,7 +7221,7 @@ function _ts_generator(thisArg, body) {
7019
7221
  }
7020
7222
  if (!!currentToken) return [
7021
7223
  3,
7022
- 10
7224
+ 9
7023
7225
  ];
7024
7226
  _state.label = 3;
7025
7227
  case 3:
@@ -7044,35 +7246,29 @@ function _ts_generator(thisArg, body) {
7044
7246
  console.error("zohoAccountsZohoAccessTokenFactory(): Failed retrieving new token from tokenRefresher: ", e);
7045
7247
  throw new ZohoAccountsAuthFailureError('Token Refresh Failed');
7046
7248
  case 6:
7047
- if (!currentToken) return [
7048
- 3,
7049
- 10
7050
- ];
7051
- _state.label = 7;
7052
- case 7:
7053
7249
  _state.trys.push([
7054
- 7,
7055
- 9,
7250
+ 6,
7251
+ 8,
7056
7252
  ,
7057
- 10
7253
+ 9
7058
7254
  ]);
7059
7255
  return [
7060
7256
  4,
7061
7257
  accessTokenCache === null || accessTokenCache === void 0 ? void 0 : accessTokenCache.updateCachedToken(currentToken)
7062
7258
  ];
7063
- case 8:
7259
+ case 7:
7064
7260
  _state.sent();
7065
7261
  return [
7066
7262
  3,
7067
- 10
7263
+ 9
7068
7264
  ];
7069
- case 9:
7265
+ case 8:
7070
7266
  _state.sent();
7071
7267
  return [
7072
7268
  3,
7073
- 10
7269
+ 9
7074
7270
  ];
7075
- case 10:
7271
+ case 9:
7076
7272
  return [
7077
7273
  2,
7078
7274
  currentToken
@@ -7107,6 +7303,7 @@ function safeZohoDateTimeString(date) {
7107
7303
 
7108
7304
  exports.DEFAULT_ZOHO_API_RATE_LIMIT = DEFAULT_ZOHO_API_RATE_LIMIT;
7109
7305
  exports.DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD = DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD;
7306
+ exports.DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
7110
7307
  exports.DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION;
7111
7308
  exports.MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA = MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA;
7112
7309
  exports.MAX_ZOHO_RECRUIT_SEARCH_MODULE_RECORDS_CRITERIA = MAX_ZOHO_RECRUIT_SEARCH_MODULE_RECORDS_CRITERIA;