@2bad/bitrix 2.3.1 → 2.5.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 (268) hide show
  1. package/README.md +53 -45
  2. package/build/main/bitrix.d.ts +25 -16
  3. package/build/main/bitrix.integration.test.js +0 -1
  4. package/build/main/bitrix.js +40 -13
  5. package/build/main/bitrix.unit.test.js +24 -9
  6. package/build/main/client/client.unit.test.js +13 -10
  7. package/build/main/client/hooks/addAccessToken.d.ts +5 -2
  8. package/build/main/client/hooks/addAccessToken.js +3 -1
  9. package/build/main/client/hooks/addAccessToken.unit.test.js +13 -12
  10. package/build/main/client/index.d.ts +10 -1
  11. package/build/main/client/index.js +23 -11
  12. package/build/main/client/methods/batch.d.ts +24 -5
  13. package/build/main/client/methods/batch.js +49 -17
  14. package/build/main/client/methods/batch.unit.test.js +103 -45
  15. package/build/main/client/methods/call.d.ts +11 -4
  16. package/build/main/client/methods/call.js +16 -6
  17. package/build/main/client/methods/call.unit.test.js +36 -21
  18. package/build/main/client/methods/list.d.ts +15 -3
  19. package/build/main/client/methods/list.js +36 -14
  20. package/build/main/client/methods/list.unit.test.js +42 -27
  21. package/build/main/commands.d.ts +2 -2
  22. package/build/main/commands.js +0 -1
  23. package/build/main/methods.d.ts +27 -8
  24. package/build/main/methods.js +1 -1
  25. package/build/main/payloads.d.ts +8 -8
  26. package/build/main/payloads.js +0 -1
  27. package/build/main/services/common.d.ts +5 -4
  28. package/build/main/services/common.js +0 -1
  29. package/build/main/services/companies/entities.d.ts +7 -6
  30. package/build/main/services/companies/entities.js +0 -1
  31. package/build/main/services/companies/index.d.ts +7 -6
  32. package/build/main/services/companies/index.integration.test.js +2 -3
  33. package/build/main/services/companies/index.js +0 -1
  34. package/build/main/services/companies/index.unit.test.js +1 -2
  35. package/build/main/services/companies/methods.d.ts +4 -4
  36. package/build/main/services/companies/methods.js +0 -1
  37. package/build/main/services/contacts/entities.d.ts +4 -3
  38. package/build/main/services/contacts/entities.js +0 -1
  39. package/build/main/services/contacts/index.d.ts +7 -6
  40. package/build/main/services/contacts/index.integration.test.js +2 -3
  41. package/build/main/services/contacts/index.js +0 -1
  42. package/build/main/services/contacts/index.unit.test.js +1 -2
  43. package/build/main/services/contacts/methods.d.ts +4 -4
  44. package/build/main/services/contacts/methods.js +0 -1
  45. package/build/main/services/currencies/entities.d.ts +2 -2
  46. package/build/main/services/currencies/entities.js +0 -1
  47. package/build/main/services/deals/entities.d.ts +2 -2
  48. package/build/main/services/deals/entities.js +0 -1
  49. package/build/main/services/deals/index.d.ts +7 -6
  50. package/build/main/services/deals/index.integration.test.js +2 -3
  51. package/build/main/services/deals/index.js +0 -1
  52. package/build/main/services/deals/index.unit.test.js +1 -2
  53. package/build/main/services/deals/methods.d.ts +4 -4
  54. package/build/main/services/deals/methods.js +0 -1
  55. package/build/main/services/leads/entities.d.ts +2 -2
  56. package/build/main/services/leads/entities.js +0 -1
  57. package/build/main/services/leads/index.d.ts +7 -6
  58. package/build/main/services/leads/index.integration.test.js +2 -3
  59. package/build/main/services/leads/index.js +0 -1
  60. package/build/main/services/leads/index.unit.test.js +1 -2
  61. package/build/main/services/leads/methods.d.ts +4 -4
  62. package/build/main/services/leads/methods.js +0 -1
  63. package/build/main/services/statuses/entities.d.ts +5 -4
  64. package/build/main/services/statuses/entities.js +0 -1
  65. package/build/main/services/statuses/index.d.ts +7 -11
  66. package/build/main/services/statuses/index.integration.test.js +8 -4
  67. package/build/main/services/statuses/index.js +0 -1
  68. package/build/main/services/statuses/index.unit.test.js +1 -2
  69. package/build/main/services/statuses/methods.d.ts +6 -6
  70. package/build/main/services/statuses/methods.js +0 -1
  71. package/build/main/services/users/entities.d.ts +4 -3
  72. package/build/main/services/users/entities.js +0 -1
  73. package/build/main/services/users/index.d.ts +3 -3
  74. package/build/main/services/users/index.integration.test.js +2 -3
  75. package/build/main/services/users/index.js +0 -1
  76. package/build/main/services/users/index.unit.test.js +1 -2
  77. package/build/main/services/users/methods.d.ts +4 -4
  78. package/build/main/services/users/methods.js +0 -1
  79. package/build/main/utils/Diff.js +0 -1
  80. package/build/main/utils/ExtractValue.d.ts +6 -1
  81. package/build/main/utils/ExtractValue.js +0 -1
  82. package/build/main/utils/isArray.d.ts +1 -1
  83. package/build/main/utils/isArray.js +1 -1
  84. package/build/module/bitrix.d.ts +25 -16
  85. package/build/module/bitrix.integration.test.js +0 -1
  86. package/build/module/bitrix.js +19 -3
  87. package/build/module/bitrix.unit.test.js +0 -1
  88. package/build/module/client/client.unit.test.js +9 -6
  89. package/build/module/client/hooks/addAccessToken.d.ts +5 -2
  90. package/build/module/client/hooks/addAccessToken.js +3 -1
  91. package/build/module/client/hooks/addAccessToken.unit.test.js +9 -8
  92. package/build/module/client/index.d.ts +10 -1
  93. package/build/module/client/index.js +19 -7
  94. package/build/module/client/methods/batch.d.ts +24 -5
  95. package/build/module/client/methods/batch.js +28 -3
  96. package/build/module/client/methods/batch.unit.test.js +61 -19
  97. package/build/module/client/methods/call.d.ts +11 -4
  98. package/build/module/client/methods/call.js +10 -3
  99. package/build/module/client/methods/call.unit.test.js +1 -2
  100. package/build/module/client/methods/list.d.ts +15 -3
  101. package/build/module/client/methods/list.js +21 -5
  102. package/build/module/client/methods/list.unit.test.js +0 -1
  103. package/build/module/commands.d.ts +2 -2
  104. package/build/module/commands.js +1 -1
  105. package/build/module/methods.d.ts +27 -8
  106. package/build/module/methods.js +0 -1
  107. package/build/module/payloads.d.ts +8 -8
  108. package/build/module/payloads.js +1 -1
  109. package/build/module/services/common.d.ts +5 -4
  110. package/build/module/services/common.js +1 -1
  111. package/build/module/services/companies/entities.d.ts +7 -6
  112. package/build/module/services/companies/entities.js +1 -1
  113. package/build/module/services/companies/index.d.ts +7 -6
  114. package/build/module/services/companies/index.integration.test.js +1 -2
  115. package/build/module/services/companies/index.js +0 -1
  116. package/build/module/services/companies/index.unit.test.js +0 -1
  117. package/build/module/services/companies/methods.d.ts +4 -4
  118. package/build/module/services/companies/methods.js +0 -1
  119. package/build/module/services/contacts/entities.d.ts +4 -3
  120. package/build/module/services/contacts/entities.js +1 -1
  121. package/build/module/services/contacts/index.d.ts +7 -6
  122. package/build/module/services/contacts/index.integration.test.js +1 -2
  123. package/build/module/services/contacts/index.js +0 -1
  124. package/build/module/services/contacts/index.unit.test.js +0 -1
  125. package/build/module/services/contacts/methods.d.ts +4 -4
  126. package/build/module/services/contacts/methods.js +0 -1
  127. package/build/module/services/currencies/entities.d.ts +2 -2
  128. package/build/module/services/currencies/entities.js +1 -1
  129. package/build/module/services/deals/entities.d.ts +2 -2
  130. package/build/module/services/deals/entities.js +1 -1
  131. package/build/module/services/deals/index.d.ts +7 -6
  132. package/build/module/services/deals/index.integration.test.js +1 -2
  133. package/build/module/services/deals/index.js +0 -1
  134. package/build/module/services/deals/index.unit.test.js +0 -1
  135. package/build/module/services/deals/methods.d.ts +4 -4
  136. package/build/module/services/deals/methods.js +0 -1
  137. package/build/module/services/leads/entities.d.ts +2 -2
  138. package/build/module/services/leads/entities.js +1 -1
  139. package/build/module/services/leads/index.d.ts +7 -6
  140. package/build/module/services/leads/index.integration.test.js +1 -2
  141. package/build/module/services/leads/index.js +0 -1
  142. package/build/module/services/leads/index.unit.test.js +0 -1
  143. package/build/module/services/leads/methods.d.ts +4 -4
  144. package/build/module/services/leads/methods.js +0 -1
  145. package/build/module/services/statuses/entities.d.ts +5 -4
  146. package/build/module/services/statuses/entities.js +1 -1
  147. package/build/module/services/statuses/index.d.ts +7 -11
  148. package/build/module/services/statuses/index.integration.test.js +7 -3
  149. package/build/module/services/statuses/index.js +0 -1
  150. package/build/module/services/statuses/index.unit.test.js +0 -1
  151. package/build/module/services/statuses/methods.d.ts +6 -6
  152. package/build/module/services/statuses/methods.js +0 -1
  153. package/build/module/services/users/entities.d.ts +4 -3
  154. package/build/module/services/users/entities.js +1 -1
  155. package/build/module/services/users/index.d.ts +3 -3
  156. package/build/module/services/users/index.integration.test.js +1 -2
  157. package/build/module/services/users/index.js +0 -1
  158. package/build/module/services/users/index.unit.test.js +0 -1
  159. package/build/module/services/users/methods.d.ts +4 -4
  160. package/build/module/services/users/methods.js +0 -1
  161. package/build/module/utils/Diff.js +1 -1
  162. package/build/module/utils/ExtractValue.d.ts +6 -1
  163. package/build/module/utils/ExtractValue.js +1 -1
  164. package/build/module/utils/isArray.d.ts +1 -1
  165. package/build/module/utils/isArray.js +1 -1
  166. package/package.json +64 -60
  167. package/build/main/bitrix.integration.test.js.map +0 -1
  168. package/build/main/bitrix.js.map +0 -1
  169. package/build/main/bitrix.unit.test.js.map +0 -1
  170. package/build/main/client/client.unit.test.js.map +0 -1
  171. package/build/main/client/hooks/addAccessToken.js.map +0 -1
  172. package/build/main/client/hooks/addAccessToken.unit.test.js.map +0 -1
  173. package/build/main/client/index.js.map +0 -1
  174. package/build/main/client/methods/batch.js.map +0 -1
  175. package/build/main/client/methods/batch.unit.test.js.map +0 -1
  176. package/build/main/client/methods/call.js.map +0 -1
  177. package/build/main/client/methods/call.unit.test.js.map +0 -1
  178. package/build/main/client/methods/list.js.map +0 -1
  179. package/build/main/client/methods/list.unit.test.js.map +0 -1
  180. package/build/main/commands.js.map +0 -1
  181. package/build/main/methods.js.map +0 -1
  182. package/build/main/payloads.js.map +0 -1
  183. package/build/main/services/common.js.map +0 -1
  184. package/build/main/services/companies/entities.js.map +0 -1
  185. package/build/main/services/companies/index.integration.test.js.map +0 -1
  186. package/build/main/services/companies/index.js.map +0 -1
  187. package/build/main/services/companies/index.unit.test.js.map +0 -1
  188. package/build/main/services/companies/methods.js.map +0 -1
  189. package/build/main/services/contacts/entities.js.map +0 -1
  190. package/build/main/services/contacts/index.integration.test.js.map +0 -1
  191. package/build/main/services/contacts/index.js.map +0 -1
  192. package/build/main/services/contacts/index.unit.test.js.map +0 -1
  193. package/build/main/services/contacts/methods.js.map +0 -1
  194. package/build/main/services/currencies/entities.js.map +0 -1
  195. package/build/main/services/deals/entities.js.map +0 -1
  196. package/build/main/services/deals/index.integration.test.js.map +0 -1
  197. package/build/main/services/deals/index.js.map +0 -1
  198. package/build/main/services/deals/index.unit.test.js.map +0 -1
  199. package/build/main/services/deals/methods.js.map +0 -1
  200. package/build/main/services/leads/entities.js.map +0 -1
  201. package/build/main/services/leads/index.integration.test.js.map +0 -1
  202. package/build/main/services/leads/index.js.map +0 -1
  203. package/build/main/services/leads/index.unit.test.js.map +0 -1
  204. package/build/main/services/leads/methods.js.map +0 -1
  205. package/build/main/services/statuses/entities.js.map +0 -1
  206. package/build/main/services/statuses/index.integration.test.js.map +0 -1
  207. package/build/main/services/statuses/index.js.map +0 -1
  208. package/build/main/services/statuses/index.unit.test.js.map +0 -1
  209. package/build/main/services/statuses/methods.js.map +0 -1
  210. package/build/main/services/users/entities.js.map +0 -1
  211. package/build/main/services/users/index.integration.test.js.map +0 -1
  212. package/build/main/services/users/index.js.map +0 -1
  213. package/build/main/services/users/index.unit.test.js.map +0 -1
  214. package/build/main/services/users/methods.js.map +0 -1
  215. package/build/main/utils/Diff.js.map +0 -1
  216. package/build/main/utils/ExtractValue.js.map +0 -1
  217. package/build/main/utils/isArray.js.map +0 -1
  218. package/build/module/bitrix.integration.test.js.map +0 -1
  219. package/build/module/bitrix.js.map +0 -1
  220. package/build/module/bitrix.unit.test.js.map +0 -1
  221. package/build/module/client/client.unit.test.js.map +0 -1
  222. package/build/module/client/hooks/addAccessToken.js.map +0 -1
  223. package/build/module/client/hooks/addAccessToken.unit.test.js.map +0 -1
  224. package/build/module/client/index.js.map +0 -1
  225. package/build/module/client/methods/batch.js.map +0 -1
  226. package/build/module/client/methods/batch.unit.test.js.map +0 -1
  227. package/build/module/client/methods/call.js.map +0 -1
  228. package/build/module/client/methods/call.unit.test.js.map +0 -1
  229. package/build/module/client/methods/list.js.map +0 -1
  230. package/build/module/client/methods/list.unit.test.js.map +0 -1
  231. package/build/module/commands.js.map +0 -1
  232. package/build/module/methods.js.map +0 -1
  233. package/build/module/payloads.js.map +0 -1
  234. package/build/module/services/common.js.map +0 -1
  235. package/build/module/services/companies/entities.js.map +0 -1
  236. package/build/module/services/companies/index.integration.test.js.map +0 -1
  237. package/build/module/services/companies/index.js.map +0 -1
  238. package/build/module/services/companies/index.unit.test.js.map +0 -1
  239. package/build/module/services/companies/methods.js.map +0 -1
  240. package/build/module/services/contacts/entities.js.map +0 -1
  241. package/build/module/services/contacts/index.integration.test.js.map +0 -1
  242. package/build/module/services/contacts/index.js.map +0 -1
  243. package/build/module/services/contacts/index.unit.test.js.map +0 -1
  244. package/build/module/services/contacts/methods.js.map +0 -1
  245. package/build/module/services/currencies/entities.js.map +0 -1
  246. package/build/module/services/deals/entities.js.map +0 -1
  247. package/build/module/services/deals/index.integration.test.js.map +0 -1
  248. package/build/module/services/deals/index.js.map +0 -1
  249. package/build/module/services/deals/index.unit.test.js.map +0 -1
  250. package/build/module/services/deals/methods.js.map +0 -1
  251. package/build/module/services/leads/entities.js.map +0 -1
  252. package/build/module/services/leads/index.integration.test.js.map +0 -1
  253. package/build/module/services/leads/index.js.map +0 -1
  254. package/build/module/services/leads/index.unit.test.js.map +0 -1
  255. package/build/module/services/leads/methods.js.map +0 -1
  256. package/build/module/services/statuses/entities.js.map +0 -1
  257. package/build/module/services/statuses/index.integration.test.js.map +0 -1
  258. package/build/module/services/statuses/index.js.map +0 -1
  259. package/build/module/services/statuses/index.unit.test.js.map +0 -1
  260. package/build/module/services/statuses/methods.js.map +0 -1
  261. package/build/module/services/users/entities.js.map +0 -1
  262. package/build/module/services/users/index.integration.test.js.map +0 -1
  263. package/build/module/services/users/index.js.map +0 -1
  264. package/build/module/services/users/index.unit.test.js.map +0 -1
  265. package/build/module/services/users/methods.js.map +0 -1
  266. package/build/module/utils/Diff.js.map +0 -1
  267. package/build/module/utils/ExtractValue.js.map +0 -1
  268. package/build/module/utils/isArray.js.map +0 -1
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
2
2
  import { GetPayload, ListPayload } from '../../payloads';
