@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,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const _1 = __importDefault(require("."));
|
|
7
|
-
const mockCall = jest.fn(() => Promise.resolve());
|
|
8
|
-
const mockList = jest.fn(() => Promise.resolve());
|
|
9
|
-
const deals = (0, _1.default)({ call: mockCall, list: mockList });
|
|
10
|
-
const ID = '77';
|
|
11
|
-
describe('Deals', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
mockCall.mockClear();
|
|
14
|
-
mockList.mockClear();
|
|
15
|
-
});
|
|
16
|
-
it('should expose API methods', () => {
|
|
17
|
-
expect(deals).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
describe('`create`', () => {
|
|
20
|
-
it('should invoke `call`', async () => {
|
|
21
|
-
await deals.create({
|
|
22
|
-
COMMENTS: 'Some comment'
|
|
23
|
-
}, {
|
|
24
|
-
REGISTER_SONET_EVENT: 'Y'
|
|
25
|
-
});
|
|
26
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
it('should work without optional params', async () => {
|
|
29
|
-
await deals.create({
|
|
30
|
-
COMMENTS: 'Some comment'
|
|
31
|
-
});
|
|
32
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe('`get`', () => {
|
|
36
|
-
it('should invoke `call`', async () => {
|
|
37
|
-
await deals.get(ID);
|
|
38
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe('`list`', () => {
|
|
42
|
-
it('should invoke `list`', async () => {
|
|
43
|
-
await deals.list({
|
|
44
|
-
start: 0,
|
|
45
|
-
order: { COMMENTS: 'ASC' },
|
|
46
|
-
filter: { '>PROBABILITY': 50 },
|
|
47
|
-
select: ['*', 'UF_*']
|
|
48
|
-
});
|
|
49
|
-
expect(mockList.mock.calls).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
it('should work without optional params', async () => {
|
|
52
|
-
await deals.list();
|
|
53
|
-
expect(mockList.mock.calls).toMatchSnapshot();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe('`update`', () => {
|
|
57
|
-
it('should invoke `call`', async () => {
|
|
58
|
-
await deals.update(ID, {
|
|
59
|
-
COMMENTS: 'Some comment'
|
|
60
|
-
}, {
|
|
61
|
-
REGISTER_SONET_EVENT: 'Y'
|
|
62
|
-
});
|
|
63
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
64
|
-
});
|
|
65
|
-
it('should work without optional params', async () => {
|
|
66
|
-
await deals.update(ID, {
|
|
67
|
-
COMMENTS: 'Some comment'
|
|
68
|
-
});
|
|
69
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BoolString, ISODate, NumberString } from '../common';
|
|
2
|
-
export declare type Lead = {
|
|
3
|
-
readonly [key: string]: string | null;
|
|
4
|
-
readonly ID: NumberString;
|
|
5
|
-
readonly TITLE: string;
|
|
6
|
-
readonly HONORIFIC: string | null;
|
|
7
|
-
readonly NAME: string | null;
|
|
8
|
-
readonly SECOND_NAME: string | null;
|
|
9
|
-
readonly LAST_NAME: string | null;
|
|
10
|
-
readonly COMPANY_TITLE: string | null;
|
|
11
|
-
readonly COMPANY_ID: NumberString | null;
|
|
12
|
-
readonly CONTACT_ID: NumberString | null;
|
|
13
|
-
readonly IS_RETURN_CUSTOMER: BoolString;
|
|
14
|
-
readonly BIRTHDATE: ISODate;
|
|
15
|
-
readonly SOURCE_ID: NumberString;
|
|
16
|
-
readonly SOURCE_DESCRIPTION: string | null;
|
|
17
|
-
readonly STATUS_ID: string;
|
|
18
|
-
readonly STATUS_DESCRIPTION: string | null;
|
|
19
|
-
readonly POST: string | null;
|
|
20
|
-
readonly COMMENTS: string | null;
|
|
21
|
-
readonly CURRENCY_ID: string;
|
|
22
|
-
readonly OPPORTUNITY: NumberString;
|
|
23
|
-
readonly HAS_PHONE: BoolString;
|
|
24
|
-
readonly HAS_EMAIL: BoolString;
|
|
25
|
-
readonly HAS_IMOL: BoolString;
|
|
26
|
-
readonly ASSIGNED_BY_ID: NumberString;
|
|
27
|
-
readonly CREATED_BY_ID: NumberString;
|
|
28
|
-
readonly MODIFY_BY_ID: NumberString;
|
|
29
|
-
readonly DATE_CREATE: ISODate;
|
|
30
|
-
readonly DATE_MODIFY: ISODate;
|
|
31
|
-
readonly DATE_CLOSED: ISODate;
|
|
32
|
-
readonly STATUS_SEMANTIC_ID: string;
|
|
33
|
-
readonly OPENED: BoolString;
|
|
34
|
-
readonly ORIGINATOR_ID: string | null;
|
|
35
|
-
readonly ORIGIN_ID: NumberString | null;
|
|
36
|
-
readonly ADDRESS: string | null;
|
|
37
|
-
readonly ADDRESS_2: string | null;
|
|
38
|
-
readonly ADDRESS_CITY: string | null;
|
|
39
|
-
readonly ADDRESS_POSTAL_CODE: string | null;
|
|
40
|
-
readonly ADDRESS_REGION: string | null;
|
|
41
|
-
readonly ADDRESS_PROVINCE: string | null;
|
|
42
|
-
readonly ADDRESS_COUNTRY: string | null;
|
|
43
|
-
readonly ADDRESS_COUNTRY_CODE: string | null;
|
|
44
|
-
readonly UTM_SOURCE: string | null;
|
|
45
|
-
readonly UTM_MEDIUM: string | null;
|
|
46
|
-
readonly UTM_CAMPAIGN: string | null;
|
|
47
|
-
readonly UTM_CONTENT: string | null;
|
|
48
|
-
readonly UTM_TERM: string | null;
|
|
49
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Call } from '../../client/methods/call';
|
|
2
|
-
import { List } from '../../client/methods/list';
|
|
3
|
-
import { Method, MethodParams } from '../../methods';
|
|
4
|
-
declare type Dependencies = {
|
|
5
|
-
readonly call: Call;
|
|
6
|
-
readonly list: List;
|
|
7
|
-
};
|
|
8
|
-
declare const _default: ({ call, list }: Dependencies) => {
|
|
9
|
-
fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
|
|
10
|
-
create: <D extends {
|
|
11
|
-
readonly fields: Partial<import("./entities").Lead>;
|
|
12
|
-
readonly params?: {
|
|
13
|
-
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
14
|
-
} | undefined;
|
|
15
|
-
}>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
|
|
16
|
-
get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Lead>>;
|
|
17
|
-
list: (params?: MethodParams<Method.CRM_LEAD_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Lead>>;
|
|
18
|
-
update: <D_1 extends {
|
|
19
|
-
readonly id: string;
|
|
20
|
-
readonly fields: Record<string, unknown>;
|
|
21
|
-
readonly params?: {
|
|
22
|
-
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
23
|
-
} | undefined;
|
|
24
|
-
}>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
25
|
-
};
|
|
26
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bitrix_1 = __importDefault(require("./../../bitrix"));
|
|
7
|
-
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
8
|
-
if (!WEBHOOK_URL) {
|
|
9
|
-
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
10
|
-
}
|
|
11
|
-
const { leads } = (0, bitrix_1.default)(WEBHOOK_URL);
|
|
12
|
-
describe('Leads', () => {
|
|
13
|
-
describe('fields', () => {
|
|
14
|
-
it('should get all fields', async () => {
|
|
15
|
-
const { result } = await leads.fields();
|
|
16
|
-
expect(result).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const methods_1 = require("../../methods");
|
|
4
|
-
exports.default = ({ call, list }) => ({
|
|
5
|
-
fields: () => call(methods_1.Method.CRM_LEAD_FIELDS, {}),
|
|
6
|
-
create: (fields, params) => call(methods_1.Method.CRM_LEAD_ADD, { fields, params }),
|
|
7
|
-
get: (id) => call(methods_1.Method.CRM_LEAD_GET, { id }),
|
|
8
|
-
list: (params = {}) => list(methods_1.Method.CRM_LEAD_LIST, params),
|
|
9
|
-
update: (id, fields, params) => call(methods_1.Method.CRM_LEAD_UPDATE, { id, fields, params })
|
|
10
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const _1 = __importDefault(require("."));
|
|
7
|
-
const mockCall = jest.fn(() => Promise.resolve());
|
|
8
|
-
const mockList = jest.fn(() => Promise.resolve());
|
|
9
|
-
const leads = (0, _1.default)({ call: mockCall, list: mockList });
|
|
10
|
-
const ID = '77';
|
|
11
|
-
describe('Leads', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
mockCall.mockClear();
|
|
14
|
-
mockList.mockClear();
|
|
15
|
-
});
|
|
16
|
-
it('should expose API methods', () => {
|
|
17
|
-
expect(leads).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
describe('`create`', () => {
|
|
20
|
-
it('should invoke `call`', async () => {
|
|
21
|
-
await leads.create({
|
|
22
|
-
COMMENTS: 'Some comment'
|
|
23
|
-
}, {
|
|
24
|
-
REGISTER_SONET_EVENT: 'Y'
|
|
25
|
-
});
|
|
26
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
it('should work without optional params', async () => {
|
|
29
|
-
await leads.create({
|
|
30
|
-
COMMENTS: 'Some comment'
|
|
31
|
-
});
|
|
32
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe('`get`', () => {
|
|
36
|
-
it('should invoke `call`', async () => {
|
|
37
|
-
await leads.get(ID);
|
|
38
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe('`list`', () => {
|
|
42
|
-
it('should invoke `list`', async () => {
|
|
43
|
-
await leads.list({
|
|
44
|
-
start: 0,
|
|
45
|
-
order: { COMMENTS: 'ASC' },
|
|
46
|
-
filter: { '>PROBABILITY': 50 },
|
|
47
|
-
select: ['*', 'UF_*']
|
|
48
|
-
});
|
|
49
|
-
expect(mockList.mock.calls).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
it('should work without optional params', async () => {
|
|
52
|
-
await leads.list();
|
|
53
|
-
expect(mockList.mock.calls).toMatchSnapshot();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe('`update`', () => {
|
|
57
|
-
it('should invoke `call`', async () => {
|
|
58
|
-
await leads.update(ID, {
|
|
59
|
-
COMMENTS: 'Some comment'
|
|
60
|
-
}, {
|
|
61
|
-
REGISTER_SONET_EVENT: 'Y'
|
|
62
|
-
});
|
|
63
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
64
|
-
});
|
|
65
|
-
it('should work without optional params', async () => {
|
|
66
|
-
await leads.update(ID, {
|
|
67
|
-
COMMENTS: 'Some comment'
|
|
68
|
-
});
|
|
69
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Call } from '../../client/methods/call';
|
|
2
|
-
import { Method, MethodParams } from '../../methods';
|
|
3
|
-
declare type Dependencies = {
|
|
4
|
-
readonly call: Call;
|
|
5
|
-
};
|
|
6
|
-
declare const _default: ({ call }: Dependencies) => {
|
|
7
|
-
fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
|
|
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>>;
|
|
10
|
-
get: (id: string | number) => Promise<import("../../payloads").GetPayload<import("./entities").Status>>;
|
|
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>>;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bitrix_1 = __importDefault(require("../../bitrix"));
|
|
7
|
-
// @ts-ignore this should be improved in a future but it works for now
|
|
8
|
-
const isSortedAsc = (arr) => arr.slice(1).every((v, i) => arr[i] <= v);
|
|
9
|
-
// @ts-ignore this should be improved in a future but it works for now
|
|
10
|
-
const isSortedDesc = (arr) => arr.slice(1).every((v, i) => arr[i] >= v);
|
|
11
|
-
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
12
|
-
if (!WEBHOOK_URL) {
|
|
13
|
-
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
14
|
-
}
|
|
15
|
-
const { statuses } = (0, bitrix_1.default)(WEBHOOK_URL);
|
|
16
|
-
describe('Statuses', () => {
|
|
17
|
-
describe('fields', () => {
|
|
18
|
-
it('should get all fields', async () => {
|
|
19
|
-
const { result } = await statuses.fields();
|
|
20
|
-
expect(result).toMatchSnapshot();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe('list', () => {
|
|
24
|
-
it('should get all entries without optional parameters', async () => {
|
|
25
|
-
const { result } = await statuses.list();
|
|
26
|
-
expect(result).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
it('should return only entries with ENTITY_ID = STATUS sorted in ascending order', async () => {
|
|
29
|
-
const { result } = await statuses.list({
|
|
30
|
-
order: { SORT: 'ASC' },
|
|
31
|
-
filter: { ENTITY_ID: 'STATUS' }
|
|
32
|
-
});
|
|
33
|
-
expect(result.every((s) => s.ENTITY_ID === 'STATUS')).toBeTruthy();
|
|
34
|
-
expect(isSortedAsc(result.map((s) => s.SORT))).toBeTruthy();
|
|
35
|
-
expect(result).toMatchSnapshot();
|
|
36
|
-
});
|
|
37
|
-
it('should return only entries with ENTITY_ID = STATUS sorted in descending order', async () => {
|
|
38
|
-
const { result } = await statuses.list({
|
|
39
|
-
order: { SORT: 'DESC' },
|
|
40
|
-
filter: { ENTITY_ID: 'STATUS' }
|
|
41
|
-
});
|
|
42
|
-
expect(result.every((s) => s.ENTITY_ID === 'STATUS')).toBeTruthy();
|
|
43
|
-
expect(isSortedDesc(result.map((s) => s.SORT))).toBeTruthy();
|
|
44
|
-
expect(result).toMatchSnapshot();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
describe('get', () => {
|
|
48
|
-
it('should get entry with ID = 1', async () => {
|
|
49
|
-
const { result } = await statuses.get('1');
|
|
50
|
-
expect(result).toMatchSnapshot();
|
|
51
|
-
});
|
|
52
|
-
it('should return an error in case non existent ID is requested', async () => {
|
|
53
|
-
const get = statuses.get('1001');
|
|
54
|
-
await expect(get).rejects.toThrow(Error);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('create', () => {
|
|
58
|
-
it('should create an entry', async () => {
|
|
59
|
-
const entry = {
|
|
60
|
-
ENTITY_ID: 'STATUS',
|
|
61
|
-
STATUS_ID: 'TEST',
|
|
62
|
-
NAME: 'TEST'
|
|
63
|
-
};
|
|
64
|
-
const { result: id } = await statuses.create(entry);
|
|
65
|
-
expect(id).toBeGreaterThan(0);
|
|
66
|
-
const { result: status } = await statuses.get(id);
|
|
67
|
-
expect(status).toMatchSnapshot({
|
|
68
|
-
ID: expect.any(String)
|
|
69
|
-
});
|
|
70
|
-
const { result: deleteResult } = await statuses.delete(id);
|
|
71
|
-
expect(deleteResult).toBeTruthy();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe('update', () => {
|
|
75
|
-
it('should update an entry', async () => {
|
|
76
|
-
const STATUS_ID = 101;
|
|
77
|
-
const { result: status } = await statuses.get(STATUS_ID);
|
|
78
|
-
expect(status).toMatchSnapshot();
|
|
79
|
-
const { result: updateResult } = await statuses.update(STATUS_ID, {
|
|
80
|
-
...status,
|
|
81
|
-
NAME: 'CHANGED'
|
|
82
|
-
});
|
|
83
|
-
expect(updateResult).toBeTruthy();
|
|
84
|
-
const { result: updatedStatus } = await statuses.get(STATUS_ID);
|
|
85
|
-
expect(updatedStatus).toMatchSnapshot();
|
|
86
|
-
const { result: rollbackResult } = await statuses.update(STATUS_ID, status);
|
|
87
|
-
expect(rollbackResult).toBeTruthy();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const methods_1 = require("../../methods");
|
|
4
|
-
exports.default = ({ call }) => ({
|
|
5
|
-
fields: () => call(methods_1.Method.CRM_STATUS_FIELDS, {}),
|
|
6
|
-
create: (fields) => call(methods_1.Method.CRM_STATUS_ADD, { fields }),
|
|
7
|
-
delete: (id, params = {}) => call(methods_1.Method.CRM_STATUS_DELETE, { id, params }),
|
|
8
|
-
get: (id) => call(methods_1.Method.CRM_STATUS_GET, { id }),
|
|
9
|
-
list: (params = {}) => call(methods_1.Method.CRM_STATUS_LIST, params),
|
|
10
|
-
update: (id, fields) => call(methods_1.Method.CRM_STATUS_UPDATE, { id, fields })
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const _1 = __importDefault(require("."));
|
|
7
|
-
const mockCall = jest.fn(() => Promise.resolve());
|
|
8
|
-
const mockList = jest.fn(() => Promise.resolve());
|
|
9
|
-
const statuses = (0, _1.default)({ call: mockCall });
|
|
10
|
-
const ID = '77';
|
|
11
|
-
describe('Statuses', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
mockCall.mockClear();
|
|
14
|
-
mockList.mockClear();
|
|
15
|
-
});
|
|
16
|
-
it('should expose API methods', () => {
|
|
17
|
-
expect(statuses).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
describe('`create`', () => {
|
|
20
|
-
it('should invoke `call`', async () => {
|
|
21
|
-
await statuses.create({
|
|
22
|
-
NAME: 'Test name'
|
|
23
|
-
});
|
|
24
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
describe('`get`', () => {
|
|
28
|
-
it('should invoke `call`', async () => {
|
|
29
|
-
await statuses.get(ID);
|
|
30
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe('`list`', () => {
|
|
34
|
-
it('should invoke `call`', async () => {
|
|
35
|
-
await statuses.list({
|
|
36
|
-
order: { NAME: 'ASC' },
|
|
37
|
-
filter: { ENTITY_ID: 'STATUS' }
|
|
38
|
-
});
|
|
39
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
it('should work without optional params', async () => {
|
|
42
|
-
await statuses.list();
|
|
43
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
describe('`update`', () => {
|
|
47
|
-
it('should invoke `call`', async () => {
|
|
48
|
-
await statuses.update(ID, {
|
|
49
|
-
NAME: 'Test name'
|
|
50
|
-
});
|
|
51
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
52
|
-
});
|
|
53
|
-
it('should work without optional params', async () => {
|
|
54
|
-
await statuses.update(ID, {
|
|
55
|
-
NAME: 'Test name'
|
|
56
|
-
});
|
|
57
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { GenderString, ISODate, NumberString } from '../common';
|
|
2
|
-
export declare type User = {
|
|
3
|
-
readonly [key: string]: string | boolean | null | readonly number[];
|
|
4
|
-
readonly ID: NumberString;
|
|
5
|
-
readonly ACTIVE: boolean;
|
|
6
|
-
readonly EMAIL: string | null;
|
|
7
|
-
readonly NAME: string | null;
|
|
8
|
-
readonly LAST_NAME: string | null;
|
|
9
|
-
readonly SECOND_NAME: string | null;
|
|
10
|
-
readonly PERSONAL_GENDER: GenderString;
|
|
11
|
-
readonly PERSONAL_PROFESSION: string | null;
|
|
12
|
-
readonly PERSONAL_WWW: string | null;
|
|
13
|
-
readonly PERSONAL_BIRTHDAY: ISODate;
|
|
14
|
-
readonly PERSONAL_PHOTO: string | null;
|
|
15
|
-
readonly PERSONAL_ICQ: string | null;
|
|
16
|
-
readonly PERSONAL_PHONE: string | null;
|
|
17
|
-
readonly PERSONAL_FAX: string | null;
|
|
18
|
-
readonly PERSONAL_MOBILE: string | null;
|
|
19
|
-
readonly PERSONAL_PAGER: string | null;
|
|
20
|
-
readonly PERSONAL_STREET: string | null;
|
|
21
|
-
readonly PERSONAL_CITY: string | null;
|
|
22
|
-
readonly PERSONAL_STATE: string | null;
|
|
23
|
-
readonly PERSONAL_ZIP: string | null;
|
|
24
|
-
readonly PERSONAL_COUNTRY: string | null;
|
|
25
|
-
readonly WORK_COMPANY: string | null;
|
|
26
|
-
readonly WORK_POSITION: string | null;
|
|
27
|
-
readonly WORK_PHONE: string | null;
|
|
28
|
-
readonly UF_DEPARTMENT: readonly number[];
|
|
29
|
-
readonly UF_INTERESTS: string | null;
|
|
30
|
-
readonly UF_SKILLS: string | null;
|
|
31
|
-
readonly UF_WEB_SITES: string | null;
|
|
32
|
-
readonly UF_XING: string | null;
|
|
33
|
-
readonly UF_LINKEDIN: string | null;
|
|
34
|
-
readonly UF_FACEBOOK: string | null;
|
|
35
|
-
readonly UF_TWITTER: string | null;
|
|
36
|
-
readonly UF_SKYPE: string | null;
|
|
37
|
-
readonly UF_DISTRICT: string | null;
|
|
38
|
-
readonly UF_PHONE_INNER: NumberString | null;
|
|
39
|
-
readonly USER_TYPE: 'employee';
|
|
40
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Call } from '../../client/methods/call';
|
|
2
|
-
declare type Dependencies = {
|
|
3
|
-
readonly call: Call;
|
|
4
|
-
};
|
|
5
|
-
declare const _default: ({ call }: Dependencies) => {
|
|
6
|
-
fields: () => Promise<import("../../payloads").GetPayload<import("./entities").User>>;
|
|
7
|
-
get: (id?: string) => Promise<import("../../payloads").GetPayload<readonly import("./entities").User[]>>;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bitrix_1 = __importDefault(require("./../../bitrix"));
|
|
7
|
-
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
8
|
-
if (!WEBHOOK_URL) {
|
|
9
|
-
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
10
|
-
}
|
|
11
|
-
const { users } = (0, bitrix_1.default)(WEBHOOK_URL);
|
|
12
|
-
describe('Users', () => {
|
|
13
|
-
describe('fields', () => {
|
|
14
|
-
it('should get all fields', async () => {
|
|
15
|
-
const { result } = await users.fields();
|
|
16
|
-
expect(result).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe('get', () => {
|
|
20
|
-
it('should get all users', async () => {
|
|
21
|
-
const { result } = await users.get();
|
|
22
|
-
expect(result).toMatchSnapshot();
|
|
23
|
-
});
|
|
24
|
-
it('should get entry with ID = 1', async () => {
|
|
25
|
-
const { result } = await users.get('1');
|
|
26
|
-
expect(result).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
it('should return an error in case non existent ID is requested', async () => {
|
|
29
|
-
const { result } = await users.get('1001');
|
|
30
|
-
expect(result).toEqual([]);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const methods_1 = require("../../methods");
|
|
4
|
-
exports.default = ({ call }) => ({
|
|
5
|
-
fields: () => call(methods_1.Method.USER_FIELDS, {}),
|
|
6
|
-
get: (id) => call(methods_1.Method.USER_GET, { id })
|
|
7
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const _1 = __importDefault(require("."));
|
|
7
|
-
const mockCall = jest.fn(() => Promise.resolve());
|
|
8
|
-
const mockList = jest.fn(() => Promise.resolve());
|
|
9
|
-
const users = (0, _1.default)({ call: mockCall });
|
|
10
|
-
const ID = '77';
|
|
11
|
-
describe('Users', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
mockCall.mockClear();
|
|
14
|
-
mockList.mockClear();
|
|
15
|
-
});
|
|
16
|
-
it('should expose API methods', () => {
|
|
17
|
-
expect(users).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
describe('`get`', () => {
|
|
20
|
-
it('should invoke `call`', async () => {
|
|
21
|
-
await users.get(ID);
|
|
22
|
-
expect(mockCall.mock.calls).toMatchSnapshot();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type Diff<T, U> = T extends U ? never : T;
|
package/build/main/utils/Diff.js
DELETED