@dereekb/zoho 13.6.16 → 13.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -3345,6 +3345,7 @@ function _ts_generator$6(thisArg, body) {
3345
3345
  var rateLimiter = util.resetPeriodPromiseRateLimiter(defaultConfig);
3346
3346
  return fetch.rateLimitedFetchHandler({
3347
3347
  rateLimiter: rateLimiter,
3348
+ maxRetries: config === null || config === void 0 ? void 0 : config.maxRetries,
3348
3349
  /**
3349
3350
  * Inspects each response for Zoho rate limit headers and updates the limiter accordingly.
3350
3351
  * Returns `true` to signal a retry when a 429 status is received.
package/index.esm.js CHANGED
@@ -3343,6 +3343,7 @@ function _ts_generator$6(thisArg, body) {
3343
3343
  var rateLimiter = resetPeriodPromiseRateLimiter(defaultConfig);
3344
3344
  return rateLimitedFetchHandler({
3345
3345
  rateLimiter: rateLimiter,
3346
+ maxRetries: config === null || config === void 0 ? void 0 : config.maxRetries,
3346
3347
  /**
3347
3348
  * Inspects each response for Zoho rate limit headers and updates the limiter accordingly.
3348
3349
  * Returns `true` to signal a retry when a 429 status is received.
@@ -3,11 +3,11 @@
3
3
  var common = require('@nestjs/common');
4
4
  var zoho = require('@dereekb/zoho');
5
5
  var util = require('@dereekb/util');
6
- var path = require('path');
7
- var fs = require('fs');
6
+ var node_path = require('node:path');
7
+ var node_fs = require('node:fs');
8
8
  var config = require('@nestjs/config');
9
9
  var nestjs = require('@dereekb/nestjs');
10
- var crypto = require('crypto');
10
+ var node_crypto = require('node:crypto');
11
11
 
12
12
  function _type_of(obj) {
13
13
  "@swc/helpers - typeof";
@@ -635,10 +635,10 @@ var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-acce
635
635
  }
636
636
  function readTokenFile() {
637
637
  return new Promise(function(resolve) {
638
- fs.mkdirSync(path.dirname(filename), {
638
+ node_fs.mkdirSync(node_path.dirname(filename), {
639
639
  recursive: true
640
640
  }); // make the directory first
641
- fs.readFile(filename, {}, function(x, data) {
641
+ node_fs.readFile(filename, {}, function(x, data) {
642
642
  var result = undefined;
643
643
  if (!x) {
644
644
  try {
@@ -670,7 +670,7 @@ var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-acce
670
670
  return [
671
671
  2,
672
672
  new Promise(function(resolve, reject) {
673
- fs.writeFile(filename, JSON.stringify(tokens), {}, function(x) {
673
+ node_fs.writeFile(filename, JSON.stringify(tokens), {}, function(x) {
674
674
  if (!x) {
675
675
  resolve();
676
676
  } else {
@@ -688,7 +688,7 @@ var DEFAULT_FILE_ZOHO_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoho-acce
688
688
  return [
689
689
  2,
690
690
  new Promise(function(resolve, reject) {
691
- fs.rm(filename, function(x) {
691
+ node_fs.rm(filename, function(x) {
692
692
  if (!x) {
693
693
  resolve();
694
694
  } else {
@@ -2857,14 +2857,14 @@ function _ts_generator$2(thisArg, body) {
2857
2857
  }
2858
2858
  payloadString = rawBody.toString('utf-8');
2859
2859
  // Compute HMAC-SHA256 and base64 encode
2860
- computedSignature = crypto.createHmac('sha256', secret).update(payloadString, 'utf-8').digest('base64');
2860
+ computedSignature = node_crypto.createHmac('sha256', secret).update(payloadString, 'utf-8').digest('base64');
2861
2861
  // Use timing-safe comparison
2862
2862
  valid = false;
2863
2863
  try {
2864
2864
  receivedBuffer = Buffer.from(receivedSignature, 'base64');
2865
2865
  computedBuffer = Buffer.from(computedSignature, 'base64');
2866
2866
  if (receivedBuffer.length === computedBuffer.length) {
2867
- valid = crypto.timingSafeEqual(receivedBuffer, computedBuffer);
2867
+ valid = node_crypto.timingSafeEqual(receivedBuffer, computedBuffer);
2868
2868
  }
2869
2869
  } catch (unused) {
2870
2870
  valid = false;
@@ -1,11 +1,11 @@
1
1
  import { Injectable, Inject, Logger, Post, Req, Controller, Module } from '@nestjs/common';
2
2
  import { zohoAccountsFactory, zohoAccountsAccessToken, zohoCrmFactory, zohoCrmInsertRecord, zohoCrmUpsertRecord, zohoCrmUpdateRecord, zohoCrmDeleteRecord, zohoCrmGetRecordById, zohoCrmGetRecords, zohoCrmSearchRecords, zohoCrmSearchRecordsPageFactory, zohoCrmGetRelatedRecordsFunctionFactory, zohoCrmGetEmailsForRecord, zohoCrmGetEmailsForRecordPageFactory, zohoCrmGetAttachmentsForRecord, zohoCrmGetAttachmentsForRecordPageFactory, zohoCrmUploadAttachmentForRecord, zohoCrmDownloadAttachmentForRecord, zohoCrmDeleteAttachmentFromRecord, zohoCrmCreateNotes, zohoCrmDeleteNotes, zohoCrmCreateNotesForRecord, zohoCrmGetNotesForRecord, zohoCrmGetNotesForRecordPageFactory, zohoCrmExecuteRestApiFunction, zohoCrmCreateTagsForModule, zohoCrmDeleteTag, zohoCrmGetTagsForModule, zohoCrmAddTagsToRecords, zohoCrmRemoveTagsFromRecords, ZOHO_CRM_SERVICE_NAME, zohoRecruitFactory, zohoRecruitInsertRecord, zohoRecruitUpsertRecord, zohoRecruitUpdateRecord, zohoRecruitDeleteRecord, zohoRecruitGetRecordById, zohoRecruitGetRecords, zohoRecruitSearchRecords, zohoRecruitSearchRecordsPageFactory, zohoRecruitGetRelatedRecordsFunctionFactory, zohoRecruitGetEmailsForRecord, zohoRecruitGetEmailsForRecordPageFactory, zohoRecruitGetAttachmentsForRecord, zohoRecruitGetAttachmentsForRecordPageFactory, zohoRecruitUploadAttachmentForRecord, zohoRecruitDownloadAttachmentForRecord, zohoRecruitDeleteAttachmentFromRecord, zohoRecruitCreateNotes, zohoRecruitDeleteNotes, zohoRecruitCreateNotesForRecord, zohoRecruitGetNotesForRecord, zohoRecruitGetNotesForRecordPageFactory, zohoRecruitExecuteRestApiFunction, zohoRecruitAssociateCandidateRecordsWithJobOpenings, zohoRecruitSearchCandidateAssociatedJobOpeningRecords, zohoRecruitSearchCandidateAssociatedJobOpeningRecordsPageFactory, zohoRecruitSearchJobOpeningAssociatedCandidateRecords, zohoRecruitSearchJobOpeningAssociatedCandidateRecordsPageFactory, zohoRecruitCreateTagsForModule, zohoRecruitGetTagsForModule, zohoRecruitAddTagsToRecords, zohoRecruitRemoveTagsFromRecords, ZOHO_RECRUIT_SERVICE_NAME, zohoSignFactory, zohoSignGetDocument, zohoSignGetDocuments, zohoSignGetDocumentsPageFactory, zohoSignGetDocumentFormData, zohoSignRetrieveFieldTypes, zohoSignDownloadPdf, zohoSignDownloadCompletionCertificate, zohoSignCreateDocument, zohoSignUpdateDocument, zohoSignSendDocumentForSignature, zohoSignExtendDocument, zohoSignDeleteDocument, ZOHO_SIGN_SERVICE_NAME } from '@dereekb/zoho';
3
3
  import { forEachKeyValue, tryWithPromiseFactoriesFunction, isPast, filterMaybeArrayValues, handlerFactory, handlerConfigurerFactory, handlerMappedSetFunctionFactory } from '@dereekb/util';
4
- import { dirname } from 'path';
5
- import { mkdirSync, readFile, writeFile, rm } from 'fs';
4
+ import { dirname } from 'node:path';
5
+ import { mkdirSync, readFile, writeFile, rm } from 'node:fs';
6
6
  import { ConfigService, ConfigModule } from '@nestjs/config';
7
7
  import { RawBody } from '@dereekb/nestjs';
8
- import { createHmac, timingSafeEqual } from 'crypto';
8
+ import { createHmac, timingSafeEqual } from 'node:crypto';
9
9
 
10
10
  function _type_of(obj) {
11
11
  "@swc/helpers - typeof";
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dereekb/zoho/nestjs",
3
- "version": "13.6.16",
3
+ "version": "13.7.0",
4
4
  "peerDependencies": {
5
- "@dereekb/nestjs": "13.6.16",
6
- "@dereekb/rxjs": "13.6.16",
7
- "@dereekb/util": "13.6.16",
8
- "@dereekb/zoho": "13.6.16",
5
+ "@dereekb/nestjs": "13.7.0",
6
+ "@dereekb/rxjs": "13.7.0",
7
+ "@dereekb/util": "13.7.0",
8
+ "@dereekb/zoho": "13.7.0",
9
9
  "@nestjs/common": "^11.1.17",
10
10
  "@nestjs/config": "^4.0.3",
11
11
  "express": "^5.0.0"
@@ -2,7 +2,7 @@ import { type ZohoCrmConfig, type ZohoCrmFactoryConfig } from '@dereekb/zoho';
2
2
  /**
3
3
  * API configuration for connecting to the Zoho CRM service endpoint.
4
4
  */
5
- export type ZohoCrmServiceApiConfig = ZohoCrmConfig & {};
5
+ export type ZohoCrmServiceApiConfig = ZohoCrmConfig;
6
6
  /**
7
7
  * Abstract configuration class for the NestJS Zoho CRM service.
8
8
  *
@@ -2,7 +2,7 @@ import { type ZohoRecruitConfig, type ZohoRecruitFactoryConfig } from '@dereekb/
2
2
  /**
3
3
  * API configuration for connecting to the Zoho Recruit service endpoint.
4
4
  */
5
- export type ZohoRecruitServiceApiConfig = ZohoRecruitConfig & {};
5
+ export type ZohoRecruitServiceApiConfig = ZohoRecruitConfig;
6
6
  /**
7
7
  * Abstract configuration class for the NestJS Zoho Recruit service.
8
8
  *
@@ -1,5 +1,5 @@
1
1
  import { type ZohoSignConfig, type ZohoSignFactoryConfig } from '@dereekb/zoho';
2
- export type ZohoSignServiceApiConfig = ZohoSignConfig & {};
2
+ export type ZohoSignServiceApiConfig = ZohoSignConfig;
3
3
  /**
4
4
  * Configuration for ZohoSignService
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/zoho",
3
- "version": "13.6.16",
3
+ "version": "13.7.0",
4
4
  "exports": {
5
5
  "./nestjs": {
6
6
  "module": "./nestjs/index.esm.js",
@@ -17,9 +17,9 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@dereekb/nestjs": "13.6.16",
21
- "@dereekb/rxjs": "13.6.16",
22
- "@dereekb/util": "13.6.16",
20
+ "@dereekb/nestjs": "13.7.0",
21
+ "@dereekb/rxjs": "13.7.0",
22
+ "@dereekb/util": "13.7.0",
23
23
  "@nestjs/common": "^11.1.17",
24
24
  "@nestjs/config": "^4.0.3",
25
25
  "express": "^5.0.0",
@@ -41,6 +41,13 @@ export interface ZohoRateLimitedFetchHandlerConfig {
41
41
  * Defaults to {@link DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD} (1 minute).
42
42
  */
43
43
  readonly resetPeriod?: Milliseconds;
44
+ /**
45
+ * Maximum number of automatic retries when a 429 Too Many Requests response is received.
46
+ *
47
+ * Defaults to 1. Set to 0 to disable retries entirely, which causes the 429 error to be
48
+ * immediately thrown to the caller instead of waiting for the rate limit reset.
49
+ */
50
+ readonly maxRetries?: number;
44
51
  /**
45
52
  * Optional callback invoked when a 429 Too Many Requests response is received.
46
53
  *