@2bad/bitrix 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -45
- package/build/main/bitrix.d.ts +25 -16
- package/build/main/bitrix.integration.test.js +0 -1
- package/build/main/bitrix.js +40 -13
- package/build/main/bitrix.unit.test.js +24 -9
- package/build/main/client/client.unit.test.js +13 -10
- package/build/main/client/hooks/addAccessToken.d.ts +5 -2
- package/build/main/client/hooks/addAccessToken.js +3 -1
- package/build/main/client/hooks/addAccessToken.unit.test.js +13 -12
- package/build/main/client/index.d.ts +10 -1
- package/build/main/client/index.js +23 -11
- package/build/main/client/methods/batch.d.ts +24 -5
- package/build/main/client/methods/batch.js +49 -17
- package/build/main/client/methods/batch.unit.test.js +103 -45
- package/build/main/client/methods/call.d.ts +11 -4
- package/build/main/client/methods/call.js +16 -6
- package/build/main/client/methods/call.unit.test.js +36 -21
- package/build/main/client/methods/list.d.ts +15 -3
- package/build/main/client/methods/list.js +36 -14
- package/build/main/client/methods/list.unit.test.js +42 -27
- package/build/main/commands.d.ts +2 -2
- package/build/main/commands.js +0 -1
- package/build/main/methods.d.ts +27 -8
- package/build/main/methods.js +1 -1
- package/build/main/payloads.d.ts +8 -8
- package/build/main/payloads.js +0 -1
- package/build/main/services/common.d.ts +5 -4
- package/build/main/services/common.js +0 -1
- package/build/main/services/companies/entities.d.ts +7 -6
- package/build/main/services/companies/entities.js +0 -1
- package/build/main/services/companies/index.d.ts +7 -6
- package/build/main/services/companies/index.integration.test.js +2 -3
- package/build/main/services/companies/index.js +0 -1
- package/build/main/services/companies/index.unit.test.js +1 -2
- package/build/main/services/companies/methods.d.ts +4 -4
- package/build/main/services/companies/methods.js +0 -1
- package/build/main/services/contacts/entities.d.ts +4 -3
- package/build/main/services/contacts/entities.js +0 -1
- package/build/main/services/contacts/index.d.ts +7 -6
- package/build/main/services/contacts/index.integration.test.js +2 -3
- package/build/main/services/contacts/index.js +0 -1
- package/build/main/services/contacts/index.unit.test.js +1 -2
- package/build/main/services/contacts/methods.d.ts +4 -4
- package/build/main/services/contacts/methods.js +0 -1
- package/build/main/services/currencies/entities.d.ts +2 -2
- package/build/main/services/currencies/entities.js +0 -1
- package/build/main/services/deals/entities.d.ts +2 -2
- package/build/main/services/deals/entities.js +0 -1
- package/build/main/services/deals/index.d.ts +7 -6
- package/build/main/services/deals/index.integration.test.js +2 -3
- package/build/main/services/deals/index.js +0 -1
- package/build/main/services/deals/index.unit.test.js +1 -2
- package/build/main/services/deals/methods.d.ts +4 -4
- package/build/main/services/deals/methods.js +0 -1
- package/build/main/services/leads/entities.d.ts +2 -2
- package/build/main/services/leads/entities.js +0 -1
- package/build/main/services/leads/index.d.ts +7 -6
- package/build/main/services/leads/index.integration.test.js +2 -3
- package/build/main/services/leads/index.js +0 -1
- package/build/main/services/leads/index.unit.test.js +1 -2
- package/build/main/services/leads/methods.d.ts +4 -4
- package/build/main/services/leads/methods.js +0 -1
- package/build/main/services/statuses/entities.d.ts +5 -4
- package/build/main/services/statuses/entities.js +0 -1
- package/build/main/services/statuses/index.d.ts +7 -11
- package/build/main/services/statuses/index.integration.test.js +8 -4
- package/build/main/services/statuses/index.js +0 -1
- package/build/main/services/statuses/index.unit.test.js +1 -2
- package/build/main/services/statuses/methods.d.ts +6 -6
- package/build/main/services/statuses/methods.js +0 -1
- package/build/main/services/users/entities.d.ts +4 -3
- package/build/main/services/users/entities.js +0 -1
- package/build/main/services/users/index.d.ts +3 -3
- package/build/main/services/users/index.integration.test.js +2 -3
- package/build/main/services/users/index.js +0 -1
- package/build/main/services/users/index.unit.test.js +1 -2
- package/build/main/services/users/methods.d.ts +4 -4
- package/build/main/services/users/methods.js +0 -1
- package/build/main/utils/Diff.js +0 -1
- package/build/main/utils/ExtractValue.d.ts +6 -1
- package/build/main/utils/ExtractValue.js +0 -1
- package/build/main/utils/isArray.d.ts +1 -1
- package/build/main/utils/isArray.js +1 -1
- package/build/module/bitrix.d.ts +25 -16
- package/build/module/bitrix.integration.test.js +0 -1
- package/build/module/bitrix.js +19 -3
- package/build/module/bitrix.unit.test.js +0 -1
- package/build/module/client/client.unit.test.js +9 -6
- package/build/module/client/hooks/addAccessToken.d.ts +5 -2
- package/build/module/client/hooks/addAccessToken.js +3 -1
- package/build/module/client/hooks/addAccessToken.unit.test.js +9 -8
- package/build/module/client/index.d.ts +10 -1
- package/build/module/client/index.js +19 -7
- package/build/module/client/methods/batch.d.ts +24 -5
- package/build/module/client/methods/batch.js +28 -3
- package/build/module/client/methods/batch.unit.test.js +61 -19
- package/build/module/client/methods/call.d.ts +11 -4
- package/build/module/client/methods/call.js +10 -3
- package/build/module/client/methods/call.unit.test.js +1 -2
- package/build/module/client/methods/list.d.ts +15 -3
- package/build/module/client/methods/list.js +21 -5
- package/build/module/client/methods/list.unit.test.js +0 -1
- package/build/module/commands.d.ts +2 -2
- package/build/module/commands.js +1 -1
- package/build/module/methods.d.ts +27 -8
- package/build/module/methods.js +0 -1
- package/build/module/payloads.d.ts +8 -8
- package/build/module/payloads.js +1 -1
- package/build/module/services/common.d.ts +5 -4
- package/build/module/services/common.js +1 -1
- package/build/module/services/companies/entities.d.ts +7 -6
- package/build/module/services/companies/entities.js +1 -1
- package/build/module/services/companies/index.d.ts +7 -6
- package/build/module/services/companies/index.integration.test.js +1 -2
- package/build/module/services/companies/index.js +0 -1
- package/build/module/services/companies/index.unit.test.js +0 -1
- package/build/module/services/companies/methods.d.ts +4 -4
- package/build/module/services/companies/methods.js +0 -1
- package/build/module/services/contacts/entities.d.ts +4 -3
- package/build/module/services/contacts/entities.js +1 -1
- package/build/module/services/contacts/index.d.ts +7 -6
- package/build/module/services/contacts/index.integration.test.js +1 -2
- package/build/module/services/contacts/index.js +0 -1
- package/build/module/services/contacts/index.unit.test.js +0 -1
- package/build/module/services/contacts/methods.d.ts +4 -4
- package/build/module/services/contacts/methods.js +0 -1
- package/build/module/services/currencies/entities.d.ts +2 -2
- package/build/module/services/currencies/entities.js +1 -1
- package/build/module/services/deals/entities.d.ts +2 -2
- package/build/module/services/deals/entities.js +1 -1
- package/build/module/services/deals/index.d.ts +7 -6
- package/build/module/services/deals/index.integration.test.js +1 -2
- package/build/module/services/deals/index.js +0 -1
- package/build/module/services/deals/index.unit.test.js +0 -1
- package/build/module/services/deals/methods.d.ts +4 -4
- package/build/module/services/deals/methods.js +0 -1
- package/build/module/services/leads/entities.d.ts +2 -2
- package/build/module/services/leads/entities.js +1 -1
- package/build/module/services/leads/index.d.ts +7 -6
- package/build/module/services/leads/index.integration.test.js +1 -2
- package/build/module/services/leads/index.js +0 -1
- package/build/module/services/leads/index.unit.test.js +0 -1
- package/build/module/services/leads/methods.d.ts +4 -4
- package/build/module/services/leads/methods.js +0 -1
- package/build/module/services/statuses/entities.d.ts +5 -4
- package/build/module/services/statuses/entities.js +1 -1
- package/build/module/services/statuses/index.d.ts +7 -11
- package/build/module/services/statuses/index.integration.test.js +7 -3
- package/build/module/services/statuses/index.js +0 -1
- package/build/module/services/statuses/index.unit.test.js +0 -1
- package/build/module/services/statuses/methods.d.ts +6 -6
- package/build/module/services/statuses/methods.js +0 -1
- package/build/module/services/users/entities.d.ts +4 -3
- package/build/module/services/users/entities.js +1 -1
- package/build/module/services/users/index.d.ts +3 -3
- package/build/module/services/users/index.integration.test.js +1 -2
- package/build/module/services/users/index.js +0 -1
- package/build/module/services/users/index.unit.test.js +0 -1
- package/build/module/services/users/methods.d.ts +4 -4
- package/build/module/services/users/methods.js +0 -1
- package/build/module/utils/Diff.js +1 -1
- package/build/module/utils/ExtractValue.d.ts +6 -1
- package/build/module/utils/ExtractValue.js +1 -1
- package/build/module/utils/isArray.d.ts +1 -1
- package/build/module/utils/isArray.js +1 -1
- package/package.json +64 -60
- package/build/main/bitrix.integration.test.js.map +0 -1
- package/build/main/bitrix.js.map +0 -1
- package/build/main/bitrix.unit.test.js.map +0 -1
- package/build/main/client/client.unit.test.js.map +0 -1
- package/build/main/client/hooks/addAccessToken.js.map +0 -1
- package/build/main/client/hooks/addAccessToken.unit.test.js.map +0 -1
- package/build/main/client/index.js.map +0 -1
- package/build/main/client/methods/batch.js.map +0 -1
- package/build/main/client/methods/batch.unit.test.js.map +0 -1
- package/build/main/client/methods/call.js.map +0 -1
- package/build/main/client/methods/call.unit.test.js.map +0 -1
- package/build/main/client/methods/list.js.map +0 -1
- package/build/main/client/methods/list.unit.test.js.map +0 -1
- package/build/main/commands.js.map +0 -1
- package/build/main/methods.js.map +0 -1
- package/build/main/payloads.js.map +0 -1
- package/build/main/services/common.js.map +0 -1
- package/build/main/services/companies/entities.js.map +0 -1
- package/build/main/services/companies/index.integration.test.js.map +0 -1
- package/build/main/services/companies/index.js.map +0 -1
- package/build/main/services/companies/index.unit.test.js.map +0 -1
- package/build/main/services/companies/methods.js.map +0 -1
- package/build/main/services/contacts/entities.js.map +0 -1
- package/build/main/services/contacts/index.integration.test.js.map +0 -1
- package/build/main/services/contacts/index.js.map +0 -1
- package/build/main/services/contacts/index.unit.test.js.map +0 -1
- package/build/main/services/contacts/methods.js.map +0 -1
- package/build/main/services/currencies/entities.js.map +0 -1
- package/build/main/services/deals/entities.js.map +0 -1
- package/build/main/services/deals/index.integration.test.js.map +0 -1
- package/build/main/services/deals/index.js.map +0 -1
- package/build/main/services/deals/index.unit.test.js.map +0 -1
- package/build/main/services/deals/methods.js.map +0 -1
- package/build/main/services/leads/entities.js.map +0 -1
- package/build/main/services/leads/index.integration.test.js.map +0 -1
- package/build/main/services/leads/index.js.map +0 -1
- package/build/main/services/leads/index.unit.test.js.map +0 -1
- package/build/main/services/leads/methods.js.map +0 -1
- package/build/main/services/statuses/entities.js.map +0 -1
- package/build/main/services/statuses/index.integration.test.js.map +0 -1
- package/build/main/services/statuses/index.js.map +0 -1
- package/build/main/services/statuses/index.unit.test.js.map +0 -1
- package/build/main/services/statuses/methods.js.map +0 -1
- package/build/main/services/users/entities.js.map +0 -1
- package/build/main/services/users/index.integration.test.js.map +0 -1
- package/build/main/services/users/index.js.map +0 -1
- package/build/main/services/users/index.unit.test.js.map +0 -1
- package/build/main/services/users/methods.js.map +0 -1
- package/build/main/utils/Diff.js.map +0 -1
- package/build/main/utils/ExtractValue.js.map +0 -1
- package/build/main/utils/isArray.js.map +0 -1
- package/build/module/bitrix.integration.test.js.map +0 -1
- package/build/module/bitrix.js.map +0 -1
- package/build/module/bitrix.unit.test.js.map +0 -1
- package/build/module/client/client.unit.test.js.map +0 -1
- package/build/module/client/hooks/addAccessToken.js.map +0 -1
- package/build/module/client/hooks/addAccessToken.unit.test.js.map +0 -1
- package/build/module/client/index.js.map +0 -1
- package/build/module/client/methods/batch.js.map +0 -1
- package/build/module/client/methods/batch.unit.test.js.map +0 -1
- package/build/module/client/methods/call.js.map +0 -1
- package/build/module/client/methods/call.unit.test.js.map +0 -1
- package/build/module/client/methods/list.js.map +0 -1
- package/build/module/client/methods/list.unit.test.js.map +0 -1
- package/build/module/commands.js.map +0 -1
- package/build/module/methods.js.map +0 -1
- package/build/module/payloads.js.map +0 -1
- package/build/module/services/common.js.map +0 -1
- package/build/module/services/companies/entities.js.map +0 -1
- package/build/module/services/companies/index.integration.test.js.map +0 -1
- package/build/module/services/companies/index.js.map +0 -1
- package/build/module/services/companies/index.unit.test.js.map +0 -1
- package/build/module/services/companies/methods.js.map +0 -1
- package/build/module/services/contacts/entities.js.map +0 -1
- package/build/module/services/contacts/index.integration.test.js.map +0 -1
- package/build/module/services/contacts/index.js.map +0 -1
- package/build/module/services/contacts/index.unit.test.js.map +0 -1
- package/build/module/services/contacts/methods.js.map +0 -1
- package/build/module/services/currencies/entities.js.map +0 -1
- package/build/module/services/deals/entities.js.map +0 -1
- package/build/module/services/deals/index.integration.test.js.map +0 -1
- package/build/module/services/deals/index.js.map +0 -1
- package/build/module/services/deals/index.unit.test.js.map +0 -1
- package/build/module/services/deals/methods.js.map +0 -1
- package/build/module/services/leads/entities.js.map +0 -1
- package/build/module/services/leads/index.integration.test.js.map +0 -1
- package/build/module/services/leads/index.js.map +0 -1
- package/build/module/services/leads/index.unit.test.js.map +0 -1
- package/build/module/services/leads/methods.js.map +0 -1
- package/build/module/services/statuses/entities.js.map +0 -1
- package/build/module/services/statuses/index.integration.test.js.map +0 -1
- package/build/module/services/statuses/index.js.map +0 -1
- package/build/module/services/statuses/index.unit.test.js.map +0 -1
- package/build/module/services/statuses/methods.js.map +0 -1
- package/build/module/services/users/entities.js.map +0 -1
- package/build/module/services/users/index.integration.test.js.map +0 -1
- package/build/module/services/users/index.js.map +0 -1
- package/build/module/services/users/index.unit.test.js.map +0 -1
- package/build/module/services/users/methods.js.map +0 -1
- package/build/module/utils/Diff.js.map +0 -1
- package/build/module/utils/ExtractValue.js.map +0 -1
- package/build/module/utils/isArray.js.map +0 -1
|
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
|
|
|
2
2
|
import { GetPayload, ListPayload } from '../../payloads';
|
|
3
3
|
import { Fields } from '../common';
|
|
4
4
|
import { Company } from './entities';
|
|
5
|
-
export
|
|
5
|
+
export declare type CompaniesMethods = {
|
|
6
6
|
readonly [Method.CRM_COMPANY_FIELDS]: {
|
|
7
7
|
readonly type: Company;
|
|
8
8
|
readonly payload: GetPayload<Fields>;
|
|
9
|
-
readonly params?:
|
|
9
|
+
readonly params?: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
readonly [Method.CRM_COMPANY_ADD]: {
|
|
12
12
|
readonly type: Company;
|
|
@@ -35,10 +35,10 @@ export interface CompaniesMethods {
|
|
|
35
35
|
readonly payload: GetPayload<boolean>;
|
|
36
36
|
readonly params: {
|
|
37
37
|
readonly id: string;
|
|
38
|
-
readonly fields: Record<string,
|
|
38
|
+
readonly fields: Record<string, unknown>;
|
|
39
39
|
readonly params?: {
|
|
40
40
|
readonly REGISTER_SONET_EVENT: 'Y' | 'N';
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
}
|
|
44
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BoolString, ISODate, NumberString } from '../common';
|
|
2
|
-
export
|
|
1
|
+
import { BoolString, ISODate, MultiFieldArray, NumberString } from '../common';
|
|
2
|
+
export declare type Contact = {
|
|
3
|
+
readonly [key: string]: MultiFieldArray | string | null;
|
|
3
4
|
readonly ID: NumberString;
|
|
4
5
|
readonly POST: string | null;
|
|
5
6
|
readonly COMMENTS: string | null;
|
|
@@ -41,4 +42,4 @@ export interface Contact {
|
|
|
41
42
|
readonly UTM_CAMPAIGN: string | null;
|
|
42
43
|
readonly UTM_CONTENT: string | null;
|
|
43
44
|
readonly UTM_TERM: string | null;
|
|
44
|
-
}
|
|
45
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { Call } from '../../client/methods/call';
|
|
2
2
|
import { List } from '../../client/methods/list';
|
|
3
|
-
|
|
3
|
+
import { Method, MethodParams } from '../../methods';
|
|
4
|
+
declare type Dependencies = {
|
|
4
5
|
readonly call: Call;
|
|
5
6
|
readonly list: List;
|
|
6
|
-
}
|
|
7
|
+
};
|
|
7
8
|
declare const _default: ({ call, list }: Dependencies) => {
|
|
8
9
|
fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
|
|
9
10
|
create: <D extends {
|
|
10
11
|
readonly fields: Partial<import("./entities").Contact>;
|
|
11
12
|
readonly params?: {
|
|
12
|
-
readonly REGISTER_SONET_EVENT:
|
|
13
|
+
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
13
14
|
} | undefined;
|
|
14
15
|
}>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
|
|
15
16
|
get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Contact>>;
|
|
16
|
-
list: (params?:
|
|
17
|
+
list: (params?: MethodParams<Method.CRM_CONTACT_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Contact>>;
|
|
17
18
|
update: <D_1 extends {
|
|
18
19
|
readonly id: string;
|
|
19
|
-
readonly fields: Record<string,
|
|
20
|
+
readonly fields: Record<string, unknown>;
|
|
20
21
|
readonly params?: {
|
|
21
|
-
readonly REGISTER_SONET_EVENT:
|
|
22
|
+
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
22
23
|
} | undefined;
|
|
23
24
|
}>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
24
25
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Bitrix from './../../bitrix';
|
|
2
|
-
const WEBHOOK_URL = process.env
|
|
2
|
+
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
3
3
|
if (!WEBHOOK_URL) {
|
|
4
4
|
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
5
5
|
}
|
|
@@ -12,4 +12,3 @@ describe('Contacts', () => {
|
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
//# sourceMappingURL=index.integration.test.js.map
|
|
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
|
|
|
2
2
|
import { GetPayload, ListPayload } from '../../payloads';
|
|
3
3
|
import { Fields } from '../common';
|
|
4
4
|
import { Contact } from './entities';
|
|
5
|
-
export
|
|
5
|
+
export declare type ContactsMethods = {
|
|
6
6
|
readonly [Method.CRM_CONTACT_FIELDS]: {
|
|
7
7
|
readonly type: Contact;
|
|
8
8
|
readonly payload: GetPayload<Fields>;
|
|
9
|
-
readonly params?:
|
|
9
|
+
readonly params?: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
readonly [Method.CRM_CONTACT_ADD]: {
|
|
12
12
|
readonly type: Contact;
|
|
@@ -35,10 +35,10 @@ export interface ContactsMethods {
|
|
|
35
35
|
readonly payload: GetPayload<boolean>;
|
|
36
36
|
readonly params: {
|
|
37
37
|
readonly id: string;
|
|
38
|
-
readonly fields: Record<string,
|
|
38
|
+
readonly fields: Record<string, unknown>;
|
|
39
39
|
readonly params?: {
|
|
40
40
|
readonly REGISTER_SONET_EVENT: 'Y' | 'N';
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
}
|
|
44
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoolString, ISODate, NumberString } from '../common';
|
|
2
|
-
export
|
|
2
|
+
export declare type Currency = {
|
|
3
3
|
readonly CURRENCY: string;
|
|
4
4
|
readonly AMOUNT_CNT: NumberString;
|
|
5
5
|
readonly AMOUNT: NumberString;
|
|
@@ -12,4 +12,4 @@ export interface Currency {
|
|
|
12
12
|
readonly THOUSANDS_SEP: string;
|
|
13
13
|
readonly DECIMALS: NumberString;
|
|
14
14
|
readonly DATE_UPDATE: ISODate;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoolString, ISODate, NumberString } from '../common';
|
|
2
|
-
export
|
|
2
|
+
export declare type Deal = {
|
|
3
3
|
readonly [key: string]: string | null;
|
|
4
4
|
readonly ID: NumberString;
|
|
5
5
|
readonly TITLE: string;
|
|
@@ -40,4 +40,4 @@ export interface Deal {
|
|
|
40
40
|
readonly UTM_CAMPAIGN: string | null;
|
|
41
41
|
readonly UTM_CONTENT: string | null;
|
|
42
42
|
readonly UTM_TERM: string | null;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { Call } from '../../client/methods/call';
|
|
2
2
|
import { List } from '../../client/methods/list';
|
|
3
|
-
|
|
3
|
+
import { Method, MethodParams } from '../../methods';
|
|
4
|
+
declare type Dependencies = {
|
|
4
5
|
readonly call: Call;
|
|
5
6
|
readonly list: List;
|
|
6
|
-
}
|
|
7
|
+
};
|
|
7
8
|
declare const _default: ({ call, list }: Dependencies) => {
|
|
8
9
|
fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
|
|
9
10
|
create: <D extends {
|
|
10
11
|
readonly fields: Partial<import("./entities").Deal>;
|
|
11
12
|
readonly params?: {
|
|
12
|
-
readonly REGISTER_SONET_EVENT:
|
|
13
|
+
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
13
14
|
} | undefined;
|
|
14
15
|
}>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
|
|
15
16
|
get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Deal>>;
|
|
16
|
-
list: (params?:
|
|
17
|
+
list: (params?: MethodParams<Method.CRM_DEAL_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Deal>>;
|
|
17
18
|
update: <D_1 extends {
|
|
18
19
|
readonly id: string;
|
|
19
|
-
readonly fields: Record<string,
|
|
20
|
+
readonly fields: Record<string, unknown>;
|
|
20
21
|
readonly params?: {
|
|
21
|
-
readonly REGISTER_SONET_EVENT:
|
|
22
|
+
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
22
23
|
} | undefined;
|
|
23
24
|
}>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
24
25
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Bitrix from './../../bitrix';
|
|
2
|
-
const WEBHOOK_URL = process.env
|
|
2
|
+
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
3
3
|
if (!WEBHOOK_URL) {
|
|
4
4
|
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
5
5
|
}
|
|
@@ -12,4 +12,3 @@ describe('Deals', () => {
|
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
//# sourceMappingURL=index.integration.test.js.map
|
|
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
|
|
|
2
2
|
import { GetPayload, ListPayload } from '../../payloads';
|
|
3
3
|
import { Fields } from '../common';
|
|
4
4
|
import { Deal } from './entities';
|
|
5
|
-
export
|
|
5
|
+
export declare type DealsMethods = {
|
|
6
6
|
readonly [Method.CRM_DEAL_FIELDS]: {
|
|
7
7
|
readonly type: Deal;
|
|
8
8
|
readonly payload: GetPayload<Fields>;
|
|
9
|
-
readonly params?:
|
|
9
|
+
readonly params?: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
readonly [Method.CRM_DEAL_ADD]: {
|
|
12
12
|
readonly type: Deal;
|
|
@@ -35,10 +35,10 @@ export interface DealsMethods {
|
|
|
35
35
|
readonly payload: GetPayload<boolean>;
|
|
36
36
|
readonly params: {
|
|
37
37
|
readonly id: string;
|
|
38
|
-
readonly fields: Record<string,
|
|
38
|
+
readonly fields: Record<string, unknown>;
|
|
39
39
|
readonly params?: {
|
|
40
40
|
readonly REGISTER_SONET_EVENT: 'Y' | 'N';
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
}
|
|
44
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoolString, ISODate, NumberString } from '../common';
|
|
2
|
-
export
|
|
2
|
+
export declare type Lead = {
|
|
3
3
|
readonly [key: string]: string | null;
|
|
4
4
|
readonly ID: NumberString;
|
|
5
5
|
readonly TITLE: string;
|
|
@@ -46,4 +46,4 @@ export interface Lead {
|
|
|
46
46
|
readonly UTM_CAMPAIGN: string | null;
|
|
47
47
|
readonly UTM_CONTENT: string | null;
|
|
48
48
|
readonly UTM_TERM: string | null;
|
|
49
|
-
}
|
|
49
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { Call } from '../../client/methods/call';
|
|
2
2
|
import { List } from '../../client/methods/list';
|
|
3
|
-
|
|
3
|
+
import { Method, MethodParams } from '../../methods';
|
|
4
|
+
declare type Dependencies = {
|
|
4
5
|
readonly call: Call;
|
|
5
6
|
readonly list: List;
|
|
6
|
-
}
|
|
7
|
+
};
|
|
7
8
|
declare const _default: ({ call, list }: Dependencies) => {
|
|
8
9
|
fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
|
|
9
10
|
create: <D extends {
|
|
10
11
|
readonly fields: Partial<import("./entities").Lead>;
|
|
11
12
|
readonly params?: {
|
|
12
|
-
readonly REGISTER_SONET_EVENT:
|
|
13
|
+
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
13
14
|
} | undefined;
|
|
14
15
|
}>(fields: D["fields"], params?: D["params"] | undefined) => Promise<import("../../payloads").GetPayload<number>>;
|
|
15
16
|
get: (id: string) => Promise<import("../../payloads").GetPayload<import("./entities").Lead>>;
|
|
16
|
-
list: (params?:
|
|
17
|
+
list: (params?: MethodParams<Method.CRM_LEAD_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Lead>>;
|
|
17
18
|
update: <D_1 extends {
|
|
18
19
|
readonly id: string;
|
|
19
|
-
readonly fields: Record<string,
|
|
20
|
+
readonly fields: Record<string, unknown>;
|
|
20
21
|
readonly params?: {
|
|
21
|
-
readonly REGISTER_SONET_EVENT:
|
|
22
|
+
readonly REGISTER_SONET_EVENT: "Y" | "N";
|
|
22
23
|
} | undefined;
|
|
23
24
|
}>(id: string, fields: D_1["fields"], params?: D_1["params"] | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
24
25
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Bitrix from './../../bitrix';
|
|
2
|
-
const WEBHOOK_URL = process.env
|
|
2
|
+
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
3
3
|
if (!WEBHOOK_URL) {
|
|
4
4
|
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
5
5
|
}
|
|
@@ -12,4 +12,3 @@ describe('Leads', () => {
|
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
//# sourceMappingURL=index.integration.test.js.map
|
|
@@ -2,11 +2,11 @@ import { ListParams, Method } from '../../methods';
|
|
|
2
2
|
import { GetPayload, ListPayload } from '../../payloads';
|
|
3
3
|
import { Fields } from '../common';
|
|
4
4
|
import { Lead } from './entities';
|
|
5
|
-
export
|
|
5
|
+
export declare type LeadsMethods = {
|
|
6
6
|
readonly [Method.CRM_LEAD_FIELDS]: {
|
|
7
7
|
readonly type: Lead;
|
|
8
8
|
readonly payload: GetPayload<Fields>;
|
|
9
|
-
readonly params?:
|
|
9
|
+
readonly params?: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
readonly [Method.CRM_LEAD_ADD]: {
|
|
12
12
|
readonly type: Lead;
|
|
@@ -35,10 +35,10 @@ export interface LeadsMethods {
|
|
|
35
35
|
readonly payload: GetPayload<boolean>;
|
|
36
36
|
readonly params: {
|
|
37
37
|
readonly id: string;
|
|
38
|
-
readonly fields: Record<string,
|
|
38
|
+
readonly fields: Record<string, unknown>;
|
|
39
39
|
readonly params?: {
|
|
40
40
|
readonly REGISTER_SONET_EVENT: 'Y' | 'N';
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
}
|
|
44
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BoolString, NumberString } from '../common';
|
|
2
|
-
export
|
|
2
|
+
export declare type Extra = {
|
|
3
3
|
readonly SEMANTICS: string;
|
|
4
4
|
readonly COLOR: string;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
5
|
+
};
|
|
6
|
+
export declare type Status = {
|
|
7
|
+
readonly [key: string]: string | Extra | undefined;
|
|
7
8
|
readonly ID: NumberString;
|
|
8
9
|
readonly ENTITY_ID: string;
|
|
9
10
|
readonly STATUS_ID: NumberString;
|
|
@@ -12,4 +13,4 @@ export interface Status {
|
|
|
12
13
|
readonly SORT: NumberString;
|
|
13
14
|
readonly SYSTEM: BoolString;
|
|
14
15
|
readonly EXTRA: Extra | undefined;
|
|
15
|
-
}
|
|
16
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { Call } from '../../client/methods/call';
|
|
2
|
-
|
|
2
|
+
import { Method, MethodParams } from '../../methods';
|
|
3
|
+
declare type Dependencies = {
|
|
3
4
|
readonly call: Call;
|
|
4
|
-
}
|
|
5
|
+
};
|
|
5
6
|
declare const _default: ({ call }: Dependencies) => {
|
|
6
7
|
fields: () => Promise<import("../../payloads").GetPayload<import("../common").Fields>>;
|
|
7
|
-
create: (fields:
|
|
8
|
-
delete: (id: string | number, params?:
|
|
9
|
-
readonly FORCED?: "Y" | "N" | undefined;
|
|
10
|
-
} | undefined) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
8
|
+
create: (fields: MethodParams<Method.CRM_STATUS_ADD>['fields']) => Promise<import("../../payloads").GetPayload<number>>;
|
|
9
|
+
delete: (id: string | number, params?: MethodParams<Method.CRM_STATUS_DELETE>['params']) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
11
10
|
get: (id: string | number) => Promise<import("../../payloads").GetPayload<import("./entities").Status>>;
|
|
12
|
-
list: (params?:
|
|
13
|
-
|
|
14
|
-
readonly filter?: Record<string, any> | undefined;
|
|
15
|
-
}) => Promise<import("../../payloads").ListPayload<import("./entities").Status>>;
|
|
16
|
-
update: (id: string | number, fields: Record<string, any>) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
11
|
+
list: (params?: MethodParams<Method.CRM_STATUS_LIST>) => Promise<import("../../payloads").ListPayload<import("./entities").Status>>;
|
|
12
|
+
update: (id: string | number, fields: MethodParams<Method.CRM_STATUS_UPDATE>['fields']) => Promise<import("../../payloads").GetPayload<boolean>>;
|
|
17
13
|
};
|
|
18
14
|
export default _default;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import Bitrix from '../../bitrix';
|
|
2
|
+
// @ts-ignore this should be improved in a future but it works for now
|
|
2
3
|
const isSortedAsc = (arr) => arr.slice(1).every((v, i) => arr[i] <= v);
|
|
4
|
+
// @ts-ignore this should be improved in a future but it works for now
|
|
3
5
|
const isSortedDesc = (arr) => arr.slice(1).every((v, i) => arr[i] >= v);
|
|
4
|
-
const WEBHOOK_URL = process.env
|
|
6
|
+
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
5
7
|
if (!WEBHOOK_URL) {
|
|
6
8
|
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
7
9
|
}
|
|
@@ -69,7 +71,10 @@ describe('Statuses', () => {
|
|
|
69
71
|
const STATUS_ID = 101;
|
|
70
72
|
const { result: status } = await statuses.get(STATUS_ID);
|
|
71
73
|
expect(status).toMatchSnapshot();
|
|
72
|
-
const { result: updateResult } = await statuses.update(STATUS_ID, {
|
|
74
|
+
const { result: updateResult } = await statuses.update(STATUS_ID, {
|
|
75
|
+
...status,
|
|
76
|
+
NAME: 'CHANGED'
|
|
77
|
+
});
|
|
73
78
|
expect(updateResult).toBeTruthy();
|
|
74
79
|
const { result: updatedStatus } = await statuses.get(STATUS_ID);
|
|
75
80
|
expect(updatedStatus).toMatchSnapshot();
|
|
@@ -78,4 +83,3 @@ describe('Statuses', () => {
|
|
|
78
83
|
});
|
|
79
84
|
});
|
|
80
85
|
});
|
|
81
|
-
//# sourceMappingURL=index.integration.test.js.map
|
|
@@ -2,11 +2,11 @@ import { Method } from '../../methods';
|
|
|
2
2
|
import { GetPayload, ListPayload } from '../../payloads';
|
|
3
3
|
import { Fields } from '../common';
|
|
4
4
|
import { Status } from './entities';
|
|
5
|
-
export
|
|
5
|
+
export declare type StatusesMethods = {
|
|
6
6
|
readonly [Method.CRM_STATUS_FIELDS]: {
|
|
7
7
|
readonly type: Status;
|
|
8
8
|
readonly payload: GetPayload<Fields>;
|
|
9
|
-
readonly params?:
|
|
9
|
+
readonly params?: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
readonly [Method.CRM_STATUS_ADD]: {
|
|
12
12
|
readonly type: Status;
|
|
@@ -36,8 +36,8 @@ export interface StatusesMethods {
|
|
|
36
36
|
readonly type: Status;
|
|
37
37
|
readonly payload: ListPayload<Status>;
|
|
38
38
|
readonly params: {
|
|
39
|
-
readonly order?: Record<string,
|
|
40
|
-
readonly filter?: Record<string,
|
|
39
|
+
readonly order?: Record<string, unknown>;
|
|
40
|
+
readonly filter?: Record<string, unknown>;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
readonly [Method.CRM_STATUS_UPDATE]: {
|
|
@@ -45,7 +45,7 @@ export interface StatusesMethods {
|
|
|
45
45
|
readonly payload: GetPayload<boolean>;
|
|
46
46
|
readonly params: {
|
|
47
47
|
readonly id: string | number;
|
|
48
|
-
readonly fields: Record<string,
|
|
48
|
+
readonly fields: Record<string, unknown>;
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
}
|
|
51
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GenderString, ISODate, NumberString } from '../common';
|
|
2
|
-
export
|
|
2
|
+
export declare type User = {
|
|
3
|
+
readonly [key: string]: string | boolean | null | readonly number[];
|
|
3
4
|
readonly ID: NumberString;
|
|
4
5
|
readonly ACTIVE: boolean;
|
|
5
6
|
readonly EMAIL: string | null;
|
|
@@ -24,7 +25,7 @@ export interface User {
|
|
|
24
25
|
readonly WORK_COMPANY: string | null;
|
|
25
26
|
readonly WORK_POSITION: string | null;
|
|
26
27
|
readonly WORK_PHONE: string | null;
|
|
27
|
-
readonly UF_DEPARTMENT:
|
|
28
|
+
readonly UF_DEPARTMENT: readonly number[];
|
|
28
29
|
readonly UF_INTERESTS: string | null;
|
|
29
30
|
readonly UF_SKILLS: string | null;
|
|
30
31
|
readonly UF_WEB_SITES: string | null;
|
|
@@ -36,4 +37,4 @@ export interface User {
|
|
|
36
37
|
readonly UF_DISTRICT: string | null;
|
|
37
38
|
readonly UF_PHONE_INNER: NumberString | null;
|
|
38
39
|
readonly USER_TYPE: 'employee';
|
|
39
|
-
}
|
|
40
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Call } from '../../client/methods/call';
|
|
2
|
-
|
|
2
|
+
declare type Dependencies = {
|
|
3
3
|
readonly call: Call;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
5
|
declare const _default: ({ call }: Dependencies) => {
|
|
6
6
|
fields: () => Promise<import("../../payloads").GetPayload<import("./entities").User>>;
|
|
7
|
-
get: (id?: string
|
|
7
|
+
get: (id?: string) => Promise<import("../../payloads").GetPayload<readonly import("./entities").User[]>>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Bitrix from './../../bitrix';
|
|
2
|
-
const WEBHOOK_URL = process.env
|
|
2
|
+
const WEBHOOK_URL = process.env['WEBHOOK_URL'];
|
|
3
3
|
if (!WEBHOOK_URL) {
|
|
4
4
|
throw Error('Integration tests require environmental variable `WEBHOOK_URL` to be set');
|
|
5
5
|
}
|
|
@@ -26,4 +26,3 @@ describe('Users', () => {
|
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
//# sourceMappingURL=index.integration.test.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Method } from '../../methods';
|
|
2
2
|
import { GetPayload } from '../../payloads';
|
|
3
3
|
import { User } from './entities';
|
|
4
|
-
export
|
|
4
|
+
export declare type UsersMethods = {
|
|
5
5
|
readonly [Method.USER_FIELDS]: {
|
|
6
6
|
readonly type: User;
|
|
7
7
|
readonly payload: GetPayload<User>;
|
|
8
|
-
readonly params?:
|
|
8
|
+
readonly params?: Record<string, unknown>;
|
|
9
9
|
};
|
|
10
10
|
readonly [Method.USER_GET]: {
|
|
11
11
|
readonly type: User;
|
|
12
|
-
readonly payload: GetPayload<
|
|
12
|
+
readonly payload: GetPayload<readonly User[]>;
|
|
13
13
|
readonly params: {
|
|
14
14
|
readonly id?: string;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
}
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Extract value from the `MAP` following the `KEY`
|
|
3
|
+
* It works with `enum` as a `KEY` when matched against dict as `enum` values as a keys,
|
|
4
|
+
* which justifies whole existence of that helper.
|
|
5
|
+
*/
|
|
6
|
+
export declare type ExtractValue<MAP extends Record<string, unknown>, KEY extends string | number | symbol, MAPKEY extends keyof MAP = KEY extends keyof MAP ? KEY : never> = MAP[MAPKEY];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: <E>(x:
|
|
1
|
+
declare const _default: <E>(x: unknown) => x is readonly E[];
|
|
2
2
|
export default _default;
|