@2bad/bitrix 2.5.1 → 3.0.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 (211) hide show
  1. package/README.md +94 -188
  2. package/build/bin.d.ts +1 -0
  3. package/build/bin.js +160 -0
  4. package/build/client-Bk76ySik.js +769 -0
  5. package/build/index.d.ts +2881 -0
  6. package/build/index.js +1 -0
  7. package/package.json +46 -73
  8. package/build/main/bitrix.d.ts +0 -114
  9. package/build/main/bitrix.integration.test.d.ts +0 -0
  10. package/build/main/bitrix.integration.test.js +0 -31
  11. package/build/main/bitrix.js +0 -61
  12. package/build/main/bitrix.unit.test.d.ts +0 -1
  13. package/build/main/bitrix.unit.test.js +0 -44
  14. package/build/main/client/client.unit.test.d.ts +0 -1
  15. package/build/main/client/client.unit.test.js +0 -70
  16. package/build/main/client/hooks/addAccessToken.d.ts +0 -6
  17. package/build/main/client/hooks/addAccessToken.js +0 -13
  18. package/build/main/client/hooks/addAccessToken.unit.test.d.ts +0 -1
  19. package/build/main/client/hooks/addAccessToken.unit.test.js +0 -31
  20. package/build/main/client/index.d.ts +0 -15
  21. package/build/main/client/index.js +0 -53
  22. package/build/main/client/methods/batch.d.ts +0 -40
  23. package/build/main/client/methods/batch.js +0 -85
  24. package/build/main/client/methods/batch.unit.test.d.ts +0 -1
  25. package/build/main/client/methods/batch.unit.test.js +0 -494
  26. package/build/main/client/methods/call.d.ts +0 -17
  27. package/build/main/client/methods/call.js +0 -36
  28. package/build/main/client/methods/call.unit.test.d.ts +0 -1
  29. package/build/main/client/methods/call.unit.test.js +0 -183
  30. package/build/main/client/methods/list.d.ts +0 -30
  31. package/build/main/client/methods/list.js +0 -66
  32. package/build/main/client/methods/list.unit.test.d.ts +0 -1
  33. package/build/main/client/methods/list.unit.test.js +0 -277
  34. package/build/main/commands.d.ts +0 -10
  35. package/build/main/commands.js +0 -2
  36. package/build/main/methods.d.ts +0 -92
  37. package/build/main/methods.js +0 -41
  38. package/build/main/payloads.d.ts +0 -40
  39. package/build/main/payloads.js +0 -2
  40. package/build/main/services/common.d.ts +0 -22
  41. package/build/main/services/common.js +0 -2
  42. package/build/main/services/companies/entities.d.ts +0 -54
  43. package/build/main/services/companies/entities.js +0 -2
  44. package/build/main/services/companies/index.d.ts +0 -26
  45. package/build/main/services/companies/index.integration.test.d.ts +0 -1
  46. package/build/main/services/companies/index.integration.test.js +0 -19
  47. package/build/main/services/companies/index.js +0 -10
  48. package/build/main/services/companies/index.unit.test.d.ts +0 -1
  49. package/build/main/services/companies/index.unit.test.js +0 -72
  50. package/build/main/services/companies/methods.d.ts +0 -44
  51. package/build/main/services/companies/methods.js +0 -3
  52. package/build/main/services/contacts/entities.d.ts +0 -45
  53. package/build/main/services/contacts/entities.js +0 -2
  54. package/build/main/services/contacts/index.d.ts +0 -26
  55. package/build/main/services/contacts/index.integration.test.d.ts +0 -1
  56. package/build/main/services/contacts/index.integration.test.js +0 -19
  57. package/build/main/services/contacts/index.js +0 -10
  58. package/build/main/services/contacts/index.unit.test.d.ts +0 -1
  59. package/build/main/services/contacts/index.unit.test.js +0 -72
  60. package/build/main/services/contacts/methods.d.ts +0 -44
  61. package/build/main/services/contacts/methods.js +0 -3
  62. package/build/main/services/currencies/entities.d.ts +0 -15
  63. package/build/main/services/currencies/entities.js +0 -2
  64. package/build/main/services/deals/entities.d.ts +0 -43
  65. package/build/main/services/deals/entities.js +0 -2
  66. package/build/main/services/deals/index.d.ts +0 -26
  67. package/build/main/services/deals/index.integration.test.d.ts +0 -1
  68. package/build/main/services/deals/index.integration.test.js +0 -19
  69. package/build/main/services/deals/index.js +0 -10
  70. package/build/main/services/deals/index.unit.test.d.ts +0 -1
  71. package/build/main/services/deals/index.unit.test.js +0 -72
  72. package/build/main/services/deals/methods.d.ts +0 -44
  73. package/build/main/services/deals/methods.js +0 -3
  74. package/build/main/services/leads/entities.d.ts +0 -49
  75. package/build/main/services/leads/entities.js +0 -2
  76. package/build/main/services/leads/index.d.ts +0 -26
  77. package/build/main/services/leads/index.integration.test.d.ts +0 -1
  78. package/build/main/services/leads/index.integration.test.js +0 -19
  79. package/build/main/services/leads/index.js +0 -10
  80. package/build/main/services/leads/index.unit.test.d.ts +0 -1
  81. package/build/main/services/leads/index.unit.test.js +0 -72
  82. package/build/main/services/leads/methods.d.ts +0 -44
  83. package/build/main/services/leads/methods.js +0 -3
  84. package/build/main/services/statuses/entities.d.ts +0 -16
  85. package/build/main/services/statuses/entities.js +0 -2
  86. package/build/main/services/statuses/index.d.ts +0 -14
  87. package/build/main/services/statuses/index.integration.test.d.ts +0 -1
  88. package/build/main/services/statuses/index.integration.test.js +0 -90
  89. package/build/main/services/statuses/index.js +0 -11
  90. package/build/main/services/statuses/index.unit.test.d.ts +0 -1
  91. package/build/main/services/statuses/index.unit.test.js +0 -60
  92. package/build/main/services/statuses/methods.d.ts +0 -51
  93. package/build/main/services/statuses/methods.js +0 -3
  94. package/build/main/services/users/entities.d.ts +0 -40
  95. package/build/main/services/users/entities.js +0 -2
  96. package/build/main/services/users/index.d.ts +0 -9
  97. package/build/main/services/users/index.integration.test.d.ts +0 -1
  98. package/build/main/services/users/index.integration.test.js +0 -33
  99. package/build/main/services/users/index.js +0 -7
  100. package/build/main/services/users/index.unit.test.d.ts +0 -1
  101. package/build/main/services/users/index.unit.test.js +0 -25
  102. package/build/main/services/users/methods.d.ts +0 -17
  103. package/build/main/services/users/methods.js +0 -3
  104. package/build/main/utils/Diff.d.ts +0 -1
  105. package/build/main/utils/Diff.js +0 -2
  106. package/build/main/utils/ExtractValue.d.ts +0 -6
  107. package/build/main/utils/ExtractValue.js +0 -2
  108. package/build/main/utils/isArray.d.ts +0 -2
  109. package/build/main/utils/isArray.js +0 -4
  110. package/build/module/bitrix.d.ts +0 -114
  111. package/build/module/bitrix.integration.test.d.ts +0 -0
  112. package/build/module/bitrix.integration.test.js +0 -31
  113. package/build/module/bitrix.js +0 -40
  114. package/build/module/bitrix.unit.test.d.ts +0 -1
  115. package/build/module/bitrix.unit.test.js +0 -16
  116. package/build/module/client/client.unit.test.d.ts +0 -1
  117. package/build/module/client/client.unit.test.js +0 -65
  118. package/build/module/client/hooks/addAccessToken.d.ts +0 -6
  119. package/build/module/client/hooks/addAccessToken.js +0 -11
  120. package/build/module/client/hooks/addAccessToken.unit.test.d.ts +0 -1
  121. package/build/module/client/hooks/addAccessToken.unit.test.js +0 -26
  122. package/build/module/client/index.d.ts +0 -15
  123. package/build/module/client/index.js +0 -48
  124. package/build/module/client/methods/batch.d.ts +0 -40
  125. package/build/module/client/methods/batch.js +0 -76
  126. package/build/module/client/methods/batch.unit.test.d.ts +0 -1
  127. package/build/module/client/methods/batch.unit.test.js +0 -466
  128. package/build/module/client/methods/call.d.ts +0 -17
  129. package/build/module/client/methods/call.js +0 -28
  130. package/build/module/client/methods/call.unit.test.d.ts +0 -1
  131. package/build/module/client/methods/call.unit.test.js +0 -155
  132. package/build/module/client/methods/list.d.ts +0 -30
  133. package/build/module/client/methods/list.js +0 -55
  134. package/build/module/client/methods/list.unit.test.d.ts +0 -1
  135. package/build/module/client/methods/list.unit.test.js +0 -252
  136. package/build/module/commands.d.ts +0 -10
  137. package/build/module/commands.js +0 -1
  138. package/build/module/methods.d.ts +0 -92
  139. package/build/module/methods.js +0 -38
  140. package/build/module/payloads.d.ts +0 -40
  141. package/build/module/payloads.js +0 -1
  142. package/build/module/services/common.d.ts +0 -22
  143. package/build/module/services/common.js +0 -1
  144. package/build/module/services/companies/entities.d.ts +0 -54
  145. package/build/module/services/companies/entities.js +0 -1
  146. package/build/module/services/companies/index.d.ts +0 -26
  147. package/build/module/services/companies/index.integration.test.d.ts +0 -1
  148. package/build/module/services/companies/index.integration.test.js +0 -14
  149. package/build/module/services/companies/index.js +0 -8
  150. package/build/module/services/companies/index.unit.test.d.ts +0 -1
  151. package/build/module/services/companies/index.unit.test.js +0 -67
  152. package/build/module/services/companies/methods.d.ts +0 -44
  153. package/build/module/services/companies/methods.js +0 -1
  154. package/build/module/services/contacts/entities.d.ts +0 -45
  155. package/build/module/services/contacts/entities.js +0 -1
  156. package/build/module/services/contacts/index.d.ts +0 -26
  157. package/build/module/services/contacts/index.integration.test.d.ts +0 -1
  158. package/build/module/services/contacts/index.integration.test.js +0 -14
  159. package/build/module/services/contacts/index.js +0 -8
  160. package/build/module/services/contacts/index.unit.test.d.ts +0 -1
  161. package/build/module/services/contacts/index.unit.test.js +0 -67
  162. package/build/module/services/contacts/methods.d.ts +0 -44
  163. package/build/module/services/contacts/methods.js +0 -1
  164. package/build/module/services/currencies/entities.d.ts +0 -15
  165. package/build/module/services/currencies/entities.js +0 -1
  166. package/build/module/services/deals/entities.d.ts +0 -43
  167. package/build/module/services/deals/entities.js +0 -1
  168. package/build/module/services/deals/index.d.ts +0 -26
  169. package/build/module/services/deals/index.integration.test.d.ts +0 -1
  170. package/build/module/services/deals/index.integration.test.js +0 -14
  171. package/build/module/services/deals/index.js +0 -8
  172. package/build/module/services/deals/index.unit.test.d.ts +0 -1
  173. package/build/module/services/deals/index.unit.test.js +0 -67
  174. package/build/module/services/deals/methods.d.ts +0 -44
  175. package/build/module/services/deals/methods.js +0 -1
  176. package/build/module/services/leads/entities.d.ts +0 -49
  177. package/build/module/services/leads/entities.js +0 -1
  178. package/build/module/services/leads/index.d.ts +0 -26
  179. package/build/module/services/leads/index.integration.test.d.ts +0 -1
  180. package/build/module/services/leads/index.integration.test.js +0 -14
  181. package/build/module/services/leads/index.js +0 -8
  182. package/build/module/services/leads/index.unit.test.d.ts +0 -1
  183. package/build/module/services/leads/index.unit.test.js +0 -67
  184. package/build/module/services/leads/methods.d.ts +0 -44
  185. package/build/module/services/leads/methods.js +0 -1
  186. package/build/module/services/statuses/entities.d.ts +0 -16
  187. package/build/module/services/statuses/entities.js +0 -1
  188. package/build/module/services/statuses/index.d.ts +0 -14
  189. package/build/module/services/statuses/index.integration.test.d.ts +0 -1
  190. package/build/module/services/statuses/index.integration.test.js +0 -85
  191. package/build/module/services/statuses/index.js +0 -9
  192. package/build/module/services/statuses/index.unit.test.d.ts +0 -1
  193. package/build/module/services/statuses/index.unit.test.js +0 -55
  194. package/build/module/services/statuses/methods.d.ts +0 -51
  195. package/build/module/services/statuses/methods.js +0 -1
  196. package/build/module/services/users/entities.d.ts +0 -40
  197. package/build/module/services/users/entities.js +0 -1
  198. package/build/module/services/users/index.d.ts +0 -9
  199. package/build/module/services/users/index.integration.test.d.ts +0 -1
  200. package/build/module/services/users/index.integration.test.js +0 -28
  201. package/build/module/services/users/index.js +0 -5
  202. package/build/module/services/users/index.unit.test.d.ts +0 -1
  203. package/build/module/services/users/index.unit.test.js +0 -20
  204. package/build/module/services/users/methods.d.ts +0 -17
  205. package/build/module/services/users/methods.js +0 -1
  206. package/build/module/utils/Diff.d.ts +0 -1
  207. package/build/module/utils/Diff.js +0 -1
  208. package/build/module/utils/ExtractValue.d.ts +0 -6
  209. package/build/module/utils/ExtractValue.js +0 -1
  210. package/build/module/utils/isArray.d.ts +0 -2
  211. package/build/module/utils/isArray.js +0 -2
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Method = void 0;
4
- var Method;
5
- (function (Method) {
6
- Method["BATCH"] = "batch";
7
- Method["CRM_COMPANY_FIELDS"] = "crm.company.fields";
8
- Method["CRM_COMPANY_ADD"] = "crm.company.add";
9
- Method["CRM_COMPANY_UPDATE"] = "crm.company.update";
10
- Method["CRM_COMPANY_GET"] = "crm.company.get";
11
- Method["CRM_COMPANY_LIST"] = "crm.company.list";
12
- Method["CRM_CONTACT_FIELDS"] = "crm.contact.fields";
13
- Method["CRM_CONTACT_ADD"] = "crm.contact.add";
14
- Method["CRM_CONTACT_UPDATE"] = "crm.contact.update";
15
- Method["CRM_CONTACT_GET"] = "crm.contact.get";
16
- Method["CRM_CONTACT_LIST"] = "crm.contact.list";
17
- Method["CRM_DEAL_FIELDS"] = "crm.deal.fields";
18
- Method["CRM_DEAL_ADD"] = "crm.deal.add";
19
- Method["CRM_DEAL_UPDATE"] = "crm.deal.update";
20
- Method["CRM_DEAL_GET"] = "crm.deal.get";
21
- Method["CRM_DEAL_LIST"] = "crm.deal.list";
22
- Method["CRM_LEAD_FIELDS"] = "crm.lead.fields";
23
- Method["CRM_LEAD_ADD"] = "crm.lead.add";
24
- Method["CRM_LEAD_UPDATE"] = "crm.lead.update";
25
- Method["CRM_LEAD_GET"] = "crm.lead.get";
26
- Method["CRM_LEAD_LIST"] = "crm.lead.list";
27
- Method["CRM_STATUS_FIELDS"] = "crm.status.fields";
28
- Method["CRM_STATUS_ADD"] = "crm.status.add";
29
- Method["CRM_STATUS_DELETE"] = "crm.status.delete";
30
- Method["CRM_STATUS_GET"] = "crm.status.get";
31
- Method["CRM_STATUS_LIST"] = "crm.status.list";
32
- Method["CRM_STATUS_UPDATE"] = "crm.status.update";
33
- Method["USER_FIELDS"] = "user.fields";
34
- Method["USER_GET"] = "user.get";
35
- })(Method = exports.Method || (exports.Method = {}));
36
- const LISTABLE_METHODS = [
37
- Method.CRM_COMPANY_LIST,
38
- Method.CRM_CONTACT_LIST,
39
- Method.CRM_DEAL_LIST,
40
- Method.CRM_LEAD_LIST
41
- ];
@@ -1,40 +0,0 @@
1
- export declare type PayloadTime = {
2
- readonly start: number;
3
- readonly finish: number;
4
- readonly duration: number;
5
- readonly processing: number;
6
- readonly date_start: string;
7
- readonly date_finish: string;
8
- };
9
- export declare type GetPayload<P> = {
10
- readonly result: P;
11
- readonly time: PayloadTime;
12
- };
13
- export declare type ListPayload<P> = {
14
- readonly result: readonly P[];
15
- readonly error?: string;
16
- readonly total: number;
17
- readonly next?: number;
18
- readonly time: PayloadTime;
19
- };
20
- export declare type BatchPayload<C> = {
21
- readonly result: {
22
- readonly result: {
23
- readonly [P in keyof C]?: C[P];
24
- } | ReadonlyArray<C[keyof C]>;
25
- readonly result_error: {
26
- readonly [P in keyof C]?: string;
27
- } | readonly string[];
28
- readonly result_total: {
29
- readonly [P in keyof C]?: number;
30
- } | readonly number[];
31
- readonly result_next: {
32
- readonly [P in keyof C]?: number;
33
- } | readonly number[];
34
- readonly result_time: {
35
- readonly [P in keyof C]?: PayloadTime;
36
- } | readonly PayloadTime[];
37
- };
38
- readonly time: PayloadTime;
39
- };
40
- export declare type Payload<P> = GetPayload<P> | ListPayload<P> | BatchPayload<P>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,22 +0,0 @@
1
- export declare type NumberString = string;
2
- export declare type ISODate = string;
3
- export declare type BoolString = 'Y' | 'N';
4
- export declare type GenderString = 'M' | 'F' | '';
5
- export declare type Fields = {
6
- readonly [key: string]: {
7
- readonly type: string;
8
- readonly isRequired: boolean;
9
- readonly isReadOnly: boolean;
10
- readonly isImmutable: boolean;
11
- readonly isMultiple: boolean;
12
- readonly isDynamic: boolean;
13
- readonly title: string;
14
- };
15
- };
16
- export declare type MultiField = {
17
- readonly ID: NumberString;
18
- readonly VALUE_TYPE: string;
19
- readonly VALUE: string;
20
- readonly TYPE_ID: string;
21
- };
22
- export declare type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,54 +0,0 @@
1
- import { BoolString, ISODate, MultiField, NumberString } from '../common';
2
- export declare type Company = {
3
- readonly [key: string]: string | boolean | null | readonly MultiField[];
4
- readonly ID: NumberString;
5
- readonly COMPANY_TYPE: string | null;
6
- readonly TITLE: string | null;
7
- readonly LOGO: string | null;
8
- readonly LEAD_ID: NumberString;
9
- readonly HAS_PHONE: BoolString;
10
- readonly HAS_EMAIL: BoolString;
11
- readonly HAS_IMOL: BoolString;
12
- readonly PHONE: readonly MultiField[];
13
- readonly EMAIL: readonly MultiField[];
14
- readonly WEB: readonly MultiField[];
15
- readonly IM: readonly MultiField[];
16
- readonly ASSIGNED_BY_ID: NumberString;
17
- readonly CREATED_BY_ID: NumberString;
18
- readonly MODIFY_BY_ID: NumberString;
19
- readonly BANKING_DETAILS: string | null;
20
- readonly INDUSTRY: string | null;
21
- readonly REVENUE: string | null;
22
- readonly CURRENCY_ID: string | null;
23
- readonly EMPLOYEES: string | null;
24
- readonly COMMENTS: string | null;
25
- readonly DATE_CREATE: ISODate;
26
- readonly DATE_MODIFY: ISODate;
27
- readonly OPENED: BoolString;
28
- readonly IS_MY_COMPANY: BoolString;
29
- readonly ORIGINATOR_ID: string | null;
30
- readonly ORIGIN_ID: NumberString;
31
- readonly ORIGIN_VERSION: string | null;
32
- readonly ADDRESS: string | null;
33
- readonly ADDRESS_2: string | null;
34
- readonly ADDRESS_CITY: string | null;
35
- readonly ADDRESS_POSTAL_CODE: string | null;
36
- readonly ADDRESS_REGION: string | null;
37
- readonly ADDRESS_PROVINCE: string | null;
38
- readonly ADDRESS_COUNTRY: string | null;
39
- readonly ADDRESS_COUNTRY_CODE: string | null;
40
- readonly ADDRESS_LEGAL: string | null;
41
- readonly REG_ADDRESS: string | null;
42
- readonly REG_ADDRESS_2: string | null;
43
- readonly REG_ADDRESS_CITY: string | null;
44
- readonly REG_ADDRESS_POSTAL_CODE: string | null;
45
- readonly REG_ADDRESS_REGION: string | null;
46
- readonly REG_ADDRESS_PROVINCE: string | null;
47
- readonly REG_ADDRESS_COUNTRY: string | null;
48
- readonly REG_ADDRESS_COUNTRY_CODE: string | null;
49
- readonly UTM_SOURCE: string | null;
50
- readonly UTM_MEDIUM: string | null;
51
- readonly UTM_CAMPAIGN: string | null;
52
- readonly UTM_CONTENT: string | null;
53
- readonly UTM_TERM: string | null;
54
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,26 +0,0 @@
1
- import { Call } from '../../client/methods/call';
2
- import { List } from '../../client/methods/list';
3
- import { Method, MethodParams } from '../../methods';
4
- declare type Dependencies = {
5
- readonly call: Call;
6
- readonly list: List;
7
- };
8
- declare const _default: ({ call, list }: Dependencies) => {
9
- fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
10
- create: <D extends {
11
- readonly fields: Partial<import("./entities").Company>;
12
- readonly params?: {
13
- readonly REGISTER_SONET_EVENT: "Y" | "N";
14
- } | undefined;
15
- }>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
16
- get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Company>>;
17
- list: (params?: MethodParams<Method.CRM_COMPANY_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Company>>;
18
- update: <D_1 extends {
19
- readonly id: string;
20
- readonly fields: Record<string, unknown>;
21
- readonly params?: {
22
- readonly REGISTER_SONET_EVENT: "Y" | "N";
23
- } | undefined;
24
- }>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
25
- };
26
- export default _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bitrix_1 = __importDefault(require("./../../bitrix"));
7
- const WEBHOOK_URL = process.env['WEBHOOK_URL'];
8
- if (!WEBHOOK_URL) {
9
- throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
10
- }
11
- const { companies } = (0, bitrix_1.default)(WEBHOOK_URL);
12
- describe('Companies', () => {
13
- describe('fields', () => {
14
- it('should get all fields', async () => {
15
- const { result } = await companies.fields();
16
- expect(result).toMatchSnapshot();
17
- });
18
- });
19
- });
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const methods_1 = require("../../methods");
4
- exports.default = ({ call, list }) => ({
5
- fields: () => call(methods_1.Method.CRM_COMPANY_FIELDS, {}),
6
- create: (fields, params) => call(methods_1.Method.CRM_COMPANY_ADD, { fields, params }),
7
- get: (id) => call(methods_1.Method.CRM_COMPANY_GET, { id }),
8
- list: (params = {}) => list(methods_1.Method.CRM_COMPANY_LIST, params),
9
- update: (id, fields, params) => call(methods_1.Method.CRM_COMPANY_UPDATE, { id, fields, params })
10
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const _1 = __importDefault(require("."));
7
- const mockCall = jest.fn(() => Promise.resolve());
8
- const mockList = jest.fn(() => Promise.resolve());
9
- const companies = (0, _1.default)({ call: mockCall, list: mockList });
10
- const ID = '77';
11
- describe('Companies', () => {
12
- beforeEach(() => {
13
- mockCall.mockClear();
14
- mockList.mockClear();
15
- });
16
- it('should expose API methods', () => {
17
- expect(companies).toMatchSnapshot();
18
- });
19
- describe('`create`', () => {
20
- it('should invoke `call`', async () => {
21
- await companies.create({
22
- COMMENTS: 'Some comment'
23
- }, {
24
- REGISTER_SONET_EVENT: 'Y'
25
- });
26
- expect(mockCall.mock.calls).toMatchSnapshot();
27
- });
28
- it('should work without optional params', async () => {
29
- await companies.create({
30
- COMMENTS: 'Some comment'
31
- });
32
- expect(mockCall.mock.calls).toMatchSnapshot();
33
- });
34
- });
35
- describe('`get`', () => {
36
- it('should invoke `call`', async () => {
37
- await companies.get(ID);
38
- expect(mockCall.mock.calls).toMatchSnapshot();
39
- });
40
- });
41
- describe('`list`', () => {
42
- it('should invoke `list`', async () => {
43
- await companies.list({
44
- start: 0,
45
- order: { COMMENTS: 'ASC' },
46
- filter: { '>PROBABILITY': 50 },
47
- select: ['*', 'UF_*']
48
- });
49
- expect(mockList.mock.calls).toMatchSnapshot();
50
- });
51
- it('should work without optional params', async () => {
52
- await companies.list();
53
- expect(mockList.mock.calls).toMatchSnapshot();
54
- });
55
- });
56
- describe('`update`', () => {
57
- it('should invoke `call`', async () => {
58
- await companies.update(ID, {
59
- COMMENTS: 'Some comment'
60
- }, {
61
- REGISTER_SONET_EVENT: 'Y'
62
- });
63
- expect(mockCall.mock.calls).toMatchSnapshot();
64
- });
65
- it('should work without optional params', async () => {
66
- await companies.update(ID, {
67
- COMMENTS: 'Some comment'
68
- });
69
- expect(mockCall.mock.calls).toMatchSnapshot();
70
- });
71
- });
72
- });
@@ -1,44 +0,0 @@
1
- import { ListParams, Method } from '../../methods';
2
- import { GetPayload, ListPayload } from '../../payloads';
3
- import { Fields } from '../common';
4
- import { Company } from './entities';
5
- export declare type CompaniesMethods = {
6
- readonly [Method.CRM_COMPANY_FIELDS]: {
7
- readonly type: Company;
8
- readonly payload: GetPayload<Fields>;
9
- readonly params?: Record<string, unknown>;
10
- };
11
- readonly [Method.CRM_COMPANY_ADD]: {
12
- readonly type: Company;
13
- readonly payload: GetPayload<number>;
14
- readonly params: {
15
- readonly fields: Partial<Company>;
16
- readonly params?: {
17
- readonly REGISTER_SONET_EVENT: 'Y' | 'N';
18
- };
19
- };
20
- };
21
- readonly [Method.CRM_COMPANY_GET]: {
22
- readonly type: Company;
23
- readonly payload: GetPayload<Company>;
24
- readonly params: {
25
- readonly id: string;
26
- };
27
- };
28
- readonly [Method.CRM_COMPANY_LIST]: {
29
- readonly type: Company;
30
- readonly payload: ListPayload<Company>;
31
- readonly params: ListParams;
32
- };
33
- readonly [Method.CRM_COMPANY_UPDATE]: {
34
- readonly type: Company;
35
- readonly payload: GetPayload<boolean>;
36
- readonly params: {
37
- readonly id: string;
38
- readonly fields: Record<string, unknown>;
39
- readonly params?: {
40
- readonly REGISTER_SONET_EVENT: 'Y' | 'N';
41
- };
42
- };
43
- };
44
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const methods_1 = require("../../methods");
@@ -1,45 +0,0 @@
1
- import { BoolString, ISODate, MultiFieldArray, NumberString } from '../common';
2
- export declare type Contact = {
3
- readonly [key: string]: MultiFieldArray | string | null;
4
- readonly ID: NumberString;
5
- readonly POST: string | null;
6
- readonly COMMENTS: string | null;
7
- readonly HONORIFIC: string | null;
8
- readonly NAME: string | null;
9
- readonly SECOND_NAME: string | null;
10
- readonly LAST_NAME: string | null;
11
- readonly PHOTO: string | null;
12
- readonly LEAD_ID: NumberString;
13
- readonly TYPE_ID: string | null;
14
- readonly SOURCE_ID: NumberString;
15
- readonly SOURCE_DESCRIPTION: string | null;
16
- readonly COMPANY_ID: NumberString;
17
- readonly BIRTHDATE: ISODate;
18
- readonly EXPORT: BoolString;
19
- readonly HAS_PHONE: BoolString;
20
- readonly HAS_EMAIL: BoolString;
21
- readonly HAS_IMOL: BoolString;
22
- readonly DATE_CREATE: ISODate;
23
- readonly DATE_MODIFY: ISODate;
24
- readonly ASSIGNED_BY_ID: NumberString;
25
- readonly CREATED_BY_ID: NumberString;
26
- readonly MODIFY_BY_ID: NumberString;
27
- readonly OPENED: BoolString;
28
- readonly ORIGINATOR_ID: string | null;
29
- readonly ORIGIN_ID: NumberString;
30
- readonly ORIGIN_VERSION: string | null;
31
- readonly FACE_ID: string | null;
32
- readonly ADDRESS: string | null;
33
- readonly ADDRESS_2: string | null;
34
- readonly ADDRESS_CITY: string | null;
35
- readonly ADDRESS_POSTAL_CODE: string | null;
36
- readonly ADDRESS_REGION: string | null;
37
- readonly ADDRESS_PROVINCE: string | null;
38
- readonly ADDRESS_COUNTRY: string | null;
39
- readonly ADDRESS_COUNTRY_CODE: string | null;
40
- readonly UTM_SOURCE: string | null;
41
- readonly UTM_MEDIUM: string | null;
42
- readonly UTM_CAMPAIGN: string | null;
43
- readonly UTM_CONTENT: string | null;
44
- readonly UTM_TERM: string | null;
45
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,26 +0,0 @@
1
- import { Call } from '../../client/methods/call';
2
- import { List } from '../../client/methods/list';
3
- import { Method, MethodParams } from '../../methods';
4
- declare type Dependencies = {
5
- readonly call: Call;
6
- readonly list: List;
7
- };
8
- declare const _default: ({ call, list }: Dependencies) => {
9
- fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
10
- create: <D extends {
11
- readonly fields: Partial<import("./entities").Contact>;
12
- readonly params?: {
13
- readonly REGISTER_SONET_EVENT: "Y" | "N";
14
- } | undefined;
15
- }>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
16
- get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Contact>>;
17
- list: (params?: MethodParams<Method.CRM_CONTACT_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Contact>>;
18
- update: <D_1 extends {
19
- readonly id: string;
20
- readonly fields: Record<string, unknown>;
21
- readonly params?: {
22
- readonly REGISTER_SONET_EVENT: "Y" | "N";
23
- } | undefined;
24
- }>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
25
- };
26
- export default _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bitrix_1 = __importDefault(require("./../../bitrix"));
7
- const WEBHOOK_URL = process.env['WEBHOOK_URL'];
8
- if (!WEBHOOK_URL) {
9
- throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
10
- }
11
- const { contacts } = (0, bitrix_1.default)(WEBHOOK_URL);
12
- describe('Contacts', () => {
13
- describe('fields', () => {
14
- it('should get all fields', async () => {
15
- const { result } = await contacts.fields();
16
- expect(result).toMatchSnapshot();
17
- });
18
- });
19
- });
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const methods_1 = require("../../methods");
4
- exports.default = ({ call, list }) => ({
5
- fields: () => call(methods_1.Method.CRM_CONTACT_FIELDS, {}),
6
- create: (fields, params) => call(methods_1.Method.CRM_CONTACT_ADD, { fields, params }),
7
- get: (id) => call(methods_1.Method.CRM_CONTACT_GET, { id }),
8
- list: (params = {}) => list(methods_1.Method.CRM_CONTACT_LIST, params),
9
- update: (id, fields, params) => call(methods_1.Method.CRM_CONTACT_UPDATE, { id, fields, params })
10
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const _1 = __importDefault(require("."));
7
- const mockCall = jest.fn(() => Promise.resolve());
8
- const mockList = jest.fn(() => Promise.resolve());
9
- const contacts = (0, _1.default)({ call: mockCall, list: mockList });
10
- const ID = '77';
11
- describe('Contacts', () => {
12
- beforeEach(() => {
13
- mockCall.mockClear();
14
- mockList.mockClear();
15
- });
16
- it('should expose API methods', () => {
17
- expect(contacts).toMatchSnapshot();
18
- });
19
- describe('`create`', () => {
20
- it('should invoke `call`', async () => {
21
- await contacts.create({
22
- COMMENTS: 'Some comment'
23
- }, {
24
- REGISTER_SONET_EVENT: 'Y'
25
- });
26
- expect(mockCall.mock.calls).toMatchSnapshot();
27
- });
28
- it('should work without optional params', async () => {
29
- await contacts.create({
30
- COMMENTS: 'Some comment'
31
- });
32
- expect(mockCall.mock.calls).toMatchSnapshot();
33
- });
34
- });
35
- describe('`get`', () => {
36
- it('should invoke `call`', async () => {
37
- await contacts.get(ID);
38
- expect(mockCall.mock.calls).toMatchSnapshot();
39
- });
40
- });
41
- describe('`list`', () => {
42
- it('should invoke `list`', async () => {
43
- await contacts.list({
44
- start: 0,
45
- order: { COMMENTS: 'ASC' },
46
- filter: { '>PROBABILITY': 50 },
47
- select: ['*', 'UF_*']
48
- });
49
- expect(mockList.mock.calls).toMatchSnapshot();
50
- });
51
- it('should work without optional params', async () => {
52
- await contacts.list();
53
- expect(mockList.mock.calls).toMatchSnapshot();
54
- });
55
- });
56
- describe('`update`', () => {
57
- it('should invoke `call`', async () => {
58
- await contacts.update(ID, {
59
- COMMENTS: 'Some comment'
60
- }, {
61
- REGISTER_SONET_EVENT: 'Y'
62
- });
63
- expect(mockCall.mock.calls).toMatchSnapshot();
64
- });
65
- it('should work without optional params', async () => {
66
- await contacts.update(ID, {
67
- COMMENTS: 'Some comment'
68
- });
69
- expect(mockCall.mock.calls).toMatchSnapshot();
70
- });
71
- });
72
- });
@@ -1,44 +0,0 @@
1
- import { ListParams, Method } from '../../methods';
2
- import { GetPayload, ListPayload } from '../../payloads';
3
- import { Fields } from '../common';
4
- import { Contact } from './entities';
5
- export declare type ContactsMethods = {
6
- readonly [Method.CRM_CONTACT_FIELDS]: {
7
- readonly type: Contact;
8
- readonly payload: GetPayload<Fields>;
9
- readonly params?: Record<string, unknown>;
10
- };
11
- readonly [Method.CRM_CONTACT_ADD]: {
12
- readonly type: Contact;
13
- readonly payload: GetPayload<number>;
14
- readonly params: {
15
- readonly fields: Partial<Contact>;
16
- readonly params?: {
17
- readonly REGISTER_SONET_EVENT: 'Y' | 'N';
18
- };
19
- };
20
- };
21
- readonly [Method.CRM_CONTACT_GET]: {
22
- readonly type: Contact;
23
- readonly payload: GetPayload<Contact>;
24
- readonly params: {
25
- readonly id: string;
26
- };
27
- };
28
- readonly [Method.CRM_CONTACT_LIST]: {
29
- readonly type: Contact;
30
- readonly payload: ListPayload<Contact>;
31
- readonly params: ListParams;
32
- };
33
- readonly [Method.CRM_CONTACT_UPDATE]: {
34
- readonly type: Contact;
35
- readonly payload: GetPayload<boolean>;
36
- readonly params: {
37
- readonly id: string;
38
- readonly fields: Record<string, unknown>;
39
- readonly params?: {
40
- readonly REGISTER_SONET_EVENT: 'Y' | 'N';
41
- };
42
- };
43
- };
44
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const methods_1 = require("../../methods");
@@ -1,15 +0,0 @@
1
- import { BoolString, ISODate, NumberString } from '../common';
2
- export declare type Currency = {
3
- readonly CURRENCY: string;
4
- readonly AMOUNT_CNT: NumberString;
5
- readonly AMOUNT: NumberString;
6
- readonly SORT: NumberString;
7
- readonly BASE: BoolString;
8
- readonly FULL_NAME: string;
9
- readonly LID: string;
10
- readonly FORMAT_STRING: string;
11
- readonly DEC_POINT: string;
12
- readonly THOUSANDS_SEP: string;
13
- readonly DECIMALS: NumberString;
14
- readonly DATE_UPDATE: ISODate;
15
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });