@webex/internal-plugin-ediscovery 3.0.0-beta.14 → 3.0.0-beta.15
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 +2 -6
- package/dist/config.js.map +1 -1
- package/dist/ediscovery.js +1 -1
- package/dist/ediscovery.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/report-request.js.map +1 -1
- package/dist/retry.js +1 -1
- package/dist/retry.js.map +1 -1
- package/dist/transforms.js.map +1 -1
- package/package.json +10 -10
- package/src/config.js +6 -4
- package/src/ediscovery.js +2 -2
- package/src/index.js +35 -22
- package/src/report-request.js +10 -1
- package/src/retry.js +23 -14
- package/src/transforms.js +460 -217
- package/test/integration/spec/ediscovery.js +62 -43
- package/test/unit/spec/content.js +304 -166
- package/test/unit/spec/report.js +76 -77
- package/test/unit/spec/transforms.js +168 -156
package/src/config.js
CHANGED
package/src/ediscovery.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
3
|
*/
|
|
4
|
+
/* eslint-disable */
|
|
4
5
|
|
|
5
6
|
import '@webex/internal-plugin-encryption';
|
|
6
7
|
import '@webex/internal-plugin-conversation';
|
|
@@ -24,7 +25,7 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
24
25
|
},
|
|
25
26
|
extract(object) {
|
|
26
27
|
return Promise.resolve(object);
|
|
27
|
-
}
|
|
28
|
+
},
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
name: 'decryptReportRequestArray',
|
|
@@ -34,17 +35,21 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
34
35
|
},
|
|
35
36
|
extract(object) {
|
|
36
37
|
return Promise.resolve(object);
|
|
37
|
-
}
|
|
38
|
+
},
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
name: 'encryptReportRequest',
|
|
41
42
|
direction: 'outbound',
|
|
42
43
|
test(ctx, object) {
|
|
43
|
-
return Promise.resolve(
|
|
44
|
+
return Promise.resolve(
|
|
45
|
+
has(object, 'body.keywords') ||
|
|
46
|
+
has(object, 'body.spaceNames') ||
|
|
47
|
+
has(object, 'body.emails')
|
|
48
|
+
);
|
|
44
49
|
},
|
|
45
50
|
extract(object) {
|
|
46
51
|
return Promise.resolve(object);
|
|
47
|
-
}
|
|
52
|
+
},
|
|
48
53
|
},
|
|
49
54
|
{
|
|
50
55
|
name: 'decryptReportContent',
|
|
@@ -54,7 +59,7 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
54
59
|
},
|
|
55
60
|
extract(object) {
|
|
56
61
|
return Promise.resolve(object);
|
|
57
|
-
}
|
|
62
|
+
},
|
|
58
63
|
},
|
|
59
64
|
{
|
|
60
65
|
name: 'decryptReportContentArray',
|
|
@@ -64,7 +69,7 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
64
69
|
},
|
|
65
70
|
extract(object) {
|
|
66
71
|
return Promise.resolve(object);
|
|
67
|
-
}
|
|
72
|
+
},
|
|
68
73
|
},
|
|
69
74
|
{
|
|
70
75
|
name: 'decryptReportContentContainer',
|
|
@@ -74,7 +79,7 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
74
79
|
},
|
|
75
80
|
extract(object) {
|
|
76
81
|
return Promise.resolve(object);
|
|
77
|
-
}
|
|
82
|
+
},
|
|
78
83
|
},
|
|
79
84
|
{
|
|
80
85
|
name: 'decryptReportContentContainerArray',
|
|
@@ -84,8 +89,8 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
84
89
|
},
|
|
85
90
|
extract(object) {
|
|
86
91
|
return Promise.resolve(object);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
89
94
|
],
|
|
90
95
|
transforms: [
|
|
91
96
|
{
|
|
@@ -93,7 +98,7 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
93
98
|
direction: 'inbound',
|
|
94
99
|
fn(ctx, object) {
|
|
95
100
|
return Transforms.decryptReportRequest(ctx, object);
|
|
96
|
-
}
|
|
101
|
+
},
|
|
97
102
|
},
|
|
98
103
|
{
|
|
99
104
|
name: 'decryptReportRequestArray',
|
|
@@ -103,22 +108,24 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
103
108
|
return Promise.resolve();
|
|
104
109
|
}
|
|
105
110
|
|
|
106
|
-
return Promise.all(
|
|
107
|
-
|
|
111
|
+
return Promise.all(
|
|
112
|
+
object.body.map((item) => ctx.transform('decryptReportRequest', {body: item}))
|
|
113
|
+
);
|
|
114
|
+
},
|
|
108
115
|
},
|
|
109
116
|
{
|
|
110
117
|
name: 'encryptReportRequest',
|
|
111
118
|
direction: 'outbound',
|
|
112
119
|
fn(ctx, object) {
|
|
113
120
|
return Transforms.encryptReportRequest(ctx, object);
|
|
114
|
-
}
|
|
121
|
+
},
|
|
115
122
|
},
|
|
116
123
|
{
|
|
117
124
|
name: 'decryptReportContent',
|
|
118
125
|
direction: 'inbound',
|
|
119
126
|
fn(ctx, object, reportId) {
|
|
120
127
|
return Transforms.decryptReportContent(ctx, object, reportId);
|
|
121
|
-
}
|
|
128
|
+
},
|
|
122
129
|
},
|
|
123
130
|
{
|
|
124
131
|
name: 'decryptReportContentArray',
|
|
@@ -129,15 +136,19 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
// Always use the report url as this'll resolve correctly for remote reports
|
|
132
|
-
return Promise.all(
|
|
133
|
-
|
|
139
|
+
return Promise.all(
|
|
140
|
+
object.body.map((item) =>
|
|
141
|
+
ctx.transform('decryptReportContent', {body: item}, object.options.uri)
|
|
142
|
+
)
|
|
143
|
+
);
|
|
144
|
+
},
|
|
134
145
|
},
|
|
135
146
|
{
|
|
136
147
|
name: 'decryptReportContentContainer',
|
|
137
148
|
direction: 'inbound',
|
|
138
149
|
fn(ctx, object) {
|
|
139
150
|
return Transforms.decryptReportContentContainer(ctx, object);
|
|
140
|
-
}
|
|
151
|
+
},
|
|
141
152
|
},
|
|
142
153
|
{
|
|
143
154
|
name: 'decryptReportContentContainerArray',
|
|
@@ -147,11 +158,13 @@ registerInternalPlugin('ediscovery', EDiscovery, {
|
|
|
147
158
|
return Promise.resolve();
|
|
148
159
|
}
|
|
149
160
|
|
|
150
|
-
return Promise.all(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
161
|
+
return Promise.all(
|
|
162
|
+
object.body.map((item) => ctx.transform('decryptReportContentContainer', {body: item}))
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
155
168
|
});
|
|
156
169
|
|
|
157
170
|
export default EDiscovery;
|
package/src/report-request.js
CHANGED
|
@@ -10,7 +10,16 @@
|
|
|
10
10
|
* @returns {Object} ReportRequest - Contains all search parameters
|
|
11
11
|
*/
|
|
12
12
|
class ReportRequest {
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
name = '',
|
|
15
|
+
description = '',
|
|
16
|
+
emails = [],
|
|
17
|
+
userIds = [],
|
|
18
|
+
keywords = [],
|
|
19
|
+
encryptionKeyUrl = '',
|
|
20
|
+
spaceNames = [],
|
|
21
|
+
range = {startTime: '2020-01-01T00:00:00', endTime: '2020-01-01T23:59:59'}
|
|
22
|
+
) {
|
|
14
23
|
this.name = name;
|
|
15
24
|
this.description = description;
|
|
16
25
|
this.emails = emails;
|
package/src/retry.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
const retryErrors = [429, 502, 503, 504];
|
|
2
2
|
|
|
3
|
-
async function requestWithRetries(
|
|
3
|
+
async function requestWithRetries(
|
|
4
|
+
ctx,
|
|
5
|
+
func,
|
|
6
|
+
args,
|
|
7
|
+
retryCount = 0,
|
|
8
|
+
retryIntervalInSeconds = 0,
|
|
9
|
+
maxRetries = 3
|
|
10
|
+
) {
|
|
4
11
|
await timeout(retryIntervalInSeconds);
|
|
5
12
|
|
|
6
|
-
return func.apply(ctx, args)
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
return func.apply(ctx, args).catch((reason) => {
|
|
14
|
+
if (retryErrors.includes(reason.statusCode) && retryCount < maxRetries) {
|
|
15
|
+
retryCount += 1;
|
|
16
|
+
// eslint-disable-next-line no-shadow
|
|
17
|
+
let retryIntervalInSeconds = (retryCount + 1) ** 2; // 4, 9 and 16 second delays as default
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
console.error(`Request #${retryCount} error: ${reason.statusCode}. Attempting retry #${retryCount} in ${retryIntervalInSeconds} seconds`);
|
|
16
|
-
|
|
17
|
-
return requestWithRetries(ctx, func, args, retryCount, retryIntervalInSeconds, maxRetries);
|
|
19
|
+
if (reason.headers && reason.headers['retry-after']) {
|
|
20
|
+
retryIntervalInSeconds = reason.headers['retry-after'];
|
|
18
21
|
}
|
|
22
|
+
console.error(
|
|
23
|
+
`Request #${retryCount} error: ${reason.statusCode}. Attempting retry #${retryCount} in ${retryIntervalInSeconds} seconds`
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return requestWithRetries(ctx, func, args, retryCount, retryIntervalInSeconds, maxRetries);
|
|
27
|
+
}
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
return Promise.reject(reason);
|
|
30
|
+
});
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
function timeout(sec) {
|