@dereekb/zoho 11.0.15 → 11.0.16

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
@@ -1208,6 +1208,18 @@ function zohoFetchPageFactory(fetch$1, defaults) {
1208
1208
  }));
1209
1209
  }
1210
1210
 
1211
+ const ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
1212
+ function zohoRecruitConfigApiUrl(input) {
1213
+ switch (input) {
1214
+ case 'sandbox':
1215
+ return 'https://recruitsandbox.zoho.com/recruit';
1216
+ case 'production':
1217
+ return 'https://recruit.zoho.com/recruit';
1218
+ default:
1219
+ return input;
1220
+ }
1221
+ }
1222
+
1211
1223
  var classof$3 = classofRaw$2;
1212
1224
 
1213
1225
  // `IsArray` abstract operation
@@ -3248,6 +3260,42 @@ function createNotesForRecord(context) {
3248
3260
  return createNotesInstance(createNotesRequest);
3249
3261
  };
3250
3262
  }
3263
+ class ZohoRecruitExecuteRestApiFunctionError extends makeError.BaseError {
3264
+ constructor(error) {
3265
+ super(`An error occured during the execution of the function. Code: ${error.code}, Message: ${error.message}`);
3266
+ this.error = void 0;
3267
+ this.error = error;
3268
+ }
3269
+ }
3270
+ /**
3271
+ * Creates a ZohoRecruitExecuteRestApiFunctionFunction
3272
+ *
3273
+ * OAuth Details:
3274
+ * - https://www.zoho.com/crm/developer/docs/functions/serverless-fn-oauth.html#OAuth2
3275
+ * - There is no documentation for ZohoRecruit specifically, but it seems to behave the same way
3276
+ * - You will need the following scopes: ZohoRecruit.functions.execute.READ,ZohoRecruit.functions.execute.CREATE
3277
+ *
3278
+ * @param context
3279
+ * @returns
3280
+ */
3281
+ function executeRestApiFunction(context) {
3282
+ return input => {
3283
+ const inputSearchParams = fetch.makeUrlSearchParams(input.params);
3284
+ const inputSearchParamsString = inputSearchParams.toString();
3285
+ const isSpecificRequest = Boolean(input.apiKey);
3286
+ const urlParams = (isSpecificRequest ? `auth_type=apikey&zapikey=${input.apiKey}` : 'auth_type=oauth') + (inputSearchParamsString ? `&${inputSearchParamsString}` : '');
3287
+ const relativeUrl = `/v2/functions/${input.functionName}/actions/execute?${urlParams}`;
3288
+ const baseUrl = isSpecificRequest && input.apiUrl != null ? zohoRecruitConfigApiUrl(input.apiUrl) : '';
3289
+ const url = `${baseUrl}${relativeUrl}`;
3290
+ return context.fetchJson(url, zohoRecruitApiFetchJsonInput('POST')).then(x => {
3291
+ if (x.code === 'success') {
3292
+ return x.details;
3293
+ } else {
3294
+ throw new ZohoRecruitExecuteRestApiFunctionError(x);
3295
+ }
3296
+ });
3297
+ };
3298
+ }
3251
3299
  // MARK: Util