3
3
  import { Fields } from '../common';
4
4
  import { Company } from './entities';
5
- export interface CompaniesMethods {
5
+ export declare type CompaniesMethods = {
6
6
  readonly [Method.CRM_COMPANY_FIELDS]: {
7
7
  readonly type: Company;
8
8
  readonly payload: GetPayload<Fields>;
9
- readonly params?: {};
9
+ readonly params?: Record<string, unknown>;
10
10
  };
11
11
  readonly [Method.CRM_COMPANY_ADD]: {
12
12
  readonly type: Company;
@@ -35,10 +35,10 @@ export interface CompaniesMethods {
35
35
  readonly payload: GetPayload<boolean>;
36
36
  readonly params: {
37
37
  readonly id: string;
38
- readonly fields: Record<string, any>;
38
+ readonly fields: Record<string, unknown>;
39
39
  readonly params?: {
40
40
  readonly REGISTER_SONET_EVENT: 'Y' | 'N';
41
41
  };
42
42
  };
43
43
  };
44
- }
44
+ };
@@ -1,2 +1 @@
1
1
  import { Method } from '../../methods';
2
- //# sourceMappingURL=methods.js.map
@@ -1,5 +1,6 @@
1
- import { BoolString, ISODate, NumberString } from '../common';
2
- export interface Contact {
1
+ import { BoolString, ISODate, MultiFieldArray, NumberString } from '../common';
2
+ export declare type Contact = {
3
+ readonly [key: string]: MultiFieldArray | string | null;
3
4
  readonly ID: NumberString;
4
5
  readonly POST: string | null;
5
6
  readonly COMMENTS: string | null;
@@ -41,4 +42,4 @@ export interface Contact {
41
42
  readonly UTM_CAMPAIGN: string | null;
42
43
  readonly UTM_CONTENT: string | null;
43
44
  readonly UTM_TERM: string | null;
44
- }
45
+ };
@@ -1 +1 @@
1
- //# sourceMappingURL=entities.js.map
1
+ export {};
@@ -1,24 +1,25 @@
1
1
  import { Call } from '../../client/methods/call';
2
2
  import { List } from '../../client/methods/list';
3
- interface Dependencies {
3
+ import { Method, MethodParams } from '../../methods';
4
+ declare type Dependencies = {
4
5
  readonly call: Call;
5
6
  readonly list: List;
6
- }
7
+ };
7
8
  declare const _default: ({ call, list }: Dependencies) => {
8
9
  fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
9
10
  create: <D extends {
10
11
  readonly fields: Partial<import("./entities").Contact>;
11
12
  readonly params?: {
12
- readonly REGISTER_SONET_EVENT: import("../common").BoolString;
13
+ readonly REGISTER_SONET_EVENT: "Y" | "N";
13
14
  } | undefined;
14
15
  }>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
15
16
  get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Contact>>;
16
- list: (params?: import("../../methods").ListParams) => Promise<import("../../payloads").ListPayload<import("./entities").Contact>>;
17
+ list: (params?: MethodParams<Method.CRM_CONTACT_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Contact>>;
17
18
  update: <D_1 extends {
18
19
  readonly id: string;
19
- readonly fields: Record<string, any>;
20
+ readonly fields: Record<string, unknown>;
20
21
  readonly params?: {
21
- readonly REGISTER_SONET_EVENT: import("../common").BoolString;
22
+ readonly REGISTER_SONET_EVENT: "Y" | "N";
22
23
  } | undefined;
23
24
  }>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
24
25
  };
@@ -1,5 +1,5 @@
1
1
  import Bitrix from './../../bitrix';
2
- const WEBHOOK_URL = process.env.WEBHOOK_URL;
2
+ const WEBHOOK_URL = process.env['WEBHOOK_URL'];
3
3
  if (!WEBHOOK_URL) {
4
4
  throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
5
5
  }
@@ -12,4 +12,3 @@ describe('Contacts', () => {
12
12
  });
13
13
  });
14
14
  });
