@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
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
5
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
6
19
|
if (mod && mod.__esModule) return mod;
|
|
7
20
|
var result = {};
|
|
8
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result
|
|
9
|
-
result
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
10
23
|
return result;
|
|
11
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
12
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
29
|
const got_1 = __importDefault(require("got"));
|
|
14
30
|
const nock_1 = __importDefault(require("nock"));
|
|
15
31
|
const methods_1 = require("../../methods");
|
|
16
32
|
const call_1 = __importStar(require("./call"));
|
|
17
33
|
const TEST_URI = 'https://test.com/rest';
|
|
18
|
-
const call = call_1.default({
|
|
19
|
-
get: got_1.default.extend({
|
|
34
|
+
const call = (0, call_1.default)({
|
|
35
|
+
get: got_1.default.extend({ prefixUrl: TEST_URI, responseType: 'json' }).get
|
|
20
36
|
});
|
|
21
37
|
const RESPONSE_200 = 200;
|
|
22
38
|
describe('Client `handlePayload` method', () => {
|
|
@@ -25,7 +41,7 @@ describe('Client `handlePayload` method', () => {
|
|
|
25
41
|
result: 'done',
|
|
26
42
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' }
|
|
27
43
|
};
|
|
28
|
-
expect(call_1.handlePayload(payload)).toBe(payload);
|
|
44
|
+
expect((0, call_1.handlePayload)(payload)).toBe(payload);
|
|
29
45
|
});
|
|
30
46
|
it('should return `ListPayload`', () => {
|
|
31
47
|
const payload = {
|
|
@@ -35,7 +51,7 @@ describe('Client `handlePayload` method', () => {
|
|
|
35
51
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' },
|
|
36
52
|
total: 1
|
|
37
53
|
};
|
|
38
|
-
expect(call_1.handlePayload(payload)).toBe(payload);
|
|
54
|
+
expect((0, call_1.handlePayload)(payload)).toBe(payload);
|
|
39
55
|
});
|
|
40
56
|
it('should throw when getting error in `ListPayload`', () => {
|
|
41
57
|
const payload = {
|
|
@@ -45,7 +61,7 @@ describe('Client `handlePayload` method', () => {
|
|
|
45
61
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' },
|
|
46
62
|
total: 1
|
|
47
63
|
};
|
|
48
|
-
expect(() => call_1.handlePayload(payload)).toThrowErrorMatchingSnapshot();
|
|
64
|
+
expect(() => (0, call_1.handlePayload)(payload)).toThrowErrorMatchingSnapshot();
|
|
49
65
|
});
|
|
50
66
|
it('should return `BatchPayload` with numbered commands', () => {
|
|
51
67
|
const payload = {
|
|
@@ -58,7 +74,7 @@ describe('Client `handlePayload` method', () => {
|
|
|
58
74
|
},
|
|
59
75
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' }
|
|
60
76
|
};
|
|
61
|
-
expect(call_1.handlePayload(payload)).toBe(payload);
|
|
77
|
+
expect((0, call_1.handlePayload)(payload)).toBe(payload);
|
|
62
78
|
});
|
|
63
79
|
it('should return `BatchPayload` with result from array of commands', () => {
|
|
64
80
|
const payload = {
|
|
@@ -71,7 +87,7 @@ describe('Client `handlePayload` method', () => {
|
|
|
71
87
|
},
|
|
72
88
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' }
|
|
73
89
|
};
|
|
74
|
-
expect(call_1.handlePayload(payload)).toBe(payload);
|
|
90
|
+
expect((0, call_1.handlePayload)(payload)).toBe(payload);
|
|
75
91
|
});
|
|
76
92
|
it('should throw when getting errors in `BatchPayload` with result from named commands', () => {
|
|
77
93
|
const payload = {
|
|
@@ -84,7 +100,7 @@ describe('Client `handlePayload` method', () => {
|
|
|
84
100
|
},
|
|
85
101
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' }
|
|
86
102
|
};
|
|
87
|
-
expect(() => call_1.handlePayload(payload)).toThrowErrorMatchingSnapshot();
|
|
103
|
+
expect(() => (0, call_1.handlePayload)(payload)).toThrowErrorMatchingSnapshot();
|
|
88
104
|
});
|
|
89
105
|
it('should throw when getting errors in `BatchPayload` with result from array of commands', () => {
|
|
90
106
|
const payload = {
|
|
@@ -97,13 +113,13 @@ describe('Client `handlePayload` method', () => {
|
|
|
97
113
|
},
|
|
98
114
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' }
|
|
99
115
|
};
|
|
100
|
-
expect(() => call_1.handlePayload(payload)).toThrowErrorMatchingSnapshot();
|
|
116
|
+
expect(() => (0, call_1.handlePayload)(payload)).toThrowErrorMatchingSnapshot();
|
|
101
117
|
});
|
|
102
118
|
});
|
|
103
119
|
describe('Client `call` method', () => {
|
|
104
120
|
it('should form a proper request', async () => {
|
|
105
121
|
const params = { id: '1' };
|
|
106
|
-
const scope = nock_1.default(TEST_URI)
|
|
122
|
+
const scope = (0, nock_1.default)(TEST_URI)
|
|
107
123
|
.get(`/${methods_1.Method.CRM_DEAL_GET}`)
|
|
108
124
|
.query(params)
|
|
109
125
|
.reply(RESPONSE_200);
|
|
@@ -117,7 +133,7 @@ describe('Client `call` method', () => {
|
|
|
117
133
|
select: ['ID', 'TITLE'],
|
|
118
134
|
start: 50
|
|
119
135
|
};
|
|
120
|
-
const scope = nock_1.default(TEST_URI)
|
|
136
|
+
const scope = (0, nock_1.default)(TEST_URI)
|
|
121
137
|
.get(`/${methods_1.Method.CRM_DEAL_LIST}`)
|
|
122
138
|
.query(params)
|
|
123
139
|
.reply(RESPONSE_200);
|
|
@@ -127,7 +143,7 @@ describe('Client `call` method', () => {
|
|
|
127
143
|
it('should return body as payload', async () => {
|
|
128
144
|
const params = { id: '1' };
|
|
129
145
|
const payload = { test: 'value' };
|
|
130
|
-
nock_1.default(TEST_URI)
|
|
146
|
+
(0, nock_1.default)(TEST_URI)
|
|
131
147
|
.get(`/${methods_1.Method.CRM_DEAL_GET}`)
|
|
132
148
|
.query(params)
|
|
133
149
|
.reply(RESPONSE_200, payload);
|
|
@@ -135,14 +151,14 @@ describe('Client `call` method', () => {
|
|
|
135
151
|
});
|
|
136
152
|
it('should return body as payload with list methods', async () => {
|
|
137
153
|
const payload = { result: ['done'] };
|
|
138
|
-
nock_1.default(TEST_URI)
|
|
154
|
+
(0, nock_1.default)(TEST_URI)
|
|
139
155
|
.get(`/${methods_1.Method.CRM_DEAL_LIST}`)
|
|
140
156
|
.reply(RESPONSE_200, payload);
|
|
141
157
|
expect(await call(methods_1.Method.CRM_DEAL_LIST, {})).toEqual(payload);
|
|
142
158
|
});
|
|
143
159
|
it('should throw when getting errors in payload', () => {
|
|
144
160
|
const payload = { result: ['done'], error: 'Expected error for `getList`' };
|
|
145
|
-
nock_1.default(TEST_URI)
|
|
161
|
+
(0, nock_1.default)(TEST_URI)
|
|
146
162
|
.get(`/${methods_1.Method.CRM_DEAL_LIST}`)
|
|
147
163
|
.reply(RESPONSE_200, payload);
|
|
148
164
|
return expect(call(methods_1.Method.CRM_DEAL_LIST, {})).rejects.toMatchSnapshot();
|
|
@@ -158,11 +174,10 @@ describe('Client `call` method', () => {
|
|
|
158
174
|
},
|
|
159
175
|
time: { start: 1, finish: 1, duration: 1, processing: 1, date_start: 'date', date_finish: 'date' }
|
|
160
176
|
};
|
|
161
|
-
nock_1.default(TEST_URI)
|
|
177
|
+
(0, nock_1.default)(TEST_URI)
|
|
162
178
|
.get(`/${methods_1.Method.BATCH}`)
|
|
163
179
|
.reply(RESPONSE_200, payload);
|
|
164
180
|
return expect(call(methods_1.Method.BATCH, {})).rejects.toMatchSnapshot();
|
|
165
181
|
});
|
|
166
182
|
it.todo('should cast payload to the <P>');
|
|
167
183
|
});
|
|
168
|
-
//# sourceMappingURL=call.unit.test.js.map
|
|
@@ -3,16 +3,28 @@ import { ListableMethod, MethodParams, MethodPayloadType } from '../../methods';
|
|
|
3
3
|
import { BatchPayload, ListPayload } from '../../payloads';
|
|
4
4
|
import { Batch } from './batch';
|
|
5
5
|
import { Call } from './call';
|
|
6
|
+
/**
|
|
7
|
+
* Generates required amount of commands to process specified amount of entries
|
|
8
|
+
*/
|
|
6
9
|
export declare const fillWithCommands: <C extends Command>({ method, params }: C, start: number, toProcess: number, entriesPerCommand: number) => readonly {
|
|
7
10
|
readonly method: C["method"];
|
|
8
11
|
readonly params?: C["params"] | undefined;
|
|
9
12
|
}[];
|
|
10
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Get the highest value from object or an array if there's any
|
|
15
|
+
*/
|
|
16
|
+
export declare const highest: (input: ReadonlyArray<number | undefined> | Record<string, number | undefined>) => number | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Converts batch payload to a list payload
|
|
19
|
+
*/
|
|
11
20
|
export declare const batchToListPayload: <P>(payload: BatchPayload<Record<string, P> | readonly P[]>) => ListPayload<P>;
|
|
12
|
-
|
|
21
|
+
declare type Dependencies = {
|
|
13
22
|
readonly call: Call;
|
|
14
23
|
readonly batch: Batch;
|
|
15
|
-
}
|
|
24
|
+
};
|
|
16
25
|
export declare type List = <M extends ListableMethod>(method: M, params: MethodParams<M>) => Promise<ListPayload<MethodPayloadType<M>>>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets all entries by dispatching required amount of requests. Will fill figure out payload type based on the Method.
|
|
28
|
+
*/
|
|
17
29
|
declare const _default: ({ call, batch }: Dependencies) => List;
|
|
18
30
|
export default _default;
|
|
@@ -3,42 +3,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.batchToListPayload = exports.highest = exports.fillWithCommands = void 0;
|
|
6
7
|
const lodash_range_1 = __importDefault(require("lodash.range"));
|
|
7
8
|
const MAX_ENTRIES_PER_COMMAND = 50;
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Generates required amount of commands to process specified amount of entries
|
|
11
|
+
*/
|
|
12
|
+
const fillWithCommands = ({ method, params }, start, toProcess, entriesPerCommand) => {
|
|
9
13
|
const requiresCommands = Math.ceil((toProcess - start) / entriesPerCommand);
|
|
10
|
-
return lodash_range_1.default(0, requiresCommands)
|
|
11
|
-
.map((i) => ({ method, params:
|
|
14
|
+
return (0, lodash_range_1.default)(0, requiresCommands)
|
|
15
|
+
.map((i) => ({ method, params: { ...params, start: start + (entriesPerCommand * i) } }));
|
|
12
16
|
};
|
|
13
|
-
exports.
|
|
17
|
+
exports.fillWithCommands = fillWithCommands;
|
|
18
|
+
/**
|
|
19
|
+
* Get the highest value from object or an array if there's any
|
|
20
|
+
*/
|
|
21
|
+
const highest = (input) => Object.values(input).reduce((a, b) => a !== undefined && b !== undefined
|
|
14
22
|
? a > b ? a : b
|
|
15
23
|
: a !== undefined && b === undefined
|
|
16
24
|
? a
|
|
17
25
|
: a === undefined && b !== undefined
|
|
18
26
|
? b
|
|
19
27
|
: undefined, undefined);
|
|
20
|
-
exports.
|
|
28
|
+
exports.highest = highest;
|
|
29
|
+
/**
|
|
30
|
+
* Converts batch payload to a list payload
|
|
31
|
+
*/
|
|
32
|
+
const batchToListPayload = (payload) => {
|
|
33
|
+
var _a;
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
21
35
|
const { result: { result, result_total, result_error, result_next }, time } = payload;
|
|
22
|
-
const flattenResult = Object.entries(result).reduce(
|
|
36
|
+
const flattenResult = Object.entries(result).reduce(
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
38
|
+
// @ts-expect-error ignore this for now
|
|
39
|
+
(flatten, [_key, r]) => !r ? flatten : [...flatten, ...r], []);
|
|
23
40
|
return {
|
|
24
41
|
error: Object.values(result_error).join('\n'),
|
|
25
|
-
next: exports.highest(result_next),
|
|
42
|
+
next: (0, exports.highest)(result_next),
|
|
26
43
|
result: flattenResult,
|
|
44
|
+
// @todo Not accurate, we do not care
|
|
27
45
|
time,
|
|
28
|
-
total: exports.highest(result_total)
|
|
46
|
+
total: (_a = (0, exports.highest)(result_total)) !== null && _a !== void 0 ? _a : 0
|
|
29
47
|
};
|
|
30
48
|
};
|
|
49
|
+
exports.batchToListPayload = batchToListPayload;
|
|
50
|
+
/**
|
|
51
|
+
* Gets all entries by dispatching required amount of requests. Will fill figure out payload type based on the Method.
|
|
52
|
+
*/
|
|
31
53
|
exports.default = ({ call, batch }) => {
|
|
32
54
|
const list = async (method, params) => {
|
|
33
|
-
|
|
55
|
+
var _a;
|
|
56
|
+
const start = (_a = params.start) !== null && _a !== void 0 ? _a : 0;
|
|
34
57
|
const listAll = async () => {
|
|
35
|
-
const batchCommands = exports.fillWithCommands({ method, params }, start, firstCall.total, MAX_ENTRIES_PER_COMMAND);
|
|
58
|
+
const batchCommands = (0, exports.fillWithCommands)({ method, params }, start, firstCall.total, MAX_ENTRIES_PER_COMMAND);
|
|
36
59
|
const payload = await batch(batchCommands);
|
|
37
|
-
return exports.batchToListPayload(payload);
|
|
60
|
+
return (0, exports.batchToListPayload)(payload);
|
|
38
61
|
};
|
|
39
|
-
const firstCall = await call(method,
|
|
40
|
-
return !firstCall.next ? firstCall : listAll();
|
|
62
|
+
const firstCall = await call(method, { ...params, start });
|
|
63
|
+
return !firstCall.next ? firstCall : await listAll();
|
|
41
64
|
};
|
|
42
65
|
return list;
|
|
43
66
|
};
|
|
44
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
2
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
19
|
if (mod && mod.__esModule) return mod;
|
|
4
20
|
var result = {};
|
|
5
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result
|
|
6
|
-
result
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
7
23
|
return result;
|
|
8
24
|
};
|
|
9
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -15,14 +31,14 @@ describe('Client `fillWithCommands` method', () => {
|
|
|
15
31
|
const start = 0;
|
|
16
32
|
const toProcess = 7;
|
|
17
33
|
const entriesPerCommand = 2;
|
|
18
|
-
expect(list_1.fillWithCommands(command, start, toProcess, entriesPerCommand)).toMatchSnapshot();
|
|
34
|
+
expect((0, list_1.fillWithCommands)(command, start, toProcess, entriesPerCommand)).toMatchSnapshot();
|
|
19
35
|
});
|
|
20
36
|
it('should properly take into account start', () => {
|
|
21
37
|
const command = { method: methods_1.Method.CRM_DEAL_LIST, params: { select: ['*'] } };
|
|
22
38
|
const start = 2;
|
|
23
39
|
const toProcess = 7;
|
|
24
40
|
const entriesPerCommand = 2;
|
|
25
|
-
expect(list_1.fillWithCommands(command, start, toProcess, entriesPerCommand)).toMatchSnapshot();
|
|
41
|
+
expect((0, list_1.fillWithCommands)(command, start, toProcess, entriesPerCommand)).toMatchSnapshot();
|
|
26
42
|
});
|
|
27
43
|
it('should override `params.start`', () => {
|
|
28
44
|
const wrongStart = 99;
|
|
@@ -30,26 +46,26 @@ describe('Client `fillWithCommands` method', () => {
|
|
|
30
46
|
const start = 0;
|
|
31
47
|
const toProcess = 2;
|
|
32
48
|
const entriesPerCommand = 1;
|
|
33
|
-
const commands = list_1.fillWithCommands(command, start, toProcess, entriesPerCommand);
|
|
49
|
+
const commands = (0, list_1.fillWithCommands)(command, start, toProcess, entriesPerCommand);
|
|
34
50
|
expect(Object.values(commands).map((c) => c.params)).toMatchSnapshot();
|
|
35
51
|
});
|
|
36
52
|
});
|
|
37
53
|
describe('Client `highest` method', () => {
|
|
38
54
|
it('should get highest value from object', () => {
|
|
39
|
-
expect(list_1.highest({ a: undefined })).toBe(undefined);
|
|
40
|
-
expect(list_1.highest({ a: undefined, b: undefined })).toBe(undefined);
|
|
41
|
-
expect(list_1.highest({ a: 1, b: undefined })).toBe(1);
|
|
42
|
-
expect(list_1.highest({ a: undefined, b: 1 })).toBe(1);
|
|
43
|
-
expect(list_1.highest({ a: 1, b: 2 })).toBe(2);
|
|
44
|
-
expect(list_1.highest({ a: 2, b: 1 })).toBe(2);
|
|
55
|
+
expect((0, list_1.highest)({ a: undefined })).toBe(undefined);
|
|
56
|
+
expect((0, list_1.highest)({ a: undefined, b: undefined })).toBe(undefined);
|
|
57
|
+
expect((0, list_1.highest)({ a: 1, b: undefined })).toBe(1);
|
|
58
|
+
expect((0, list_1.highest)({ a: undefined, b: 1 })).toBe(1);
|
|
59
|
+
expect((0, list_1.highest)({ a: 1, b: 2 })).toBe(2);
|
|
60
|
+
expect((0, list_1.highest)({ a: 2, b: 1 })).toBe(2);
|
|
45
61
|
});
|
|
46
62
|
it('should get highest value from array', () => {
|
|
47
|
-
expect(list_1.highest([undefined])).toBe(undefined);
|
|
48
|
-
expect(list_1.highest([undefined, undefined])).toBe(undefined);
|
|
49
|
-
expect(list_1.highest([1, undefined])).toBe(1);
|
|
50
|
-
expect(list_1.highest([undefined, 1])).toBe(1);
|
|
51
|
-
expect(list_1.highest([1, 2])).toBe(2);
|
|
52
|
-
expect(list_1.highest([2, 1])).toBe(2);
|
|
63
|
+
expect((0, list_1.highest)([undefined])).toBe(undefined);
|
|
64
|
+
expect((0, list_1.highest)([undefined, undefined])).toBe(undefined);
|
|
65
|
+
expect((0, list_1.highest)([1, undefined])).toBe(1);
|
|
66
|
+
expect((0, list_1.highest)([undefined, 1])).toBe(1);
|
|
67
|
+
expect((0, list_1.highest)([1, 2])).toBe(2);
|
|
68
|
+
expect((0, list_1.highest)([2, 1])).toBe(2);
|
|
53
69
|
});
|
|
54
70
|
});
|
|
55
71
|
describe('Client `batchToListPayload` method', () => {
|
|
@@ -91,7 +107,7 @@ describe('Client `batchToListPayload` method', () => {
|
|
|
91
107
|
date_finish: '2019-08-30T23:28:11+03:00'
|
|
92
108
|
}
|
|
93
109
|
};
|
|
94
|
-
expect(list_1.batchToListPayload(payload)).toMatchSnapshot();
|
|
110
|
+
expect((0, list_1.batchToListPayload)(payload)).toMatchSnapshot();
|
|
95
111
|
});
|
|
96
112
|
it('should convert batch with payload of arrays to a list payload', () => {
|
|
97
113
|
const payload = {
|
|
@@ -128,7 +144,7 @@ describe('Client `batchToListPayload` method', () => {
|
|
|
128
144
|
date_finish: '2019-08-30T23:28:11+03:00'
|
|
129
145
|
}
|
|
130
146
|
};
|
|
131
|
-
expect(list_1.batchToListPayload(payload)).toMatchSnapshot();
|
|
147
|
+
expect((0, list_1.batchToListPayload)(payload)).toMatchSnapshot();
|
|
132
148
|
});
|
|
133
149
|
it('should handle undefined in `result`', () => {
|
|
134
150
|
const payload = {
|
|
@@ -162,14 +178,14 @@ describe('Client `batchToListPayload` method', () => {
|
|
|
162
178
|
date_finish: '2019-08-30T23:28:11+03:00'
|
|
163
179
|
}
|
|
164
180
|
};
|
|
165
|
-
expect(list_1.batchToListPayload(payload)).toMatchSnapshot();
|
|
181
|
+
expect((0, list_1.batchToListPayload)(payload)).toMatchSnapshot();
|
|
166
182
|
});
|
|
167
183
|
});
|
|
168
184
|
describe('Client `list` method', () => {
|
|
169
185
|
it('should make one request when entries can be fetched in one go', async () => {
|
|
170
186
|
const callMock = jest.fn(() => Promise.resolve({ next: false }));
|
|
171
187
|
const batchMock = jest.fn(() => Promise.resolve({}));
|
|
172
|
-
const list = list_1.default({ call: callMock, batch: batchMock });
|
|
188
|
+
const list = (0, list_1.default)({ call: callMock, batch: batchMock });
|
|
173
189
|
await list(methods_1.Method.CRM_DEAL_LIST, {});
|
|
174
190
|
expect(callMock.mock.calls).toMatchSnapshot();
|
|
175
191
|
expect(batchMock).not.toBeCalled();
|
|
@@ -186,7 +202,7 @@ describe('Client `list` method', () => {
|
|
|
186
202
|
},
|
|
187
203
|
time: {}
|
|
188
204
|
}));
|
|
189
|
-
const list = list_1.default({ call: callMock, batch: batchMock });
|
|
205
|
+
const list = (0, list_1.default)({ call: callMock, batch: batchMock });
|
|
190
206
|
await list(methods_1.Method.CRM_DEAL_LIST, {});
|
|
191
207
|
expect(callMock.mock.calls).toMatchSnapshot();
|
|
192
208
|
expect(batchMock.mock.calls).toMatchSnapshot();
|
|
@@ -195,7 +211,7 @@ describe('Client `list` method', () => {
|
|
|
195
211
|
const mockPayload = { next: false, result: 'test' };
|
|
196
212
|
const callMock = jest.fn(() => Promise.resolve(mockPayload));
|
|
197
213
|
const batchMock = jest.fn(() => Promise.resolve({}));
|
|
198
|
-
const list = list_1.default({ call: callMock, batch: batchMock });
|
|
214
|
+
const list = (0, list_1.default)({ call: callMock, batch: batchMock });
|
|
199
215
|
const payload = await list(methods_1.Method.CRM_DEAL_LIST, {});
|
|
200
216
|
expect(payload).toEqual(mockPayload);
|
|
201
217
|
});
|
|
@@ -218,7 +234,7 @@ describe('Client `list` method', () => {
|
|
|
218
234
|
};
|
|
219
235
|
const callMock = jest.fn(() => Promise.resolve({ next: 2 }));
|
|
220
236
|
const batchMock = jest.fn(() => Promise.resolve(mockPayload));
|
|
221
|
-
const list = list_1.default({ call: callMock, batch: batchMock });
|
|
237
|
+
const list = (0, list_1.default)({ call: callMock, batch: batchMock });
|
|
222
238
|
const payload = await list(methods_1.Method.CRM_DEAL_LIST, {});
|
|
223
239
|
expect(payload).toMatchSnapshot();
|
|
224
240
|
});
|
|
@@ -234,7 +250,7 @@ describe('Client `list` method', () => {
|
|
|
234
250
|
},
|
|
235
251
|
time: {}
|
|
236
252
|
}));
|
|
237
|
-
const list = list_1.default({ call: callMock, batch: batchMock });
|
|
253
|
+
const list = (0, list_1.default)({ call: callMock, batch: batchMock });
|
|
238
254
|
await list(methods_1.Method.CRM_DEAL_LIST, {});
|
|
239
255
|
expect(callMock.mock.calls[0]).toMatchSnapshot();
|
|
240
256
|
expect(batchMock.mock.calls[0]).toMatchSnapshot();
|
|
@@ -251,7 +267,7 @@ describe('Client `list` method', () => {
|
|
|
251
267
|
},
|
|
252
268
|
time: {}
|
|
253
269
|
}));
|
|
254
|
-
const list = list_1.default({ call: callMock, batch: batchMock });
|
|
270
|
+
const list = (0, list_1.default)({ call: callMock, batch: batchMock });
|
|
255
271
|
await list(methods_1.Method.CRM_DEAL_LIST, { start: 27 });
|
|
256
272
|
expect(callMock.mock.calls).toMatchSnapshot();
|
|
257
273
|
expect(batchMock.mock.calls).toMatchSnapshot();
|
|
@@ -259,4 +275,3 @@ describe('Client `list` method', () => {
|
|
|
259
275
|
it.todo('should cast first request payload to the <P>');
|
|
260
276
|
it.todo('should cast payload results to the <P>');
|
|
261
277
|
});
|
|
262
|
-
//# sourceMappingURL=list.unit.test.js.map
|
package/build/main/commands.d.ts
CHANGED
package/build/main/commands.js
CHANGED
package/build/main/methods.d.ts
CHANGED
|
@@ -42,14 +42,14 @@ export declare enum Method {
|
|
|
42
42
|
declare const LISTABLE_METHODS: readonly [Method.CRM_COMPANY_LIST, Method.CRM_CONTACT_LIST, Method.CRM_DEAL_LIST, Method.CRM_LEAD_LIST];
|
|
43
43
|
export declare type ListableMethod = typeof LISTABLE_METHODS[number];
|
|
44
44
|
export declare type GettableMethod = Diff<Method, ListableMethod>;
|
|
45
|
-
|
|
45
|
+
declare type MethodsMap = {
|
|
46
46
|
readonly [key: string]: {
|
|
47
47
|
readonly type: unknown;
|
|
48
48
|
readonly payload: unknown;
|
|
49
|
-
readonly params: Record<string,
|
|
49
|
+
readonly params: Record<string, unknown>;
|
|
50
50
|
};
|
|
51
|
-
}
|
|
52
|
-
export
|
|
51
|
+
};
|
|
52
|
+
export declare type ListParams = {
|
|
53
53
|
readonly start?: number;
|
|
54
54
|
readonly order?: {
|
|
55
55
|
readonly [key: string]: string;
|
|
@@ -57,17 +57,36 @@ export interface ListParams {
|
|
|
57
57
|
readonly filter?: {
|
|
58
58
|
readonly [key: string]: string | number;
|
|
59
59
|
};
|
|
60
|
-
readonly select?:
|
|
61
|
-
}
|
|
62
|
-
|
|
60
|
+
readonly select?: readonly string[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* A mega map of all supported Bitrix methods to their parameters. Used to resolve
|
|
64
|
+
* low-level client method required params and payload types.
|
|
65
|
+
* - `type` — a type that method associated with
|
|
66
|
+
* - `payload` — a payload that method returns
|
|
67
|
+
* - `params` — params that method accepts
|
|
68
|
+
*/
|
|
69
|
+
export declare type Methods = MethodsMap & CompaniesMethods & ContactsMethods & DealsMethods & LeadsMethods & StatusesMethods & UsersMethods & {
|
|
63
70
|
readonly [Method.BATCH]: {
|
|
64
71
|
readonly type: unknown;
|
|
65
72
|
readonly payload: BatchPayload<unknown>;
|
|
66
73
|
readonly params: Commands;
|
|
67
74
|
};
|
|
68
|
-
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Retrieve specified method data
|
|
78
|
+
*/
|
|
69
79
|
export declare type MethodData<M extends Method> = ExtractValue<Methods, M>;
|
|
80
|
+
/**
|
|
81
|
+
* Retrieve associated with specified method type
|
|
82
|
+
*/
|
|
70
83
|
export declare type MethodPayloadType<M extends Method> = MethodData<M>['type'];
|
|
84
|
+
/**
|
|
85
|
+
* Retrieve specified method payload type
|
|
86
|
+
*/
|
|
71
87
|
export declare type MethodPayload<M extends Method> = MethodData<M>['payload'];
|
|
88
|
+
/**
|
|
89
|
+
* Retrieve specified method params
|
|
90
|
+
*/
|
|
72
91
|
export declare type MethodParams<M extends Method> = MethodData<M>['params'];
|
|
73
92
|
export {};
|
package/build/main/methods.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Method = void 0;
|
|
3
4
|
var Method;
|
|
4
5
|
(function (Method) {
|
|
5
6
|
Method["BATCH"] = "batch";
|
|
@@ -38,4 +39,3 @@ const LISTABLE_METHODS = [
|
|
|
38
39
|
Method.CRM_DEAL_LIST,
|
|
39
40
|
Method.CRM_LEAD_LIST
|
|
40
41
|
];
|
|
41
|
-
//# sourceMappingURL=methods.js.map
|
package/build/main/payloads.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare type PayloadTime = {
|
|
2
2
|
readonly start: number;
|
|
3
3
|
readonly finish: number;
|
|
4
4
|
readonly duration: number;
|
|
5
5
|
readonly processing: number;
|
|
6
6
|
readonly date_start: string;
|
|
7
7
|
readonly date_finish: string;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
};
|
|
9
|
+
export declare type GetPayload<P> = {
|
|
10
10
|
readonly result: P;
|
|
11
11
|
readonly time: PayloadTime;
|
|
12
|
-
}
|
|
13
|
-
export
|
|
12
|
+
};
|
|
13
|
+
export declare type ListPayload<P> = {
|
|
14
14
|
readonly result: readonly P[];
|
|
15
15
|
readonly error?: string;
|
|
16
16
|
readonly total: number;
|
|
17
17
|
readonly next?: number;
|
|
18
18
|
readonly time: PayloadTime;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
19
|
+
};
|
|
20
|
+
export declare type BatchPayload<C> = {
|
|
21
21
|
readonly result: {
|
|
22
22
|
readonly result: {
|
|
23
23
|
readonly [P in keyof C]?: C[P];
|
|
@@ -36,5 +36,5 @@ export interface BatchPayload<C> {
|
|
|
36
36
|
} | readonly PayloadTime[];
|
|
37
37
|
};
|
|
38
38
|
readonly time: PayloadTime;
|
|
39
|
-
}
|
|
39
|
+
};
|
|
40
40
|
export declare type Payload<P> = GetPayload<P> | ListPayload<P> | BatchPayload<P>;
|
package/build/main/payloads.js
CHANGED
|
@@ -2,7 +2,7 @@ export declare type NumberString = string;
|
|
|
2
2
|
export declare type ISODate = string;
|
|
3
3
|
export declare type BoolString = 'Y' | 'N';
|
|
4
4
|
export declare type GenderString = 'M' | 'F' | '';
|
|
5
|
-
export
|
|
5
|
+
export declare type Fields = {
|
|
6
6
|
readonly [key: string]: {
|
|
7
7
|
readonly type: string;
|
|
8
8
|
readonly isRequired: boolean;
|
|
@@ -12,10 +12,11 @@ export interface Fields {
|
|
|
12
12
|
readonly isDynamic: boolean;
|
|
13
13
|
readonly title: string;
|
|
14
14
|
};
|
|
15
|
-
}
|
|
16
|
-
export
|
|
15
|
+
};
|
|
16
|
+
export declare type MultiField = {
|
|
17
17
|
readonly ID: NumberString;
|
|
18
18
|
readonly VALUE_TYPE: string;
|
|
19
19
|
readonly VALUE: string;
|
|
20
20
|
readonly TYPE_ID: string;
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
|
+
export declare type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BoolString, ISODate, MultiField, NumberString } from '../common';
|
|
2
|
-
export
|
|
2
|
+
export declare type Company = {
|
|
3
|
+
readonly [key: string]: string | boolean | null | readonly MultiField[];
|
|
3
4
|
readonly ID: NumberString;
|
|
4
5
|
readonly COMPANY_TYPE: string | null;
|
|
5
6
|
readonly TITLE: string | null;
|
|
@@ -8,10 +9,10 @@ export interface Company {
|
|
|
8
9
|
readonly HAS_PHONE: BoolString;
|
|
9
10
|
readonly HAS_EMAIL: BoolString;
|
|
10
11
|
readonly HAS_IMOL: BoolString;
|
|
11
|
-
readonly PHONE:
|
|
12
|
-
readonly EMAIL:
|
|
13
|
-
readonly WEB:
|
|
14
|
-
readonly IM:
|
|
12
|
+
readonly PHONE: readonly MultiField[];
|
|
13
|
+
readonly EMAIL: readonly MultiField[];
|
|
14
|
+
readonly WEB: readonly MultiField[];
|
|
15
|
+
readonly IM: readonly MultiField[];
|
|
15
16
|
readonly ASSIGNED_BY_ID: NumberString;
|
|
16
17
|
readonly CREATED_BY_ID: NumberString;
|
|
17
18
|
readonly MODIFY_BY_ID: NumberString;
|
|
@@ -50,4 +51,4 @@ export interface Company {
|
|
|
50
51
|
readonly UTM_CAMPAIGN: string | null;
|
|
51
52
|
readonly UTM_CONTENT: string | null;
|
|
52
53
|
readonly UTM_TERM: string | null;
|
|
53
|
-
}
|
|
54
|
+
};
|