3252
3300
  function zohoRecruitUrlSearchParamsMinusModule(...input) {
3253
3301
  return fetch.makeUrlSearchParams(input, {
@@ -3266,7 +3314,7 @@ const zohoRecruitUrlSearchParams = fetch.makeUrlSearchParams;
3266
3314
  function zohoRecruitApiFetchJsonInput(method, body) {
3267
3315
  const result = {
3268
3316
  method,
3269
- body
3317
+ body: body != null ? body : undefined
3270
3318
  };
3271
3319
  return result;
3272
3320
  }
@@ -3294,18 +3342,6 @@ function zohoRecruitMultiRecordResult(input, results) {
3294
3342
  return result;
3295
3343
  }
3296
3344
 
3297
- const ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
3298
- function zohoRecruitConfigApiUrl(input) {
3299
- switch (input) {
3300
- case 'sandbox':
3301
- return 'https://recruitsandbox.zoho.com/recruit';
3302
- case 'production':
3303
- return 'https://recruit.zoho.com/recruit/';
3304
- default:
3305
- return input;
3306
- }
3307
- }
3308
-
3309
3345
  /**
3310
3346
  * Error in the following cases:
3311
3347
  * - the refresh token string is invalid
@@ -3421,9 +3457,9 @@ function zohoRateLimitedFetchHandler(config) {
3421
3457
  function configForLimit(limit, resetAt) {
3422
3458
  return {
3423
3459
  limit: defaultLimit,
3424
- startLimitAt: Math.ceil(limit / 20),
3425
- cooldownRate: 1.1 * (limit / (defaultResetPeriod / util.MS_IN_SECOND)),
3426
- exponentRate: 1.1,
3460
+ startLimitAt: Math.ceil(limit / 10),
3461
+ cooldownRate: 1.2 * (limit / (defaultResetPeriod / util.MS_IN_SECOND)),
3462
+ exponentRate: 1.08,
3427
3463
  maxWaitTime: util.MS_IN_SECOND * 10,
3428
3464
  resetPeriod: defaultResetPeriod,
3429
3465
  resetAt
@@ -3805,6 +3841,7 @@ exports.ZohoAccountsAuthFailureError = ZohoAccountsAuthFailureError;
3805
3841
  exports.ZohoInternalError = ZohoInternalError;
3806
3842
  exports.ZohoInvalidAuthorizationError = ZohoInvalidAuthorizationError;
3807
3843
  exports.ZohoInvalidQueryError = ZohoInvalidQueryError;
3844
+ exports.ZohoRecruitExecuteRestApiFunctionError = ZohoRecruitExecuteRestApiFunctionError;
3808
3845
  exports.ZohoRecruitRecordCrudDuplicateDataError = ZohoRecruitRecordCrudDuplicateDataError;
3809
3846
  exports.ZohoRecruitRecordCrudError = ZohoRecruitRecordCrudError;
3810
3847
  exports.ZohoRecruitRecordCrudInvalidDataError = ZohoRecruitRecordCrudInvalidDataError;
@@ -3820,6 +3857,7 @@ exports.createNotes = createNotes;
3820
3857
  exports.createNotesForRecord = createNotesForRecord;
3821
3858
  exports.deleteNotes = deleteNotes;
3822
3859
  exports.escapeZohoFieldValueForCriteriaString = escapeZohoFieldValueForCriteriaString;
3860
+ exports.executeRestApiFunction = executeRestApiFunction;
3823
3861
  exports.getNotesForRecord = getNotesForRecord;
3824
3862
  exports.getNotesForRecordPageFactory = getNotesForRecordPageFactory;
3825
3863
  exports.getRecordById = getRecordById;
package/index.esm.js CHANGED
@@ -1222,6 +1222,18 @@ function zohoFetchPageFactory(fetch, defaults) {
1222
1222
  }));
1223
1223
  }
1224
1224
 
1225
+ const ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
1226
+ function zohoRecruitConfigApiUrl(input) {
1227
+ switch (input) {
1228
+ case 'sandbox':
1229
+ return 'https://recruitsandbox.zoho.com/recruit';
1230
+ case 'production':
1231
+ return 'https://recruit.zoho.com/recruit';
1232
+ default:
1233
+ return input;
1234
+ }
1235
+ }
1236
+
1225
1237
  var classof$3 = classofRaw$2;
1226
1238
 
1227
1239
  // `IsArray` abstract operation
@@ -1556,6 +1568,10 @@ const ZOHO_RECRUIT_CANDIDATES_MODULE = 'Candidates';
1556
1568
  * Contains a reference to a module.
1557
1569
  */
1558
1570
 
1571
+ /**
1572
+ * The API name of a function that is accessible via the Recruit REST API
1573
+ */
1574
+
1559
1575
  /**
1560
1576
  * An identifier in Zoho Recruit.
1561
1577
  */
@@ -1572,6 +1588,12 @@ const ZOHO_RECRUIT_CANDIDATES_MODULE = 'Candidates';
1572
1588
  * Example "576214000000820595"
1573
1589
  */
1574
1590
 
1591
+ /**
1592
+ * Zoho Recruit user identifier.
1593
+ *
1594
+ * Users can be found in the Users and Controls section in settings.
1595
+ */
1596
+
1575
1597
  /**
1576
1598
  * Zoho Recruit custom view id
1577
1599
  */
@@ -1588,6 +1610,10 @@ const ZOHO_RECRUIT_CANDIDATES_MODULE = 'Candidates';
1588
1610
  * Comma separated list of field names
1589
1611
  */
1590
1612
 
1613
+ /**
1614
+ * Reference pair of a Zoho Recruit user name and id
1615
+ */
1616
+
1591
1617
  /**
1592
1618
  * Zoho Recruit only allows URLs that can be resolved via the internet (I.E. uses a normal tdl)
1593
1619
  *
@@ -3352,6 +3378,51 @@ function createNotesForRecord(context) {
3352
3378
  };
3353
3379
  }
3354
3380
 
3381
+ // MARK: Function
3382
+
3383
+ class ZohoRecruitExecuteRestApiFunctionError extends BaseError {
3384
+ constructor(error) {
3385
+ super(`An error occured during the execution of the function. Code: ${error.code}, Message: ${error.message}`);
3386
+ this.error = error;
3387
+ }
3388
+ }
3389
+
3390
+ /**
3391
+ * Executes the Zoho Recruit function based on the input.
3392
+ *
3393
+ * If the function fails execution a ZohoRecruitExecuteRestApiFunctionError will be thrown. Other API errors may still be thrown.
3394
+ */
3395
+
3396
+ /**
3397
+ * Creates a ZohoRecruitExecuteRestApiFunctionFunction
3398
+ *
3399
+ * OAuth Details:
3400
+ * - https://www.zoho.com/crm/developer/docs/functions/serverless-fn-oauth.html#OAuth2
3401
+ * - There is no documentation for ZohoRecruit specifically, but it seems to behave the same way
3402
+ * - You will need the following scopes: ZohoRecruit.functions.execute.READ,ZohoRecruit.functions.execute.CREATE
3403
+ *
3404
+ * @param context
3405
+ * @returns
3406
+ */
3407
+ function executeRestApiFunction(context) {
3408
+ return input => {
3409
+ const inputSearchParams = makeUrlSearchParams(input.params);
3410
+ const inputSearchParamsString = inputSearchParams.toString();
3411
+ const isSpecificRequest = Boolean(input.apiKey);
3412
+ const urlParams = (isSpecificRequest ? `auth_type=apikey&zapikey=${input.apiKey}` : 'auth_type=oauth') + (inputSearchParamsString ? `&${inputSearchParamsString}` : '');
3413
+ const relativeUrl = `/v2/functions/${input.functionName}/actions/execute?${urlParams}`;
3414
+ const baseUrl = isSpecificRequest && input.apiUrl != null ? zohoRecruitConfigApiUrl(input.apiUrl) : '';
3415
+ const url = `${baseUrl}${relativeUrl}`;
3416
+ return context.fetchJson(url, zohoRecruitApiFetchJsonInput('POST')).then(x => {
3417
+ if (x.code === 'success') {
3418
+ return x.details;
3419
+ } else {
3420
+ throw new ZohoRecruitExecuteRestApiFunctionError(x);
3421
+ }
3422
+ });
3423
+ };
3424
+ }
3425
+
3355
3426
  // MARK: Util
3356
3427
  function zohoRecruitUrlSearchParamsMinusModule(...input) {
3357
3428
  return makeUrlSearchParams(input, {
@@ -3371,7 +3442,7 @@ const zohoRecruitUrlSearchParams = makeUrlSearchParams;
3371
3442
  function zohoRecruitApiFetchJsonInput(method, body) {
3372
3443
  const result = {
3373
3444
  method,
3374
- body
3445
+ body: body != null ? body : undefined
3375
3446
  };
3376
3447
  return result;
3377
3448
  }
@@ -3417,18 +3488,6 @@ function zohoRecruitMultiRecordResult(input, results) {
3417
3488
  * @deprecated use ZohoRecruitChangeObjectResponseErrorEntry instead.
3418
3489
  */
3419
3490
 
3420
- const ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
3421
- function zohoRecruitConfigApiUrl(input) {
3422
- switch (input) {
3423
- case 'sandbox':
3424
- return 'https://recruitsandbox.zoho.com/recruit';
3425
- case 'production':
3426
- return 'https://recruit.zoho.com/recruit/';
3427
- default:
3428
- return input;
3429
- }
3430
- }
3431
-
3432
3491
  /**
3433
3492
  * Error in the following cases:
3434
3493
  * - the refresh token string is invalid
@@ -3559,10 +3618,10 @@ function zohoRateLimitedFetchHandler(config) {
3559
3618
  function configForLimit(limit, resetAt) {
3560
3619
  return {
3561
3620
  limit: defaultLimit,
3562
- startLimitAt: Math.ceil(limit / 20),
3563
- // can do 5% of the requests of the limit before rate limiting begins
3564
- cooldownRate: 1.1 * (limit / (defaultResetPeriod / MS_IN_SECOND)),
3565
- exponentRate: 1.1,
3621
+ startLimitAt: Math.ceil(limit / 10),
3622
+ // can do 10% of the requests of the limit before rate limiting begins
3623
+ cooldownRate: 1.2 * (limit / (defaultResetPeriod / MS_IN_SECOND)),
3624
+ exponentRate: 1.08,
3566
3625
  maxWaitTime: MS_IN_SECOND * 10,
3567
3626
  resetPeriod: defaultResetPeriod,
3568
3627
  resetAt
@@ -3865,4 +3924,4 @@ function zohoDateTimeString(date) {
3865
3924
  return isoDate.substring(0, isoDate.length - 5) + 'Z';
3866
3925
  }
3867
3926
 
3868
- export { DEFAULT_ZOHO_API_RATE_LIMIT, DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD, DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION, ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE, ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE, ZOHO_ACCOUNTS_US_API_URL, ZOHO_DUPLICATE_DATA_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_CANDIDATES_MODULE, ZOHO_RECRUIT_SERVICE_NAME, ZOHO_SUCCESS_CODE, ZOHO_TOO_MANY_REQUESTS_ERROR_CODE, ZOHO_TOO_MANY_REQUESTS_HTTP_STATUS_CODE, ZohoAccountsAccessTokenError, ZohoAccountsAuthFailureError, ZohoInternalError, ZohoInvalidAuthorizationError, ZohoInvalidQueryError, ZohoRecruitRecordCrudDuplicateDataError, ZohoRecruitRecordCrudError, ZohoRecruitRecordCrudInvalidDataError, ZohoRecruitRecordCrudMandatoryFieldNotFoundError, ZohoRecruitRecordCrudNoMatchingRecordError, ZohoRecruitRecordNoContentError, ZohoServerError, ZohoServerFetchResponseError, ZohoTooManyRequestsError, accessToken, assertRecordDataArrayResultHasContent, createNotes, createNotesForRecord, deleteNotes, escapeZohoFieldValueForCriteriaString, getNotesForRecord, getNotesForRecordPageFactory, getRecordById, getRecords, handleZohoAccountsErrorFetch, handleZohoErrorFetchFactory, handleZohoRecruitErrorFetch, insertRecord, interceptZohoAccountsErrorResponse, interceptZohoErrorResponseFactory, interceptZohoRecruitErrorResponse, isZohoRecruitValidUrl, logZohoAccountsErrorToConsole, logZohoRecruitErrorToConsole, logZohoServerErrorFunction, parseZohoAccountsError, parseZohoAccountsServerErrorResponseData, parseZohoRecruitError, parseZohoRecruitServerErrorResponseData, parseZohoServerErrorResponseData, safeZohoDateTimeString, searchRecords, searchRecordsPageFactory, tryFindZohoServerErrorData, updateRecord, upsertRecord, zohoAccessTokenStringFactory, zohoAccountsApiFetchJsonInput, zohoAccountsConfigApiUrl, zohoAccountsFactory, zohoAccountsZohoAccessTokenFactory, zohoDateTimeString, zohoFetchPageFactory, zohoRateLimitHeaderDetails, zohoRateLimitedFetchHandler, zohoRecruitApiFetchJsonInput, zohoRecruitConfigApiUrl, zohoRecruitFactory, zohoRecruitMultiRecordResult, zohoRecruitRecordCrudError, zohoRecruitSearchRecordsCriteriaEntryToCriteriaString, zohoRecruitSearchRecordsCriteriaString, zohoRecruitSearchRecordsCriteriaStringForTree, zohoRecruitUrlSearchParams, zohoRecruitUrlSearchParamsMinusIdAndModule, zohoRecruitUrlSearchParamsMinusModule, zohoServerErrorData };
3927
+ export { DEFAULT_ZOHO_API_RATE_LIMIT, DEFAULT_ZOHO_API_RATE_LIMIT_RESET_PERIOD, DEFAULT_ZOHO_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION, ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE, ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE, ZOHO_ACCOUNTS_US_API_URL, ZOHO_DUPLICATE_DATA_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_CANDIDATES_MODULE, ZOHO_RECRUIT_SERVICE_NAME, ZOHO_SUCCESS_CODE, 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, assertRecordDataArrayResultHasContent, createNotes, createNotesForRecord, deleteNotes, escapeZohoFieldValueForCriteriaString, executeRestApiFunction, getNotesForRecord, getNotesForRecordPageFactory, getRecordById, getRecords, handleZohoAccountsErrorFetch, handleZohoErrorFetchFactory, handleZohoRecruitErrorFetch, insertRecord, interceptZohoAccountsErrorResponse, interceptZohoErrorResponseFactory, interceptZohoRecruitErrorResponse, isZohoRecruitValidUrl, logZohoAccountsErrorToConsole, logZohoRecruitErrorToConsole, logZohoServerErrorFunction, parseZohoAccountsError, parseZohoAccountsServerErrorResponseData, parseZohoRecruitError, parseZohoRecruitServerErrorResponseData, parseZohoServerErrorResponseData, safeZohoDateTimeString, searchRecords, searchRecordsPageFactory, tryFindZohoServerErrorData, updateRecord, upsertRecord, zohoAccessTokenStringFactory, zohoAccountsApiFetchJsonInput, zohoAccountsConfigApiUrl, zohoAccountsFactory, zohoAccountsZohoAccessTokenFactory, zohoDateTimeString, zohoFetchPageFactory, zohoRateLimitHeaderDetails, zohoRateLimitedFetchHandler, zohoRecruitApiFetchJsonInput, zohoRecruitConfigApiUrl, zohoRecruitFactory, zohoRecruitMultiRecordResult, zohoRecruitRecordCrudError, zohoRecruitSearchRecordsCriteriaEntryToCriteriaString, zohoRecruitSearchRecordsCriteriaString, zohoRecruitSearchRecordsCriteriaStringForTree, zohoRecruitUrlSearchParams, zohoRecruitUrlSearchParamsMinusIdAndModule, zohoRecruitUrlSearchParamsMinusModule, zohoServerErrorData };
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [11.0.16](https://github.com/dereekb/dbx-components/compare/v11.0.15-dev...v11.0.16) (2024-12-05)
6
+
7
+
8
+
5
9
  ## [11.0.15](https://github.com/dereekb/dbx-components/compare/v11.0.14-dev...v11.0.15) (2024-11-29)
6
10
 
7
11
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/zoho/nestjs",
3
- "version": "11.0.15",
3
+ "version": "11.0.16",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }
@@ -19,4 +19,5 @@ export declare class ZohoRecruitApi {
19
19
  get deleteNotes(): (input: import("@dereekb/zoho").ZohoRecruitDeleteNotesRequest) => Promise<import("@dereekb/zoho").ZohoRecruitMultiRecordResult<string, import("@dereekb/zoho").ZohoRecruitChangeObjectResponseSuccessEntry<import("@dereekb/zoho").ZohoRecruitChangeObjectDetails>, import("@dereekb/zoho").ZohoRecruitChangeObjectResponseErrorEntry>>;
20
20
  get createNotesForRecord(): import("@dereekb/zoho").ZohoRecruitCreateNotesForRecordFunction;
21
21
  get getNotesForRecord(): import("@dereekb/zoho").ZohoRecruitGetNotesForRecordFunction;
22
+ get executeRestApiFunction(): import("@dereekb/zoho").ZohoRecruitExecuteRestApiFunctionFunction;
22
23
  }
@@ -58,6 +58,9 @@ let ZohoRecruitApi = exports.ZohoRecruitApi = class ZohoRecruitApi {
58
58
  get getNotesForRecord() {
59
59
  return (0, zoho_1.getNotesForRecord)(this.recruitContext);
60
60
  }
61
+ get executeRestApiFunction() {
62
+ return (0, zoho_1.executeRestApiFunction)(this.recruitContext);
63
+ }
61
64
  };
62
65
  exports.ZohoRecruitApi = ZohoRecruitApi = tslib_1.__decorate([
63
66
  (0, common_1.Injectable)(),
@@ -1 +1 @@
1
- {"version":3,"file":"recruit.api.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/recruit/recruit.api.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,wCAAqQ;AACrQ,qDAA4D;AAC5D,2DAA2D;AAGpD,IAAM,cAAc,4BAApB,MAAM,cAAc;IAW8B;IAAoE;IAVlH,WAAW,CAAc;IAElC,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACzC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,eAAe,CAAC;IACzD,CAAC;IAED,YAAuD,MAAgC,EAAoC,eAAgC;QAApG,WAAM,GAAN,MAAM,CAA0B;QAAoC,oBAAe,GAAf,eAAe,CAAiB;QACzJ,IAAI,CAAC,WAAW,GAAG,IAAA,yBAAkB,EAAC;YACpC,GAAG,MAAM,CAAC,aAAa;YACvB,eAAe,EAAE,eAAe,CAAC,eAAe;SACjD,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED,kBAAkB;IAClB,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,IAAA,+BAAwB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,oBAAoB;QACtB,OAAO,IAAA,2BAAoB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAA,wBAAiB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;yBA9DY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAYE,mBAAA,IAAA,eAAM,EAAC,yCAAwB,CAAC,CAAA;IAA6C,mBAAA,IAAA,eAAM,EAAC,8BAAe,CAAC,CAAA;6CAAlD,yCAAwB,EAAqD,8BAAe;GAXhJ,cAAc,CA8D1B"}
1
+ {"version":3,"file":"recruit.api.js","sourceRoot":"","sources":["../../../../../../../packages/zoho/nestjs/src/lib/recruit/recruit.api.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,wCAA6R;AAC7R,qDAA4D;AAC5D,2DAA2D;AAGpD,IAAM,cAAc,4BAApB,MAAM,cAAc;IAW8B;IAAoE;IAVlH,WAAW,CAAc;IAElC,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACzC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,eAAe,CAAC;IACzD,CAAC;IAED,YAAuD,MAAgC,EAAoC,eAAgC;QAApG,WAAM,GAAN,MAAM,CAA0B;QAAoC,oBAAe,GAAf,eAAe,CAAiB;QACzJ,IAAI,CAAC,WAAW,GAAG,IAAA,yBAAkB,EAAC;YACpC,GAAG,MAAM,CAAC,aAAa;YACvB,eAAe,EAAE,eAAe,CAAC,eAAe;SACjD,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED,kBAAkB;IAClB,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,mBAAY,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,IAAA,+BAAwB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,oBAAoB;QACtB,OAAO,IAAA,2BAAoB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAA,wBAAiB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,sBAAsB;QACxB,OAAO,IAAA,6BAAsB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;CACF,CAAA;yBAlEY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAYE,mBAAA,IAAA,eAAM,EAAC,yCAAwB,CAAC,CAAA;IAA6C,mBAAA,IAAA,eAAM,EAAC,8BAAe,CAAC,CAAA;6CAAlD,yCAAwB,EAAqD,8BAAe;GAXhJ,cAAc,CAkE1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/zoho",
3
- "version": "11.0.15",
3
+ "version": "11.0.16",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -1,9 +1,11 @@
1
1
  import { ZohoDataArrayResultRef, ZohoPageFilter, ZohoPageResult } from './../zoho.api.page';
2
2
  import { FetchJsonBody, FetchJsonInput, FetchPage, FetchPageFactory, FetchPageFactoryOptions, makeUrlSearchParams } from '@dereekb/util/fetch';
3
- import { ZohoRecruitContext } from './recruit.config';
4
- import { NewZohoRecruitNoteData, ZohoRecruitCommaSeparateFieldNames, ZohoRecruitCustomViewId, ZohoRecruitDraftOrSaveState, ZohoRecruitFieldName, ZohoRecruitModuleNameRef, ZohoRecruitChangeObjectDetails, ZohoRecruitRecord, ZohoRecruitRecordId, ZohoRecruitRecordNote, ZohoRecruitSearchRecordsCriteriaTreeElement, ZohoRecruitTerritoryId, ZohoRecruitTrueFalseBoth, ZohoRecruitNoteId } from './recruit';
3
+ import { ZohoRecruitConfigApiUrlInput, ZohoRecruitContext } from './recruit.config';
4
+ import { NewZohoRecruitNoteData, ZohoRecruitCommaSeparateFieldNames, ZohoRecruitCustomViewId, ZohoRecruitDraftOrSaveState, ZohoRecruitFieldName, ZohoRecruitModuleNameRef, ZohoRecruitChangeObjectDetails, ZohoRecruitRecord, ZohoRecruitRecordId, ZohoRecruitRecordNote, ZohoRecruitSearchRecordsCriteriaTreeElement, ZohoRecruitTerritoryId, ZohoRecruitTrueFalseBoth, ZohoRecruitNoteId, ZohoRecruitRestFunctionApiName, ZohoRecruitUserId } from './recruit';
5
5
  import { ArrayOrValue, EmailAddress, Maybe, PhoneNumber, SortingOrder, UniqueModelWithId } from '@dereekb/util';
6
6
  import { ZohoServerErrorDataWithDetails, ZohoServerErrorStatus, ZohoServerSuccessCode, ZohoServerSuccessStatus } from '../zoho.error.api';
7
+ import { ZohoDateTimeString } from '../zoho.type';
8
+ import { BaseError } from 'make-error';
7
9
  export type ZohoRecruitUpdateRecordResult<T> = ZohoRecruitMultiRecordResult<T, ZohoRecruitChangeObjectResponseSuccessEntry, ZohoRecruitChangeObjectResponseErrorEntry>;
8
10
  export type ZohoRecruitUpdateRecordResponse = ZohoRecruitChangeObjectResponse;
9
11
  export type ZohoRecruitCreateRecordData<T> = Omit<T, 'id'>;
@@ -166,13 +168,70 @@ export interface ZohoRecruitCreateNotesForRecordRequest extends ZohoRecruitModul
166
168
  }
167
169
  export type ZohoRecruitCreateNotesForRecordFunction = (input: ZohoRecruitCreateNotesForRecordRequest) => Promise<ZohoRecruitCreateNotesResult>;
168
170
  export declare function createNotesForRecord(context: ZohoRecruitContext): ZohoRecruitCreateNotesForRecordFunction;
171
+ export type ZohoRecruitExecuteRestApiFunctionRequest = ZohoRecruitExecuteRestApiFunctionNormalRequest | ZohoRecruitExecuteRestApiFunctionApiSpecificRequest;
172
+ export interface ZohoRecruitExecuteRestApiFunctionNormalRequest {
173
+ readonly functionName: ZohoRecruitRestFunctionApiName;
174
+ readonly params?: Maybe<ZohoRecruitExecuteRestApiFunctionParams>;
175
+ }
176
+ export interface ZohoRecruitExecuteRestApiFunctionApiSpecificRequest extends ZohoRecruitExecuteRestApiFunctionNormalRequest {
177
+ /**
178
+ * If provided the function will use the API key provided instead of the internal oauth
179
+ */
180
+ readonly apiKey: Maybe<ZohoRecruitRestFunctionApiKey>;
181
+ /**
182
+ * If provided, the function will target the given API and not the default. Only used when apiKey is provided.
183
+ *
184
+ * Careful when using this, as it might indicate that the target is not environment specific/aware.
185
+ */
186
+ readonly apiUrl?: ZohoRecruitConfigApiUrlInput;
187
+ }
188
+ export type ZohoRecruitRestFunctionApiKey = string;
189
+ export type ZohoRecruitExecuteRestApiFunctionParams = Record<string, string | number | boolean | ZohoDateTimeString>;
190
+ export type ZohoRecruitExecuteRestApiFunctionResponse = ZohoRecruitExecuteRestApiFunctionSuccessResponse | ZohoRecruitExecuteRestApiFunctionErrorResponse;
191
+ export interface ZohoRecruitExecuteRestApiFunctionSuccessResponse {
192
+ readonly code: 'success';
193
+ readonly details: ZohoRecruitExecuteRestApiFunctionSuccessDetails;
194
+ readonly message: string;
195
+ }
196
+ export interface ZohoRecruitExecuteRestApiFunctionSuccessDetails {
197
+ readonly userMessage: string[];
198
+ readonly output_type: string;
199
+ readonly id: ZohoRecruitUserId;
200
+ }
201
+ export interface ZohoRecruitExecuteRestApiFunctionErrorResponse {
202
+ readonly code: string;
203
+ readonly details: unknown;
204
+ readonly message: string;
205
+ }
206
+ export declare class ZohoRecruitExecuteRestApiFunctionError extends BaseError {
207
+ readonly error: ZohoRecruitExecuteRestApiFunctionErrorResponse;
208
+ constructor(error: ZohoRecruitExecuteRestApiFunctionErrorResponse);
209
+ }
210
+ /**
211
+ * Executes the Zoho Recruit function based on the input.
212
+ *
213
+ * If the function fails execution a ZohoRecruitExecuteRestApiFunctionError will be thrown. Other API errors may still be thrown.
214
+ */
215
+ export type ZohoRecruitExecuteRestApiFunctionFunction = (input: ZohoRecruitExecuteRestApiFunctionRequest) => Promise<ZohoRecruitExecuteRestApiFunctionSuccessDetails>;
216
+ /**
217
+ * Creates a ZohoRecruitExecuteRestApiFunctionFunction
218
+ *
219
+ * OAuth Details:
220
+ * - https://www.zoho.com/crm/developer/docs/functions/serverless-fn-oauth.html#OAuth2
221
+ * - There is no documentation for ZohoRecruit specifically, but it seems to behave the same way
222
+ * - You will need the following scopes: ZohoRecruit.functions.execute.READ,ZohoRecruit.functions.execute.CREATE
223
+ *
224
+ * @param context
225
+ * @returns
226
+ */
227
+ export declare function executeRestApiFunction(context: ZohoRecruitContext): ZohoRecruitExecuteRestApiFunctionFunction;
169
228
  export declare function zohoRecruitUrlSearchParamsMinusModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
170
229
  export declare function zohoRecruitUrlSearchParamsMinusIdAndModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
171
230
  /**
172
231
  * @deprecated use makeUrlSearchParams instead.
173
232
  */
174
233
  export declare const zohoRecruitUrlSearchParams: typeof makeUrlSearchParams;
175
- export declare function zohoRecruitApiFetchJsonInput(method: string, body?: FetchJsonBody): FetchJsonInput;
234
+ export declare function zohoRecruitApiFetchJsonInput(method: string, body?: Maybe<FetchJsonBody>): FetchJsonInput;
176
235
  export type ZohoRecruitChangeObjectResponse<T extends ZohoRecruitChangeObjectResponseEntry = ZohoRecruitChangeObjectResponseEntry> = ZohoDataArrayResultRef<T>;
177
236
  export type ZohoRecruitChangeObjectResponseEntry<E extends ZohoRecruitChangeObjectResponseSuccessEntry = ZohoRecruitChangeObjectResponseSuccessEntry> = E | ZohoRecruitChangeObjectResponseErrorEntry;
178
237
  export interface ZohoRecruitChangeObjectResponseSuccessEntry<D extends ZohoRecruitChangeObjectDetails = ZohoRecruitChangeObjectDetails> {
@@ -15,6 +15,10 @@ export declare const ZOHO_RECRUIT_CANDIDATES_MODULE = "Candidates";
15
15
  export interface ZohoRecruitModuleNameRef {
16
16
  readonly module: ZohoRecruitModuleName;
17
17
  }
18
+ /**
19
+ * The API name of a function that is accessible via the Recruit REST API
20
+ */
21
+ export type ZohoRecruitRestFunctionApiName = string;
18
22
  /**
19
23
  * An identifier in Zoho Recruit.
20
24
  */
@@ -31,6 +35,12 @@ export type ZohoRecruitRecordId = string;
31
35
  * Example "576214000000820595"
32
36
  */
33
37
  export type ZohoRecruitTypeId = string;
38
+ /**
39
+ * Zoho Recruit user identifier.
40
+ *
41
+ * Users can be found in the Users and Controls section in settings.
42
+ */
43
+ export type ZohoRecruitUserId = string;
34
44
  /**
35
45
  * Zoho Recruit custom view id
36
46
  */
@@ -53,9 +63,17 @@ export interface ZohoRecruitReferenceData {
53
63
  name: string;
54
64
  id: ZohoRecruitId;
55
65
  }
66
+ /**
67
+ * Reference pair of a Zoho Recruit user name and id
68
+ */
69
+ export interface ZohoRecruitUserReferenceData {
70
+ name: string;
71
+ id: ZohoRecruitUserId;
72
+ }
56
73
  export interface ZohoRecruitReferenceDataWithModule extends ZohoRecruitReferenceData, ZohoRecruitModuleNameRef {
57
74
  }
58
- export type ZohoRecruitCreatedByData = ZohoRecruitReferenceData;
75
+ export type ZohoRecruitCreatedByData = ZohoRecruitUserReferenceData;
76
+ export type ZohoRecruitCandidateOwner = ZohoRecruitUserReferenceData;
59
77
  export interface ZohoRecruitModifiedByData extends ZohoRecruitReferenceData {
60
78
  zuid: ZohoRecruitId;
61
79
  }