15
- //# sourceMappingURL=index.integration.test.js.map
@@ -6,4 +6,3 @@ export default ({ call, list }) => ({
6
6
  list: (params = {}) => list(Method.CRM_CONTACT_LIST, params),
7
7
  update: (id, fields, params) => call(Method.CRM_CONTACT_UPDATE, { id, fields, params })
8
8
  });
9
- //# sourceMappingURL=index.js.map
@@ -65,4 +65,3 @@ describe('Contacts', () => {
65
65
  });
66
66
  });
67
67
  });
68
- //# sourceMappingURL=index.unit.test.js.map
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
2
2
  import { GetPayload, ListPayload } from '../../payloads';
3
3
  import { Fields } from '../common';
4
4
  import { Contact } from './entities';
5
- export interface ContactsMethods {
5
+ export declare type ContactsMethods = {
6
6
  readonly [Method.CRM_CONTACT_FIELDS]: {
7
7
  readonly type: Contact;
8
8
  readonly payload: GetPayload<Fields>;
9
- readonly params?: {};
9
+ readonly params?: Record<string, unknown>;
10
10
  };
11
11
  readonly [Method.CRM_CONTACT_ADD]: {
12
12
  readonly type: Contact;
@@ -35,10 +35,10 @@ export interface ContactsMethods {
35
35
  readonly payload: GetPayload<boolean>;
36
36
  readonly params: {
37
37
  readonly id: string;
38
- readonly fields: Record<string, any>;
38
+ readonly fields: Record<string, unknown>;
39
39
  readonly params?: {
40
40
  readonly REGISTER_SONET_EVENT: 'Y' | 'N';
41
41
  };
42
42
  };
43
43
  };
44
- }
44
+ };
@@ -1,2 +1 @@
1
1
  import { Method } from '../../methods';
2
- //# sourceMappingURL=methods.js.map
@@ -1,5 +1,5 @@
1
1
  import { BoolString, ISODate, NumberString } from '../common';
2
- export interface Currency {
2
+ export declare type Currency = {
3
3
  readonly CURRENCY: string;
4
4
  readonly AMOUNT_CNT: NumberString;
5
5
  readonly AMOUNT: NumberString;
@@ -12,4 +12,4 @@ export interface Currency {
12
12
  readonly THOUSANDS_SEP: string;
13
13
  readonly DECIMALS: NumberString;
14
14
  readonly DATE_UPDATE: ISODate;
15
- }
15
+ };
@@ -1 +1 @@
1
- //# sourceMappingURL=entities.js.map
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { BoolString, ISODate, NumberString } from '../common';
2
- export interface Deal {
2
+ export declare type Deal = {
3
3
  readonly [key: string]: string | null;
4
4
  readonly ID: NumberString;
5
5
  readonly TITLE: string;
@@ -40,4 +40,4 @@ export interface Deal {
40
40
  readonly UTM_CAMPAIGN: string | null;
41
41
  readonly UTM_CONTENT: string | null;
42
42
  readonly UTM_TERM: string | null;
43
- }
43
+ };
@@ -1 +1 @@
1
- //# sourceMappingURL=entities.js.map
1
+ export {};
@@ -1,24 +1,25 @@
1
1
  import { Call } from '../../client/methods/call';
2
2
  import { List } from '../../client/methods/list';
3
- interface Dependencies {
3
+ import { Method, MethodParams } from '../../methods';
4
+ declare type Dependencies = {
4
5
  readonly call: Call;
5
6
  readonly list: List;
6
- }
7
+ };
7
8
  declare const _default: ({ call, list }: Dependencies) => {
8
9
  fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
9
10
  create: <D extends {
10
11
  readonly fields: Partial<import("./entities").Deal>;
11
12
  readonly params?: {
12
- readonly REGISTER_SONET_EVENT: import("../common").BoolString;
13
+ readonly REGISTER_SONET_EVENT: "Y" | "N";
13
14
  } | undefined;
14
15
  }>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
15
16
  get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Deal>>;
16
- list: (params?: import("../../methods").ListParams) => Promise<import("../../payloads").ListPayload<import("./entities").Deal>>;
17
+ list: (params?: MethodParams<Method.CRM_DEAL_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Deal>>;
17
18
  update: <D_1 extends {
18
19
  readonly id: string;
19
- readonly fields: Record<string, any>;
20
+ readonly fields: Record<string, unknown>;
20
21
  readonly params?: {
21
- readonly REGISTER_SONET_EVENT: import("../common").BoolString;
22
+ readonly REGISTER_SONET_EVENT: "Y" | "N";
22
23
  } | undefined;
23
24
  }>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
24
25
  };
@@ -1,5 +1,5 @@
1
1
  import Bitrix from './../../bitrix';
2
- const WEBHOOK_URL = process.env.WEBHOOK_URL;
2
+ const WEBHOOK_URL = process.env['WEBHOOK_URL'];
3
3
  if (!WEBHOOK_URL) {
4
4
  throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
5
5
  }
@@ -12,4 +12,3 @@ describe('Deals', () => {
12
12
  });
13
13
  });
14
14
  });
