@2bad/bitrix 2.5.1 → 3.0.0-beta.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 (242) hide show
  1. package/README.md +1 -2
  2. package/build/bitrix.d.ts +65 -0
  3. package/build/bitrix.js +55 -0
  4. package/build/client/hooks/addAccessToken.js +9 -0
  5. package/build/{module/client → client}/index.d.ts +3 -3
  6. package/build/{module/client → client}/index.js +21 -16
  7. package/build/{module/client → client}/methods/batch.d.ts +6 -6
  8. package/build/client/methods/batch.js +75 -0
  9. package/build/{module/client → client}/methods/call.d.ts +4 -4
  10. package/build/{module/client → client}/methods/call.js +8 -9
  11. package/build/{module/client → client}/methods/list.d.ts +10 -10
  12. package/build/client/methods/list.js +58 -0
  13. package/build/{module/commands.d.ts → commands.d.ts} +3 -3
  14. package/build/commands.js +1 -0
  15. package/build/{module/methods.d.ts → methods.d.ts} +19 -19
  16. package/build/{module/methods.js → methods.js} +5 -5
  17. package/build/{main/payloads.d.ts → payloads.d.ts} +5 -5
  18. package/build/payloads.js +1 -0
  19. package/build/{main/services → services}/common.d.ts +7 -7
  20. package/build/services/common.js +2 -0
  21. package/build/{main/services → services}/companies/entities.d.ts +2 -2
  22. package/build/services/companies/entities.js +1 -0
  23. package/build/services/companies/index.d.ts +15 -0
  24. package/build/services/companies/index.js +17 -0
  25. package/build/{module/services → services}/companies/methods.d.ts +5 -5
  26. package/build/services/companies/methods.js +1 -0
  27. package/build/{module/services → services}/contacts/entities.d.ts +2 -2
  28. package/build/services/contacts/entities.js +1 -0
  29. package/build/services/contacts/index.d.ts +15 -0
  30. package/build/services/contacts/index.js +17 -0
  31. package/build/{module/services → services}/contacts/methods.d.ts +5 -5
  32. package/build/services/contacts/methods.js +1 -0
  33. package/build/{module/services → services}/currencies/entities.d.ts +2 -2
  34. package/build/services/currencies/entities.js +1 -0
  35. package/build/{module/services → services}/deals/entities.d.ts +2 -2
  36. package/build/services/deals/entities.js +1 -0
  37. package/build/services/deals/index.d.ts +15 -0
  38. package/build/services/deals/index.js +17 -0
  39. package/build/{main/services → services}/deals/methods.d.ts +5 -5
  40. package/build/services/deals/methods.js +1 -0
  41. package/build/{module/services → services}/leads/entities.d.ts +2 -2
  42. package/build/services/leads/entities.js +1 -0
  43. package/build/services/leads/index.d.ts +15 -0
  44. package/build/services/leads/index.js +17 -0
  45. package/build/{main/services → services}/leads/methods.d.ts +5 -5
  46. package/build/services/leads/methods.js +1 -0
  47. package/build/{main/services → services}/statuses/entities.d.ts +3 -3
  48. package/build/services/statuses/entities.js +1 -0
  49. package/build/services/statuses/index.d.ts +14 -0
  50. package/build/services/statuses/index.js +19 -0
  51. package/build/{main/services → services}/statuses/methods.d.ts +5 -5
  52. package/build/services/statuses/methods.js +1 -0
  53. package/build/{module/services → services}/users/entities.d.ts +2 -2
  54. package/build/services/users/entities.js +1 -0
  55. package/build/services/users/index.d.ts +9 -0
  56. package/build/services/users/index.js +7 -0
  57. package/build/{main/services → services}/users/methods.d.ts +4 -4
  58. package/build/services/users/methods.js +1 -0
  59. package/build/utils/Diff.d.ts +1 -0
  60. package/build/utils/Diff.js +7 -0
  61. package/build/{module/utils → utils}/ExtractValue.d.ts +1 -1
  62. package/build/{main/utils/ExtractValue.d.ts → utils/ExtractValue.js} +1 -2
  63. package/build/utils/isArray.d.ts +2 -0
  64. package/build/{module/utils → utils}/isArray.js +1 -1
  65. package/package.json +43 -49
  66. package/build/main/bitrix.d.ts +0 -114
  67. package/build/main/bitrix.integration.test.d.ts +0 -0
  68. package/build/main/bitrix.integration.test.js +0 -31
  69. package/build/main/bitrix.js +0 -61
  70. package/build/main/bitrix.unit.test.d.ts +0 -1
  71. package/build/main/bitrix.unit.test.js +0 -44
  72. package/build/main/client/client.unit.test.d.ts +0 -1
  73. package/build/main/client/client.unit.test.js +0 -70
  74. package/build/main/client/hooks/addAccessToken.js +0 -13
  75. package/build/main/client/hooks/addAccessToken.unit.test.d.ts +0 -1
  76. package/build/main/client/hooks/addAccessToken.unit.test.js +0 -31
  77. package/build/main/client/index.d.ts +0 -15
  78. package/build/main/client/index.js +0 -53
  79. package/build/main/client/methods/batch.d.ts +0 -40
  80. package/build/main/client/methods/batch.js +0 -85
  81. package/build/main/client/methods/batch.unit.test.d.ts +0 -1
  82. package/build/main/client/methods/batch.unit.test.js +0 -494
  83. package/build/main/client/methods/call.d.ts +0 -17
  84. package/build/main/client/methods/call.js +0 -36
  85. package/build/main/client/methods/call.unit.test.d.ts +0 -1
  86. package/build/main/client/methods/call.unit.test.js +0 -183
  87. package/build/main/client/methods/list.d.ts +0 -30
  88. package/build/main/client/methods/list.js +0 -66
  89. package/build/main/client/methods/list.unit.test.d.ts +0 -1
  90. package/build/main/client/methods/list.unit.test.js +0 -277
  91. package/build/main/commands.d.ts +0 -10
  92. package/build/main/commands.js +0 -2
  93. package/build/main/methods.d.ts +0 -92
  94. package/build/main/methods.js +0 -41
  95. package/build/main/payloads.js +0 -2
  96. package/build/main/services/common.js +0 -2
  97. package/build/main/services/companies/entities.js +0 -2
  98. package/build/main/services/companies/index.d.ts +0 -26
  99. package/build/main/services/companies/index.integration.test.d.ts +0 -1
  100. package/build/main/services/companies/index.integration.test.js +0 -19
  101. package/build/main/services/companies/index.js +0 -10
  102. package/build/main/services/companies/index.unit.test.d.ts +0 -1
  103. package/build/main/services/companies/index.unit.test.js +0 -72
  104. package/build/main/services/companies/methods.d.ts +0 -44
  105. package/build/main/services/companies/methods.js +0 -3
  106. package/build/main/services/contacts/entities.d.ts +0 -45
  107. package/build/main/services/contacts/entities.js +0 -2
  108. package/build/main/services/contacts/index.d.ts +0 -26
  109. package/build/main/services/contacts/index.integration.test.d.ts +0 -1
  110. package/build/main/services/contacts/index.integration.test.js +0 -19
  111. package/build/main/services/contacts/index.js +0 -10
  112. package/build/main/services/contacts/index.unit.test.d.ts +0 -1
  113. package/build/main/services/contacts/index.unit.test.js +0 -72
  114. package/build/main/services/contacts/methods.d.ts +0 -44
  115. package/build/main/services/contacts/methods.js +0 -3
  116. package/build/main/services/currencies/entities.d.ts +0 -15
  117. package/build/main/services/currencies/entities.js +0 -2
  118. package/build/main/services/deals/entities.d.ts +0 -43
  119. package/build/main/services/deals/entities.js +0 -2
  120. package/build/main/services/deals/index.d.ts +0 -26
  121. package/build/main/services/deals/index.integration.test.d.ts +0 -1
  122. package/build/main/services/deals/index.integration.test.js +0 -19
  123. package/build/main/services/deals/index.js +0 -10
  124. package/build/main/services/deals/index.unit.test.d.ts +0 -1
  125. package/build/main/services/deals/index.unit.test.js +0 -72
  126. package/build/main/services/deals/methods.js +0 -3
  127. package/build/main/services/leads/entities.d.ts +0 -49
  128. package/build/main/services/leads/entities.js +0 -2
  129. package/build/main/services/leads/index.d.ts +0 -26
  130. package/build/main/services/leads/index.integration.test.d.ts +0 -1
  131. package/build/main/services/leads/index.integration.test.js +0 -19
  132. package/build/main/services/leads/index.js +0 -10
  133. package/build/main/services/leads/index.unit.test.d.ts +0 -1
  134. package/build/main/services/leads/index.unit.test.js +0 -72
  135. package/build/main/services/leads/methods.js +0 -3
  136. package/build/main/services/statuses/entities.js +0 -2
  137. package/build/main/services/statuses/index.d.ts +0 -14
  138. package/build/main/services/statuses/index.integration.test.d.ts +0 -1
  139. package/build/main/services/statuses/index.integration.test.js +0 -90
  140. package/build/main/services/statuses/index.js +0 -11
  141. package/build/main/services/statuses/index.unit.test.d.ts +0 -1
  142. package/build/main/services/statuses/index.unit.test.js +0 -60
  143. package/build/main/services/statuses/methods.js +0 -3
  144. package/build/main/services/users/entities.d.ts +0 -40
  145. package/build/main/services/users/entities.js +0 -2
  146. package/build/main/services/users/index.d.ts +0 -9
  147. package/build/main/services/users/index.integration.test.d.ts +0 -1
  148. package/build/main/services/users/index.integration.test.js +0 -33
  149. package/build/main/services/users/index.js +0 -7
  150. package/build/main/services/users/index.unit.test.d.ts +0 -1
  151. package/build/main/services/users/index.unit.test.js +0 -25
  152. package/build/main/services/users/methods.js +0 -3
  153. package/build/main/utils/Diff.d.ts +0 -1
  154. package/build/main/utils/Diff.js +0 -2
  155. package/build/main/utils/ExtractValue.js +0 -2
  156. package/build/main/utils/isArray.d.ts +0 -2
  157. package/build/main/utils/isArray.js +0 -4
  158. package/build/module/bitrix.d.ts +0 -114
  159. package/build/module/bitrix.integration.test.d.ts +0 -0
  160. package/build/module/bitrix.integration.test.js +0 -31
  161. package/build/module/bitrix.js +0 -40
  162. package/build/module/bitrix.unit.test.d.ts +0 -1
  163. package/build/module/bitrix.unit.test.js +0 -16
  164. package/build/module/client/client.unit.test.d.ts +0 -1
  165. package/build/module/client/client.unit.test.js +0 -65
  166. package/build/module/client/hooks/addAccessToken.d.ts +0 -6
  167. package/build/module/client/hooks/addAccessToken.js +0 -11
  168. package/build/module/client/hooks/addAccessToken.unit.test.d.ts +0 -1
  169. package/build/module/client/hooks/addAccessToken.unit.test.js +0 -26
  170. package/build/module/client/methods/batch.js +0 -76
  171. package/build/module/client/methods/batch.unit.test.d.ts +0 -1
  172. package/build/module/client/methods/batch.unit.test.js +0 -466
  173. package/build/module/client/methods/call.unit.test.d.ts +0 -1
  174. package/build/module/client/methods/call.unit.test.js +0 -155
  175. package/build/module/client/methods/list.js +0 -55
  176. package/build/module/client/methods/list.unit.test.d.ts +0 -1
  177. package/build/module/client/methods/list.unit.test.js +0 -252
  178. package/build/module/commands.js +0 -1
  179. package/build/module/payloads.d.ts +0 -40
  180. package/build/module/payloads.js +0 -1
  181. package/build/module/services/common.d.ts +0 -22
  182. package/build/module/services/common.js +0 -1
  183. package/build/module/services/companies/entities.d.ts +0 -54
  184. package/build/module/services/companies/entities.js +0 -1
  185. package/build/module/services/companies/index.d.ts +0 -26
  186. package/build/module/services/companies/index.integration.test.d.ts +0 -1
  187. package/build/module/services/companies/index.integration.test.js +0 -14
  188. package/build/module/services/companies/index.js +0 -8
  189. package/build/module/services/companies/index.unit.test.d.ts +0 -1
  190. package/build/module/services/companies/index.unit.test.js +0 -67
  191. package/build/module/services/companies/methods.js +0 -1
  192. package/build/module/services/contacts/entities.js +0 -1
  193. package/build/module/services/contacts/index.d.ts +0 -26
  194. package/build/module/services/contacts/index.integration.test.d.ts +0 -1
  195. package/build/module/services/contacts/index.integration.test.js +0 -14
  196. package/build/module/services/contacts/index.js +0 -8
  197. package/build/module/services/contacts/index.unit.test.d.ts +0 -1
  198. package/build/module/services/contacts/index.unit.test.js +0 -67
  199. package/build/module/services/contacts/methods.js +0 -1
  200. package/build/module/services/currencies/entities.js +0 -1
  201. package/build/module/services/deals/entities.js +0 -1
  202. package/build/module/services/deals/index.d.ts +0 -26
  203. package/build/module/services/deals/index.integration.test.d.ts +0 -1
  204. package/build/module/services/deals/index.integration.test.js +0 -14
  205. package/build/module/services/deals/index.js +0 -8
  206. package/build/module/services/deals/index.unit.test.d.ts +0 -1
  207. package/build/module/services/deals/index.unit.test.js +0 -67
  208. package/build/module/services/deals/methods.d.ts +0 -44
  209. package/build/module/services/deals/methods.js +0 -1
  210. package/build/module/services/leads/entities.js +0 -1
  211. package/build/module/services/leads/index.d.ts +0 -26
  212. package/build/module/services/leads/index.integration.test.d.ts +0 -1
  213. package/build/module/services/leads/index.integration.test.js +0 -14
  214. package/build/module/services/leads/index.js +0 -8
  215. package/build/module/services/leads/index.unit.test.d.ts +0 -1
  216. package/build/module/services/leads/index.unit.test.js +0 -67
  217. package/build/module/services/leads/methods.d.ts +0 -44
  218. package/build/module/services/leads/methods.js +0 -1
  219. package/build/module/services/statuses/entities.d.ts +0 -16
  220. package/build/module/services/statuses/entities.js +0 -1
  221. package/build/module/services/statuses/index.d.ts +0 -14
  222. package/build/module/services/statuses/index.integration.test.d.ts +0 -1
  223. package/build/module/services/statuses/index.integration.test.js +0 -85
  224. package/build/module/services/statuses/index.js +0 -9
  225. package/build/module/services/statuses/index.unit.test.d.ts +0 -1
  226. package/build/module/services/statuses/index.unit.test.js +0 -55
  227. package/build/module/services/statuses/methods.d.ts +0 -51
  228. package/build/module/services/statuses/methods.js +0 -1
  229. package/build/module/services/users/entities.js +0 -1
  230. package/build/module/services/users/index.d.ts +0 -9
  231. package/build/module/services/users/index.integration.test.d.ts +0 -1
  232. package/build/module/services/users/index.integration.test.js +0 -28
  233. package/build/module/services/users/index.js +0 -5
  234. package/build/module/services/users/index.unit.test.d.ts +0 -1
  235. package/build/module/services/users/index.unit.test.js +0 -20
  236. package/build/module/services/users/methods.d.ts +0 -17
  237. package/build/module/services/users/methods.js +0 -1
  238. package/build/module/utils/Diff.d.ts +0 -1
  239. package/build/module/utils/Diff.js +0 -1
  240. package/build/module/utils/ExtractValue.js +0 -1
  241. package/build/module/utils/isArray.d.ts +0 -2
  242. /package/build/{main/client → client}/hooks/addAccessToken.d.ts +0 -0
