@dereekb/zoho 12.6.21 → 12.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.
Files changed (52) hide show
  1. package/index.cjs.js +1786 -419
  2. package/index.esm.js +1678 -417
  3. package/nestjs/CHANGELOG.md +9 -0
  4. package/nestjs/package.json +1 -1
  5. package/nestjs/src/lib/accounts/accounts.api.js +3 -2
  6. package/nestjs/src/lib/accounts/accounts.api.js.map +1 -1
  7. package/nestjs/src/lib/accounts/accounts.config.d.ts +32 -0
  8. package/nestjs/src/lib/accounts/accounts.config.js +29 -4
  9. package/nestjs/src/lib/accounts/accounts.config.js.map +1 -1
  10. package/nestjs/src/lib/crm/crm.api.d.ts +42 -0
  11. package/nestjs/src/lib/crm/crm.api.js +115 -0
  12. package/nestjs/src/lib/crm/crm.api.js.map +1 -0
  13. package/nestjs/src/lib/crm/crm.config.d.ts +10 -0
  14. package/nestjs/src/lib/crm/crm.config.js +16 -0
  15. package/nestjs/src/lib/crm/crm.config.js.map +1 -0
  16. package/nestjs/src/lib/crm/crm.module.d.ts +24 -0
  17. package/nestjs/src/lib/crm/crm.module.js +61 -0
  18. package/nestjs/src/lib/crm/crm.module.js.map +1 -0
  19. package/nestjs/src/lib/crm/index.d.ts +3 -0
  20. package/nestjs/src/lib/crm/index.js +7 -0
  21. package/nestjs/src/lib/crm/index.js.map +1 -0
  22. package/nestjs/src/lib/recruit/recruit.api.d.ts +4 -4
  23. package/nestjs/src/lib/recruit/recruit.api.js +31 -31
  24. package/nestjs/src/lib/recruit/recruit.api.js.map +1 -1
  25. package/nestjs/src/lib/recruit/recruit.module.js +1 -1
  26. package/nestjs/src/lib/recruit/recruit.module.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/lib/accounts/accounts.api.d.ts +1 -1
  29. package/src/lib/crm/crm.api.d.ts +430 -0
  30. package/src/lib/crm/crm.api.notes.d.ts +40 -0
  31. package/src/lib/crm/crm.api.tags.d.ts +136 -0
  32. package/src/lib/crm/crm.config.d.ts +24 -0
  33. package/src/lib/crm/crm.criteria.d.ts +19 -0
  34. package/src/lib/crm/crm.d.ts +325 -0
  35. package/src/lib/crm/crm.error.api.d.ts +52 -0
  36. package/src/lib/crm/crm.factory.d.ts +22 -0
  37. package/src/lib/crm/crm.notes.d.ts +48 -0
  38. package/src/lib/crm/crm.tags.d.ts +40 -0
  39. package/src/lib/crm/index.d.ts +10 -0
  40. package/src/lib/index.d.ts +1 -0
  41. package/src/lib/recruit/index.d.ts +0 -1
  42. package/src/lib/recruit/recruit.api.candidates.d.ts +30 -6
  43. package/src/lib/recruit/recruit.api.d.ts +102 -22
  44. package/src/lib/recruit/recruit.api.notes.d.ts +30 -6
  45. package/src/lib/recruit/recruit.api.tags.d.ts +30 -6
  46. package/src/lib/recruit/recruit.criteria.d.ts +8 -44
  47. package/src/lib/recruit/recruit.d.ts +7 -3
  48. package/src/lib/recruit/recruit.error.api.d.ts +5 -1
  49. package/src/lib/shared/criteria.d.ts +55 -0
  50. package/src/lib/shared/criteria.util.d.ts +10 -0
  51. package/src/lib/zoho.error.api.d.ts +62 -4
  52. package/src/lib/recruit/recruit.criteria.util.d.ts +0 -10
@@ -1,7 +1,36 @@
1
1
  import { type Maybe, type UnixDateTimeNumber } from '@dereekb/util';
2
2
  import { type ConfiguredFetch, type FetchJsonInterceptJsonResponseFunction, type FetchRequestFactoryError, FetchResponseError } from '@dereekb/util/fetch';
3
3
  import { BaseError } from 'make-error';
4
+ /**
5
+ * Returned by Zoho CRM.
6
+ *
7
+ * The data array contains the list of possible success
8
+ */
9
+ export interface ZohoServerErrorResponseDataArrayRef {
10
+ readonly data: ZohoServerErrorResponseDataArrayElement[];
11
+ }
12
+ /**
13
+ * Array of response elements that may contain either a success or error.
14
+ */
15
+ export type ZohoServerErrorResponseDataArrayElement = ZohoServerErrorData | ZohoServerSuccessData;
16
+ /**
17
+ * Default place-holder used by the ZohoServerFetchResponseDataArrayError class.
18
+ */
19
+ export declare const ZOHO_DATA_ARRAY_BLANK_ERROR_CODE = "__internal_data_array_blank_error";
20
+ /**
21
+ * Returns true if the input value is a ZohoServerErrorResponseDataArrayRef.
22
+ *
23
+ * @param value
24
+ * @returns
25
+ */
26
+ export declare function isZohoServerErrorResponseDataArrayRef(value: unknown): value is ZohoServerErrorResponseDataArrayRef;
27
+ /**
28
+ * Returned by Zoho Recruit.
29
+ */
4
30
  export type ZohoServerErrorResponseDataError = ZohoServerErrorData | ZohoServerErrorCode;