15
- //# sourceMappingURL=index.integration.test.js.map
@@ -6,4 +6,3 @@ export default ({ call, list }) => ({
6
6
  list: (params = {}) => list(Method.CRM_DEAL_LIST, params),
7
7
  update: (id, fields, params) => call(Method.CRM_DEAL_UPDATE, { id, fields, params })
8
8
  });
9
- //# sourceMappingURL=index.js.map
@@ -65,4 +65,3 @@ describe('Deals', () => {
65
65
  });
66
66
  });
67
67
  });
68
- //# sourceMappingURL=index.unit.test.js.map
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
2
2
  import { GetPayload, ListPayload } from '../../payloads';
3
3
  import { Fields } from '../common';
4
4
  import { Deal } from './entities';
5
- export interface DealsMethods {
5
+ export declare type DealsMethods = {
6
6
  readonly [Method.CRM_DEAL_FIELDS]: {
7
7
  readonly type: Deal;
8
8
  readonly payload: GetPayload<Fields>;
9
- readonly params?: {};
9
+ readonly params?: Record<string, unknown>;
10
10
  };
11
11
  readonly [Method.CRM_DEAL_ADD]: {
12
12
  readonly type: Deal;
@@ -35,10 +35,10 @@ export interface DealsMethods {
35
35
  readonly payload: GetPayload<boolean>;
36
36
  readonly params: {
37
37
  readonly id: string;
38
- readonly fields: Record<string, any>;
38
+ readonly fields: Record<string, unknown>;
39
39
  readonly params?: {
40
40
  readonly REGISTER_SONET_EVENT: 'Y' | 'N';
41
41
  };
42
42
  };
43
43
  };
44
- }
44
+ };
@@ -1,2 +1 @@
1
1
  import { Method } from '../../methods';
2
- //# sourceMappingURL=methods.js.map
@@ -1,5 +1,5 @@
1
1
  import { BoolString, ISODate, NumberString } from '../common';
2
- export interface Lead {
2
+ export declare type Lead = {
3
3
  readonly [key: string]: string | null;
4
4
  readonly ID: NumberString;
5
5
  readonly TITLE: string;
@@ -46,4 +46,4 @@ export interface Lead {
46
46
  readonly UTM_CAMPAIGN: string | null;
47
47
  readonly UTM_CONTENT: string | null;
48
48
  readonly UTM_TERM: string | null;
49
- }
49
+ };
@@ -1 +1 @@
1
- //# sourceMappingURL=entities.js.map
1
+ export {};
@@ -1,24 +1,25 @@
1
1
  import { Call } from '../../client/methods/call';
2
2
  import { List } from '../../client/methods/list';
3
- interface Dependencies {
3
+ import { Method, MethodParams } from '../../methods';
4
+ declare type Dependencies = {
4
5
  readonly call: Call;
5
6
  readonly list: List;
6
- }
7
+ };
7
8
  declare const _default: ({ call, list }: Dependencies) => {
8
9
  fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
9
10
  create: <D extends {
10
11
  readonly fields: Partial<import("./entities").Lead>;
11
12
  readonly params?: {
12
- readonly REGISTER_SONET_EVENT: import("../common").BoolString;
13
+ readonly REGISTER_SONET_EVENT: "Y" | "N";
13
14
  } | undefined;
14
15
  }>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
15
16
  get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Lead>>;
16
- list: (params?: import("../../methods").ListParams) => Promise<import("../../payloads").ListPayload<import("./entities").Lead>>;
17
+ list: (params?: MethodParams<Method.CRM_LEAD_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Lead>>;
17
18
  update: <D_1 extends {
18
19
  readonly id: string;
19
- readonly fields: Record<string, any>;
20
+ readonly fields: Record<string, unknown>;
20
21
  readonly params?: {
21
- readonly REGISTER_SONET_EVENT: import("../common").BoolString;
22
+ readonly REGISTER_SONET_EVENT: "Y" | "N";
22
23
  } | undefined;
23
24
  }>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
24
25
  };
@@ -1,5 +1,5 @@
1
1
  import Bitrix from './../../bitrix';
2
- const WEBHOOK_URL = process.env.WEBHOOK_URL;
2
+ const WEBHOOK_URL = process.env['WEBHOOK_URL'];
3
3
  if (!WEBHOOK_URL) {
4
4
  throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
5
5
  }
@@ -12,4 +12,3 @@ describe('Leads', () => {
12
12
  });
13
13
  });
14
14
  });
