@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.
- package/README.md +1 -2
- package/build/bitrix.d.ts +65 -0
- package/build/bitrix.js +55 -0
- package/build/client/hooks/addAccessToken.js +9 -0
- package/build/{module/client → client}/index.d.ts +3 -3
- package/build/{module/client → client}/index.js +21 -16
- package/build/{module/client → client}/methods/batch.d.ts +6 -6
- package/build/client/methods/batch.js +75 -0
- package/build/{module/client → client}/methods/call.d.ts +4 -4
- package/build/{module/client → client}/methods/call.js +8 -9
- package/build/{module/client → client}/methods/list.d.ts +10 -10
- package/build/client/methods/list.js +58 -0
- package/build/{module/commands.d.ts → commands.d.ts} +3 -3
- package/build/commands.js +1 -0
- package/build/{module/methods.d.ts → methods.d.ts} +19 -19
- package/build/{module/methods.js → methods.js} +5 -5
- package/build/{main/payloads.d.ts → payloads.d.ts} +5 -5
- package/build/payloads.js +1 -0
- package/build/{main/services → services}/common.d.ts +7 -7
- package/build/services/common.js +2 -0
- package/build/{main/services → services}/companies/entities.d.ts +2 -2
- package/build/services/companies/entities.js +1 -0
- package/build/services/companies/index.d.ts +15 -0
- package/build/services/companies/index.js +17 -0
- package/build/{module/services → services}/companies/methods.d.ts +5 -5
- package/build/services/companies/methods.js +1 -0
- package/build/{module/services → services}/contacts/entities.d.ts +2 -2
- package/build/services/contacts/entities.js +1 -0
- package/build/services/contacts/index.d.ts +15 -0
- package/build/services/contacts/index.js +17 -0
- package/build/{module/services → services}/contacts/methods.d.ts +5 -5
- package/build/services/contacts/methods.js +1 -0
- package/build/{module/services → services}/currencies/entities.d.ts +2 -2
- package/build/services/currencies/entities.js +1 -0
- package/build/{module/services → services}/deals/entities.d.ts +2 -2
- package/build/services/deals/entities.js +1 -0
- package/build/services/deals/index.d.ts +15 -0
- package/build/services/deals/index.js +17 -0
- package/build/{main/services → services}/deals/methods.d.ts +5 -5
- package/build/services/deals/methods.js +1 -0
- package/build/{module/services → services}/leads/entities.d.ts +2 -2
- package/build/services/leads/entities.js +1 -0
- package/build/services/leads/index.d.ts +15 -0
- package/build/services/leads/index.js +17 -0
- package/build/{main/services → services}/leads/methods.d.ts +5 -5
- package/build/services/leads/methods.js +1 -0
- package/build/{main/services → services}/statuses/entities.d.ts +3 -3
- package/build/services/statuses/entities.js +1 -0
- package/build/services/statuses/index.d.ts +14 -0
- package/build/services/statuses/index.js +19 -0
- package/build/{main/services → services}/statuses/methods.d.ts +5 -5
- package/build/services/statuses/methods.js +1 -0
- package/build/{module/services → services}/users/entities.d.ts +2 -2
- package/build/services/users/entities.js +1 -0
- package/build/services/users/index.d.ts +9 -0
- package/build/services/users/index.js +7 -0
- package/build/{main/services → services}/users/methods.d.ts +4 -4
- package/build/services/users/methods.js +1 -0
- package/build/utils/Diff.d.ts +1 -0
- package/build/utils/Diff.js +7 -0
- package/build/{module/utils → utils}/ExtractValue.d.ts +1 -1
- package/build/{main/utils/ExtractValue.d.ts → utils/ExtractValue.js} +1 -2
- package/build/utils/isArray.d.ts +2 -0
- package/build/{module/utils → utils}/isArray.js +1 -1
- package/package.json +43 -49
- package/build/main/bitrix.d.ts +0 -114
- package/build/main/bitrix.integration.test.d.ts +0 -0
- package/build/main/bitrix.integration.test.js +0 -31
- package/build/main/bitrix.js +0 -61
- package/build/main/bitrix.unit.test.d.ts +0 -1
- package/build/main/bitrix.unit.test.js +0 -44
- package/build/main/client/client.unit.test.d.ts +0 -1
- package/build/main/client/client.unit.test.js +0 -70
- package/build/main/client/hooks/addAccessToken.js +0 -13
- package/build/main/client/hooks/addAccessToken.unit.test.d.ts +0 -1
- package/build/main/client/hooks/addAccessToken.unit.test.js +0 -31
- package/build/main/client/index.d.ts +0 -15
- package/build/main/client/index.js +0 -53
- package/build/main/client/methods/batch.d.ts +0 -40
- package/build/main/client/methods/batch.js +0 -85
- package/build/main/client/methods/batch.unit.test.d.ts +0 -1
- package/build/main/client/methods/batch.unit.test.js +0 -494
- package/build/main/client/methods/call.d.ts +0 -17
- package/build/main/client/methods/call.js +0 -36
- package/build/main/client/methods/call.unit.test.d.ts +0 -1
- package/build/main/client/methods/call.unit.test.js +0 -183
- package/build/main/client/methods/list.d.ts +0 -30
- package/build/main/client/methods/list.js +0 -66
- package/build/main/client/methods/list.unit.test.d.ts +0 -1
- package/build/main/client/methods/list.unit.test.js +0 -277
- package/build/main/commands.d.ts +0 -10
- package/build/main/commands.js +0 -2
- package/build/main/methods.d.ts +0 -92
- package/build/main/methods.js +0 -41
- package/build/main/payloads.js +0 -2
- package/build/main/services/common.js +0 -2
- package/build/main/services/companies/entities.js +0 -2
- package/build/main/services/companies/index.d.ts +0 -26
- package/build/main/services/companies/index.integration.test.d.ts +0 -1
- package/build/main/services/companies/index.integration.test.js +0 -19
- package/build/main/services/companies/index.js +0 -10
- package/build/main/services/companies/index.unit.test.d.ts +0 -1
- package/build/main/services/companies/index.unit.test.js +0 -72
- package/build/main/services/companies/methods.d.ts +0 -44
- package/build/main/services/companies/methods.js +0 -3
- package/build/main/services/contacts/entities.d.ts +0 -45
- package/build/main/services/contacts/entities.js +0 -2
- package/build/main/services/contacts/index.d.ts +0 -26
- package/build/main/services/contacts/index.integration.test.d.ts +0 -1
- package/build/main/services/contacts/index.integration.test.js +0 -19
- package/build/main/services/contacts/index.js +0 -10
- package/build/main/services/contacts/index.unit.test.d.ts +0 -1
- package/build/main/services/contacts/index.unit.test.js +0 -72
- package/build/main/services/contacts/methods.d.ts +0 -44
- package/build/main/services/contacts/methods.js +0 -3
- package/build/main/services/currencies/entities.d.ts +0 -15
- package/build/main/services/currencies/entities.js +0 -2
- package/build/main/services/deals/entities.d.ts +0 -43
- package/build/main/services/deals/entities.js +0 -2
- package/build/main/services/deals/index.d.ts +0 -26
- package/build/main/services/deals/index.integration.test.d.ts +0 -1
- package/build/main/services/deals/index.integration.test.js +0 -19
- package/build/main/services/deals/index.js +0 -10
- package/build/main/services/deals/index.unit.test.d.ts +0 -1
- package/build/main/services/deals/index.unit.test.js +0 -72
- package/build/main/services/deals/methods.js +0 -3
- package/build/main/services/leads/entities.d.ts +0 -49
- package/build/main/services/leads/entities.js +0 -2
- package/build/main/services/leads/index.d.ts +0 -26
- package/build/main/services/leads/index.integration.test.d.ts +0 -1
- package/build/main/services/leads/index.integration.test.js +0 -19
- package/build/main/services/leads/index.js +0 -10
- package/build/main/services/leads/index.unit.test.d.ts +0 -1
- package/build/main/services/leads/index.unit.test.js +0 -72
- package/build/main/services/leads/methods.js +0 -3
- package/build/main/services/statuses/entities.js +0 -2
- package/build/main/services/statuses/index.d.ts +0 -14
- package/build/main/services/statuses/index.integration.test.d.ts +0 -1
- package/build/main/services/statuses/index.integration.test.js +0 -90
- package/build/main/services/statuses/index.js +0 -11
- package/build/main/services/statuses/index.unit.test.d.ts +0 -1
- package/build/main/services/statuses/index.unit.test.js +0 -60
- package/build/main/services/statuses/methods.js +0 -3
- package/build/main/services/users/entities.d.ts +0 -40
- package/build/main/services/users/entities.js +0 -2
- package/build/main/services/users/index.d.ts +0 -9
- package/build/main/services/users/index.integration.test.d.ts +0 -1
- package/build/main/services/users/index.integration.test.js +0 -33
- package/build/main/services/users/index.js +0 -7
- package/build/main/services/users/index.unit.test.d.ts +0 -1
- package/build/main/services/users/index.unit.test.js +0 -25
- package/build/main/services/users/methods.js +0 -3
- package/build/main/utils/Diff.d.ts +0 -1
- package/build/main/utils/Diff.js +0 -2
- package/build/main/utils/ExtractValue.js +0 -2
- package/build/main/utils/isArray.d.ts +0 -2
- package/build/main/utils/isArray.js +0 -4
- package/build/module/bitrix.d.ts +0 -114
- package/build/module/bitrix.integration.test.d.ts +0 -0
- package/build/module/bitrix.integration.test.js +0 -31
- package/build/module/bitrix.js +0 -40
- package/build/module/bitrix.unit.test.d.ts +0 -1
- package/build/module/bitrix.unit.test.js +0 -16
- package/build/module/client/client.unit.test.d.ts +0 -1
- package/build/module/client/client.unit.test.js +0 -65
- package/build/module/client/hooks/addAccessToken.d.ts +0 -6
- package/build/module/client/hooks/addAccessToken.js +0 -11
- package/build/module/client/hooks/addAccessToken.unit.test.d.ts +0 -1
- package/build/module/client/hooks/addAccessToken.unit.test.js +0 -26
- package/build/module/client/methods/batch.js +0 -76
- package/build/module/client/methods/batch.unit.test.d.ts +0 -1
- package/build/module/client/methods/batch.unit.test.js +0 -466
- package/build/module/client/methods/call.unit.test.d.ts +0 -1
- package/build/module/client/methods/call.unit.test.js +0 -155
- package/build/module/client/methods/list.js +0 -55
- package/build/module/client/methods/list.unit.test.d.ts +0 -1
- package/build/module/client/methods/list.unit.test.js +0 -252
- package/build/module/commands.js +0 -1
- package/build/module/payloads.d.ts +0 -40
- package/build/module/payloads.js +0 -1
- package/build/module/services/common.d.ts +0 -22
- package/build/module/services/common.js +0 -1
- package/build/module/services/companies/entities.d.ts +0 -54
- package/build/module/services/companies/entities.js +0 -1
- package/build/module/services/companies/index.d.ts +0 -26
- package/build/module/services/companies/index.integration.test.d.ts +0 -1
- package/build/module/services/companies/index.integration.test.js +0 -14
- package/build/module/services/companies/index.js +0 -8
- package/build/module/services/companies/index.unit.test.d.ts +0 -1
- package/build/module/services/companies/index.unit.test.js +0 -67
- package/build/module/services/companies/methods.js +0 -1
- package/build/module/services/contacts/entities.js +0 -1
- package/build/module/services/contacts/index.d.ts +0 -26
- package/build/module/services/contacts/index.integration.test.d.ts +0 -1
- package/build/module/services/contacts/index.integration.test.js +0 -14
- package/build/module/services/contacts/index.js +0 -8
- package/build/module/services/contacts/index.unit.test.d.ts +0 -1
- package/build/module/services/contacts/index.unit.test.js +0 -67
- package/build/module/services/contacts/methods.js +0 -1
- package/build/module/services/currencies/entities.js +0 -1
- package/build/module/services/deals/entities.js +0 -1
- package/build/module/services/deals/index.d.ts +0 -26
- package/build/module/services/deals/index.integration.test.d.ts +0 -1
- package/build/module/services/deals/index.integration.test.js +0 -14
- package/build/module/services/deals/index.js +0 -8
- package/build/module/services/deals/index.unit.test.d.ts +0 -1
- package/build/module/services/deals/index.unit.test.js +0 -67
- package/build/module/services/deals/methods.d.ts +0 -44
- package/build/module/services/deals/methods.js +0 -1
- package/build/module/services/leads/entities.js +0 -1
- package/build/module/services/leads/index.d.ts +0 -26
- package/build/module/services/leads/index.integration.test.d.ts +0 -1
- package/build/module/services/leads/index.integration.test.js +0 -14
- package/build/module/services/leads/index.js +0 -8
- package/build/module/services/leads/index.unit.test.d.ts +0 -1
- package/build/module/services/leads/index.unit.test.js +0 -67
- package/build/module/services/leads/methods.d.ts +0 -44
- package/build/module/services/leads/methods.js +0 -1
- package/build/module/services/statuses/entities.d.ts +0 -16
- package/build/module/services/statuses/entities.js +0 -1
- package/build/module/services/statuses/index.d.ts +0 -14
- package/build/module/services/statuses/index.integration.test.d.ts +0 -1
- package/build/module/services/statuses/index.integration.test.js +0 -85
- package/build/module/services/statuses/index.js +0 -9
- package/build/module/services/statuses/index.unit.test.d.ts +0 -1
- package/build/module/services/statuses/index.unit.test.js +0 -55
- package/build/module/services/statuses/methods.d.ts +0 -51
- package/build/module/services/statuses/methods.js +0 -1
- package/build/module/services/users/entities.js +0 -1
- package/build/module/services/users/index.d.ts +0 -9
- package/build/module/services/users/index.integration.test.d.ts +0 -1
- package/build/module/services/users/index.integration.test.js +0 -28
- package/build/module/services/users/index.js +0 -5
- package/build/module/services/users/index.unit.test.d.ts +0 -1
- package/build/module/services/users/index.unit.test.js +0 -20
- package/build/module/services/users/methods.d.ts +0 -17
- package/build/module/services/users/methods.js +0 -1
- package/build/module/utils/Diff.d.ts +0 -1
- package/build/module/utils/Diff.js +0 -1
- package/build/module/utils/ExtractValue.js +0 -1
- package/build/module/utils/isArray.d.ts +0 -2
- /package/build/{main/client → client}/hooks/addAccessToken.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
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
|
|
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
|
|
22
|
+
export type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BoolString, ISODate, MultiField, NumberString } from '../common';
|
|
2
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Method } from '../../methods';
|
|
2
|
-
import { GetPayload } from '../../payloads';
|
|
3
|
-
import { User } from './entities';
|
|
4
|
-
export
|
|
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;
|
|
@@ -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
|
|
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 { };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Because `Array.isArray` itself give a strange result with `any[]`
|
|
2
|
-
export default (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": "
|
|
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
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"typings": "build/
|
|
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
|
-
"
|
|
34
|
-
"build
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"preversion": "run-s
|
|
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.
|
|
70
|
-
"@types/lodash.frompairs": "4.0.
|
|
71
|
-
"@types/lodash.range": "3.2.
|
|
72
|
-
"@types/qs": "6.9.
|
|
73
|
-
"got": "
|
|
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": "
|
|
78
|
-
"qs": "6.
|
|
63
|
+
"p-queue": "8.0.1",
|
|
64
|
+
"qs": "6.12.3"
|
|
79
65
|
},
|
|
80
66
|
"devDependencies": {
|
|
81
|
-
"@2bad/tsconfig": "
|
|
82
|
-
"@
|
|
83
|
-
"@
|
|
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.
|
|
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
|
-
"
|
|
94
|
-
"nock": "13.2.9",
|
|
81
|
+
"nock": "13.5.4",
|
|
95
82
|
"npm-run-all": "4.1.5",
|
|
96
|
-
"rimraf": "
|
|
97
|
-
"
|
|
98
|
-
"typescript": "
|
|
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": "
|
|
94
|
+
"node": "22.5.0",
|
|
95
|
+
"npm": "10.8.2"
|
|
102
96
|
}
|
|
103
97
|
}
|