31
+ /**
32
+ * Returned by Zoho Recruit.
33
+ */
5
34
  export interface ZohoServerErrorResponseData {
6
35
  readonly error: ZohoServerErrorResponseDataError;
7
36
  }
@@ -35,6 +64,14 @@ export interface ZohoServerErrorData<T = unknown> {
35
64
  */
36
65
  readonly status?: ZohoServerErrorStatus;
37
66
  }
67
+ /**
68
+ * Zoho Server Success Data
69
+ *
70
+ * Always contains a code and message. Details and status are optional.
71
+ */
72
+ export type ZohoServerSuccessData<T = unknown> = Omit<ZohoServerErrorData<T>, 'code'> & {
73
+ readonly code: ZohoServerSuccessCode;
74
+ };
38
75
  /**
39
76
  * Contains details and a status
40
77
  */
@@ -53,17 +90,37 @@ export declare class ZohoServerError<D extends ZohoServerErrorData = ZohoServerE
53
90
  */
54
91
  export declare class ZohoServerFetchResponseError<D extends ZohoServerErrorData = ZohoServerErrorData> extends ZohoServerError<D> {
55
92
  readonly data: D;
93
+ readonly errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef;
56
94
  readonly responseError: FetchResponseError;
57
- constructor(data: D, responseError: FetchResponseError);
95
+ constructor(data: D, errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError);
96
+ }
97
+ /**
98
+ * Used as a transient error for situations where there are potentially multiple errors within the data array returned.
99
+ *
100
+ * Zoho CRM returns a non-200 error as a result, but generally there is a partial success that can occur, with both
101
+ * the successful and errored results returned within the data.
102
+ */
103
+ export declare class ZohoServerFetchResponseDataArrayError extends ZohoServerFetchResponseError<ZohoServerErrorData> {
104
+ constructor(errorResponseData: ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError);
105
+ get errorDataArray(): ZohoServerErrorResponseDataArrayElement[];
58
106
  }
59
107
  export type LogZohoServerErrorFunction = (error: FetchRequestFactoryError | ZohoServerError | ZohoServerFetchResponseError) => void;
108
+ /**
109
+ * Config for logZohoServerErrorFunction.
110
+ */
111
+ export interface LogZohoServerErrorFunctionConfig {
112
+ /**
113
+ * If true, will log errors that are ZohoServerFetchResponseDataArrayError.
114
+ */
115
+ readonly logDataArrayErrors?: boolean;
116
+ }
60
117
  /**
61
118
  * Creates a logZohoServerErrorFunction that logs the error to console.
62
119
  *
63
120
  * @param zohoApiNamePrefix Prefix to use when logging. I.E. ZohoRecruitError, etc.
64
121
  * @returns
65
122
  */
66
- export declare function logZohoServerErrorFunction(zohoApiNamePrefix: string): LogZohoServerErrorFunction;
123
+ export declare function logZohoServerErrorFunction(zohoApiNamePrefix: string, options?: LogZohoServerErrorFunctionConfig): LogZohoServerErrorFunction;
67
124
  /**
68
125
  * Wraps a ConfiguredFetch to support handling errors returned by fetch.
69
126
  *
@@ -183,14 +240,15 @@ export declare class ZohoTooManyRequestsError extends ZohoServerFetchResponseErr
183
240
  * @param responseError
184
241
  * @returns
185
242
  */
186
- export declare function parseZohoServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData, responseError: FetchResponseError): ZohoServerFetchResponseError | undefined;
243
+ export declare function parseZohoServerErrorResponseData(errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataArrayRef, responseError: FetchResponseError): ZohoServerFetchResponseError | undefined;
187
244
  /**
188
245
  * Attempts to retrieve an ZohoServerErrorResponseDataError from the input.
189
246
  *
190
247
  * Non-200 errors returned by the Zoho API are returned as the object directly instead of as an ZohoServerErrorResponseData directly.
248
+ * Zoho CRM returns a ZohoServerErrorResponseDataArrayRef value for errors.
191
249
  *
192
250
  * @param errorResponseData
193
251
  * @param responseError
194
252
  * @returns
195
253
  */
196
- export declare function tryFindZohoServerErrorData(errorResponseData: ZohoServerErrorResponseData | ZohoServerErrorResponseDataError, responseError: FetchResponseError): Maybe<ZohoServerErrorResponseDataError>;
254
+ export declare function tryFindZohoServerErrorData(errorResponseData: ZohoServerErrorResponseDataArrayRef | ZohoServerErrorResponseData | ZohoServerErrorResponseDataError, responseError: FetchResponseError): Maybe<ZohoServerErrorResponseDataError>;
@@ -1,10 +0,0 @@
1
- import { type ArrayOrValue, type EmailAddress, type PrimativeKey } from '@dereekb/util';
2
- import { type ZohoRecruitSearchRecordsCriteriaEntryArray } from './recruit.criteria';
3
- /**
4
- * Creates a ZohoRecruitSearchRecordsCriteriaEntryArray from an array of emails.
5
- *
6
- * @param emails Email or array of emails to search for.
7
- * @param field Optional field name to use. Defaults to 'Email'.
8
- * @returns Array of ZohoRecruitSearchRecordsCriteriaEntry
9
- */
10
- export declare function zohoRecruitSearchRecordsCriteriaEntriesForEmails<T = any>(emails: ArrayOrValue<EmailAddress>, field?: keyof T extends PrimativeKey ? PrimativeKey & keyof T : PrimativeKey): ZohoRecruitSearchRecordsCriteriaEntryArray<T>;