15
- //# sourceMappingURL=index.integration.test.js.map
@@ -6,4 +6,3 @@ export default ({ call, list }) => ({
6
6
  list: (params = {}) => list(Method.CRM_LEAD_LIST, params),
7
7
  update: (id, fields, params) => call(Method.CRM_LEAD_UPDATE, { id, fields, params })
8
8
  });
9
- //# sourceMappingURL=index.js.map
@@ -65,4 +65,3 @@ describe('Leads', () => {
65
65
  });
66
66
  });
67
67
  });
68
- //# sourceMappingURL=index.unit.test.js.map
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
2
2
  import { GetPayload, ListPayload } from '../../payloads';
3
3
  import { Fields } from '../common';
4
4
  import { Lead } from './entities';
5
- export interface LeadsMethods {
5
+ export declare type LeadsMethods = {
6
6
  readonly [Method.CRM_LEAD_FIELDS]: {
7
7
  readonly type: Lead;
8
8
  readonly payload: GetPayload<Fields>;
9
- readonly params?: {};
9
+ readonly params?: Record<string, unknown>;
10
10
  };
11
11
  readonly [Method.CRM_LEAD_ADD]: {
12
12
  readonly type: Lead;
@@ -35,10 +35,10 @@ export interface LeadsMethods {
35
35
  readonly payload: GetPayload<boolean>;
36
36
  readonly params: {
37
37
  readonly id: string;
38
- readonly fields: Record<string, any>;
38
+ readonly fields: Record<string, unknown>;
39
39
  readonly params?: {
40
40
  readonly REGISTER_SONET_EVENT: 'Y' | 'N';
41
41
  };
42
42
  };
43
43
  };
44
- }
44
+ };
@@ -1,2 +1 @@
1
1
  import { Method } from '../../methods';
2
- //# sourceMappingURL=methods.js.map
@@ -1,9 +1,10 @@
1
1
  import { BoolString, NumberString } from '../common';
2
- export interface Extra {
2
+ export declare type Extra = {
3
3
  readonly SEMANTICS: string;
4
4
  readonly COLOR: string;
5
- }
6
- export interface Status {
5
+ };
6
+ export declare type Status = {
7
+ readonly [key: string]: string | Extra | undefined;
7
8
  readonly ID: NumberString;
8
9
  readonly ENTITY_ID: string;
9
10
  readonly STATUS_ID: NumberString;
@@ -12,4 +13,4 @@ export interface Status {
12
13
  readonly SORT: NumberString;
13
14
  readonly SYSTEM: BoolString;
14
15
  readonly EXTRA: Extra | undefined;
15
- }
16
+ };
@@ -1 +1 @@
1
- //# sourceMappingURL=entities.js.map
1
+ export {};
@@ -1,18 +1,14 @@
1
1
  import { Call } from '../../client/methods/call';
2
- interface Dependencies {
2
+ import { Method, MethodParams } from '../../methods';
3
+ declare type Dependencies = {
3
4
  readonly call: Call;
4
- }
5
+ };
5
6
  declare const _default: ({ call }: Dependencies) => {
6
7
  fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
7
- create: (fields: Partial<import("./entities").Status>) => Promise<import("../../payloads").GetPayload<number>>;
8
- delete: (id: string | number, params?: {
9
- readonly FORCED?: "Y" | "N" | undefined;
10
- } | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
8
+ create: (fields: MethodParams<Method.CRM_STATUS_ADD>['fields']) => Promise<import("../../payloads").GetPayload<number>>;
9
+ delete: (id: string | number, params?: MethodParams<Method.CRM_STATUS_DELETE>['params']) => Promise<import("../../payloads").GetPayload<boolean>>;
11
10
  get: (id: string | number) => Promise<import("../../payloads").GetPayload<import("./entities").Status>>;
12
- list: (params?: {
13
- readonly order?: Record<string, any> | undefined;
14
- readonly filter?: Record<string, any> | undefined;
15
- }) => Promise<import("../../payloads").ListPayload<import("./entities").Status>>;
16
- update: (id: string | number, fields: Record<string, any>) => Promise<import("../../payloads").GetPayload<boolean>>;
11
+ list: (params?: MethodParams<Method.CRM_STATUS_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Status>>;
12
+ update: (id: string | number, fields: MethodParams<Method.CRM_STATUS_UPDATE>['fields']) => Promise<import("../../payloads").GetPayload<boolean>>;
17
13
  };
18
14
  export default _default;
@@ -1,7 +1,9 @@
1
1
  import Bitrix from '../../bitrix';
2
+ // @ts-ignore this should be improved in a future but it works for now
2
3
  const isSortedAsc = (arr) => arr.slice(1).every((v, i) => arr[i] <= v);
4
+ // @ts-ignore this should be improved in a future but it works for now
3
5
  const isSortedDesc = (arr) => arr.slice(1).every((v, i) => arr[i] >= v);
4
- const WEBHOOK_URL = process.env.WEBHOOK_URL;
6
+ const WEBHOOK_URL = process.env['WEBHOOK_URL'];
5
7
  if (!WEBHOOK_URL) {
6
8
  throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
7
9
  }
@@ -69,7 +71,10 @@ describe('Statuses', () => {
69
71
  const STATUS_ID = 101;
70
72
  const { result: status } = await statuses.get(STATUS_ID);
71
73
  expect(status).toMatchSnapshot();
72
- const { result: updateResult } = await statuses.update(STATUS_ID, { ...status, NAME: 'CHANGED' });
74
+ const { result: updateResult } = await statuses.update(STATUS_ID, {
75
+ ...status,
76
+ NAME: 'CHANGED'
77
+ });
73
78
  expect(updateResult).toBeTruthy();
74
79
  const { result: updatedStatus } = await statuses.get(STATUS_ID);
75
80
  expect(updatedStatus).toMatchSnapshot();
@@ -78,4 +83,3 @@ describe('Statuses', () => {
78
83
  });
79
84
  });
80
85
  });
81
- //# sourceMappingURL=index.integration.test.js.map
@@ -7,4 +7,3 @@ export default ({ call }) => ({
7
7
  list: (params = {}) => call(Method.CRM_STATUS_LIST, params),
8
8
  update: (id, fields) => call(Method.CRM_STATUS_UPDATE, { id, fields })
9
9
  });
10
- //# sourceMappingURL=index.js.map
@@ -53,4 +53,3 @@ describe('Statuses', () => {
53
53
  });
54
54
  });