@@ -1,8 +1,8 @@
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 = {
1
+ export type NumberString = string;
2
+ export type ISODate = string;
3
+ export type BoolString = 'Y' | 'N';
4
+ export type GenderString = 'M' | 'F' | '';
5
+ export type Fields = {
6
6
  readonly [key: string]: {
7
7
  readonly type: string;
8
8
  readonly isRequired: boolean;
@@ -13,10 +13,10 @@ export declare type Fields = {
13
13
  readonly title: string;
14
14
  };
15
15
  };
16
- export declare type MultiField = {
16
+ export type MultiField = {
17
17
  readonly ID: NumberString;
18
18
  readonly VALUE_TYPE: string;
19
19
  readonly VALUE: string;
20
20
  readonly TYPE_ID: string;
21
21
  };
22
- export declare type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
22
+ export type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
@@ -0,0 +1,2 @@
1
+ // String which is actually a number, like `'20.23'`
2
+ export { };
@@ -1,5 +1,5 @@
1
- import { BoolString, ISODate, MultiField, NumberString } from '../common';
2
- export declare type Company = {
1
+ import { BoolString, ISODate, MultiField, NumberString } from '../common.js';
2
+ export type Company = {
3
3
  readonly [key: string]: string | boolean | null | readonly MultiField[];
4
4
  readonly ID: NumberString;
5
5
  readonly COMPANY_TYPE: string | null;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,15 @@
1
+ import { Call } from '../../client/methods/call.js';
2
+ import { List } from '../../client/methods/list.js';
3
+ import { Method, MethodParams } from '../../methods.js';
4
+ type Dependencies = {
5
+ readonly call: Call;
6
+ readonly list: List;
7
+ };
8
+ declare const _default: ({ call, list }: Dependencies) => {
9
+ fields: () => Promise<import("../../payloads.ts").GetPayload<import("../common.ts").Fields>>;
10
+ create: <D extends MethodParams<Method.CRM_COMPANY_ADD>>(fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<number>>;
11
+ get: (id: string) => Promise<import("../../payloads.ts").GetPayload<import("./entities.ts").Company>>;
12
+ list: (params?: MethodParams<Method.CRM_COMPANY_LIST>) => Promise<import("../../payloads.ts").ListPayload<import("./entities.ts").Company>>;
13
+ update: <D extends MethodParams<Method.CRM_COMPANY_UPDATE>>(id: string, fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<boolean>>;
14
+ };
15
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { Method } from "../../methods.js";
2
+ export default (({ call, list })=>({
3
+ fields: ()=>call(Method.CRM_COMPANY_FIELDS, {}),
4
+ create: (fields, params)=>call(Method.CRM_COMPANY_ADD, {
5
+ fields,
6
+ params
7
+ }),
8
+ get: (id)=>call(Method.CRM_COMPANY_GET, {
9
+ id
10
+ }),
11
+ list: (params = {})=>list(Method.CRM_COMPANY_LIST, params),
12
+ update: (id, fields, params)=>call(Method.CRM_COMPANY_UPDATE, {
13
+ id,
14
+ fields,
15
+ params
16
+ })
17
+ }));
@@ -1,8 +1,8 @@
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 = {
1
+ import { ListParams, Method } from '../../methods.js';
2
+ import { GetPayload, ListPayload } from '../../payloads.js';
3
+ import { Fields } from '../common.js';
4
+ import { Company } from './entities.js';
5
+ export type CompaniesMethods = {
6
6
  readonly [Method.CRM_COMPANY_FIELDS]: {
7
7
  readonly type: Company;
8
8
  readonly payload: GetPayload<Fields>;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,5 @@
1
- import { BoolString, ISODate, MultiFieldArray, NumberString } from '../common';
2
- export declare type Contact = {
1
+ import { BoolString, ISODate, MultiFieldArray, NumberString } from '../common.js';
2
+ export type Contact = {
3
3
  readonly [key: string]: MultiFieldArray | string | null;
4
4
  readonly ID: NumberString;
5
5
  readonly POST: string | null;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,15 @@
1
+ import { Call } from '../../client/methods/call.js';
2
+ import { List } from '../../client/methods/list.js';
3
+ import { Method, MethodParams } from '../../methods.js';
4
+ type Dependencies = {
5
+ readonly call: Call;
6
+ readonly list: List;
7
+ };
8
+ declare const _default: ({ call, list }: Dependencies) => {
9
+ fields: () => Promise<import("../../payloads.ts").GetPayload<import("../common.ts").Fields>>;
10
+ create: <D extends MethodParams<Method.CRM_CONTACT_ADD>>(fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<number>>;
11
+ get: (id: string) => Promise<import("../../payloads.ts").GetPayload<import("./entities.ts").Contact>>;
12
+ list: (params?: MethodParams<Method.CRM_CONTACT_LIST>) => Promise<import("../../payloads.ts").ListPayload<import("./entities.ts").Contact>>;
13
+ update: <D extends MethodParams<Method.CRM_CONTACT_UPDATE>>(id: string, fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<boolean>>;
14
+ };
15
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { Method } from "../../methods.js";
2
+ export default (({ call, list })=>({
3
+ fields: ()=>call(Method.CRM_CONTACT_FIELDS, {}),
4
+ create: (fields, params)=>call(Method.CRM_CONTACT_ADD, {
5
+ fields,
6
+ params
7
+ }),
8
+ get: (id)=>call(Method.CRM_CONTACT_GET, {
9
+ id
10
+ }),
11
+ list: (params = {})=>list(Method.CRM_CONTACT_LIST, params),
12
+ update: (id, fields, params)=>call(Method.CRM_CONTACT_UPDATE, {
13
+ id,
14
+ fields,
15
+ params
16
+ })
17
+ }));
@@ -1,8 +1,8 @@
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 = {
1
+ import { ListParams, Method } from '../../methods.js';
2
+ import { GetPayload, ListPayload } from '../../payloads.js';
3
+ import { Fields } from '../common.js';
4
+ import { Contact } from './entities.js';
5
+ export type ContactsMethods = {
6
6
  readonly [Method.CRM_CONTACT_FIELDS]: {
7
7
  readonly type: Contact;
8
8
  readonly payload: GetPayload<Fields>;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,5 @@
1
- import { BoolString, ISODate, NumberString } from '../common';
2
- export declare type Currency = {
1
+ import { BoolString, ISODate, NumberString } from '../common.js';
2
+ export type Currency = {
3
3
  readonly CURRENCY: string;
4
4
  readonly AMOUNT_CNT: NumberString;
5
5
  readonly AMOUNT: NumberString;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,5 @@
1
- import { BoolString, ISODate, NumberString } from '../common';
2
- export declare type Deal = {
1
+ import { BoolString, ISODate, NumberString } from '../common.js';
2
+ export type Deal = {
3
3
  readonly [key: string]: string | null;
4
4
  readonly ID: NumberString;
5
5
  readonly TITLE: string;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,15 @@
1
+ import { Call } from '../../client/methods/call.js';
2
+ import { List } from '../../client/methods/list.js';
3
+ import { Method, MethodParams } from '../../methods.js';
4
+ type Dependencies = {
5
+ readonly call: Call;
6
+ readonly list: List;
7
+ };
8
+ declare const _default: ({ call, list }: Dependencies) => {
9
+ fields: () => Promise<import("../../payloads.ts").GetPayload<import("../common.ts").Fields>>;
10
+ create: <D extends MethodParams<Method.CRM_DEAL_ADD>>(fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<number>>;
11
+ get: (id: string) => Promise<import("../../payloads.ts").GetPayload<import("./entities.ts").Deal>>;
12
+ list: (params?: MethodParams<Method.CRM_DEAL_LIST>) => Promise<import("../../payloads.ts").ListPayload<import("./entities.ts").Deal>>;
13
+ update: <D extends MethodParams<Method.CRM_DEAL_UPDATE>>(id: string, fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<boolean>>;
14
+ };
15
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { Method } from "../../methods.js";
2
+ export default (({ call, list })=>({
3
+ fields: ()=>call(Method.CRM_DEAL_FIELDS, {}),
4
+ create: (fields, params)=>call(Method.CRM_DEAL_ADD, {
5
+ fields,
6
+ params
7
+ }),
8
+ get: (id)=>call(Method.CRM_DEAL_GET, {
9
+ id
10
+ }),
11
+ list: (params = {})=>list(Method.CRM_DEAL_LIST, params),
12
+ update: (id, fields, params)=>call(Method.CRM_DEAL_UPDATE, {
13
+ id,
14
+ fields,
15
+ params
16
+ })
17
+ }));
@@ -1,8 +1,8 @@
1
- import { ListParams, Method } from '../../methods';
2
- import { GetPayload, ListPayload } from '../../payloads';
3
- import { Fields } from '../common';
4
- import { Deal } from './entities';
5
- export declare type DealsMethods = {
1
+ import { ListParams, Method } from '../../methods.js';
2
+ import { GetPayload, ListPayload } from '../../payloads.js';
3
+ import { Fields } from '../common.js';
4
+ import { Deal } from './entities.js';
5
+ export type DealsMethods = {
6
6
  readonly [Method.CRM_DEAL_FIELDS]: {
7
7
  readonly type: Deal;
8
8
  readonly payload: GetPayload<Fields>;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,5 @@
1
- import { BoolString, ISODate, NumberString } from '../common';
2
- export declare type Lead = {
1
+ import { BoolString, ISODate, NumberString } from '../common.js';
2
+ export type Lead = {
3
3
  readonly [key: string]: string | null;
4
4
  readonly ID: NumberString;
5
5
  readonly TITLE: string;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,15 @@
1
+ import { Call } from '../../client/methods/call.js';
2
+ import { List } from '../../client/methods/list.js';
3
+ import { Method, MethodParams } from '../../methods.js';
4
+ type Dependencies = {
5
+ readonly call: Call;
6
+ readonly list: List;
7
+ };
8
+ declare const _default: ({ call, list }: Dependencies) => {
9
+ fields: () => Promise<import("../../payloads.ts").GetPayload<import("../common.ts").Fields>>;
10
+ create: <D extends MethodParams<Method.CRM_LEAD_ADD>>(fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<number>>;
11
+ get: (id: string) => Promise<import("../../payloads.ts").GetPayload<import("./entities.ts").Lead>>;
12
+ list: (params?: MethodParams<Method.CRM_LEAD_LIST>) => Promise<import("../../payloads.ts").ListPayload<import("./entities.ts").Lead>>;
13
+ update: <D extends MethodParams<Method.CRM_LEAD_UPDATE>>(id: string, fields: D["fields"], params?: D["params"]) => Promise<import("../../payloads.ts").GetPayload<boolean>>;
14
+ };
15
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { Method } from "../../methods.js";
2
+ export default (({ call, list })=>({
3
+ fields: ()=>call(Method.CRM_LEAD_FIELDS, {}),
4
+ create: (fields, params)=>call(Method.CRM_LEAD_ADD, {
5
+ fields,
6
+ params
7
+ }),
8
+ get: (id)=>call(Method.CRM_LEAD_GET, {
9
+ id
10
+ }),
11
+ list: (params = {})=>list(Method.CRM_LEAD_LIST, params),
12
+ update: (id, fields, params)=>call(Method.CRM_LEAD_UPDATE, {
13
+ id,
14
+ fields,
15
+ params
16
+ })
17
+ }));
@@ -1,8 +1,8 @@
1
- import { ListParams, Method } from '../../methods';
2
- import { GetPayload, ListPayload } from '../../payloads';
3
- import { Fields } from '../common';
4
- import { Lead } from './entities';
5
- export declare type LeadsMethods = {
1
+ import { ListParams, Method } from '../../methods.js';
2
+ import { GetPayload, ListPayload } from '../../payloads.js';
3
+ import { Fields } from '../common.js';
4
+ import { Lead } from './entities.js';
5
+ export type LeadsMethods = {
6
6
  readonly [Method.CRM_LEAD_FIELDS]: {
7
7
  readonly type: Lead;
8
8
  readonly payload: GetPayload<Fields>;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,9 +1,9 @@
1
- import { BoolString, NumberString } from '../common';
2
- export declare type Extra = {
1
+ import { BoolString, NumberString } from '../common.js';
2
+ export type Extra = {
3
3
  readonly SEMANTICS: string;
4
4
  readonly COLOR: string;
5
5
  };
6
- export declare type Status = {
6
+ export type Status = {
7
7
  readonly [key: string]: string | Extra | undefined;
8
8
  readonly ID: NumberString;
9
9
  readonly ENTITY_ID: string;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { Call } from '../../client/methods/call.js';
2
+ import { Method, MethodParams } from '../../methods.js';
3
+ type Dependencies = {
4
+ readonly call: Call;
5
+ };
6
+ declare const _default: ({ call }: Dependencies) => {
7
+ fields: () => Promise<import("../../payloads.ts").GetPayload<import("../common.ts").Fields>>;
8
+ create: (fields: MethodParams<Method.CRM_STATUS_ADD>["fields"]) => Promise<import("../../payloads.ts").GetPayload<number>>;
9
+ delete: (id: string | number, params?: MethodParams<Method.CRM_STATUS_DELETE>["params"]) => Promise<import("../../payloads.ts").GetPayload<boolean>>;
10
+ get: (id: string | number) => Promise<import("../../payloads.ts").GetPayload<import("./entities.ts").Status>>;
11
+ list: (params?: MethodParams<Method.CRM_STATUS_LIST>) => Promise<import("../../payloads.ts").ListPayload<import("./entities.ts").Status>>;
12
+ update: (id: string | number, fields: MethodParams<Method.CRM_STATUS_UPDATE>["fields"]) => Promise<import("../../payloads.ts").GetPayload<boolean>>;
13
+ };
14
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { Method } from "../../methods.js";
2
+ export default (({ call })=>({
3
+ fields: ()=>call(Method.CRM_STATUS_FIELDS, {}),
4
+ create: (fields)=>call(Method.CRM_STATUS_ADD, {
5
+ fields
6
+ }),
7
+ delete: (id, params = {})=>call(Method.CRM_STATUS_DELETE, {
8
+ id,
9
+ params
10
+ }),
11
+ get: (id)=>call(Method.CRM_STATUS_GET, {
12
+ id
13
+ }),
14
+ list: (params = {})=>call(Method.CRM_STATUS_LIST, params),
15
+ update: (id, fields)=>call(Method.CRM_STATUS_UPDATE, {
16
+ id,
17
+ fields
18
+ })
19
+ }));
@@ -1,8 +1,8 @@
1
- import { Method } from '../../methods';
2
- import { GetPayload, ListPayload } from '../../payloads';
3
- import { Fields } from '../common';
4
- import { Status } from './entities';
5
- export declare type StatusesMethods = {
1
+ import { Method } from '../../methods.js';
2
+ import { GetPayload, ListPayload } from '../../payloads.js';
3
+ import { Fields } from '../common.js';
4
+ import { Status } from './entities.js';
5
+ export type StatusesMethods = {
6
6
  readonly [Method.CRM_STATUS_FIELDS]: {
7
7
  readonly type: Status;
8
8
  readonly payload: GetPayload<Fields>;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,5 @@
1
- import { GenderString, ISODate, NumberString } from '../common';
2
- export declare type User = {
1
+ import { GenderString, ISODate, NumberString } from '../common.js';
2
+ export type User = {
3
3
  readonly [key: string]: string | boolean | null | readonly number[];
4
4
  readonly ID: NumberString;
5
5
  readonly ACTIVE: boolean;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,9 @@
1
+ import { Call } from '../../client/methods/call.js';
2
+ type Dependencies = {
3
+ readonly call: Call;
4
+ };
5
+ declare const _default: ({ call }: Dependencies) => {
6
+ fields: () => Promise<import("../../payloads.ts").GetPayload<import("./entities.ts").User>>;
7
+ get: (id?: string) => Promise<import("../../payloads.ts").GetPayload<readonly import("./entities.ts").User[]>>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { Method } from "../../methods.js";
2
+ export default (({ call })=>({
3
+ fields: ()=>call(Method.USER_FIELDS, {}),
4
+ get: (id)=>call(Method.USER_GET, {
5
+ id
6
+ })
7
+ }));
@@ -1,7 +1,7 @@
1
- import { Method } from '../../methods';
2
- import { GetPayload } from '../../payloads';
3
- import { User } from './entities';
4
- export declare type UsersMethods = {
1
+ import { Method } from '../../methods.js';
2
+ import { GetPayload } from '../../payloads.js';
3
+ import { User } from './entities.js';
4
+ export type UsersMethods = {
5
5
  readonly [Method.USER_FIELDS]: {
6
6
  readonly type: User;
7
7
  readonly payload: GetPayload<User>;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export type Diff<T, U> = T extends U ? never : T;
@@ -0,0 +1,7 @@
1
+ // Remove types from T that are assignable to U
2
+ // ```
3
+ // type T = 'a' | 'b' | 'c' | 'd'
4
+ // type U = 'a' | 'c' | 'f'
5
+ // type Test = Diff<T, U> // Returns `'b' | 'd'`
6
+ // ```
7
+ export { };
@@ -3,4 +3,4 @@
3
3
  * It works with `enum` as a `KEY` when matched against dict as `enum` values as a keys,
4
4
  * which justifies whole existence of that helper.
5
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];
6
+ export type ExtractValue<MAP extends Record<string, unknown>, KEY extends string | number | symbol, MAPKEY extends keyof MAP = KEY extends keyof MAP ? KEY : never> = MAP[MAPKEY];
@@ -2,5 +2,4 @@
2
2
  * Extract value from the `MAP` following the `KEY`
3
3
  * It works with `enum` as a `KEY` when matched against dict as `enum` values as a keys,
4
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];
5
+ */ export { };
@@ -0,0 +1,2 @@
1
+ declare const _default: <E>(x: E | readonly E[] | unknown) => x is readonly E[];
2
+ export default _default;
@@ -1,2 +1,2 @@
1
1
  // Because `Array.isArray` itself give a strange result with `any[]`
2
- export default (x) => Array.isArray(x);
2
+ export default ((x)=>Array.isArray(x));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2bad/bitrix",
3
- "version": "2.5.1",
3
+ "version": "3.0.0-beta.0",
4
4
  "description": "Bitrix24 REST API client that doesn't suck",
5
5
  "keywords": [
6
6
  "api",
@@ -23,24 +23,27 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "author": "2BAD (https://github.com/2BAD)",
26
- "main": "build/main/bitrix.js",
27
- "module": "build/module/bitrix.js",
28
- "typings": "build/main/bitrix.d.ts",
26
+ "type": "module",
27
+ "exports": "./build/bitrix.js",
28
+ "typings": "./build/bitrix.d.ts",
29
29
  "files": [
30
30
  "build"
31
31
  ],
32
32
  "scripts": {
33
- "build": "run-s clean && run-p build:*",
34
- "build:main": "tsc --project tsconfig.main.json",
35
- "build:module": "tsc --project tsconfig.json",
36
- "clean": "rimraf build",
37
- "lint": "eslint . --ext .ts",
38
- "lint:fix": "run-s \"lint -- --fix\"",
39
- "prepublishOnly": "run-s clean build",
40
- "test": "jest --coverage",
41
- "test:integration": "jest integration --coverage",
42
- "test:unit": "jest unit --coverage",
43
- "preversion": "run-s clean lint test:unit build"
33
+ "prebuild": "rimraf build",
34
+ "build": "run-p build:*",
35
+ "postbuild": "run-s fix:alias",
36
+ "build:swc": "swc ./source -d ./build --strip-leading-paths",
37
+ "build:types": "tsc --project tsconfig.build.json",
38
+ "check": "run-p check:*",
39
+ "check:code": "eslint . --ext .ts --report-unused-disable-directives --max-warnings 0",
40
+ "fix:alias": "tsc-alias -p tsconfig.build.json",
41
+ "fix:code": "run-s 'check:code -- --fix'",
42
+ "prepublishOnly": "run-s build",
43
+ "preversion": "run-s check test:unit build",
44
+ "test": "vitest run",
45
+ "test:integration": "vitest run integration --coverage",
46
+ "test:unit": "vitest run unit --coverage"
44
47
  },
45
48
  "prettier": {
46
49
  "printWidth": 100,
@@ -48,56 +51,47 @@
48
51
  "singleQuote": true,
49
52
  "trailingComma": "none"
50
53
  },
51
- "jest": {
52
- "collectCoverageFrom": [
53
- "source/**/*.ts"
54
- ],
55
- "coverageDirectory": "coverage",
56
- "modulePathIgnorePatterns": [
57
- "<rootDir>/build/"
58
- ],
59
- "preset": "ts-jest",
60
- "setupFiles": [
61
- "dotenv/config"
62
- ],
63
- "testEnvironment": "node",
64
- "testMatch": [
65
- "**/?(*.)+(spec|test).[jt]s?(x)"
66
- ]
67
- },
68
54
  "dependencies": {
69
- "@types/lodash.chunk": "4.2.7",
70
- "@types/lodash.frompairs": "4.0.7",
71
- "@types/lodash.range": "3.2.7",
72
- "@types/qs": "6.9.7",
73
- "got": "11.8.2",
55
+ "@types/lodash.chunk": "4.2.9",
56
+ "@types/lodash.frompairs": "4.0.9",
57
+ "@types/lodash.range": "3.2.9",
58
+ "@types/qs": "6.9.15",
59
+ "got": "14.4.1",
74
60
  "lodash.chunk": "4.2.0",
75
61
  "lodash.frompairs": "4.0.1",
76
62
  "lodash.range": "3.2.0",
77
- "p-queue": "6.6.2",
78
- "qs": "6.11.0"
63
+ "p-queue": "8.0.1",
64
+ "qs": "6.12.3"
79
65
  },
80
66
  "devDependencies": {
81
- "@2bad/tsconfig": "1.4.0",
82
- "@types/jest": "26.0.23",
83
- "@types/node": "18.11.2",
67
+ "@2bad/tsconfig": "3.0.1",
68
+ "@swc/cli": "0.4.0",
69
+ "@swc/core": "1.7.0",
70
+ "@types/node": "20.14.11",
84
71
  "@typescript-eslint/eslint-plugin": "4.22.0",
72
+ "@vitest/coverage-v8": "2.0.3",
85
73
  "codecov": "3.8.2",
86
- "dotenv": "16.0.3",
74
+ "dotenv": "16.4.5",
87
75
  "eslint": "7.25.0",
88
76
  "eslint-config-standard-with-typescript": "20.0.0",
89
77
  "eslint-plugin-import": "2.22.1",
90
78
  "eslint-plugin-node": "11.1.0",
91
79
  "eslint-plugin-promise": "4.2.1",
92
80
  "eslint-plugin-standard": "4.1.0",
93
- "jest": "26.6.3",
94
- "nock": "13.2.9",
81
+ "nock": "13.5.4",
95
82
  "npm-run-all": "4.1.5",
96
- "rimraf": "3.0.2",
97
- "ts-jest": "26.5.5",
98
- "typescript": "4.8.4"
83
+ "rimraf": "6.0.1",
84
+ "tsc-alias": "1.8.10",
85
+ "typescript": "5.5.3",
86
+ "vite-tsconfig-paths": "4.3.2",
87
+ "vitest": "2.0.3"
88
+ },
89
+ "packageManager": "npm@10.8.2",
90
+ "engines": {
91
+ "node": ">=20"
99
92
  },
100
93
  "volta": {
101
- "node": "19.0.0"
94
+ "node": "22.5.0",
95
+ "npm": "10.8.2"
102
96
  }
103
97
  }