@dereekb/zoho 13.4.0 → 13.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/index.cjs.js +272 -92
  2. package/index.esm.js +272 -93
  3. package/nestjs/index.cjs.js +404 -90
  4. package/nestjs/index.esm.js +404 -90
  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
@@ -113,6 +113,9 @@ function _object_spread_props$c(target, source) {
113
113
  */ var ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
114
114
  /**
115
115
  * Resolves an environment key or passthrough URL to the full Zoho Recruit API URL.
116
+ *
117
+ * @param input - An environment key ('sandbox' or 'production') or a full API URL
118
+ * @returns The resolved Zoho Recruit API URL
116
119
  */ function zohoRecruitConfigApiUrl(input) {
117
120
  switch(input){
118
121
  case 'sandbox':
@@ -192,18 +195,20 @@ function _type_of$6(obj) {
192
195
  result = input;
193
196
  break;
194
197
  case 'object':
195
- var tree;
196
- if (Array.isArray(input)) {
197
- tree = {
198
- and: [
199
- input
200
- ]
201
- };
202
- } else {
203
- tree = input;
198
+ {
199
+ var tree;
200
+ if (Array.isArray(input)) {
201
+ tree = {
202
+ and: [
203
+ input
204
+ ]
205
+ };
206
+ } else {
207
+ tree = input;
208
+ }
209
+ result = zohoSearchRecordsCriteriaStringForTree(tree);
210
+ break;
204
211
  }
205
- result = zohoSearchRecordsCriteriaStringForTree(tree);
206
- break;
207
212
  }
208
213
  }
209
214
  return result;
@@ -554,7 +559,12 @@ function _ts_generator$9(thisArg, body) {
554
559
  /**
555
560
  * Set in the status field
556
561
  */ var ZOHO_ERROR_STATUS = 'error';
557
- function zohoServerErrorData(error) {
562
+ /**
563
+ * Normalizes a Zoho error response entry into a consistent {@link ZohoServerErrorData} shape, handling both object and string error formats.
564
+ *
565
+ * @param error - The raw error entry, either a structured object or a plain error code string
566
+ * @returns Normalized error data with code and message fields
567
+ */ function zohoServerErrorData(error) {
558
568
  var errorType = typeof error === "undefined" ? "undefined" : _type_of$5(error);
559
569
  var errorData;
560
570
  if (errorType === 'object') {
@@ -638,8 +648,9 @@ function zohoServerErrorData(error) {
638
648
  /**
639
649
  * Creates a logZohoServerErrorFunction that logs the error to console.
640
650
  *
641
- * @param zohoApiNamePrefix Prefix to use when logging. I.E. ZohoRecruitError, etc.
642
- * @returns
651
+ * @param zohoApiNamePrefix - Prefix to use when logging (e.g. 'ZohoRecruit', 'ZohoSign')
652
+ * @param options - Optional configuration for controlling which error types are logged
653
+ * @returns A function that logs Zoho server errors to the console
643
654
  */ function logZohoServerErrorFunction(zohoApiNamePrefix, options) {
644
655
  var _ref = options !== null && options !== void 0 ? options : {}, _ref_logDataArrayErrors = _ref.logDataArrayErrors, logDataArrayErrors = _ref_logDataArrayErrors === void 0 ? false : _ref_logDataArrayErrors;
645
656
  return function(error) {
@@ -662,8 +673,9 @@ function zohoServerErrorData(error) {
662
673
  /**
663
674
  * Wraps a ConfiguredFetch to support handling errors returned by fetch.
664
675
  *
665
- * @param fetch
666
- * @returns
676
+ * @param parseZohoError - Function that parses a fetch response error into a Zoho-specific error
677
+ * @param defaultLogError - Default error logging function used when no custom logger is provided
678
+ * @returns Factory that wraps a ConfiguredFetch with Zoho error handling
667
679
  */ function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
668
680
  return function(fetch$1) {
669
681
  var logError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultLogError, onError = arguments.length > 2 ? arguments[2] : void 0;
@@ -720,16 +732,17 @@ function zohoServerErrorData(error) {
720
732
  }
721
733
  /**
722
734
  * FetchJsonInterceptJsonResponseFunction that intercepts a 200 response that actually contains a ZohoServerError and throws a ZohoServerError for the error handling to catch.
735
+ *
736
+ * @param parseZohoServerErrorResponseData - Function that parses raw error response data into a structured error
737
+ * @returns Interceptor function that detects and throws hidden errors in 200 responses
723
738
  */ function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData) {
724
739
  return function(json, response) {
725
740
  var error = json === null || json === void 0 ? void 0 : json.error;
726
741
  if (error != null) {
727
742
  var responseError = new fetch.FetchResponseError(response);
728
- if (responseError) {
729
- var parsedError = parseZohoServerErrorResponseData(json, responseError);
730
- if (parsedError) {
731
- throw parsedError;
732
- }
743
+ var parsedError = parseZohoServerErrorResponseData(json, responseError);
744
+ if (parsedError) {
745
+ throw parsedError;
733
746
  }
734
747
  }
735
748
  return json;
@@ -819,7 +832,12 @@ var ZOHO_RATE_LIMIT_REMAINING_HEADER = 'X-RATELIMIT-REMAINING';
819
832
  var ZOHO_RATE_LIMIT_RESET_HEADER = 'X-RATELIMIT-RESET';
820
833
  var DEFAULT_ZOHO_API_RATE_LIMIT = 100;
821
834
  var DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD = util.MS_IN_MINUTE;
822
- function zohoRateLimitHeaderDetails(headers) {
835
+ /**
836
+ * Extracts rate limit details from Zoho API response headers, returning null if the headers are absent.
837
+ *
838
+ * @param headers - HTTP response headers from a Zoho API call
839
+ * @returns Parsed rate limit details, or null if rate limit headers are missing
840
+ */ function zohoRateLimitHeaderDetails(headers) {
823
841
  var limitHeader = headers.get(ZOHO_RATE_LIMIT_LIMIT_HEADER);
824
842
  var remainingHeader = headers.get(ZOHO_RATE_LIMIT_REMAINING_HEADER);
825
843
  var resetHeader = headers.get(ZOHO_RATE_LIMIT_RESET_HEADER);
@@ -857,9 +875,9 @@ var ZohoTooManyRequestsError = /*#__PURE__*/ function(ZohoServerFetchResponseErr
857
875
  /**
858
876
  * Function that parses/transforms a ZohoServerErrorResponseData into a general ZohoServerError or other known error type.
859
877
  *
860
- * @param errorResponseData
861
- * @param responseError
862
- * @returns
878
+ * @param errorResponseData - Raw error response data from the Zoho API
879
+ * @param responseError - The underlying fetch response error
880
+ * @returns A typed Zoho server error, or undefined if no error is found
863
881
  */ function parseZohoServerErrorResponseData(errorResponseData, responseError) {
864
882
  var result;
865
883
  if (isZohoServerErrorResponseDataArrayRef(errorResponseData)) {
@@ -904,8 +922,7 @@ var ZohoTooManyRequestsError = /*#__PURE__*/ function(ZohoServerFetchResponseErr
904
922
  */ function tryFindZohoServerErrorData(errorResponseData, responseError) {
905
923
  var _ref, _errorResponseData_error;
906
924
  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;
925
+ 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
926
  }
910
927
 
911
928
  function _assert_this_initialized$4(self) {
@@ -1202,17 +1219,22 @@ function _ts_generator$8(thisArg, body) {
1202
1219
  }(ZohoRecruitRecordCrudInvalidDataError);
1203
1220
  /**
1204
1221
  * Creates a typed CRUD error subclass based on the error code returned by the Zoho Recruit API, enabling callers to catch specific failure modes.
1222
+ *
1223
+ * @param error - Structured error data from the Zoho Recruit API response
1224
+ * @returns A specific CRUD error subclass matching the error code
1205
1225
  */ function zohoRecruitRecordCrudError(error) {
1206
1226
  var result;
1207
1227
  switch(error.code){
1208
1228
  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;
1229
+ {
1230
+ var invalidDataError = new ZohoRecruitRecordCrudInvalidDataError(error);
1231
+ if (invalidDataError.invalidFieldDetails['id']) {
1232
+ result = new ZohoRecruitRecordCrudNoMatchingRecordError(error);
1233
+ } else {
1234
+ result = invalidDataError;
1235
+ }
1236
+ break;
1214
1237
  }
1215
- break;
1216
1238
  case ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE:
1217
1239
  result = new ZohoRecruitRecordCrudMandatoryFieldNotFoundError(error);
1218
1240
  break;
@@ -1227,10 +1249,14 @@ function _ts_generator$8(thisArg, body) {
1227
1249
  }
1228
1250
  /**
1229
1251
  * Returns an assertion function that throws {@link ZohoRecruitRecordNoContentError} when the data array result is empty or null, indicating the requested record does not exist.
1252
+ *
1253
+ * @param moduleName - Optional module name for the error context
1254
+ * @param recordId - Optional record ID for the error context
1255
+ * @returns Assertion function that validates the data array is non-empty
1230
1256
  */ function assertZohoRecruitRecordDataArrayResultHasContent(moduleName, recordId) {
1231
1257
  return function(x) {
1232
1258
  var _x_data;
1233
- if (x == null || !((_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.length)) {
1259
+ if (!(x === null || x === void 0 ? void 0 : (_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.length)) {
1234
1260
  throw new ZohoRecruitRecordNoContentError(moduleName, recordId);
1235
1261
  } else {
1236
1262
  return x;
@@ -1242,6 +1268,9 @@ function _ts_generator$8(thisArg, body) {
1242
1268
  */ var logZohoRecruitErrorToConsole = logZohoServerErrorFunction('ZohoRecruit');
1243
1269
  /**
1244
1270
  * Parses the JSON body of a failed Zoho Recruit fetch response into a structured error, returning undefined if the body cannot be parsed.
1271
+ *
1272
+ * @param responseError - The fetch response error to parse
1273
+ * @returns Parsed Zoho server error, or undefined if parsing fails
1245
1274
  */ function parseZohoRecruitError(responseError) {
1246
1275
  return _async_to_generator$8(function() {
1247
1276
  var data, result;
@@ -1250,7 +1279,7 @@ function _ts_generator$8(thisArg, body) {
1250
1279
  case 0:
1251
1280
  return [
1252
1281
  4,
1253
- responseError.response.json().catch(function(x) {
1282
+ responseError.response.json().catch(function() {
1254
1283
  return undefined;
1255
1284
  })
1256
1285
  ];
@@ -1269,6 +1298,10 @@ function _ts_generator$8(thisArg, body) {
1269
1298
  }
1270
1299
  /**
1271
1300
  * 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.
1301
+ *
1302
+ * @param errorResponseData - Raw error response data from the Zoho Recruit API
1303
+ * @param responseError - The underlying fetch response error
1304
+ * @returns Parsed Zoho server error, or undefined if the data contains no recognizable error
1272
1305
  */ function parseZohoRecruitServerErrorResponseData(errorResponseData, responseError) {
1273
1306
  var result;
1274
1307
  var error = tryFindZohoServerErrorData(errorResponseData, responseError);
@@ -1411,6 +1444,11 @@ function _is_native_reflect_construct$3() {
1411
1444
  *
1412
1445
  * When a single record is provided, the function returns the change details directly or throws on error.
1413
1446
  * When multiple records are provided, it returns a paired success/error result.
1447
+ *
1448
+ * @param context - Zoho Recruit API context providing fetch and authentication
1449
+ * @param fetchUrlPrefix - URL path suffix for the endpoint (empty for insert/update, '/upsert' for upsert)
1450
+ * @param fetchMethod - HTTP method to use for the request
1451
+ * @returns Factory function that inserts, updates, or upserts records
1414
1452
  */ function updateRecordLikeFunction$1(context, fetchUrlPrefix, fetchMethod) {
1415
1453
  return function(param) {
1416
1454
  var data = param.data, module = param.module;
@@ -1671,11 +1709,11 @@ function _is_native_reflect_construct$3() {
1671
1709
  var criteriaString = zohoRecruitSearchRecordsCriteriaString(input.criteria);
1672
1710
  baseInput.criteria = criteriaString;
1673
1711
  }
1712
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Zoho API migration pending
1674
1713
  if (!baseInput.word && !input.criteria && !input.email && !input.phone) {
1675
1714
  throw new Error('At least one of word, criteria, email, or phone must be provided');
1676
1715
  }
1677
- var urlParams = zohoRecruitUrlSearchParamsMinusModule(baseInput);
1678
- return urlParams;
1716
+ return zohoRecruitUrlSearchParamsMinusModule(baseInput);
1679
1717
  }
1680
1718
  return function(input) {
1681
1719
  return context.fetchJson("/v2/".concat(input.module, "/search?").concat(searchRecordsUrlSearchParams(input).toString()), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
@@ -1744,6 +1782,7 @@ function _is_native_reflect_construct$3() {
1744
1782
  */ function zohoRecruitGetRelatedRecordsFunctionFactory(context) {
1745
1783
  return function(config) {
1746
1784
  var targetModule = config.targetModule, _config_returnEmptyRecordsInsteadOfNull = config.returnEmptyRecordsInsteadOfNull, returnEmptyRecordsInsteadOfNull = _config_returnEmptyRecordsInsteadOfNull === void 0 ? true : _config_returnEmptyRecordsInsteadOfNull;
1785
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Zoho API migration pending
1747
1786
  return function(input) {
1748
1787
  return context.fetchJson("/v2/".concat(input.module, "/").concat(input.id, "/").concat(targetModule, "?").concat(zohoRecruitUrlSearchParamsMinusIdAndModule(input, input.filter).toString()), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
1749
1788
  return x !== null && x !== void 0 ? x : returnEmptyRecordsInsteadOfNull !== false ? emptyZohoPageResult() : x;
@@ -2076,6 +2115,9 @@ function _is_native_reflect_construct$3() {
2076
2115
  // MARK: Util
2077
2116
  /**
2078
2117
  * Builds URL search params from input objects, omitting the `module` key since it is used in the URL path rather than query string.
2118
+ *
2119
+ * @param input - One or more objects whose key-value pairs become query parameters
2120
+ * @returns URLSearchParams with the `module` key excluded
2079
2121
  */ function zohoRecruitUrlSearchParamsMinusModule() {
2080
2122
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
2081
2123
  input[_key] = arguments[_key];
@@ -2086,6 +2128,9 @@ function _is_native_reflect_construct$3() {
2086
2128
  }
2087
2129
  /**
2088
2130
  * Builds URL search params from input objects, omitting both `id` and `module` keys since they are used in the URL path.
2131
+ *
2132
+ * @param input - One or more objects whose key-value pairs become query parameters
2133
+ * @returns URLSearchParams with `id` and `module` keys excluded
2089
2134
  */ function zohoRecruitUrlSearchParamsMinusIdAndModule() {
2090
2135
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
2091
2136
  input[_key] = arguments[_key];
@@ -2102,12 +2147,15 @@ function _is_native_reflect_construct$3() {
2102
2147
  */ var zohoRecruitUrlSearchParams = fetch.makeUrlSearchParams;
2103
2148
  /**
2104
2149
  * Constructs a standard {@link FetchJsonInput} for Zoho Recruit API calls with the given HTTP method and optional body.
2150
+ *
2151
+ * @param method - HTTP method for the request
2152
+ * @param body - Optional JSON body to include in the request
2153
+ * @returns Configured fetch JSON input
2105
2154
  */ function zohoRecruitApiFetchJsonInput(method, body) {
2106
- var result = {
2155
+ return {
2107
2156
  method: method,
2108
2157
  body: body !== null && body !== void 0 ? body : undefined
2109
2158
  };
2110
- return result;
2111
2159
  }
2112
2160
  /**
2113
2161
  * Separates a change response's entries into success and error arrays based on their status.
@@ -2287,6 +2335,9 @@ function _object_spread_props$a(target, source) {
2287
2335
  *
2288
2336
  * The result separates "already associated" errors from other errors, allowing callers to treat duplicate associations as non-fatal.
2289
2337
  *
2338
+ * @param context - Zoho Recruit API context providing fetch and authentication
2339
+ * @returns Factory function that associates candidates with job openings
2340
+ *
2290
2341
  * https://www.zoho.com/recruit/developer-guide/apiv2/associate-candidate.html
2291
2342
  */ function zohoRecruitAssociateCandidateRecordsWithJobOpenings(context) {
2292
2343
  return function(input) {
@@ -2310,6 +2361,9 @@ function _object_spread_props$a(target, source) {
2310
2361
  }
2311
2362
  /**
2312
2363
  * Searches for records associated with a given candidate or job opening. Returns an empty page result when no records are found.
2364
+ *
2365
+ * @param context - Zoho Recruit API context providing fetch and authentication
2366
+ * @returns Factory function that searches for associated records
2313
2367
  */ function zohoRecruitSearchAssociatedRecords(context) {
2314
2368
  return function(input) {
2315
2369
  return context.fetchJson("/v2/".concat(input.module, "/").concat(input.id, "/associate?").concat(zohoRecruitUrlSearchParamsMinusIdAndModule(input).toString()), zohoRecruitApiFetchJsonInput('GET')).then(function(x) {
@@ -2320,6 +2374,9 @@ function _object_spread_props$a(target, source) {
2320
2374
  }
2321
2375
  /**
2322
2376
  * Searches for job openings associated with a specific candidate.
2377
+ *
2378
+ * @param context - Zoho Recruit API context providing fetch and authentication
2379
+ * @returns Factory function that searches for job openings associated with a candidate
2323
2380
  */ function zohoRecruitSearchCandidateAssociatedJobOpeningRecords(context) {
2324
2381
  var searchAssociatedRecordsFactory = zohoRecruitSearchAssociatedRecords(context);
2325
2382
  return function(input) {
@@ -2330,11 +2387,18 @@ function _object_spread_props$a(target, source) {
2330
2387
  }
2331
2388
  /**
2332
2389
  * Creates a page factory for paginating over job openings associated with a candidate.
2390
+ *
2391
+ * @param context - Zoho Recruit API context providing fetch and authentication
2392
+ * @returns Page factory for iterating through associated job openings
2333
2393
  */ function zohoRecruitSearchCandidateAssociatedJobOpeningRecordsPageFactory(context) {
2334
2394
  return zohoFetchPageFactory(zohoRecruitSearchCandidateAssociatedJobOpeningRecords(context));
2335
2395
  }
2336
2396
  /**
2337
2397
  * Searches for candidates associated with a specific job opening.
2398
+ *
2399
+ * @param context - Zoho Recruit API context providing fetch and authentication
2400
+ * @param jobOpeningModuleName - Module name for job openings, defaults to the standard module
2401
+ * @returns Factory function that searches for candidates associated with a job opening
2338
2402
  */ function zohoRecruitSearchJobOpeningAssociatedCandidateRecords(context) {
2339
2403
  var jobOpeningModuleName = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZOHO_RECRUIT_JOB_OPENINGS_MODULE;
2340
2404
  var searchAssociatedRecordsFactory = zohoRecruitSearchAssociatedRecords(context);
@@ -2346,6 +2410,9 @@ function _object_spread_props$a(target, source) {
2346
2410
  }
2347
2411
  /**
2348
2412
  * Creates a page factory for paginating over candidates associated with a job opening.
2413
+ *
2414
+ * @param context - Zoho Recruit API context providing fetch and authentication
2415
+ * @returns Page factory for iterating through associated candidates
2349
2416
  */ function zohoRecruitSearchJobOpeningAssociatedCandidateRecordsPageFactory(context) {
2350
2417
  return zohoFetchPageFactory(zohoRecruitSearchJobOpeningAssociatedCandidateRecords(context));
2351
2418
  }
@@ -3014,7 +3081,12 @@ var ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = 'invalid_client';
3014
3081
  return ZohoAccountsAuthFailureError;
3015
3082
  }(fetch.FetchRequestFactoryError);
3016
3083
  var logZohoAccountsErrorToConsole = logZohoServerErrorFunction('ZohoAccounts');
3017
- function parseZohoAccountsError(responseError) {
3084
+ /**
3085
+ * Parses a fetch response error into a typed Zoho Accounts server error by extracting and interpreting the JSON error body.
3086
+ *
3087
+ * @param responseError - The fetch response error to parse
3088
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
3089
+ */ function parseZohoAccountsError(responseError) {
3018
3090
  return _async_to_generator$7(function() {
3019
3091
  var data, result;
3020
3092
  return _ts_generator$7(this, function(_state) {
@@ -3022,7 +3094,7 @@ function parseZohoAccountsError(responseError) {
3022
3094
  case 0:
3023
3095
  return [
3024
3096
  4,
3025
- responseError.response.json().catch(function(x) {
3097
+ responseError.response.json().catch(function() {
3026
3098
  return undefined;
3027
3099
  })
3028
3100
  ];
@@ -3039,7 +3111,13 @@ function parseZohoAccountsError(responseError) {
3039
3111
  });
3040
3112
  })();
3041
3113
  }
3042
- function parseZohoAccountsServerErrorResponseData(errorResponseData, responseError) {
3114
+ /**
3115
+ * 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.
3116
+ *
3117
+ * @param errorResponseData - The raw error response data from the Zoho Accounts API
3118
+ * @param responseError - The original fetch response error for context
3119
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
3120
+ */ function parseZohoAccountsServerErrorResponseData(errorResponseData, responseError) {
3043
3121
  var result;
3044
3122
  var error = errorResponseData.error;
3045
3123
  if (error) {
@@ -3189,6 +3267,9 @@ function _ts_generator$6(thisArg, body) {
3189
3267
  }
3190
3268
  /**
3191
3269
  * Generates a new ZohoAccessTokenStringFactory.
3270
+ *
3271
+ * @param zohoAccessTokenFactory - Factory that produces ZohoAccessToken instances
3272
+ * @returns A factory function that resolves to the access token string
3192
3273
  */ function zohoAccessTokenStringFactory(zohoAccessTokenFactory) {
3193
3274
  return function() {
3194
3275
  return _async_to_generator$6(function() {
@@ -3202,7 +3283,7 @@ function _ts_generator$6(thisArg, body) {
3202
3283
  ];
3203
3284
  case 1:
3204
3285
  token = _state.sent();
3205
- if (!(token === null || token === void 0 ? void 0 : token.accessToken)) {
3286
+ if (!token.accessToken) {
3206
3287
  throw new ZohoAccountsAuthFailureError();
3207
3288
  }
3208
3289
  return [
@@ -3217,7 +3298,9 @@ function _ts_generator$6(thisArg, body) {
3217
3298
 
3218
3299
  /**
3219
3300
  * 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) {
3301
+ *
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) {
3221
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, "."));
3222
3305
  };
3223
3306
  /**
@@ -3236,13 +3319,17 @@ function _ts_generator$6(thisArg, body) {
3236
3319
  * @returns A rate-limited fetch handler with the underlying rate limiter accessible via `_rateLimiter`
3237
3320
  */ function zohoRateLimitedFetchHandler(config) {
3238
3321
  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;
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;
3240
3323
  var defaultLimit = (_ref1 = config === null || config === void 0 ? void 0 : config.maxRateLimit) !== null && _ref1 !== void 0 ? _ref1 : DEFAULT_ZOHO_API_RATE_LIMIT;
3241
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;
3242
3325
  /**
3243
3326
  * Builds a rate limiter config derived from the given limit.
3244
3327
  * Called once at initialization with `defaultLimit`, and again dynamically
3245
3328
  * when the API's `X-RATELIMIT-LIMIT` header reports a different value.
3329
+ *
3330
+ * @param limit - Maximum number of requests allowed per reset period
3331
+ * @param resetAt - Optional date when the rate limit window resets
3332
+ * @returns Rate limiter configuration scaled to the given limit
3246
3333
  */ function configForLimit(limit, resetAt) {
3247
3334
  return {
3248
3335
  limit: limit,
@@ -3261,6 +3348,10 @@ function _ts_generator$6(thisArg, body) {
3261
3348
  /**
3262
3349
  * Inspects each response for Zoho rate limit headers and updates the limiter accordingly.
3263
3350
  * Returns `true` to signal a retry when a 429 status is received.
3351
+ *
3352
+ * @param response - The HTTP response to inspect for rate limit headers
3353
+ * @param fetchResponseError - Optional fetch error if the response was an error
3354
+ * @returns Whether the request should be retried
3264
3355
  */ updateWithResponse: function updateWithResponse(response, fetchResponseError) {
3265
3356
  var hasLimitHeader = response.headers.has(ZOHO_RATE_LIMIT_REMAINING_HEADER);
3266
3357
  var shouldRetry = false;
@@ -3280,8 +3371,9 @@ function _ts_generator$6(thisArg, body) {
3280
3371
  if (response.status === ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3281
3372
  shouldRetry = true;
3282
3373
  try {
3283
- onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(headerDetails, response, fetchResponseError);
3284
- } catch (e) {}
3374
+ void (onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(headerDetails, response, fetchResponseError));
3375
+ } catch (unused) {
3376
+ /* ignored */ }
3285
3377
  }
3286
3378
  }
3287
3379
  }
@@ -3290,6 +3382,10 @@ function _ts_generator$6(thisArg, body) {
3290
3382
  }
3291
3383
  });
3292
3384
  }
3385
+ // MARK: Compat
3386
+ /**
3387
+ * @deprecated use DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION instead.
3388
+ */ var DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
3293
3389
 
3294
3390
  function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3295
3391
  try {
@@ -3546,7 +3642,7 @@ function _ts_generator$5(thisArg, body) {
3546
3642
  });
3547
3643
  var fetch$1 = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
3548
3644
  if (_instanceof$4(x, ZohoInvalidTokenError)) {
3549
- accountsContext.loadAccessToken.resetAccessToken();
3645
+ void accountsContext.loadAccessToken.resetAccessToken();
3550
3646
  }
3551
3647
  });
3552
3648
  var fetchJson = fetch.fetchJsonFunction(fetch$1, {
@@ -3578,6 +3674,9 @@ function _ts_generator$5(thisArg, body) {
3578
3674
  */ var ZOHO_CRM_SERVICE_NAME = 'crm';
3579
3675
  /**
3580
3676
  * 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.
3677
+ *
3678
+ * @param input - A well-known environment key or a custom CRM API URL
3679
+ * @returns The resolved full Zoho CRM API base URL
3581
3680
  */ function zohoCrmConfigApiUrl(input) {
3582
3681
  switch(input){
3583
3682
  case 'sandbox':
@@ -3939,17 +4038,22 @@ function _ts_generator$4(thisArg, body) {
3939
4038
  }(ZohoCrmRecordCrudInvalidDataError);
3940
4039
  /**
3941
4040
  * Maps a Zoho CRM server error to the appropriate typed {@link ZohoCrmRecordCrudError} subclass based on the error code and affected field.
4041
+ *
4042
+ * @param error - The server error data containing the error code and field details
4043
+ * @returns The appropriate typed CRM CRUD error instance
3942
4044
  */ function zohoCrmRecordCrudError(error) {
3943
4045
  var result;
3944
4046
  switch(error.code){
3945
4047
  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;
4048
+ {
4049
+ var invalidDataError = new ZohoCrmRecordCrudInvalidDataError(error);
4050
+ if (invalidDataError.invalidFieldDetails.api_name === 'id') {
4051
+ result = new ZohoCrmRecordCrudNoMatchingRecordError(error);
4052
+ } else {
4053
+ result = invalidDataError;
4054
+ }
4055
+ break;
3951
4056
  }
3952
- break;
3953
4057
  case ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE:
3954
4058
  result = new ZohoCrmRecordCrudMandatoryFieldNotFoundError(error);
3955
4059
  break;
@@ -3964,10 +4068,14 @@ function _ts_generator$4(thisArg, body) {
3964
4068
  }
3965
4069
  /**
3966
4070
  * Returns an assertion function that throws {@link ZohoCrmRecordNoContentError} when a data array result is empty or null, typically indicating a missing record.
4071
+ *
4072
+ * @param moduleName - Optional CRM module name for the error context
4073
+ * @param recordId - Optional record ID for the error context
4074
+ * @returns Assertion function that throws if the data array is empty
3967
4075
  */ function assertZohoCrmRecordDataArrayResultHasContent(moduleName, recordId) {
3968
4076
  return function(x) {
3969
4077
  var _x_data;
3970
- if (x == null || !((_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.length)) {
4078
+ if (!(x === null || x === void 0 ? void 0 : (_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.length)) {
3971
4079
  throw new ZohoCrmRecordNoContentError(moduleName, recordId);
3972
4080
  } else {
3973
4081
  return x;
@@ -3981,6 +4089,9 @@ function _ts_generator$4(thisArg, body) {
3981
4089
  });
3982
4090
  /**
3983
4091
  * Parses a fetch response error into a typed Zoho CRM server error by extracting and interpreting the JSON error body.
4092
+ *
4093
+ * @param responseError - The fetch response error to parse
4094
+ * @returns The parsed Zoho server error, or undefined if the response could not be parsed
3984
4095
  */ function parseZohoCrmError(responseError) {
3985
4096
  return _async_to_generator$4(function() {
3986
4097
  var data, result;
@@ -3989,7 +4100,7 @@ function _ts_generator$4(thisArg, body) {
3989
4100
  case 0:
3990
4101
  return [
3991
4102
  4,
3992
- responseError.response.json().catch(function(x) {
4103
+ responseError.response.json().catch(function() {
3993
4104
  return undefined;
3994
4105
  })
3995
4106
  ];
@@ -4008,6 +4119,10 @@ function _ts_generator$4(thisArg, body) {
4008
4119
  }
4009
4120
  /**
4010
4121
  * 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.
4122
+ *
4123
+ * @param errorResponseData - The raw error response data from the Zoho CRM API
4124
+ * @param responseError - The original fetch response error for context
4125
+ * @returns The parsed Zoho server error, or undefined if the error could not be classified
4011
4126
  */ function parseZohoCrmServerErrorResponseData(errorResponseData, responseError) {
4012
4127
  var result;
4013
4128
  var error = tryFindZohoServerErrorData(errorResponseData, responseError);
@@ -4153,6 +4268,11 @@ function _is_native_reflect_construct() {
4153
4268
  *
4154
4269
  * When a single record is provided, the function returns the change details directly or throws on error.
4155
4270
  * When multiple records are provided, it returns a paired success/error result.
4271
+ *
4272
+ * @param context - Authenticated Zoho CRM context for making API calls
4273
+ * @param fetchUrlPrefix - URL path segment appended after the module name (empty string for insert/update, '/upsert' for upsert)
4274
+ * @param fetchMethod - HTTP method to use for the request (POST for insert/upsert, PUT for update)
4275
+ * @returns Overloaded function handling both single and multi-record operations
4156
4276
  */ function updateRecordLikeFunction(context, fetchUrlPrefix, fetchMethod) {
4157
4277
  return function(param) {
4158
4278
  var data = param.data, module = param.module;
@@ -4417,8 +4537,7 @@ function _is_native_reflect_construct() {
4417
4537
  if (!baseInput.word && !input.cvid && !input.criteria && !input.email && !input.phone) {
4418
4538
  throw new Error('At least one of word, cvid, criteria, email, or phone must be provided');
4419
4539
  }
4420
- var urlParams = zohoCrmUrlSearchParamsMinusModule(baseInput);
4421
- return urlParams;
4540
+ return zohoCrmUrlSearchParamsMinusModule(baseInput);
4422
4541
  }
4423
4542
  return function(input) {
4424
4543
  return context.fetchJson("/v8/".concat(input.module, "/search?").concat(searchRecordsUrlSearchParams(input).toString()), zohoCrmApiFetchJsonInput('GET')).then(function(x) {
@@ -4487,6 +4606,7 @@ function _is_native_reflect_construct() {
4487
4606
  */ function zohoCrmGetRelatedRecordsFunctionFactory(context) {
4488
4607
  return function(config) {
4489
4608
  var targetModule = config.targetModule, _config_returnEmptyRecordsInsteadOfNull = config.returnEmptyRecordsInsteadOfNull, returnEmptyRecordsInsteadOfNull = _config_returnEmptyRecordsInsteadOfNull === void 0 ? true : _config_returnEmptyRecordsInsteadOfNull;
4609
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Zoho API migration pending
4490
4610
  return function(input) {
4491
4611
  return context.fetchJson("/v8/".concat(input.module, "/").concat(input.id, "/").concat(targetModule, "?").concat(zohoCrmUrlSearchParamsMinusIdAndModule(input, input.filter).toString()), zohoCrmApiFetchJsonInput('GET')).then(function(x) {
4492
4612
  return x !== null && x !== void 0 ? x : returnEmptyRecordsInsteadOfNull !== false ? emptyZohoPageResult() : x;
@@ -4804,6 +4924,9 @@ function _is_native_reflect_construct() {
4804
4924
  // MARK: Util
4805
4925
  /**
4806
4926
  * 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.
4927
+ *
4928
+ * @param input - One or more objects to convert into URL search parameters
4929
+ * @returns URL search params string with the `module` key excluded
4807
4930
  */ function zohoCrmUrlSearchParamsMinusModule() {
4808
4931
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
4809
4932
  input[_key] = arguments[_key];
@@ -4814,6 +4937,9 @@ function _is_native_reflect_construct() {
4814
4937
  }
4815
4938
  /**
4816
4939
  * Builds URL search params from the input objects, omitting both `id` and `module` keys since they are used in the URL path.
4940
+ *
4941
+ * @param input - One or more objects to convert into URL search parameters
4942
+ * @returns URL search params string with `id` and `module` keys excluded
4817
4943
  */ function zohoCrmUrlSearchParamsMinusIdAndModule() {
4818
4944
  for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
4819
4945
  input[_key] = arguments[_key];
@@ -4830,18 +4956,24 @@ function _is_native_reflect_construct() {
4830
4956
  */ var zohoCrmUrlSearchParams = fetch.makeUrlSearchParams;
4831
4957
  /**
4832
4958
  * Constructs the standard FetchJsonInput used by CRM API calls, pairing the HTTP method with an optional body.
4959
+ *
4960
+ * @param method - HTTP method to use for the request
4961
+ * @param body - Optional request body to include
4962
+ * @returns Configured fetch input for the Zoho CRM API call
4833
4963
  */ function zohoCrmApiFetchJsonInput(method, body) {
4834
- var result = {
4964
+ return {
4835
4965
  method: method,
4836
4966
  body: body !== null && body !== void 0 ? body : undefined
4837
4967
  };
4838
- return result;
4839
4968
  }
4840
4969
  // MARK: Results
4841
4970
  /**
4842
4971
  * Catches ZohoServerFetchResponseDataArrayError and returns the error data array as the response data, as each data element will have the error details.
4843
4972
  *
4844
4973
  * Use to catch errors from functions that return ZohoCrmChangeObjectLikeResponse and pass the result to zohoCrmChangeObjectLikeResponseSuccessAndErrorPairs.
4974
+ *
4975
+ * @param e - The error to catch and potentially convert
4976
+ * @returns The error data array wrapped as a change object response
4845
4977
  */ function zohoCrmCatchZohoCrmChangeObjectLikeResponseError(e) {
4846
4978
  var result;
4847
4979
  if (_instanceof$3(e, ZohoServerFetchResponseDataArrayError)) {
@@ -4979,6 +5111,9 @@ function _object_spread_props$5(target, source) {
4979
5111
  * Creates notes directly in the CRM Notes module. Each note must include the parent record reference and module name.
4980
5112
  *
4981
5113
  * For creating notes associated with a specific record, prefer {@link zohoCrmCreateNotesForRecord} which handles parent binding automatically.
5114
+ *
5115
+ * @param context - Authenticated Zoho CRM context for making API calls
5116
+ * @returns Function that creates notes in the CRM Notes module
4982
5117
  */ function zohoCrmCreateNotes(context) {
4983
5118
  return function(input) {
4984
5119
  return context.fetchJson("/v2/".concat(ZOHO_CRM_NOTES_MODULE), zohoCrmApiFetchJsonInput('POST', {
@@ -4990,6 +5125,9 @@ function _object_spread_props$5(target, source) {
4990
5125
  }
4991
5126
  /**
4992
5127
  * Deletes one or more notes from the CRM Notes module by their IDs.
5128
+ *
5129
+ * @param context - Authenticated Zoho CRM context for making API calls
5130
+ * @returns Function that deletes notes by their IDs
4993
5131
  */ function zohoCrmDeleteNotes(context) {
4994
5132
  return function(input) {
4995
5133
  return context.fetchJson("/v2/".concat(ZOHO_CRM_NOTES_MODULE, "?").concat(fetch.makeUrlSearchParams({
@@ -5001,6 +5139,9 @@ function _object_spread_props$5(target, source) {
5001
5139
  }
5002
5140
  /**
5003
5141
  * Retrieves paginated notes associated with a specific CRM record using the related records API.
5142
+ *
5143
+ * @param context - Authenticated Zoho CRM context for making API calls
5144
+ * @returns Function that retrieves notes for a specific record
5004
5145
  */ function zohoCrmGetNotesForRecord(context) {
5005
5146
  return zohoCrmGetRelatedRecordsFunctionFactory(context)({
5006
5147
  targetModule: ZOHO_CRM_NOTES_MODULE
@@ -5008,6 +5149,9 @@ function _object_spread_props$5(target, source) {
5008
5149
  }
5009
5150
  /**
5010
5151
  * Creates a page factory for iterating through all notes for a record across multiple pages.
5152
+ *
5153
+ * @param context - Authenticated Zoho CRM context for making API calls
5154
+ * @returns Page factory for paginating through notes for a record
5011
5155
  */ function zohoCrmGetNotesForRecordPageFactory(context) {
5012
5156
  return zohoFetchPageFactory(zohoCrmGetNotesForRecord(context));
5013
5157
  }
@@ -5015,6 +5159,9 @@ function _object_spread_props$5(target, source) {
5015
5159
  * Creates notes for a specific record, automatically binding the parent module and record ID to each note entry.
5016
5160
  *
5017
5161
  * https://www.zoho.com/crm/developer/docs/api/v8/create-notes.html
5162
+ *
5163
+ * @param context - Authenticated Zoho CRM context for making API calls
5164
+ * @returns Function that creates notes bound to a specific record
5018
5165
  */ function zohoCrmCreateNotesForRecord(context) {
5019
5166
  var createNotesInstance = zohoCrmCreateNotes(context);
5020
5167
  return function(input) {
@@ -5112,6 +5259,9 @@ function _unsupported_iterable_to_array(o, minLen) {
5112
5259
  }
5113
5260
  /**
5114
5261
  * Creates one or more tags for a CRM module. Duplicate tag errors are separated from other errors in the result to simplify idempotent workflows.
5262
+ *
5263
+ * @param context - Authenticated Zoho CRM context for making API calls
5264
+ * @returns Function that creates tags for a module
5115
5265
  */ function zohoCrmCreateTagsForModule(context) {
5116
5266
  return function(input) {
5117
5267
  return context.fetchJson("/v8/settings/tags?".concat(fetch.makeUrlSearchParams({
@@ -5153,8 +5303,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5153
5303
  *
5154
5304
  * https://www.zoho.com/crm/developer/docs/api/v8/delete-tag.html
5155
5305
  *
5156
- * @param context
5157
- * @returns
5306
+ * @param context - Authenticated Zoho CRM context for making API calls
5307
+ * @returns Function that deletes a tag by ID
5158
5308
  */ function zohoCrmDeleteTag(context) {
5159
5309
  return function(input) {
5160
5310
  return context.fetchJson("/v8/settings/tags/".concat(input.id), zohoCrmApiFetchJsonInput('DELETE')).then(function(x) {
@@ -5167,8 +5317,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5167
5317
  *
5168
5318
  * https://www.zoho.com/crm/developer-guide/apiv2/get-tag-list.html
5169
5319
  *
5170
- * @param context
5171
- * @returns
5320
+ * @param context - Authenticated Zoho CRM context for making API calls
5321
+ * @returns Function that retrieves tags for a module
5172
5322
  */ function zohoCrmGetTagsForModule(context) {
5173
5323
  return function(input) {
5174
5324
  return context.fetchJson("/v8/settings/tags?".concat(fetch.makeUrlSearchParams({
@@ -5184,6 +5334,9 @@ function _unsupported_iterable_to_array(o, minLen) {
5184
5334
  }
5185
5335
  /**
5186
5336
  * Creates a page factory for iterating through all tags in a module across multiple pages.
5337
+ *
5338
+ * @param context - Authenticated Zoho CRM context for making API calls
5339
+ * @returns Page factory for paginating through tags in a module
5187
5340
  */ function zohoCrmGetTagsForModulePageFactory(context) {
5188
5341
  return zohoFetchPageFactory(zohoCrmGetTagsForModule(context));
5189
5342
  }
@@ -5196,8 +5349,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5196
5349
  *
5197
5350
  * https://www.zoho.com/crm/developer-guide/apiv2/add-tags.html
5198
5351
  *
5199
- * @param context
5200
- * @returns
5352
+ * @param context - Authenticated Zoho CRM context for making API calls
5353
+ * @returns Function that adds tags to records
5201
5354
  */ function zohoCrmAddTagsToRecords(context) {
5202
5355
  return function(input) {
5203
5356
  return context.fetchJson("/v8/".concat(input.module, "/actions/add_tags"), zohoCrmApiFetchJsonInput('POST', zohoCrmAddTagsToRecordsRequestBody(input))).then(function(x) {
@@ -5210,6 +5363,9 @@ function _unsupported_iterable_to_array(o, minLen) {
5210
5363
  }
5211
5364
  /**
5212
5365
  * Builds the request body for the add/remove tags endpoints, merging `tag_names` into `tags` and enforcing the max ID limit.
5366
+ *
5367
+ * @param input - The add/remove tags request containing tag names, tag objects, and record IDs
5368
+ * @returns The formatted request body with merged tags and record IDs
5213
5369
  */ function zohoCrmAddTagsToRecordsRequestBody(input) {
5214
5370
  if (Array.isArray(input.ids) && input.ids.length > ZOHO_CRM_ADD_TAGS_TO_RECORDS_MAX_IDS_ALLOWED) {
5215
5371
  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 +5398,8 @@ function _unsupported_iterable_to_array(o, minLen) {
5242
5398
  *
5243
5399
  * https://www.zoho.com/crm/developer-guide/apiv2/remove-tags.html
5244
5400
  *
5245
- * @param context
5246
- * @returns
5401
+ * @param context - Authenticated Zoho CRM context for making API calls
5402
+ * @returns Function that removes tags from records
5247
5403
  */ function zohoCrmRemoveTagsFromRecords(context) {
5248
5404
  return function(input) {
5249
5405
  return context.fetchJson("/v8/".concat(input.module, "/actions/remove_tags"), zohoCrmApiFetchJsonInput('POST', zohoCrmAddTagsToRecordsRequestBody(input))).then(function(x) {
@@ -5510,7 +5666,7 @@ function _ts_generator$3(thisArg, body) {
5510
5666
  });
5511
5667
  var fetch$1 = handleZohoCrmErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
5512
5668
  if (_instanceof$1(x, ZohoInvalidTokenError)) {
5513
- accountsContext.loadAccessToken.resetAccessToken();
5669
+ void accountsContext.loadAccessToken.resetAccessToken();
5514
5670
  }
5515
5671
  });
5516
5672
  var fetchJson = fetch.fetchJsonFunction(fetch$1, {
@@ -5696,6 +5852,10 @@ function _object_without_properties_loose(source, excluded) {
5696
5852
  // MARK: Utility
5697
5853
  /**
5698
5854
  * Builds a {@link FetchJsonInput} for Zoho Sign API calls.
5855
+ *
5856
+ * @param method - HTTP method for the request
5857
+ * @param body - Optional JSON body to include in the request
5858
+ * @returns Configured fetch JSON input
5699
5859
  */ function zohoSignApiFetchJsonInput(method, body) {
5700
5860
  return {
5701
5861
  method: method,
@@ -5861,7 +6021,8 @@ function _object_without_properties_loose(source, excluded) {
5861
6021
  ]);
5862
6022
  var searchParams = fetch.makeUrlSearchParams(params);
5863
6023
  var queryString = searchParams.toString();
5864
- var url = "/requests/".concat(requestId, "/pdf").concat(queryString ? "?".concat(queryString) : '');
6024
+ var suffix = queryString ? "?".concat(queryString) : '';
6025
+ var url = "/requests/".concat(requestId, "/pdf").concat(suffix);
5865
6026
  return context.fetch(url, {
5866
6027
  method: 'GET'
5867
6028
  });
@@ -6091,7 +6252,12 @@ function _object_without_properties_loose(source, excluded) {
6091
6252
  }
6092
6253
 
6093
6254
  var ZOHO_SIGN_SERVICE_NAME = 'sign';
6094
- function zohoSignConfigApiUrl(input) {
6255
+ /**
6256
+ * Resolves an environment key or passthrough URL to the full Zoho Sign API URL.
6257
+ *
6258
+ * @param input - An environment key ('sandbox' or 'production') or a full API URL
6259
+ * @returns The resolved Zoho Sign API URL
6260
+ */ function zohoSignConfigApiUrl(input) {
6095
6261
  switch(input){
6096
6262
  case 'sandbox':
6097
6263
  return 'https://signsandbox.zoho.com/api/v1';
@@ -6233,7 +6399,12 @@ function _ts_generator$2(thisArg, body) {
6233
6399
  var logZohoSignErrorToConsole = logZohoServerErrorFunction('ZohoSign', {
6234
6400
  logDataArrayErrors: false
6235
6401
  });
6236
- function parseZohoSignError(responseError) {
6402
+ /**
6403
+ * Parses the JSON body of a failed Zoho Sign fetch response into a structured error, returning undefined if the body cannot be parsed.
6404
+ *
6405
+ * @param responseError - The fetch response error to parse
6406
+ * @returns Parsed Zoho server error, or undefined if parsing fails
6407
+ */ function parseZohoSignError(responseError) {
6237
6408
  return _async_to_generator$2(function() {
6238
6409
  var data, result;
6239
6410
  return _ts_generator$2(this, function(_state) {
@@ -6258,7 +6429,13 @@ function parseZohoSignError(responseError) {
6258
6429
  });
6259
6430
  })();
6260
6431
  }
6261
- function parseZohoSignServerErrorResponseData(errorResponseData, responseError) {
6432
+ /**
6433
+ * 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.
6434
+ *
6435
+ * @param errorResponseData - Raw error response data from the Zoho Sign API
6436
+ * @param responseError - The underlying fetch response error
6437
+ * @returns Parsed Zoho server error, or undefined if the data contains no recognizable error
6438
+ */ function parseZohoSignServerErrorResponseData(errorResponseData, responseError) {
6262
6439
  var result;
6263
6440
  var error = tryFindZohoServerErrorData(errorResponseData, responseError);
6264
6441
  if (error) {
@@ -6530,7 +6707,7 @@ function _ts_generator$1(thisArg, body) {
6530
6707
  });
6531
6708
  var fetch$1 = handleZohoSignErrorFetch(baseFetch, logZohoServerErrorFunction, function(x) {
6532
6709
  if (_instanceof(x, ZohoInvalidTokenError)) {
6533
- accountsContext.loadAccessToken.resetAccessToken();
6710
+ void accountsContext.loadAccessToken.resetAccessToken();
6534
6711
  }
6535
6712
  });
6536
6713
  var fetchJson = fetch.fetchJsonFunction(fetch$1, {
@@ -6641,18 +6818,26 @@ function _ts_generator$1(thisArg, body) {
6641
6818
  }
6642
6819
  /**
6643
6820
  * Constructs a standard {@link FetchJsonInput} for Zoho Accounts API calls with the given HTTP method and optional body.
6821
+ *
6822
+ * @param method - HTTP method to use for the request
6823
+ * @param body - Optional request body to include
6824
+ * @returns Configured fetch input for the Zoho Accounts API call
6644
6825
  */ function zohoAccountsApiFetchJsonInput(method, body) {
6645
- var result = {
6826
+ return {
6646
6827
  method: method,
6647
6828
  body: body
6648
6829
  };
6649
- return result;
6650
6830
  }
6651
6831
 
6652
6832
  /**
6653
6833
  * The Zoho Accounts API URL for the US datacenter.
6654
6834
  */ var ZOHO_ACCOUNTS_US_API_URL = 'https://accounts.zoho.com';
6655
- function zohoAccountsConfigApiUrl(input) {
6835
+ /**
6836
+ * 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.
6837
+ *
6838
+ * @param input - A well-known datacenter key or a custom Zoho Accounts API URL
6839
+ * @returns The resolved full Zoho Accounts API base URL
6840
+ */ function zohoAccountsConfigApiUrl(input) {
6656
6841
  switch(input){
6657
6842
  case 'us':
6658
6843
  return ZOHO_ACCOUNTS_US_API_URL;
@@ -7019,7 +7204,7 @@ function _ts_generator(thisArg, body) {
7019
7204
  }
7020
7205
  if (!!currentToken) return [
7021
7206
  3,
7022
- 10
7207
+ 9
7023
7208
  ];
7024
7209
  _state.label = 3;
7025
7210
  case 3:
@@ -7044,35 +7229,29 @@ function _ts_generator(thisArg, body) {
7044
7229
  console.error("zohoAccountsZohoAccessTokenFactory(): Failed retrieving new token from tokenRefresher: ", e);
7045
7230
  throw new ZohoAccountsAuthFailureError('Token Refresh Failed');
7046
7231
  case 6:
7047
- if (!currentToken) return [
7048
- 3,
7049
- 10
7050
- ];
7051
- _state.label = 7;
7052
- case 7:
7053
7232
  _state.trys.push([
7054
- 7,
7055
- 9,
7233
+ 6,
7234
+ 8,
7056
7235
  ,
7057
- 10
7236
+ 9
7058
7237
  ]);
7059
7238
  return [
7060
7239
  4,
7061
7240
  accessTokenCache === null || accessTokenCache === void 0 ? void 0 : accessTokenCache.updateCachedToken(currentToken)
7062
7241
  ];
7063
- case 8:
7242
+ case 7:
7064
7243
  _state.sent();
7065
7244
  return [
7066
7245
  3,
7067
- 10
7246
+ 9
7068
7247
  ];
7069
- case 9:
7248
+ case 8:
7070
7249
  _state.sent();
7071
7250
  return [
7072
7251
  3,
7073
- 10
7252
+ 9
7074
7253
  ];
7075
- case 10:
7254
+ case 9:
7076
7255
  return [
7077
7256
  2,
7078
7257
  currentToken
@@ -7107,6 +7286,7 @@ function safeZohoDateTimeString(date) {
7107
7286
 
7108
7287
  exports.DEFAULT_ZOHO_API_RATE_LIMIT = DEFAULT_ZOHO_API_RATE_LIMIT;
7109
7288
  exports.DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD = DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD;
7289
+ exports.DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
7110
7290
  exports.DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION;
7111
7291
  exports.MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA = MAX_ZOHO_CRM_SEARCH_MODULE_RECORDS_CRITERIA;
7112
7292
  exports.MAX_ZOHO_RECRUIT_SEARCH_MODULE_RECORDS_CRITERIA = MAX_ZOHO_RECRUIT_SEARCH_MODULE_RECORDS_CRITERIA;