55
55
  });
56
- //# sourceMappingURL=index.unit.test.js.map
@@ -2,11 +2,11 @@ import { Method } from '../../methods';
2
2
  import { GetPayload, ListPayload } from '../../payloads';
3
3
  import { Fields } from '../common';
4
4
  import { Status } from './entities';
5
- export interface StatusesMethods {
5
+ export declare type StatusesMethods = {
6
6
  readonly [Method.CRM_STATUS_FIELDS]: {
7
7
  readonly type: Status;
8
8
  readonly payload: GetPayload<Fields>;
9
- readonly params?: {};
9
+ readonly params?: Record<string, unknown>;
10
10
  };
11
11
  readonly [Method.CRM_STATUS_ADD]: {
12
12
  readonly type: Status;
@@ -36,8 +36,8 @@ export interface StatusesMethods {
36
36
  readonly type: Status;
37
37
  readonly payload: ListPayload<Status>;
38
38
  readonly params: {
39
- readonly order?: Record<string, any>;
40
- readonly filter?: Record<string, any>;
39
+ readonly order?: Record<string, unknown>;
40
+ readonly filter?: Record<string, unknown>;
41
41
  };
42
42
  };
43
43
  readonly [Method.CRM_STATUS_UPDATE]: {
@@ -45,7 +45,7 @@ export interface StatusesMethods {
45
45
  readonly payload: GetPayload<boolean>;
46
46
  readonly params: {
47
47
  readonly id: string | number;
48
- readonly fields: Record<string, any>;
48
+ readonly fields: Record<string, unknown>;
49
49
  };
50
50
  };
51
- }
51
+ };
@@ -1,2 +1 @@
1
1
  import { Method } from '../../methods';
2
- //# sourceMappingURL=methods.js.map
@@ -1,5 +1,6 @@
1
1
  import { GenderString, ISODate, NumberString } from '../common';
2
- export interface User {
2
+ export declare type User = {
3
+ readonly [key: string]: string | boolean | null | readonly number[];
3
4
  readonly ID: NumberString;
4
5
  readonly ACTIVE: boolean;
5
6
  readonly EMAIL: string | null;
@@ -24,7 +25,7 @@ export interface User {
24
25
  readonly WORK_COMPANY: string | null;
25
26
  readonly WORK_POSITION: string | null;
26
27
  readonly WORK_PHONE: string | null;
27
- readonly UF_DEPARTMENT: ReadonlyArray<number>;
28
+ readonly UF_DEPARTMENT: readonly number[];
28
29
  readonly UF_INTERESTS: string | null;
29
30
  readonly UF_SKILLS: string | null;
30
31
  readonly UF_WEB_SITES: string | null;
@@ -36,4 +37,4 @@ export interface User {
36
37
  readonly UF_DISTRICT: string | null;
37
38
  readonly UF_PHONE_INNER: NumberString | null;
38
39
  readonly USER_TYPE: 'employee';
39
- }
40
+ };
@@ -1 +1 @@
1
- //# sourceMappingURL=entities.js.map
1
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { Call } from '../../client/methods/call';
2
- interface Dependencies {
2
+ declare type Dependencies = {
3
3
  readonly call: Call;
4
- }
4
+ };
5
5
  declare const _default: ({ call }: Dependencies) => {
6
6
  fields: () => Promise<import("../../payloads").GetPayload<import("./entities").User>>;
7
- get: (id?: string | undefined) => Promise<import("../../payloads").GetPayload<readonly import("./entities").User[]>>;
7
+ get: (id?: string) => Promise<import("../../payloads").GetPayload<readonly import("./entities").User[]>>;
8
8
  };
9
9
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import Bitrix from './../../bitrix';
2
- const WEBHOOK_URL = process.env.WEBHOOK_URL;
2
+ const WEBHOOK_URL = process.env['WEBHOOK_URL'];
3
3
  if (!WEBHOOK_URL) {
4
4
  throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
5
5
  }
@@ -26,4 +26,3 @@ describe('Users', () => {
26
26
  });
27
27
  });
28
28
  });
