@or-sdk/hitl 0.34.68 → 0.34.69-beta.3622.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/dist/cjs/api/Agents.js +71 -49
- package/dist/cjs/api/Agents.js.map +1 -1
- package/dist/cjs/api/CannedMessages.js +34 -24
- package/dist/cjs/api/CannedMessages.js.map +1 -1
- package/dist/cjs/api/Commands.js +18 -9
- package/dist/cjs/api/Commands.js.map +1 -1
- package/dist/cjs/api/Conferences.js +33 -20
- package/dist/cjs/api/Conferences.js.map +1 -1
- package/dist/cjs/api/ContactRuleGroups.js +36 -18
- package/dist/cjs/api/ContactRuleGroups.js.map +1 -1
- package/dist/cjs/api/ContactsMeta.js +4 -2
- package/dist/cjs/api/ContactsMeta.js.map +1 -1
- package/dist/cjs/api/EventTemplates.js +30 -19
- package/dist/cjs/api/EventTemplates.js.map +1 -1
- package/dist/cjs/api/Filters.js +46 -18
- package/dist/cjs/api/Filters.js.map +1 -1
- package/dist/cjs/api/HITLBase.js +3 -7
- package/dist/cjs/api/HITLBase.js.map +1 -1
- package/dist/cjs/api/Listeners.js +35 -23
- package/dist/cjs/api/Listeners.js.map +1 -1
- package/dist/cjs/api/Migrations.js +33 -23
- package/dist/cjs/api/Migrations.js.map +1 -1
- package/dist/cjs/api/RuleGroups.js +36 -18
- package/dist/cjs/api/RuleGroups.js.map +1 -1
- package/dist/cjs/api/SessionEvents.js +38 -26
- package/dist/cjs/api/SessionEvents.js.map +1 -1
- package/dist/cjs/api/SessionRelations.js +12 -7
- package/dist/cjs/api/SessionRelations.js.map +1 -1
- package/dist/cjs/api/Sessions.js +90 -72
- package/dist/cjs/api/Sessions.js.map +1 -1
- package/dist/cjs/api/Settings.js +37 -18
- package/dist/cjs/api/Settings.js.map +1 -1
- package/dist/cjs/api/Tasks.js +15 -9
- package/dist/cjs/api/Tasks.js.map +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/esm/api/Agents.js +39 -33
- package/dist/esm/api/Agents.js.map +1 -1
- package/dist/esm/api/CannedMessages.js +23 -13
- package/dist/esm/api/CannedMessages.js.map +1 -1
- package/dist/esm/api/Commands.js +17 -7
- package/dist/esm/api/Commands.js.map +1 -1
- package/dist/esm/api/Conferences.js +34 -21
- package/dist/esm/api/Conferences.js.map +1 -1
- package/dist/esm/api/ContactRuleGroups.js +32 -18
- package/dist/esm/api/ContactRuleGroups.js.map +1 -1
- package/dist/esm/api/ContactsMeta.js +1 -2
- package/dist/esm/api/ContactsMeta.js.map +1 -1
- package/dist/esm/api/EventTemplates.js +19 -14
- package/dist/esm/api/EventTemplates.js.map +1 -1
- package/dist/esm/api/Filters.js +35 -21
- package/dist/esm/api/Filters.js.map +1 -1
- package/dist/esm/api/HITLBase.js +2 -3
- package/dist/esm/api/HITLBase.js.map +1 -1
- package/dist/esm/api/Listeners.js +24 -13
- package/dist/esm/api/Listeners.js.map +1 -1
- package/dist/esm/api/Migrations.js +20 -12
- package/dist/esm/api/Migrations.js.map +1 -1
- package/dist/esm/api/RuleGroups.js +32 -18
- package/dist/esm/api/RuleGroups.js.map +1 -1
- package/dist/esm/api/SessionEvents.js +24 -21
- package/dist/esm/api/SessionEvents.js.map +1 -1
- package/dist/esm/api/SessionRelations.js +3 -4
- package/dist/esm/api/SessionRelations.js.map +1 -1
- package/dist/esm/api/Sessions.js +60 -57
- package/dist/esm/api/Sessions.js.map +1 -1
- package/dist/esm/api/Settings.js +23 -14
- package/dist/esm/api/Settings.js.map +1 -1
- package/dist/esm/api/Tasks.js +14 -7
- package/dist/esm/api/Tasks.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/types/api/Agents.d.ts +7 -5
- package/dist/types/api/Agents.d.ts.map +1 -1
- package/dist/types/api/CannedMessages.d.ts +2 -2
- package/dist/types/api/CannedMessages.d.ts.map +1 -1
- package/dist/types/api/Commands.d.ts +1 -1
- package/dist/types/api/Commands.d.ts.map +1 -1
- package/dist/types/api/Conferences.d.ts +3 -3
- package/dist/types/api/Conferences.d.ts.map +1 -1
- package/dist/types/api/ContactRuleGroups.d.ts +4 -4
- package/dist/types/api/ContactRuleGroups.d.ts.map +1 -1
- package/dist/types/api/ContactsMeta.d.ts.map +1 -1
- package/dist/types/api/EventTemplates.d.ts +2 -2
- package/dist/types/api/EventTemplates.d.ts.map +1 -1
- package/dist/types/api/Filters.d.ts +1 -1
- package/dist/types/api/Filters.d.ts.map +1 -1
- package/dist/types/api/HITLBase.d.ts +3 -1
- package/dist/types/api/HITLBase.d.ts.map +1 -1
- package/dist/types/api/Listeners.d.ts +3 -3
- package/dist/types/api/Listeners.d.ts.map +1 -1
- package/dist/types/api/Migrations.d.ts +2 -2
- package/dist/types/api/Migrations.d.ts.map +1 -1
- package/dist/types/api/RuleGroups.d.ts +4 -4
- package/dist/types/api/RuleGroups.d.ts.map +1 -1
- package/dist/types/api/SessionEvents.d.ts +7 -3
- package/dist/types/api/SessionEvents.d.ts.map +1 -1
- package/dist/types/api/SessionRelations.d.ts.map +1 -1
- package/dist/types/api/Sessions.d.ts +20 -20
- package/dist/types/api/Sessions.d.ts.map +1 -1
- package/dist/types/api/Settings.d.ts +2 -2
- package/dist/types/api/Settings.d.ts.map +1 -1
- package/dist/types/api/Tasks.d.ts +1 -1
- package/dist/types/api/Tasks.d.ts.map +1 -1
- package/dist/types/constants.d.ts +3 -3
- package/dist/types/constants.d.ts.map +1 -1
- package/package.json +5 -7
- package/src/api/Agents.ts +38 -28
- package/src/api/CannedMessages.ts +16 -11
- package/src/api/Commands.ts +6 -7
- package/src/api/Conferences.ts +29 -19
- package/src/api/ContactRuleGroups.ts +19 -15
- package/src/api/ContactsMeta.ts +4 -3
- package/src/api/EventTemplates.ts +10 -13
- package/src/api/Filters.ts +34 -27
- package/src/api/HITLBase.ts +2 -4
- package/src/api/Listeners.ts +16 -12
- package/src/api/Migrations.ts +13 -10
- package/src/api/RuleGroups.ts +19 -15
- package/src/api/SessionEvents.ts +21 -16
- package/src/api/SessionRelations.ts +12 -6
- package/src/api/Sessions.ts +58 -60
- package/src/api/Settings.ts +17 -14
- package/src/api/Tasks.ts +3 -7
- package/src/constants.ts +2 -3
package/src/api/Commands.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
1
|
import { ApplyCommandOptions } from '../types/commands';
|
|
4
2
|
|
|
5
3
|
import { HITLBase } from './HITLBase';
|
|
@@ -12,17 +10,18 @@ export class Commands extends HITLBase {
|
|
|
12
10
|
* @param options
|
|
13
11
|
*/
|
|
14
12
|
public static async applyCommandToSession(
|
|
15
|
-
options: ApplyCommandOptions
|
|
13
|
+
{ command, sessionId, data, ...options }: ApplyCommandOptions
|
|
16
14
|
): Promise<void> {
|
|
17
15
|
const route = this.getBaseUrl(options);
|
|
18
|
-
const params = _.pick(options, ['command', 'sessionId']);
|
|
19
|
-
const data = _.pick(options, ['data']);
|
|
20
16
|
|
|
21
17
|
return this.request({
|
|
22
18
|
method: 'POST',
|
|
23
19
|
route,
|
|
24
|
-
params
|
|
25
|
-
|
|
20
|
+
params: {
|
|
21
|
+
command,
|
|
22
|
+
sessionId,
|
|
23
|
+
},
|
|
24
|
+
data: { data },
|
|
26
25
|
...this.getBaseSettings(options),
|
|
27
26
|
});
|
|
28
27
|
}
|
package/src/api/Conferences.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
GetConferenceMembersOptions,
|
|
5
3
|
GetConferenceMembersResponse,
|
|
@@ -18,14 +16,16 @@ export class Conferences extends HITLBase {
|
|
|
18
16
|
* @param options
|
|
19
17
|
*/
|
|
20
18
|
public static getConferenceMembers(
|
|
21
|
-
options: GetConferenceMembersOptions
|
|
19
|
+
{ hitlSessionId, memberId, ...options }: GetConferenceMembersOptions
|
|
22
20
|
): Promise<GetConferenceMembersResponse | Conference> {
|
|
23
21
|
const route = this.getBaseUrl(options);
|
|
24
|
-
const params = _.pick(options, ['hitlSessionId', 'memberId']);
|
|
25
22
|
|
|
26
23
|
return this.request({
|
|
27
24
|
route,
|
|
28
|
-
params
|
|
25
|
+
params: {
|
|
26
|
+
hitlSessionId,
|
|
27
|
+
memberId,
|
|
28
|
+
},
|
|
29
29
|
...this.getBaseSettings(options),
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -35,23 +35,31 @@ export class Conferences extends HITLBase {
|
|
|
35
35
|
* @param options
|
|
36
36
|
*/
|
|
37
37
|
public static addOrUpdateConferenceMember(
|
|
38
|
-
|
|
38
|
+
{
|
|
39
|
+
hitlSessionId,
|
|
40
|
+
memberId,
|
|
41
|
+
identifier,
|
|
42
|
+
type,
|
|
43
|
+
status,
|
|
44
|
+
state,
|
|
45
|
+
disconnectedAt,
|
|
46
|
+
...options
|
|
47
|
+
}: AddOrUpdateConferenceMemberOptions
|
|
39
48
|
): Promise<Conference> {
|
|
40
49
|
const route = this.getBaseUrl(options);
|
|
41
|
-
const data = _.pick(options, [
|
|
42
|
-
'hitlSessionId',
|
|
43
|
-
'memberId',
|
|
44
|
-
'identifier',
|
|
45
|
-
'type',
|
|
46
|
-
'status',
|
|
47
|
-
'state',
|
|
48
|
-
'disconnectedAt',
|
|
49
|
-
]);
|
|
50
50
|
|
|
51
51
|
return this.request({
|
|
52
52
|
method: 'POST',
|
|
53
53
|
route,
|
|
54
|
-
data
|
|
54
|
+
data: {
|
|
55
|
+
hitlSessionId,
|
|
56
|
+
memberId,
|
|
57
|
+
identifier,
|
|
58
|
+
type,
|
|
59
|
+
status,
|
|
60
|
+
state,
|
|
61
|
+
disconnectedAt,
|
|
62
|
+
},
|
|
55
63
|
...this.getBaseSettings(options),
|
|
56
64
|
});
|
|
57
65
|
}
|
|
@@ -61,15 +69,17 @@ export class Conferences extends HITLBase {
|
|
|
61
69
|
* @param options
|
|
62
70
|
*/
|
|
63
71
|
public static cleanUpConference(
|
|
64
|
-
options: CleanUpConferenceOptions
|
|
72
|
+
{ hitlSessionId, memberId, ...options }: CleanUpConferenceOptions
|
|
65
73
|
): Promise<void> {
|
|
66
74
|
const route = this.getBaseUrl(options);
|
|
67
|
-
const params = _.pick(options, ['hitlSessionId', 'memberId']);
|
|
68
75
|
|
|
69
76
|
return this.request({
|
|
70
77
|
method: 'DELETE',
|
|
71
78
|
route,
|
|
72
|
-
params
|
|
79
|
+
params: {
|
|
80
|
+
hitlSessionId,
|
|
81
|
+
memberId,
|
|
82
|
+
},
|
|
73
83
|
...this.getBaseSettings(options),
|
|
74
84
|
});
|
|
75
85
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
1
|
import { DEFAULT_OMIT_FIELDS } from '../constants';
|
|
4
2
|
import {
|
|
5
3
|
SearchRuleGroupsOptions,
|
|
@@ -20,16 +18,17 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
20
18
|
* @param options
|
|
21
19
|
*/
|
|
22
20
|
public static searchContactRuleGroups(
|
|
23
|
-
options: SearchRuleGroupsOptions = {}
|
|
21
|
+
{ groupIdList, ...options }: SearchRuleGroupsOptions = {}
|
|
24
22
|
): Promise<SearchRuleGroupsResponse | RuleGroup> {
|
|
25
23
|
const route = this.getBaseUrl(options);
|
|
26
|
-
const params =
|
|
27
|
-
|
|
24
|
+
const params = Object.fromEntries(
|
|
25
|
+
Object.entries(options).filter(([key]) => ![...DEFAULT_OMIT_FIELDS, 'accountId'].includes(key))
|
|
26
|
+
);
|
|
28
27
|
|
|
29
28
|
return this.request({
|
|
30
29
|
route,
|
|
31
30
|
params,
|
|
32
|
-
data,
|
|
31
|
+
data: { groupIdList },
|
|
33
32
|
...this.getBaseSettings(options),
|
|
34
33
|
});
|
|
35
34
|
}
|
|
@@ -39,15 +38,18 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
39
38
|
* @param options
|
|
40
39
|
*/
|
|
41
40
|
public static createContactRuleGroup(
|
|
42
|
-
options: CreateRuleGroupOptions
|
|
41
|
+
{ groupId, name, rules, ...options }: CreateRuleGroupOptions
|
|
43
42
|
): Promise<RuleGroup> {
|
|
44
43
|
const route = this.getBaseUrl(options);
|
|
45
|
-
const data = _.pick(options, ['groupId', 'name', 'rules']);
|
|
46
44
|
|
|
47
45
|
return this.request({
|
|
48
46
|
method: 'POST',
|
|
49
47
|
route,
|
|
50
|
-
data
|
|
48
|
+
data: {
|
|
49
|
+
groupId,
|
|
50
|
+
name,
|
|
51
|
+
rules,
|
|
52
|
+
},
|
|
51
53
|
...this.getBaseSettings(options),
|
|
52
54
|
});
|
|
53
55
|
}
|
|
@@ -57,15 +59,18 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
57
59
|
* @param options
|
|
58
60
|
*/
|
|
59
61
|
public static updateContactRuleGroup(
|
|
60
|
-
options: UpdateRuleGroupOptions
|
|
62
|
+
{ groupId, name, rules, ...options }: UpdateRuleGroupOptions
|
|
61
63
|
): Promise<RuleGroup> {
|
|
62
64
|
const route = this.getBaseUrl(options);
|
|
63
|
-
const data = _.pick(options, ['groupId', 'name', 'rules']);
|
|
64
65
|
|
|
65
66
|
return this.request({
|
|
66
67
|
method: 'PUT',
|
|
67
68
|
route,
|
|
68
|
-
data
|
|
69
|
+
data: {
|
|
70
|
+
groupId,
|
|
71
|
+
name,
|
|
72
|
+
rules,
|
|
73
|
+
},
|
|
69
74
|
...this.getBaseSettings(options),
|
|
70
75
|
});
|
|
71
76
|
}
|
|
@@ -75,15 +80,14 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
75
80
|
* @param options
|
|
76
81
|
*/
|
|
77
82
|
public static deleteContactRuleGroup(
|
|
78
|
-
options: DeleteRuleGroupOptions
|
|
83
|
+
{ groupId, ...options }: DeleteRuleGroupOptions
|
|
79
84
|
): Promise<void> {
|
|
80
85
|
const route = this.getBaseUrl(options);
|
|
81
|
-
const params = _.pick(options, ['groupId']);
|
|
82
86
|
|
|
83
87
|
return this.request({
|
|
84
88
|
method: 'DELETE',
|
|
85
89
|
route,
|
|
86
|
-
params,
|
|
90
|
+
params: { groupId },
|
|
87
91
|
...this.getBaseSettings(options),
|
|
88
92
|
});
|
|
89
93
|
}
|
package/src/api/ContactsMeta.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
1
|
import URI from 'urijs';
|
|
3
2
|
|
|
4
3
|
import { DEFAULT_OMIT_FIELDS } from '../constants';
|
|
@@ -16,7 +15,7 @@ export class ContactsMeta extends HITLBase {
|
|
|
16
15
|
/**
|
|
17
16
|
* @description Get HitL specific Contacts parameters (meta info):
|
|
18
17
|
* a list of Contact record fields visible in CRM card,
|
|
19
|
-
*
|
|
18
|
+
* identifier to conversation trigger map, etc.
|
|
20
19
|
* @param options
|
|
21
20
|
*/
|
|
22
21
|
public static async searchContactsMeta(
|
|
@@ -24,7 +23,9 @@ export class ContactsMeta extends HITLBase {
|
|
|
24
23
|
): Promise<SearchContactsMetaResponse> {
|
|
25
24
|
const baseUrl = this.getBaseUrl(options);
|
|
26
25
|
const route = new URI(baseUrl).segment(this.SEARCH_URL).href();
|
|
27
|
-
const data =
|
|
26
|
+
const data = Object.fromEntries(
|
|
27
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
28
|
+
);
|
|
28
29
|
|
|
29
30
|
return this.request({
|
|
30
31
|
method: 'POST',
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
1
|
import { DEFAULT_OMIT_FIELDS } from '../constants';
|
|
4
2
|
import {
|
|
5
3
|
GetEventTemplatesOptions,
|
|
@@ -20,15 +18,14 @@ export class EventTemplates extends HITLBase {
|
|
|
20
18
|
* @param options
|
|
21
19
|
*/
|
|
22
20
|
public static async getEventTemplates(
|
|
23
|
-
options: GetEventTemplatesOptions = {}
|
|
21
|
+
{ templateId, ...options }: GetEventTemplatesOptions = {}
|
|
24
22
|
): Promise<GetEventTemplatesResponse | EventTemplate> {
|
|
25
23
|
const route = this.getBaseUrl(options);
|
|
26
|
-
const params = _.pick(options, ['templateId']);
|
|
27
24
|
|
|
28
25
|
return this.request({
|
|
29
26
|
method: 'GET',
|
|
30
27
|
route,
|
|
31
|
-
params,
|
|
28
|
+
params: { templateId },
|
|
32
29
|
...this.getBaseSettings(options),
|
|
33
30
|
});
|
|
34
31
|
}
|
|
@@ -41,10 +38,9 @@ export class EventTemplates extends HITLBase {
|
|
|
41
38
|
options: CreateEventTemplateOptions
|
|
42
39
|
): Promise<EventTemplate> {
|
|
43
40
|
const route = this.getBaseUrl(options);
|
|
44
|
-
const data =
|
|
45
|
-
...DEFAULT_OMIT_FIELDS,
|
|
46
|
-
|
|
47
|
-
]);
|
|
41
|
+
const data = Object.fromEntries(
|
|
42
|
+
Object.entries(options).filter(([key]) => ![...DEFAULT_OMIT_FIELDS, 'templateId'].includes(key))
|
|
43
|
+
);
|
|
48
44
|
|
|
49
45
|
return this.request({
|
|
50
46
|
method: 'POST',
|
|
@@ -62,7 +58,9 @@ export class EventTemplates extends HITLBase {
|
|
|
62
58
|
options: UpdateEventTemplateOptions
|
|
63
59
|
): Promise<EventTemplate> {
|
|
64
60
|
const route = this.getBaseUrl(options);
|
|
65
|
-
const data =
|
|
61
|
+
const data = Object.fromEntries(
|
|
62
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
63
|
+
);
|
|
66
64
|
|
|
67
65
|
return this.request({
|
|
68
66
|
method: 'PUT',
|
|
@@ -77,15 +75,14 @@ export class EventTemplates extends HITLBase {
|
|
|
77
75
|
* @param options
|
|
78
76
|
*/
|
|
79
77
|
public static async deleteEventTemplate(
|
|
80
|
-
options: DeleteEventTemplateOptions
|
|
78
|
+
{ templateId, ...options }: DeleteEventTemplateOptions
|
|
81
79
|
): Promise<void> {
|
|
82
80
|
const route = this.getBaseUrl(options);
|
|
83
|
-
const params = _.pick(options, ['templateId']);
|
|
84
81
|
|
|
85
82
|
return this.request({
|
|
86
83
|
method: 'DELETE',
|
|
87
84
|
route,
|
|
88
|
-
params,
|
|
85
|
+
params: { templateId },
|
|
89
86
|
...this.getBaseSettings(options),
|
|
90
87
|
});
|
|
91
88
|
}
|
package/src/api/Filters.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
1
|
import URI from 'urijs';
|
|
3
2
|
|
|
4
3
|
import {
|
|
@@ -36,7 +35,7 @@ export class Filters extends HITLBase {
|
|
|
36
35
|
'ruleTags',
|
|
37
36
|
'tags',
|
|
38
37
|
];
|
|
39
|
-
protected static FILTER_VERSION_FIELD = 'filterVersion';
|
|
38
|
+
protected static FILTER_VERSION_FIELD = 'filterVersion' as const;
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* @description Get Conversation view filters list
|
|
@@ -45,15 +44,18 @@ export class Filters extends HITLBase {
|
|
|
45
44
|
public static getFilters(options: GetFiltersOptionsV1): Promise<GetFiltersResponseV1>;
|
|
46
45
|
public static getFilters(options: GetFiltersOptions): Promise<GetFiltersResponse>;
|
|
47
46
|
public static getFilters(
|
|
48
|
-
options: GetFiltersOptions = {}
|
|
47
|
+
{ id, agentId, ignoreRuleTags, ...options }: GetFiltersOptions = {}
|
|
49
48
|
) {
|
|
50
49
|
const route = this.getBaseUrl(options);
|
|
51
|
-
const params = _.pick(options, ['id', 'agentId', 'ignoreRuleTags']);
|
|
52
50
|
|
|
53
51
|
return this.request({
|
|
54
52
|
method: 'GET',
|
|
55
53
|
route,
|
|
56
|
-
params
|
|
54
|
+
params: {
|
|
55
|
+
id,
|
|
56
|
+
agentId,
|
|
57
|
+
ignoreRuleTags,
|
|
58
|
+
},
|
|
57
59
|
...this.getBaseSettings(options),
|
|
58
60
|
});
|
|
59
61
|
}
|
|
@@ -66,16 +68,15 @@ export class Filters extends HITLBase {
|
|
|
66
68
|
public static bulkGetFilters(options: BulkGetFiltersOptionsV1): Promise<GetFiltersResponseV1>;
|
|
67
69
|
public static bulkGetFilters(options: BulkGetFiltersOptions): Promise<GetFiltersResponse>;
|
|
68
70
|
public static bulkGetFilters(
|
|
69
|
-
options: BulkGetFiltersOptions = {}
|
|
71
|
+
{ ignoreRuleTags, ...options }: BulkGetFiltersOptions = {}
|
|
70
72
|
) {
|
|
71
73
|
const baseUrl = this.getBaseUrl(options);
|
|
72
74
|
const route = new URI(baseUrl).segment(this.BULK_URL).href();
|
|
73
|
-
const params = _.pick(options, ['ignoreRuleTags']);
|
|
74
75
|
|
|
75
76
|
return this.request({
|
|
76
77
|
method: 'GET',
|
|
77
78
|
route,
|
|
78
|
-
params,
|
|
79
|
+
params: { ignoreRuleTags },
|
|
79
80
|
...this.getBaseSettings(options),
|
|
80
81
|
});
|
|
81
82
|
}
|
|
@@ -86,18 +87,22 @@ export class Filters extends HITLBase {
|
|
|
86
87
|
*/
|
|
87
88
|
public static createFilter(options: CreateFilterOptionsV1): Promise<FilterV1>;
|
|
88
89
|
public static createFilter(options: CreateFilterOptions): Promise<Filter>;
|
|
89
|
-
public static createFilter(options: CreateFilterOptions) {
|
|
90
|
+
public static createFilter({ isCommon, agentId, ...options }: CreateFilterOptions) {
|
|
90
91
|
const route = this.getBaseUrl(options);
|
|
91
|
-
const params = _.pick(options, ['isCommon', 'agentId']);
|
|
92
92
|
const data = {
|
|
93
|
-
...
|
|
94
|
-
|
|
93
|
+
...Object.fromEntries(
|
|
94
|
+
Object.entries(options).filter(([key]) => this.DEFAULT_FIELDS.includes(key))
|
|
95
|
+
),
|
|
96
|
+
version: options[this.FILTER_VERSION_FIELD],
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
return this.request({
|
|
98
100
|
method: 'POST',
|
|
99
101
|
route,
|
|
100
|
-
params
|
|
102
|
+
params: {
|
|
103
|
+
isCommon,
|
|
104
|
+
agentId,
|
|
105
|
+
},
|
|
101
106
|
data,
|
|
102
107
|
...this.getBaseSettings(options),
|
|
103
108
|
});
|
|
@@ -112,8 +117,10 @@ export class Filters extends HITLBase {
|
|
|
112
117
|
public static updateFilter(options: UpdateFilterOptions) {
|
|
113
118
|
const route = this.getBaseUrl(options);
|
|
114
119
|
const data = {
|
|
115
|
-
...
|
|
116
|
-
|
|
120
|
+
...Object.fromEntries(
|
|
121
|
+
Object.entries(options).filter(([key]) => [...this.DEFAULT_FIELDS, 'id'].includes(key))
|
|
122
|
+
),
|
|
123
|
+
version: options[this.FILTER_VERSION_FIELD],
|
|
117
124
|
};
|
|
118
125
|
|
|
119
126
|
return this.request({
|
|
@@ -130,16 +137,19 @@ export class Filters extends HITLBase {
|
|
|
130
137
|
*/
|
|
131
138
|
public static bulkUpdateFilters(options: BulkUpdateFiltersOptionsV1): Promise<BulkUpdateFiltersResponseV1>;
|
|
132
139
|
public static bulkUpdateFilters(options: BulkUpdateFiltersOptions): Promise<BulkUpdateFiltersResponse>;
|
|
133
|
-
|
|
140
|
+
// TODO: added ` & { filterVersion?: string; }` hack to make it build
|
|
141
|
+
public static bulkUpdateFilters(options: BulkUpdateFiltersOptionsV1 & { filterVersion?: string; }) {
|
|
134
142
|
const baseUrl = this.getBaseUrl(options);
|
|
135
143
|
const route = new URI(baseUrl).segment(this.BULK_URL).href();
|
|
136
144
|
const data = {
|
|
137
|
-
filters: options?.filters.map(filter =>
|
|
138
|
-
|
|
139
|
-
...
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
filters: options?.filters.map(filter => {
|
|
146
|
+
return {
|
|
147
|
+
...Object.fromEntries(
|
|
148
|
+
Object.entries(filter).filter(([key]) => [...this.DEFAULT_FIELDS, 'id'].includes(key))
|
|
149
|
+
),
|
|
150
|
+
version: options[this.FILTER_VERSION_FIELD],
|
|
151
|
+
};
|
|
152
|
+
}),
|
|
143
153
|
};
|
|
144
154
|
|
|
145
155
|
return this.request({
|
|
@@ -156,16 +166,13 @@ export class Filters extends HITLBase {
|
|
|
156
166
|
*/
|
|
157
167
|
public static deleteFilter(options: DeleteFilterOptionsV1): Promise<GetFiltersResponseV1 | FilterV1>;
|
|
158
168
|
public static deleteFilter(options: DeleteFilterOptions): Promise<GetFiltersResponse | Filter>;
|
|
159
|
-
public static deleteFilter(
|
|
160
|
-
options: DeleteFilterOptions
|
|
161
|
-
) {
|
|
169
|
+
public static deleteFilter({ id, ...options }: DeleteFilterOptions) {
|
|
162
170
|
const route = this.getBaseUrl(options);
|
|
163
|
-
const params = _.pick(options, ['id']);
|
|
164
171
|
|
|
165
172
|
return this.request({
|
|
166
173
|
method: 'DELETE',
|
|
167
174
|
route,
|
|
168
|
-
params,
|
|
175
|
+
params: { id },
|
|
169
176
|
...this.getBaseSettings(options),
|
|
170
177
|
});
|
|
171
178
|
}
|
package/src/api/HITLBase.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
1
|
import { Request, BaseUrlOptions } from '../types';
|
|
4
2
|
|
|
5
3
|
export class HITLBase {
|
|
@@ -40,7 +38,7 @@ export class HITLBase {
|
|
|
40
38
|
return this.format(this.BASE_URL, content);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
protected static getBaseSettings(
|
|
44
|
-
return
|
|
41
|
+
protected static getBaseSettings({ timeout }: BaseUrlOptions = {}) {
|
|
42
|
+
return { timeout };
|
|
45
43
|
}
|
|
46
44
|
}
|
package/src/api/Listeners.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
1
|
import URI from 'urijs';
|
|
3
2
|
|
|
4
3
|
import { DEFAULT_OMIT_FIELDS } from '../constants';
|
|
@@ -30,7 +29,9 @@ export class Listeners extends HITLBase {
|
|
|
30
29
|
options: GetListenersOptions = {}
|
|
31
30
|
): Promise<GetListenersResponse> {
|
|
32
31
|
const route = this.getBaseUrl(options);
|
|
33
|
-
const params =
|
|
32
|
+
const params = Object.fromEntries(
|
|
33
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
34
|
+
);
|
|
34
35
|
|
|
35
36
|
return this.request({
|
|
36
37
|
method: 'GET',
|
|
@@ -45,16 +46,15 @@ export class Listeners extends HITLBase {
|
|
|
45
46
|
* @param options
|
|
46
47
|
*/
|
|
47
48
|
public static async getListenerById(
|
|
48
|
-
options: GetListenerByIdOptions
|
|
49
|
+
{ agentId, callbackId, ...options }: GetListenerByIdOptions
|
|
49
50
|
): Promise<GetListenersResponse> {
|
|
50
51
|
const baseUrl = this.getBaseUrl(options);
|
|
51
|
-
const route = new URI(baseUrl).segment(
|
|
52
|
-
const params = _.pick(options, ['agentId']);
|
|
52
|
+
const route = new URI(baseUrl).segment(callbackId).href();
|
|
53
53
|
|
|
54
54
|
return this.request({
|
|
55
55
|
method: 'GET',
|
|
56
56
|
route,
|
|
57
|
-
params,
|
|
57
|
+
params: { agentId },
|
|
58
58
|
...this.getBaseSettings(options),
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -67,7 +67,9 @@ export class Listeners extends HITLBase {
|
|
|
67
67
|
options: CreateListenersOptions
|
|
68
68
|
): Promise<Listener> {
|
|
69
69
|
const route = this.getBaseUrl(options);
|
|
70
|
-
const data =
|
|
70
|
+
const data = Object.fromEntries(
|
|
71
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
72
|
+
);
|
|
71
73
|
|
|
72
74
|
return this.request({
|
|
73
75
|
method: 'POST',
|
|
@@ -82,11 +84,13 @@ export class Listeners extends HITLBase {
|
|
|
82
84
|
* @param options
|
|
83
85
|
*/
|
|
84
86
|
public static async updateListener(
|
|
85
|
-
options: UpdateListenersOptions
|
|
87
|
+
{ callbackId, ...options }: UpdateListenersOptions
|
|
86
88
|
): Promise<Listener> {
|
|
87
89
|
const baseUrl = this.getBaseUrl(options);
|
|
88
|
-
const route = new URI(baseUrl).segment(
|
|
89
|
-
const data =
|
|
90
|
+
const route = new URI(baseUrl).segment(callbackId).href();
|
|
91
|
+
const data = Object.fromEntries(
|
|
92
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
93
|
+
);
|
|
90
94
|
|
|
91
95
|
return this.request({
|
|
92
96
|
method: 'PUT',
|
|
@@ -101,10 +105,10 @@ export class Listeners extends HITLBase {
|
|
|
101
105
|
* @param options
|
|
102
106
|
*/
|
|
103
107
|
public static async deleteListener(
|
|
104
|
-
options: DeleteListenersOptions
|
|
108
|
+
{ callbackId, ...options }: DeleteListenersOptions
|
|
105
109
|
): Promise<void> {
|
|
106
110
|
const baseUrl = this.getBaseUrl(options);
|
|
107
|
-
const route = new URI(baseUrl).segment(
|
|
111
|
+
const route = new URI(baseUrl).segment(callbackId).href();
|
|
108
112
|
|
|
109
113
|
return this.request({
|
|
110
114
|
method: 'DELETE',
|
package/src/api/Migrations.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
1
|
import URI from 'urijs';
|
|
3
2
|
|
|
4
3
|
import { DEFAULT_OMIT_FIELDS } from '../constants';
|
|
@@ -31,14 +30,13 @@ export class Migrations extends HITLBase {
|
|
|
31
30
|
* @param options
|
|
32
31
|
*/
|
|
33
32
|
public static async getListOfMigrations(
|
|
34
|
-
options: GetMigrationsOptions = {}
|
|
33
|
+
{ appVersion, ...options }: GetMigrationsOptions = {}
|
|
35
34
|
): Promise<GetMigrationsResponse> {
|
|
36
35
|
const route = this.getBaseUrl(options);
|
|
37
|
-
const params = _.pick(options, ['appVersion']);
|
|
38
36
|
|
|
39
37
|
return this.request({
|
|
40
38
|
route,
|
|
41
|
-
params,
|
|
39
|
+
params: { appVersion },
|
|
42
40
|
...this.getBaseSettings(options),
|
|
43
41
|
});
|
|
44
42
|
}
|
|
@@ -48,17 +46,18 @@ export class Migrations extends HITLBase {
|
|
|
48
46
|
* @param options
|
|
49
47
|
*/
|
|
50
48
|
public static async runAllMigrations(
|
|
51
|
-
options: RunMigrationsOptions = {}
|
|
49
|
+
{ meta, ...options }: RunMigrationsOptions = {}
|
|
52
50
|
): Promise<RunMigrationsResponse> {
|
|
53
51
|
const route = this.getBaseUrl(options);
|
|
54
|
-
const params =
|
|
55
|
-
|
|
52
|
+
const params = Object.fromEntries(
|
|
53
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
54
|
+
);
|
|
56
55
|
|
|
57
56
|
return this.request({
|
|
58
57
|
route,
|
|
59
58
|
method: 'POST',
|
|
60
59
|
params,
|
|
61
|
-
data,
|
|
60
|
+
data: { meta },
|
|
62
61
|
...this.getBaseSettings(options),
|
|
63
62
|
});
|
|
64
63
|
}
|
|
@@ -113,7 +112,9 @@ export class Migrations extends HITLBase {
|
|
|
113
112
|
public static async getTableDefaultRecords(options: GetDefaultRecordsOptions): Promise<GetDefaultRecordsResponse> {
|
|
114
113
|
const baseUrl = this.getBaseUrl({});
|
|
115
114
|
const route = new URI(baseUrl).segment(this.DEFAULT_RECORDS_URL).href();
|
|
116
|
-
const params =
|
|
115
|
+
const params = Object.fromEntries(
|
|
116
|
+
Object.entries(options).filter(([key]) => !['version'].includes(key))
|
|
117
|
+
);
|
|
117
118
|
|
|
118
119
|
return this.request({
|
|
119
120
|
route,
|
|
@@ -145,7 +146,9 @@ export class Migrations extends HITLBase {
|
|
|
145
146
|
public static async syncTableDefaultRecords(options: SyncDefaultRecordsOptions): Promise<SyncDefaultRecordsResponse> {
|
|
146
147
|
const baseUrl = this.getBaseUrl({});
|
|
147
148
|
const route = new URI(baseUrl).segment(this.DEFAULT_RECORDS_URL).href();
|
|
148
|
-
const params =
|
|
149
|
+
const params = Object.fromEntries(
|
|
150
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
151
|
+
);
|
|
149
152
|
|
|
150
153
|
return this.request({
|
|
151
154
|
route,
|
package/src/api/RuleGroups.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
1
|
import { DEFAULT_OMIT_FIELDS } from '../constants';
|
|
4
2
|
import {
|
|
5
3
|
SearchRuleGroupsOptions,
|
|
@@ -20,16 +18,17 @@ export class RuleGroups extends HITLBase {
|
|
|
20
18
|
* @param options
|
|
21
19
|
*/
|
|
22
20
|
public static searchRuleGroups(
|
|
23
|
-
options: SearchRuleGroupsOptions = {}
|
|
21
|
+
{ groupIdList, ...options }: SearchRuleGroupsOptions = {}
|
|
24
22
|
): Promise<SearchRuleGroupsResponse | RuleGroup> {
|
|
25
23
|
const route = this.getBaseUrl(options);
|
|
26
|
-
const params =
|
|
27
|
-
|
|
24
|
+
const params = Object.fromEntries(
|
|
25
|
+
Object.entries(options).filter(([key]) => ![...DEFAULT_OMIT_FIELDS, 'accountId'].includes(key))
|
|
26
|
+
);
|
|
28
27
|
|
|
29
28
|
return this.request({
|
|
30
29
|
route,
|
|
31
30
|
params,
|
|
32
|
-
data,
|
|
31
|
+
data: { groupIdList },
|
|
33
32
|
...this.getBaseSettings(options),
|
|
34
33
|
});
|
|
35
34
|
}
|
|
@@ -39,15 +38,18 @@ export class RuleGroups extends HITLBase {
|
|
|
39
38
|
* @param options
|
|
40
39
|
*/
|
|
41
40
|
public static createRuleGroup(
|
|
42
|
-
options: CreateRuleGroupOptions
|
|
41
|
+
{ name, rules, groupId, ...options }: CreateRuleGroupOptions
|
|
43
42
|
): Promise<RuleGroup> {
|
|
44
43
|
const route = this.getBaseUrl(options);
|
|
45
|
-
const data = _.pick(options, ['name', 'rules', 'groupId']);
|
|
46
44
|
|
|
47
45
|
return this.request({
|
|
48
46
|
method: 'POST',
|
|
49
47
|
route,
|
|
50
|
-
data
|
|
48
|
+
data: {
|
|
49
|
+
name,
|
|
50
|
+
rules,
|
|
51
|
+
groupId,
|
|
52
|
+
},
|
|
51
53
|
...this.getBaseSettings(options),
|
|
52
54
|
});
|
|
53
55
|
}
|
|
@@ -57,15 +59,18 @@ export class RuleGroups extends HITLBase {
|
|
|
57
59
|
* @param options
|
|
58
60
|
*/
|
|
59
61
|
public static updateRuleGroup(
|
|
60
|
-
options: UpdateRuleGroupOptions
|
|
62
|
+
{ groupId, name, rules, ...options }: UpdateRuleGroupOptions
|
|
61
63
|
): Promise<RuleGroup> {
|
|
62
64
|
const route = this.getBaseUrl(options);
|
|
63
|
-
const data = _.pick(options, ['groupId', 'name', 'rules']);
|
|
64
65
|
|
|
65
66
|
return this.request({
|
|
66
67
|
method: 'PUT',
|
|
67
68
|
route,
|
|
68
|
-
data
|
|
69
|
+
data: {
|
|
70
|
+
groupId,
|
|
71
|
+
name,
|
|
72
|
+
rules,
|
|
73
|
+
},
|
|
69
74
|
...this.getBaseSettings(options),
|
|
70
75
|
});
|
|
71
76
|
}
|
|
@@ -75,15 +80,14 @@ export class RuleGroups extends HITLBase {
|
|
|
75
80
|
* @param options
|
|
76
81
|
*/
|
|
77
82
|
public static deleteRuleGroup(
|
|
78
|
-
options: DeleteRuleGroupOptions
|
|
83
|
+
{ groupId, ...options }: DeleteRuleGroupOptions
|
|
79
84
|
): Promise<void> {
|
|
80
85
|
const route = this.getBaseUrl(options);
|
|
81
|
-
const params = _.pick(options, ['groupId']);
|
|
82
86
|
|
|
83
87
|
return this.request({
|
|
84
88
|
method: 'DELETE',
|
|
85
89
|
route,
|
|
86
|
-
params,
|
|
90
|
+
params: { groupId },
|
|
87
91
|
...this.getBaseSettings(options),
|
|
88
92
|
});
|
|
89
93
|
}
|