@dereekb/zoho 12.3.8 → 12.3.10
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 +26 -3
- package/index.esm.js +25 -4
- package/nestjs/CHANGELOG.md +8 -0
- package/nestjs/package.json +1 -1
- package/nestjs/src/lib/accounts/accounts.service.js +17 -0
- package/nestjs/src/lib/accounts/accounts.service.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/accounts/accounts.d.ts +10 -1
- package/src/lib/recruit/recruit.d.ts +9 -2
- package/src/lib/zoho.error.api.d.ts +7 -1
package/index.cjs.js
CHANGED
|
@@ -2077,7 +2077,7 @@ function logZohoServerErrorFunction(zohoApiNamePrefix) {
|
|
|
2077
2077
|
* @returns
|
|
2078
2078
|
*/
|
|
2079
2079
|
function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
|
|
2080
|
-
return (fetch$1, logError = defaultLogError) => {
|
|
2080
|
+
return (fetch$1, logError = defaultLogError, onError) => {
|
|
2081
2081
|
return async (x, y) => {
|
|
2082
2082
|
try {
|
|
2083
2083
|
return await fetch$1(x, y); // await to catch thrown errors
|
|
@@ -2086,6 +2086,7 @@ function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
|
|
|
2086
2086
|
const error = await parseZohoError(e);
|
|
2087
2087
|
if (error) {
|
|
2088
2088
|
logError(error); // log before throwing.
|
|
2089
|
+
onError?.(error); // perform a task
|
|
2089
2090
|
throw error;
|
|
2090
2091
|
}
|
|
2091
2092
|
}
|
|
@@ -2118,6 +2119,11 @@ function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData) {
|
|
|
2118
2119
|
* - An extra parameter is provided
|
|
2119
2120
|
*/
|
|
2120
2121
|
const ZOHO_INTERNAL_ERROR_CODE = 'INTERNAL_ERROR';
|
|
2122
|
+
/**
|
|
2123
|
+
* Error code for when an invalid oauth token is provided.
|
|
2124
|
+
*/
|
|
2125
|
+
const ZOHO_INVALID_TOKEN_ERROR_CODE = 'INVALID_TOKEN';
|
|
2126
|
+
class ZohoInvalidTokenError extends ZohoServerFetchResponseError {}
|
|
2121
2127
|
/**
|
|
2122
2128
|
* Error code for when a failure occured for the given action
|
|
2123
2129
|
*/
|
|
@@ -2211,6 +2217,9 @@ function parseZohoServerErrorResponseData(errorResponseData, responseError) {
|
|
|
2211
2217
|
case ZOHO_INTERNAL_ERROR_CODE:
|
|
2212
2218
|
result = new ZohoInternalError(errorData, responseError);
|
|
2213
2219
|
break;
|
|
2220
|
+
case ZOHO_INVALID_TOKEN_ERROR_CODE:
|
|
2221
|
+
result = new ZohoInvalidTokenError(errorData, responseError);
|
|
2222
|
+
break;
|
|
2214
2223
|
case ZOHO_INVALID_AUTHORIZATION_ERROR_CODE:
|
|
2215
2224
|
result = new ZohoInvalidAuthorizationError(errorData, responseError);
|
|
2216
2225
|
break;
|
|
@@ -3034,7 +3043,11 @@ function zohoRecruitFactory(factoryConfig) {
|
|
|
3034
3043
|
const baseFetch = fetchFactory({
|
|
3035
3044
|
apiUrl
|
|
3036
3045
|
});
|
|
3037
|
-
const fetch$1 = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction
|
|
3046
|
+
const fetch$1 = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction, x => {
|
|
3047
|
+
if (x instanceof ZohoInvalidTokenError) {
|
|
3048
|
+
accountsContext.loadAccessToken.resetAccessToken();
|
|
3049
|
+
}
|
|
3050
|
+
});
|
|
3038
3051
|
const fetchJson = fetch.fetchJsonFunction(fetch$1, {
|
|
3039
3052
|
interceptJsonResponse: interceptZohoRecruit200StatusWithErrorResponse,
|
|
3040
3053
|
// intercept errors that return status 200
|
|
@@ -3145,6 +3158,9 @@ function zohoAccountsFactory(factoryConfig) {
|
|
|
3145
3158
|
};
|
|
3146
3159
|
return result;
|
|
3147
3160
|
};
|
|
3161
|
+
tokenRefresher.resetAccessToken = async () => {
|
|
3162
|
+
return config.accessTokenCache?.clearCachedToken();
|
|
3163
|
+
};
|
|
3148
3164
|
const loadAccessToken = zohoAccountsZohoAccessTokenFactory({
|
|
3149
3165
|
tokenRefresher,
|
|
3150
3166
|
accessTokenCache: config.accessTokenCache
|
|
@@ -3181,7 +3197,10 @@ function zohoAccountsZohoAccessTokenFactory(config) {
|
|
|
3181
3197
|
* Caches the token internally here until it expires.
|
|
3182
3198
|
*/
|
|
3183
3199
|
let currentToken = null;
|
|
3184
|
-
|
|
3200
|
+
const resetAccessToken = async () => {
|
|
3201
|
+
currentToken = null;
|
|
3202
|
+
};
|
|
3203
|
+
const fn = async () => {
|
|
3185
3204
|
// load from cache
|
|
3186
3205
|
if (!currentToken) {
|
|
3187
3206
|
const cachedToken = await accessTokenCache?.loadCachedToken();
|
|
@@ -3214,6 +3233,8 @@ function zohoAccountsZohoAccessTokenFactory(config) {
|
|
|
3214
3233
|
}
|
|
3215
3234
|
return currentToken;
|
|
3216
3235
|
};
|
|
3236
|
+
fn.resetAccessToken = resetAccessToken;
|
|
3237
|
+
return fn;
|
|
3217
3238
|
}
|
|
3218
3239
|
|
|
3219
3240
|
function safeZohoDateTimeString(date) {
|
|
@@ -3244,6 +3265,7 @@ exports.ZOHO_INTERNAL_ERROR_CODE = ZOHO_INTERNAL_ERROR_CODE;
|
|
|
3244
3265
|
exports.ZOHO_INVALID_AUTHORIZATION_ERROR_CODE = ZOHO_INVALID_AUTHORIZATION_ERROR_CODE;
|
|
3245
3266
|
exports.ZOHO_INVALID_DATA_ERROR_CODE = ZOHO_INVALID_DATA_ERROR_CODE;
|
|
3246
3267
|
exports.ZOHO_INVALID_QUERY_ERROR_CODE = ZOHO_INVALID_QUERY_ERROR_CODE;
|
|
3268
|
+
exports.ZOHO_INVALID_TOKEN_ERROR_CODE = ZOHO_INVALID_TOKEN_ERROR_CODE;
|
|
3247
3269
|
exports.ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE = ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE;
|
|
3248
3270
|
exports.ZOHO_RATE_LIMIT_LIMIT_HEADER = ZOHO_RATE_LIMIT_LIMIT_HEADER;
|
|
3249
3271
|
exports.ZOHO_RATE_LIMIT_REMAINING_HEADER = ZOHO_RATE_LIMIT_REMAINING_HEADER;
|
|
@@ -3267,6 +3289,7 @@ exports.ZohoAccountsAuthFailureError = ZohoAccountsAuthFailureError;
|
|
|
3267
3289
|
exports.ZohoInternalError = ZohoInternalError;
|
|
3268
3290
|
exports.ZohoInvalidAuthorizationError = ZohoInvalidAuthorizationError;
|
|
3269
3291
|
exports.ZohoInvalidQueryError = ZohoInvalidQueryError;
|
|
3292
|
+
exports.ZohoInvalidTokenError = ZohoInvalidTokenError;
|
|
3270
3293
|
exports.ZohoRecruitExecuteRestApiFunctionError = ZohoRecruitExecuteRestApiFunctionError;
|
|
3271
3294
|
exports.ZohoRecruitRecordCrudDuplicateDataError = ZohoRecruitRecordCrudDuplicateDataError;
|
|
3272
3295
|
exports.ZohoRecruitRecordCrudError = ZohoRecruitRecordCrudError;
|
package/index.esm.js
CHANGED
|
@@ -2075,7 +2075,7 @@ function logZohoServerErrorFunction(zohoApiNamePrefix) {
|
|
|
2075
2075
|
* @returns
|
|
2076
2076
|
*/
|
|
2077
2077
|
function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
|
|
2078
|
-
return (fetch, logError = defaultLogError) => {
|
|
2078
|
+
return (fetch, logError = defaultLogError, onError) => {
|
|
2079
2079
|
return async (x, y) => {
|
|
2080
2080
|
try {
|
|
2081
2081
|
return await fetch(x, y); // await to catch thrown errors
|
|
@@ -2084,6 +2084,7 @@ function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
|
|
|
2084
2084
|
const error = await parseZohoError(e);
|
|
2085
2085
|
if (error) {
|
|
2086
2086
|
logError(error); // log before throwing.
|
|
2087
|
+
onError?.(error); // perform a task
|
|
2087
2088
|
throw error;
|
|
2088
2089
|
}
|
|
2089
2090
|
}
|
|
@@ -2116,6 +2117,11 @@ function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData) {
|
|
|
2116
2117
|
* - An extra parameter is provided
|
|
2117
2118
|
*/
|
|
2118
2119
|
const ZOHO_INTERNAL_ERROR_CODE = 'INTERNAL_ERROR';
|
|
2120
|
+
/**
|
|
2121
|
+
* Error code for when an invalid oauth token is provided.
|
|
2122
|
+
*/
|
|
2123
|
+
const ZOHO_INVALID_TOKEN_ERROR_CODE = 'INVALID_TOKEN';
|
|
2124
|
+
class ZohoInvalidTokenError extends ZohoServerFetchResponseError {}
|
|
2119
2125
|
/**
|
|
2120
2126
|
* Error code for when a failure occured for the given action
|
|
2121
2127
|
*/
|
|
@@ -2209,6 +2215,9 @@ function parseZohoServerErrorResponseData(errorResponseData, responseError) {
|
|
|
2209
2215
|
case ZOHO_INTERNAL_ERROR_CODE:
|
|
2210
2216
|
result = new ZohoInternalError(errorData, responseError);
|
|
2211
2217
|
break;
|
|
2218
|
+
case ZOHO_INVALID_TOKEN_ERROR_CODE:
|
|
2219
|
+
result = new ZohoInvalidTokenError(errorData, responseError);
|
|
2220
|
+
break;
|
|
2212
2221
|
case ZOHO_INVALID_AUTHORIZATION_ERROR_CODE:
|
|
2213
2222
|
result = new ZohoInvalidAuthorizationError(errorData, responseError);
|
|
2214
2223
|
break;
|
|
@@ -3032,7 +3041,11 @@ function zohoRecruitFactory(factoryConfig) {
|
|
|
3032
3041
|
const baseFetch = fetchFactory({
|
|
3033
3042
|
apiUrl
|
|
3034
3043
|
});
|
|
3035
|
-
const fetch = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction
|
|
3044
|
+
const fetch = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction, x => {
|
|
3045
|
+
if (x instanceof ZohoInvalidTokenError) {
|
|
3046
|
+
accountsContext.loadAccessToken.resetAccessToken();
|
|
3047
|
+
}
|
|
3048
|
+
});
|
|
3036
3049
|
const fetchJson = fetchJsonFunction(fetch, {
|
|
3037
3050
|
interceptJsonResponse: interceptZohoRecruit200StatusWithErrorResponse,
|
|
3038
3051
|
// intercept errors that return status 200
|
|
@@ -3143,6 +3156,9 @@ function zohoAccountsFactory(factoryConfig) {
|
|
|
3143
3156
|
};
|
|
3144
3157
|
return result;
|
|
3145
3158
|
};
|
|
3159
|
+
tokenRefresher.resetAccessToken = async () => {
|
|
3160
|
+
return config.accessTokenCache?.clearCachedToken();
|
|
3161
|
+
};
|
|
3146
3162
|
const loadAccessToken = zohoAccountsZohoAccessTokenFactory({
|
|
3147
3163
|
tokenRefresher,
|
|
3148
3164
|
accessTokenCache: config.accessTokenCache
|
|
@@ -3179,7 +3195,10 @@ function zohoAccountsZohoAccessTokenFactory(config) {
|
|
|
3179
3195
|
* Caches the token internally here until it expires.
|
|
3180
3196
|
*/
|
|
3181
3197
|
let currentToken = null;
|
|
3182
|
-
|
|
3198
|
+
const resetAccessToken = async () => {
|
|
3199
|
+
currentToken = null;
|
|
3200
|
+
};
|
|
3201
|
+
const fn = async () => {
|
|
3183
3202
|
// load from cache
|
|
3184
3203
|
if (!currentToken) {
|
|
3185
3204
|
const cachedToken = await accessTokenCache?.loadCachedToken();
|
|
@@ -3212,6 +3231,8 @@ function zohoAccountsZohoAccessTokenFactory(config) {
|
|
|
3212
3231
|
}
|
|
3213
3232
|
return currentToken;
|
|
3214
3233
|
};
|
|
3234
|
+
fn.resetAccessToken = resetAccessToken;
|
|
3235
|
+
return fn;
|
|
3215
3236
|
}
|
|
3216
3237
|
|
|
3217
3238
|
function safeZohoDateTimeString(date) {
|
|
@@ -3228,4 +3249,4 @@ function zohoDateTimeString(date) {
|
|
|
3228
3249
|
return isoDate.substring(0, isoDate.length - 5) + 'Z';
|
|
3229
3250
|
}
|
|
3230
3251
|
|
|
3231
|
-
export { DEFAULT_ZOHO_API_RATE_LIMIT, DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD, DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION, MAX_ZOHO_RECRUIT_SEARCH_MODULE_RECORDS_CRITERIA, ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE, ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE, ZOHO_ACCOUNTS_US_API_URL, ZOHO_DUPLICATE_DATA_ERROR_CODE, ZOHO_ERROR_STATUS, ZOHO_FAILURE_ERROR_CODE, ZOHO_INTERNAL_ERROR_CODE, ZOHO_INVALID_AUTHORIZATION_ERROR_CODE, ZOHO_INVALID_DATA_ERROR_CODE, ZOHO_INVALID_QUERY_ERROR_CODE, ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE, ZOHO_RATE_LIMIT_LIMIT_HEADER, ZOHO_RATE_LIMIT_REMAINING_HEADER, ZOHO_RATE_LIMIT_RESET_HEADER, ZOHO_RECRUIT_ALREADY_ASSOCIATED_ERROR_CODE, ZOHO_RECRUIT_ATTACHMENTS_MODULE, ZOHO_RECRUIT_ATTACHMENT_MAX_SIZE, ZOHO_RECRUIT_CANDIDATES_MODULE, ZOHO_RECRUIT_EMAILS_MODULE, ZOHO_RECRUIT_JOB_OPENINGS_MODULE, ZOHO_RECRUIT_NOTES_MODULE, ZOHO_RECRUIT_RECORD_ATTACHMENT_METADATA_ATTACH_TYPE_RESUME, ZOHO_RECRUIT_SERVICE_NAME, ZOHO_RECRUIT_TAG_NAME_MAX_LENGTH, ZOHO_SUCCESS_CODE, ZOHO_SUCCESS_STATUS, ZOHO_TOO_MANY_REQUESTS_ERROR_CODE, ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE, ZohoAccountsAccessTokenError, ZohoAccountsAuthFailureError, ZohoInternalError, ZohoInvalidAuthorizationError, ZohoInvalidQueryError, ZohoRecruitExecuteRestApiFunctionError, ZohoRecruitRecordCrudDuplicateDataError, ZohoRecruitRecordCrudError, ZohoRecruitRecordCrudInvalidDataError, ZohoRecruitRecordCrudMandatoryFieldNotFoundError, ZohoRecruitRecordCrudNoMatchingRecordError, ZohoRecruitRecordNoContentError, ZohoServerError, ZohoServerFetchResponseError, ZohoTooManyRequestsError, accessToken, addTagsToRecords, assertRecordDataArrayResultHasContent, associateCandidateRecordsWithJobOpenings, createNotes, createNotesForRecord, createTagsForModule, deleteAttachmentFromRecord, deleteNotes, deleteRecord, downloadAttachmentForRecord, emptyZohoPageResult, escapeZohoFieldValueForCriteriaString, executeRestApiFunction, getAttachmentsForRecord, getAttachmentsForRecordPageFactory, getEmailsForRecord, getEmailsForRecordPageFactory, getNotesForRecord, getNotesForRecordPageFactory, getRecordById, getRecords, getRelatedRecordsFunctionFactory, getTagsForModule, getTagsForModulePageFactory, handleZohoAccountsErrorFetch, handleZohoErrorFetchFactory, handleZohoRecruitErrorFetch, insertRecord, interceptZohoAccounts200StatusWithErrorResponse, interceptZohoErrorResponseFactory, interceptZohoRecruit200StatusWithErrorResponse, isZohoRecruitValidUrl, logZohoAccountsErrorToConsole, logZohoRecruitErrorToConsole, logZohoServerErrorFunction, parseZohoAccountsError, parseZohoAccountsServerErrorResponseData, parseZohoRecruitError, parseZohoRecruitServerErrorResponseData, parseZohoServerErrorResponseData, safeZohoDateTimeString, searchAssociatedRecords, searchCandidateAssociatedJobOpeningRecords, searchCandidateAssociatedJobOpeningRecordsPageFactory, searchJobOpeningAssociatedCandidateRecords, searchJobOpeningAssociatedCandidateRecordsPageFactory, searchRecords, searchRecordsPageFactory, tryFindZohoServerErrorData, updateRecord, uploadAttachmentForRecord, upsertRecord, zohoAccessTokenStringFactory, zohoAccountsApiFetchJsonInput, zohoAccountsConfigApiUrl, zohoAccountsFactory, zohoAccountsZohoAccessTokenFactory, zohoDateTimeString, zohoFetchPageFactory, zohoRateLimitHeaderDetails, zohoRateLimitedFetchHandler, zohoRecruitApiFetchJsonInput, zohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs, zohoRecruitConfigApiUrl, zohoRecruitFactory, zohoRecruitMultiRecordResult, zohoRecruitRecordCrudError, zohoRecruitSearchRecordsCriteriaEntriesForEmails, zohoRecruitSearchRecordsCriteriaEntryToCriteriaString, zohoRecruitSearchRecordsCriteriaString, zohoRecruitSearchRecordsCriteriaStringForTree, zohoRecruitUrlSearchParams, zohoRecruitUrlSearchParamsMinusIdAndModule, zohoRecruitUrlSearchParamsMinusModule, zohoServerErrorData };
|
|
3252
|
+
export { DEFAULT_ZOHO_API_RATE_LIMIT, DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD, DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION, MAX_ZOHO_RECRUIT_SEARCH_MODULE_RECORDS_CRITERIA, ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE, ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE, ZOHO_ACCOUNTS_US_API_URL, ZOHO_DUPLICATE_DATA_ERROR_CODE, ZOHO_ERROR_STATUS, ZOHO_FAILURE_ERROR_CODE, ZOHO_INTERNAL_ERROR_CODE, ZOHO_INVALID_AUTHORIZATION_ERROR_CODE, ZOHO_INVALID_DATA_ERROR_CODE, ZOHO_INVALID_QUERY_ERROR_CODE, ZOHO_INVALID_TOKEN_ERROR_CODE, ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE, ZOHO_RATE_LIMIT_LIMIT_HEADER, ZOHO_RATE_LIMIT_REMAINING_HEADER, ZOHO_RATE_LIMIT_RESET_HEADER, ZOHO_RECRUIT_ALREADY_ASSOCIATED_ERROR_CODE, ZOHO_RECRUIT_ATTACHMENTS_MODULE, ZOHO_RECRUIT_ATTACHMENT_MAX_SIZE, ZOHO_RECRUIT_CANDIDATES_MODULE, ZOHO_RECRUIT_EMAILS_MODULE, ZOHO_RECRUIT_JOB_OPENINGS_MODULE, ZOHO_RECRUIT_NOTES_MODULE, ZOHO_RECRUIT_RECORD_ATTACHMENT_METADATA_ATTACH_TYPE_RESUME, ZOHO_RECRUIT_SERVICE_NAME, ZOHO_RECRUIT_TAG_NAME_MAX_LENGTH, ZOHO_SUCCESS_CODE, ZOHO_SUCCESS_STATUS, ZOHO_TOO_MANY_REQUESTS_ERROR_CODE, ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE, ZohoAccountsAccessTokenError, ZohoAccountsAuthFailureError, ZohoInternalError, ZohoInvalidAuthorizationError, ZohoInvalidQueryError, ZohoInvalidTokenError, ZohoRecruitExecuteRestApiFunctionError, ZohoRecruitRecordCrudDuplicateDataError, ZohoRecruitRecordCrudError, ZohoRecruitRecordCrudInvalidDataError, ZohoRecruitRecordCrudMandatoryFieldNotFoundError, ZohoRecruitRecordCrudNoMatchingRecordError, ZohoRecruitRecordNoContentError, ZohoServerError, ZohoServerFetchResponseError, ZohoTooManyRequestsError, accessToken, addTagsToRecords, assertRecordDataArrayResultHasContent, associateCandidateRecordsWithJobOpenings, createNotes, createNotesForRecord, createTagsForModule, deleteAttachmentFromRecord, deleteNotes, deleteRecord, downloadAttachmentForRecord, emptyZohoPageResult, escapeZohoFieldValueForCriteriaString, executeRestApiFunction, getAttachmentsForRecord, getAttachmentsForRecordPageFactory, getEmailsForRecord, getEmailsForRecordPageFactory, getNotesForRecord, getNotesForRecordPageFactory, getRecordById, getRecords, getRelatedRecordsFunctionFactory, getTagsForModule, getTagsForModulePageFactory, handleZohoAccountsErrorFetch, handleZohoErrorFetchFactory, handleZohoRecruitErrorFetch, insertRecord, interceptZohoAccounts200StatusWithErrorResponse, interceptZohoErrorResponseFactory, interceptZohoRecruit200StatusWithErrorResponse, isZohoRecruitValidUrl, logZohoAccountsErrorToConsole, logZohoRecruitErrorToConsole, logZohoServerErrorFunction, parseZohoAccountsError, parseZohoAccountsServerErrorResponseData, parseZohoRecruitError, parseZohoRecruitServerErrorResponseData, parseZohoServerErrorResponseData, safeZohoDateTimeString, searchAssociatedRecords, searchCandidateAssociatedJobOpeningRecords, searchCandidateAssociatedJobOpeningRecordsPageFactory, searchJobOpeningAssociatedCandidateRecords, searchJobOpeningAssociatedCandidateRecordsPageFactory, searchRecords, searchRecordsPageFactory, tryFindZohoServerErrorData, updateRecord, uploadAttachmentForRecord, upsertRecord, zohoAccessTokenStringFactory, zohoAccountsApiFetchJsonInput, zohoAccountsConfigApiUrl, zohoAccountsFactory, zohoAccountsZohoAccessTokenFactory, zohoDateTimeString, zohoFetchPageFactory, zohoRateLimitHeaderDetails, zohoRateLimitedFetchHandler, zohoRecruitApiFetchJsonInput, zohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs, zohoRecruitConfigApiUrl, zohoRecruitFactory, zohoRecruitMultiRecordResult, zohoRecruitRecordCrudError, zohoRecruitSearchRecordsCriteriaEntriesForEmails, zohoRecruitSearchRecordsCriteriaEntryToCriteriaString, zohoRecruitSearchRecordsCriteriaString, zohoRecruitSearchRecordsCriteriaStringForTree, zohoRecruitUrlSearchParams, zohoRecruitUrlSearchParamsMinusIdAndModule, zohoRecruitUrlSearchParamsMinusModule, zohoServerErrorData };
|
package/nestjs/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [12.3.10](https://github.com/dereekb/dbx-components/compare/v12.3.9-dev...v12.3.10) (2025-08-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [12.3.9](https://github.com/dereekb/dbx-components/compare/v12.3.8-dev...v12.3.9) (2025-08-15)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [12.3.8](https://github.com/dereekb/dbx-components/compare/v12.3.7-dev...v12.3.8) (2025-08-14)
|
|
6
14
|
|
|
7
15
|
|
package/nestjs/package.json
CHANGED
|
@@ -76,6 +76,9 @@ function mergeZohoAccountsAccessTokenCacheServices(inputServicesToMerge, logErro
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
+
},
|
|
80
|
+
clearCachedToken: async function () {
|
|
81
|
+
await Promise.allSettled(accessCachesForServices.map((x) => x.clearCachedToken()));
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
84
|
return cacheForService;
|
|
@@ -105,6 +108,12 @@ function memoryZohoAccountsAccessTokenCacheService(existingCache, logAccessToCon
|
|
|
105
108
|
if (logAccessToConsole) {
|
|
106
109
|
console.log('updating access token in memory: ', { accessToken, service });
|
|
107
110
|
}
|
|
111
|
+
},
|
|
112
|
+
clearCachedToken: async function () {
|
|
113
|
+
delete tokens[service];
|
|
114
|
+
if (logAccessToConsole) {
|
|
115
|
+
console.log('clearing access token in memory: ', { service });
|
|
116
|
+
}
|
|
108
117
|
}
|
|
109
118
|
};
|
|
110
119
|
return accessTokenCache;
|
|
@@ -209,6 +218,14 @@ function fileZohoAccountsAccessTokenCacheService(filename = exports.DEFAULT_FILE
|
|
|
209
218
|
catch (e) {
|
|
210
219
|
console.error('Failed updating access token in file: ', e);
|
|
211
220
|
}
|
|
221
|
+
},
|
|
222
|
+
clearCachedToken: async function () {
|
|
223
|
+
try {
|
|
224
|
+
await writeTokenFile({});
|
|
225
|
+
}
|
|
226
|
+
catch (e) {
|
|
227
|
+
console.error('Failed clearing access token in file: ', e);
|
|
228
|
+
}
|
|
212
229
|
}
|
|
213
230
|
};
|
|
214
231
|
return accessTokenCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.service.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/accounts/accounts.service.ts"],"names":[],"mappings":";;;AAuBA,4HAKC;AAWD,
|
|
1
|
+
{"version":3,"file":"accounts.service.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/accounts/accounts.service.ts"],"names":[],"mappings":";;;AAuBA,4HAKC;AAWD,8FAkEC;AAQD,8FAkCC;AAkBD,0FAgHC;;AArRD,2CAA4C;AAE5C,wCAAsI;AACtI,+BAA+B;AAC/B,2BAAwD;AAIxD;;GAEG;AAEI,IAAe,mCAAmC,GAAlD,MAAe,mCAAmC;CAOxD,CAAA;AAPqB,kFAAmC;8CAAnC,mCAAmC;IADxD,IAAA,mBAAU,GAAE;GACS,mCA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,WAA4B;gBAC7D,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;gBAElC,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC;gBAChC,CAAC;gBAED,4EAA4E;gBAE5E,IAAI,CAAC;oBACH,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;YACD,gBAAgB,EAAE,KAAK;gBACrB,IAAI,CAAC;oBACH,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC3B,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;SACF,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,wBAAwB;QACxB,aAAa;QACb,cAAc;QACd,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -52,13 +52,22 @@ export interface ZohoAccessTokenCache {
|
|
|
52
52
|
* Updates the cache with the given access token.
|
|
53
53
|
*/
|
|
54
54
|
updateCachedToken(accessToken: ZohoAccessToken): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Clears the cached token.
|
|
57
|
+
*/
|
|
58
|
+
clearCachedToken(): Promise<void>;
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
57
61
|
* Source for retriving a ZohoAccessToken.
|
|
58
62
|
*
|
|
59
63
|
* Throws an ZohoAccountsAuthRetrievalError error if the token could not be retrieved.
|
|
60
64
|
*/
|
|
61
|
-
export type ZohoAccessTokenFactory = () => Promise<ZohoAccessToken
|
|
65
|
+
export type ZohoAccessTokenFactory = (() => Promise<ZohoAccessToken>) & {
|
|
66
|
+
/**
|
|
67
|
+
* Resets/expires the existing token in the factory, if using a cache.
|
|
68
|
+
*/
|
|
69
|
+
resetAccessToken(): Promise<void>;
|
|
70
|
+
};
|
|
62
71
|
/**
|
|
63
72
|
* A ZohoAccessTokenFactory that always generates a new ZohoAccessToken.
|
|
64
73
|
*/
|
|
@@ -213,6 +213,13 @@ export type KnownZohoRecruitAttachmentCategoryName = 'Resume' | 'Offer' | 'Contr
|
|
|
213
213
|
* I.E. "Resume"
|
|
214
214
|
*/
|
|
215
215
|
export type ZohoRecruitAttachmentCategoryName = KnownZohoRecruitAttachmentCategoryName | string;
|
|
216
|
+
/**
|
|
217
|
+
* The type of attachment.
|
|
218
|
+
*
|
|
219
|
+
* "Attachment" - Download the attachment to retrieve the value.
|
|
220
|
+
* "Link URL" - Use the Attachment_URL property to retrieve the value.
|
|
221
|
+
*/
|
|
222
|
+
export type ZohoRecruitAttachmentType = 'Attachment' | 'Link URL';
|
|
216
223
|
/**
|
|
217
224
|
* Metadata for a record's attachment.
|
|
218
225
|
*/
|
|
@@ -254,9 +261,9 @@ export interface ZohoRecruitRecordAttachmentMetadata {
|
|
|
254
261
|
*/
|
|
255
262
|
$file_id: string;
|
|
256
263
|
/**
|
|
257
|
-
* Type
|
|
264
|
+
* Type of attachment, and how to retrieve the value.
|
|
258
265
|
*/
|
|
259
|
-
$type:
|
|
266
|
+
$type: ZohoRecruitAttachmentType;
|
|
260
267
|
/**
|
|
261
268
|
* Direct URL to the attachment, when available
|
|
262
269
|
*/
|
|
@@ -70,7 +70,7 @@ export declare function logZohoServerErrorFunction(zohoApiNamePrefix: string): L
|
|
|
70
70
|
* @param fetch
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
|
-
export type HandleZohoErrorFetchFactory = (fetch: ConfiguredFetch, logError?: LogZohoServerErrorFunction) => ConfiguredFetch;
|
|
73
|
+
export type HandleZohoErrorFetchFactory = (fetch: ConfiguredFetch, logError?: LogZohoServerErrorFunction, onError?: (error: ParsedZohoServerError) => void) => ConfiguredFetch;
|
|
74
74
|
export type ParsedZohoServerError = FetchRequestFactoryError | ZohoServerError | undefined;
|
|
75
75
|
export type ParseZohoFetchResponseErrorFunction = (responseError: FetchResponseError) => Promise<ParsedZohoServerError>;
|
|
76
76
|
/**
|
|
@@ -90,6 +90,12 @@ export declare function interceptZohoErrorResponseFactory(parseZohoServerErrorRe
|
|
|
90
90
|
* - An extra parameter is provided
|
|
91
91
|
*/
|
|
92
92
|
export declare const ZOHO_INTERNAL_ERROR_CODE = "INTERNAL_ERROR";
|
|
93
|
+
/**
|
|
94
|
+
* Error code for when an invalid oauth token is provided.
|
|
95
|
+
*/
|
|
96
|
+
export declare const ZOHO_INVALID_TOKEN_ERROR_CODE = "INVALID_TOKEN";
|
|
97
|
+
export declare class ZohoInvalidTokenError extends ZohoServerFetchResponseError {
|
|
98
|
+
}
|
|
93
99
|
/**
|
|
94
100
|
* Error code for when a failure occured for the given action
|
|
95
101
|
*/
|