29
- //# sourceMappingURL=index.integration.test.js.map
@@ -3,4 +3,3 @@ export default ({ call }) => ({
3
3
  fields: () => call(Method.USER_FIELDS, {}),
4
4
  get: (id) => call(Method.USER_GET, { id })
5
5
  });
6
- //# sourceMappingURL=index.js.map
@@ -18,4 +18,3 @@ describe('Users', () => {
18
18
  });
19
19
  });
20
20
  });
21
- //# sourceMappingURL=index.unit.test.js.map
@@ -1,17 +1,17 @@
1
1
  import { Method } from '../../methods';
2
2
  import { GetPayload } from '../../payloads';
3
3
  import { User } from './entities';
4
- export interface UsersMethods {
4
+ export declare type UsersMethods = {
5
5
  readonly [Method.USER_FIELDS]: {
6
6
  readonly type: User;
7
7
  readonly payload: GetPayload<User>;
8
- readonly params?: {};
8
+ readonly params?: Record<string, unknown>;
9
9
  };
10
10
  readonly [Method.USER_GET]: {
11
11
  readonly type: User;
12
- readonly payload: GetPayload<ReadonlyArray<User>>;
12
+ readonly payload: GetPayload<readonly User[]>;
13
13
  readonly params: {
14
14
  readonly id?: string;
15
15
  };
16
16
  };
17
- }
17
+ };
@@ -1,2 +1 @@
1
1
  import { Method } from '../../methods';
2
- //# sourceMappingURL=methods.js.map
@@ -1 +1 @@
1
- //# sourceMappingURL=Diff.js.map
1
+ export {};
@@ -1 +1,6 @@
1
- export declare type ExtractValue<MAP extends Record<string, any>, KEY extends string | number | symbol, MAPKEY extends keyof MAP = KEY extends keyof MAP ? KEY : never> = MAP[MAPKEY];
1
+ /**
2
+ * Extract value from the `MAP` following the `KEY`
3
+ * It works with `enum` as a `KEY` when matched against dict as `enum` values as a keys,
4
+ * which justifies whole existence of that helper.
5
+ */
6
+ export declare type ExtractValue<MAP extends Record<string, unknown>, KEY extends string | number | symbol, MAPKEY extends keyof MAP = KEY extends keyof MAP ? KEY : never> = MAP[MAPKEY];
@@ -1 +1 @@
1
- //# sourceMappingURL=ExtractValue.js.map
1
+ export {};
@@ -1,2 +1,2 @@
1
- declare const _default: <E>(x: any) => x is readonly E[];
1
+ declare const _default: <E>(x: unknown) => x is readonly E[];
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
+ // Because `Array.isArray` itself give a strange result with `any[]`
1
2
  export default (x) => Array.isArray(x);
2
- //# sourceMappingURL=isArray.js.map