@webex/internal-plugin-support 3.12.0-next.2 → 3.12.0-next.20

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/support.js CHANGED
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
10
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
11
12
  var _webexCore = require("@webex/webex-core");
12
13
  var _lodash = require("lodash");
@@ -62,10 +63,10 @@ var Support = _webexCore.WebexPlugin.extend({
62
63
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
63
64
  var metadataArray = this._constructFileMetadata(metadata);
64
65
  var type = options.type;
66
+ var diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;
65
67
 
66
68
  // this is really testing that Ampersand is fully ready. once it's ready, these exist
67
69
  if (!logs && this.webex.logger.sdkBuffer && this.webex.logger.clientBuffer && this.webex.logger.buffer) {
68
- var diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;
69
70
  logs = this.webex.logger.formatLogs({
70
71
  diff: diff
71
72
  });
@@ -123,7 +124,16 @@ var Support = _webexCore.WebexPlugin.extend({
123
124
  })
124
125
  }
125
126
  });
126
- return _context.abrupt("return", _this.webex.upload(uploadOptions));
127
+ return _context.abrupt("return", _this.webex.upload(uploadOptions).then(function (res) {
128
+ _this.webex.logger.updateLastSubmittedIndex();
129
+ return res;
130
+ }).catch(function (err) {
131
+ if (diff && _this.config.retryFailedLogUploadsAtNextInterval) {
132
+ _this.webex.logger.error('Support: Failed to upload logs. Will retry to upload these logs at next interval', err);
133
+ _this.webex.logger.resetBufferToLastSuccessfulUpload();
134
+ }
135
+ return _promise.default.reject(err);
136
+ }));
127
137
  case 1:
128
138
  case "end":
129
139
  return _context.stop();
@@ -183,7 +193,7 @@ var Support = _webexCore.WebexPlugin.extend({
183
193
  }
184
194
  return metadataArray;
185
195
  },
186
- version: "3.12.0-next.2"
196
+ version: "3.12.0-next.20"
187
197
  });
188
198
  var _default = exports.default = Support;
189
199
  //# sourceMappingURL=support.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_lodash","_uuid","_interopRequireDefault","Support","WebexPlugin","extend","namespace","getFeedbackUrl","options","request","method","api","resource","body","defaults","appVersion","config","appType","feedbackId","uuid","v4","languageCode","then","res","url","getSupportUrl","webex","qs","submitLogs","metadata","logs","_this","arguments","length","undefined","metadataArray","_constructFileMetadata","type","logger","sdkBuffer","clientBuffer","buffer","diff","incrementalLogs","formatLogs","filename","locusId","callStart","concat","sessionId","userId","credentials","getUserToken","catch","getClientToken","_ref","_asyncToGenerator2","default","_regenerator","mark","_callee","token","headers","initalOpts","finalOpts","uploadOptions","wrap","_context","prev","next","authorization","toString","service","file","shouldAttemptReauth","phases","initialize","upload","$uri","session","tempURL","finalize","$body","logFilename","data","internal","device","abrupt","stop","_x","apply","map","key","value","filter","entry","Boolean","push","support","orgId","version","_default","exports"],"sources":["support.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\nimport {defaults} from 'lodash';\nimport uuid from 'uuid';\n\nconst Support = WebexPlugin.extend({\n namespace: 'Support',\n\n getFeedbackUrl(options) {\n options = options || {};\n\n return this.request({\n method: 'POST',\n api: 'conversation',\n resource: 'users/deskFeedbackUrl',\n body: defaults(options, {\n appVersion: this.config.appVersion,\n appType: this.config.appType,\n feedbackId: options.feedbackId || uuid.v4(),\n languageCode: this.config.languageCode,\n }),\n }).then((res) => res.body.url);\n },\n\n getSupportUrl() {\n return this.webex\n .request({\n method: 'GET',\n api: 'conversation',\n resource: 'users/deskSupportUrl',\n qs: {\n languageCode: this.config.languageCode,\n },\n })\n .then((res) => res.body.url);\n },\n\n /**\n * Sends logs to the backend\n *\n * @param {Object} metadata metadata about the logs\n * @param {Array} logs logs to send, if undefined, SDK's logs will be sent\n * @param {Object} options additional options\n * @param {string} options.type 'full' or 'diff', if not specified then the config.incrementalLogs value is used to determine the type,\n * this option only applies if logs parameter is undefined\n * 'diff' means that only the logs since the last log upload will be sent\n * 'full' means that all the logs from internal buffers will be sent\n * @returns {Promise}\n */\n submitLogs(metadata, logs, options = {}) {\n const metadataArray = this._constructFileMetadata(metadata);\n\n const {type} = options;\n\n // this is really testing that Ampersand is fully ready. once it's ready, these exist\n if (\n !logs &&\n this.webex.logger.sdkBuffer &&\n this.webex.logger.clientBuffer &&\n this.webex.logger.buffer\n ) {\n const diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;\n\n logs = this.webex.logger.formatLogs({diff});\n }\n\n let filename;\n\n if (metadata.locusId && metadata.callStart) {\n filename = `${metadata.locusId}_${metadata.callStart}.txt`;\n } else {\n filename = `${this.webex.sessionId}.txt`;\n }\n\n let userId;\n\n return this.webex.credentials\n .getUserToken()\n .catch(() => this.webex.credentials.getClientToken())\n .then(async (token) => {\n const headers = {authorization: token.toString()};\n\n const initalOpts = {\n service: 'clientLogs',\n resource: 'logs/urls',\n };\n\n const finalOpts = {\n service: 'clientLogs',\n resource: 'logs/meta',\n };\n\n const uploadOptions = defaults(initalOpts, {\n file: logs,\n shouldAttemptReauth: false,\n headers,\n phases: {\n initialize: {\n body: {\n file: filename,\n },\n },\n upload: {\n $uri: (session) => session.tempURL,\n },\n finalize: defaults(finalOpts, {\n $body: (session) => {\n userId = session.userId;\n\n return {\n filename: session.logFilename,\n data: metadataArray,\n userId: this.webex.internal.device.userId || session.userId,\n };\n },\n }),\n },\n });\n\n return this.webex.upload(uploadOptions);\n })\n .then((body) => {\n if (userId && !body.userId) {\n body.userId = userId;\n }\n\n return body;\n });\n },\n\n /**\n * Constructs an array of key-value pairs for log upload.\n * @param {*} metadata\n * @returns {array}\n */\n _constructFileMetadata(metadata) {\n const metadataArray = [\n 'locusId',\n 'appVersion',\n 'callStart',\n 'feedbackId',\n 'correlationId',\n 'broadworksCorrelationInfo',\n 'meetingId',\n 'surveySessionId',\n 'productAreaTag',\n 'issueTypeTag',\n 'issueDescTag',\n 'locussessionid',\n 'autoupload',\n ]\n .map((key) => {\n if (metadata[key]) {\n return {\n key,\n value: metadata[key],\n };\n }\n\n return null;\n })\n .filter((entry) => Boolean(entry));\n\n if (this.webex.sessionId) {\n metadataArray.push({\n key: 'trackingId',\n value: this.webex.sessionId,\n });\n }\n\n if (this.webex.internal.support.config.appVersion) {\n metadataArray.push({\n key: 'appVersion',\n value: this.webex.internal.support.config.appVersion,\n });\n }\n\n if (this.webex.internal.device.userId) {\n metadataArray.push({\n key: 'userId',\n value: this.webex.internal.device.userId,\n });\n }\n\n if (this.webex.internal.device.orgId) {\n metadataArray.push({\n key: 'orgId',\n value: this.webex.internal.device.orgId,\n });\n }\n\n return metadataArray;\n },\n});\n\nexport default Support;\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AANA;AACA;AACA;;AAMA,IAAMI,OAAO,GAAGC,sBAAW,CAACC,MAAM,CAAC;EACjCC,SAAS,EAAE,SAAS;EAEpBC,cAAc,WAAdA,cAAcA,CAACC,OAAO,EAAE;IACtBA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAEvB,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,GAAG,EAAE,cAAc;MACnBC,QAAQ,EAAE,uBAAuB;MACjCC,IAAI,EAAE,IAAAC,gBAAQ,EAACN,OAAO,EAAE;QACtBO,UAAU,EAAE,IAAI,CAACC,MAAM,CAACD,UAAU;QAClCE,OAAO,EAAE,IAAI,CAACD,MAAM,CAACC,OAAO;QAC5BC,UAAU,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ChE,aAAa,CAAC8D,IAAI,CAAC;QACjBL,GAAG,EAAE,OAAO;QACZC,KAAK,EAAE,IAAI,CAACnE,KAAK,CAAC2D,QAAQ,CAACC,MAAM,CAACa;MACpC,CAAC,CAAC;IACJ;IAEA,OAAOhE,aAAa;EACtB,CAAC;EAAAiE,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7C,OAAA,GAEYtD,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_webexCore","require","_lodash","_uuid","_interopRequireDefault","Support","WebexPlugin","extend","namespace","getFeedbackUrl","options","request","method","api","resource","body","defaults","appVersion","config","appType","feedbackId","uuid","v4","languageCode","then","res","url","getSupportUrl","webex","qs","submitLogs","metadata","logs","_this","arguments","length","undefined","metadataArray","_constructFileMetadata","type","diff","incrementalLogs","logger","sdkBuffer","clientBuffer","buffer","formatLogs","filename","locusId","callStart","concat","sessionId","userId","credentials","getUserToken","catch","getClientToken","_ref","_asyncToGenerator2","default","_regenerator","mark","_callee","token","headers","initalOpts","finalOpts","uploadOptions","wrap","_context","prev","next","authorization","toString","service","file","shouldAttemptReauth","phases","initialize","upload","$uri","session","tempURL","finalize","$body","logFilename","data","internal","device","abrupt","updateLastSubmittedIndex","err","retryFailedLogUploadsAtNextInterval","error","resetBufferToLastSuccessfulUpload","_promise","reject","stop","_x","apply","map","key","value","filter","entry","Boolean","push","support","orgId","version","_default","exports"],"sources":["support.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\nimport {defaults} from 'lodash';\nimport uuid from 'uuid';\n\nconst Support = WebexPlugin.extend({\n namespace: 'Support',\n\n getFeedbackUrl(options) {\n options = options || {};\n\n return this.request({\n method: 'POST',\n api: 'conversation',\n resource: 'users/deskFeedbackUrl',\n body: defaults(options, {\n appVersion: this.config.appVersion,\n appType: this.config.appType,\n feedbackId: options.feedbackId || uuid.v4(),\n languageCode: this.config.languageCode,\n }),\n }).then((res) => res.body.url);\n },\n\n getSupportUrl() {\n return this.webex\n .request({\n method: 'GET',\n api: 'conversation',\n resource: 'users/deskSupportUrl',\n qs: {\n languageCode: this.config.languageCode,\n },\n })\n .then((res) => res.body.url);\n },\n\n /**\n * Sends logs to the backend\n *\n * @param {Object} metadata metadata about the logs\n * @param {Array} logs logs to send, if undefined, SDK's logs will be sent\n * @param {Object} options additional options\n * @param {string} options.type 'full' or 'diff', if not specified then the config.incrementalLogs value is used to determine the type,\n * this option only applies if logs parameter is undefined\n * 'diff' means that only the logs since the last log upload will be sent\n * 'full' means that all the logs from internal buffers will be sent\n * @returns {Promise}\n */\n submitLogs(metadata, logs, options = {}) {\n const metadataArray = this._constructFileMetadata(metadata);\n\n const {type} = options;\n const diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;\n\n // this is really testing that Ampersand is fully ready. once it's ready, these exist\n if (\n !logs &&\n this.webex.logger.sdkBuffer &&\n this.webex.logger.clientBuffer &&\n this.webex.logger.buffer\n ) {\n logs = this.webex.logger.formatLogs({diff});\n }\n\n let filename;\n\n if (metadata.locusId && metadata.callStart) {\n filename = `${metadata.locusId}_${metadata.callStart}.txt`;\n } else {\n filename = `${this.webex.sessionId}.txt`;\n }\n\n let userId;\n\n return this.webex.credentials\n .getUserToken()\n .catch(() => this.webex.credentials.getClientToken())\n .then(async (token) => {\n const headers = {authorization: token.toString()};\n\n const initalOpts = {\n service: 'clientLogs',\n resource: 'logs/urls',\n };\n\n const finalOpts = {\n service: 'clientLogs',\n resource: 'logs/meta',\n };\n\n const uploadOptions = defaults(initalOpts, {\n file: logs,\n shouldAttemptReauth: false,\n headers,\n phases: {\n initialize: {\n body: {\n file: filename,\n },\n },\n upload: {\n $uri: (session) => session.tempURL,\n },\n finalize: defaults(finalOpts, {\n $body: (session) => {\n userId = session.userId;\n\n return {\n filename: session.logFilename,\n data: metadataArray,\n userId: this.webex.internal.device.userId || session.userId,\n };\n },\n }),\n },\n });\n\n return this.webex\n .upload(uploadOptions)\n .then((res) => {\n this.webex.logger.updateLastSubmittedIndex();\n\n return res;\n })\n .catch((err) => {\n if (diff && this.config.retryFailedLogUploadsAtNextInterval) {\n this.webex.logger.error(\n 'Support: Failed to upload logs. Will retry to upload these logs at next interval',\n err\n );\n\n this.webex.logger.resetBufferToLastSuccessfulUpload();\n }\n\n return Promise.reject(err);\n });\n })\n .then((body) => {\n if (userId && !body.userId) {\n body.userId = userId;\n }\n\n return body;\n });\n },\n\n /**\n * Constructs an array of key-value pairs for log upload.\n * @param {*} metadata\n * @returns {array}\n */\n _constructFileMetadata(metadata) {\n const metadataArray = [\n 'locusId',\n 'appVersion',\n 'callStart',\n 'feedbackId',\n 'correlationId',\n 'broadworksCorrelationInfo',\n 'meetingId',\n 'surveySessionId',\n 'productAreaTag',\n 'issueTypeTag',\n 'issueDescTag',\n 'locussessionid',\n 'autoupload',\n ]\n .map((key) => {\n if (metadata[key]) {\n return {\n key,\n value: metadata[key],\n };\n }\n\n return null;\n })\n .filter((entry) => Boolean(entry));\n\n if (this.webex.sessionId) {\n metadataArray.push({\n key: 'trackingId',\n value: this.webex.sessionId,\n });\n }\n\n if (this.webex.internal.support.config.appVersion) {\n metadataArray.push({\n key: 'appVersion',\n value: this.webex.internal.support.config.appVersion,\n });\n }\n\n if (this.webex.internal.device.userId) {\n metadataArray.push({\n key: 'userId',\n value: this.webex.internal.device.userId,\n });\n }\n\n if (this.webex.internal.device.orgId) {\n metadataArray.push({\n key: 'orgId',\n value: this.webex.internal.device.orgId,\n });\n }\n\n return metadataArray;\n },\n});\n\nexport default Support;\n"],"mappings":";;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AANA;AACA;AACA;;AAMA,IAAMI,OAAO,GAAGC,sBAAW,CAACC,MAAM,CAAC;EACjCC,SAAS,EAAE,SAAS;EAEpBC,c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device": "3.12.0-next.2",
24
- "@webex/internal-plugin-search": "3.12.0-next.2",
25
- "@webex/test-helper-chai": "3.11.0-next.1",
26
- "@webex/test-helper-file": "3.11.0-next.1",
27
- "@webex/test-helper-mock-webex": "3.11.0-next.1",
28
- "@webex/test-helper-test-users": "3.11.0-next.1",
29
- "@webex/webex-core": "3.12.0-next.2",
23
+ "@webex/internal-plugin-device": "3.12.0-next.18",
24
+ "@webex/internal-plugin-search": "3.12.0-next.20",
25
+ "@webex/test-helper-chai": "3.12.0-next.2",
26
+ "@webex/test-helper-file": "3.12.0-next.2",
27
+ "@webex/test-helper-mock-webex": "3.12.0-next.2",
28
+ "@webex/test-helper-test-users": "3.12.0-next.2",
29
+ "@webex/webex-core": "3.12.0-next.18",
30
30
  "lodash": "^4.17.21",
31
31
  "uuid": "^3.3.2"
32
32
  },
@@ -46,12 +46,12 @@
46
46
  "@webex/eslint-config-legacy": "0.0.0",
47
47
  "@webex/jest-config-legacy": "0.0.0",
48
48
  "@webex/legacy-tools": "0.0.0",
49
- "@webex/test-helper-chai": "3.11.0-next.1",
50
- "@webex/test-helper-mocha": "3.11.0-next.1",
51
- "@webex/test-helper-mock-webex": "3.11.0-next.1",
52
- "@webex/test-helper-test-users": "3.11.0-next.1",
49
+ "@webex/test-helper-chai": "3.12.0-next.2",
50
+ "@webex/test-helper-mocha": "3.12.0-next.2",
51
+ "@webex/test-helper-mock-webex": "3.12.0-next.2",
52
+ "@webex/test-helper-test-users": "3.12.0-next.2",
53
53
  "eslint": "^8.24.0",
54
54
  "prettier": "^2.7.1"
55
55
  },
56
- "version": "3.12.0-next.2"
56
+ "version": "3.12.0-next.20"
57
57
  }
package/src/support.js CHANGED
@@ -54,6 +54,7 @@ const Support = WebexPlugin.extend({
54
54
  const metadataArray = this._constructFileMetadata(metadata);
55
55
 
56
56
  const {type} = options;
57
+ const diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;
57
58
 
58
59
  // this is really testing that Ampersand is fully ready. once it's ready, these exist
59
60
  if (
@@ -62,8 +63,6 @@ const Support = WebexPlugin.extend({
62
63
  this.webex.logger.clientBuffer &&
63
64
  this.webex.logger.buffer
64
65
  ) {
65
- const diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;
66
-
67
66
  logs = this.webex.logger.formatLogs({diff});
68
67
  }
69
68
 
@@ -120,7 +119,25 @@ const Support = WebexPlugin.extend({
120
119
  },
121
120
  });
122
121
 
123
- return this.webex.upload(uploadOptions);
122
+ return this.webex
123
+ .upload(uploadOptions)
124
+ .then((res) => {
125
+ this.webex.logger.updateLastSubmittedIndex();
126
+
127
+ return res;
128
+ })
129
+ .catch((err) => {
130
+ if (diff && this.config.retryFailedLogUploadsAtNextInterval) {
131
+ this.webex.logger.error(
132
+ 'Support: Failed to upload logs. Will retry to upload these logs at next interval',
133
+ err
134
+ );
135
+
136
+ this.webex.logger.resetBufferToLastSuccessfulUpload();
137
+ }
138
+
139
+ return Promise.reject(err);
140
+ });
124
141
  })
125
142
  .then((body) => {
126
143
  if (userId && !body.userId) {
@@ -173,6 +173,9 @@ describe('plugin-support', () => {
173
173
  beforeEach(() => {
174
174
  webex.logger = {
175
175
  formatLogs: sinon.stub().returns(['fake logs']),
176
+ updateLastSubmittedIndex: sinon.stub(),
177
+ resetBufferToLastSuccessfulUpload: sinon.stub(),
178
+ error: sinon.stub(),
176
179
  sdkBuffer: [],
177
180
  clientBuffer: [],
178
181
  buffer: [],
@@ -227,5 +230,149 @@ describe('plugin-support', () => {
227
230
  assert.deepEqual(uploadArgs[0].file, ['test logs']);
228
231
  });
229
232
  });
233
+
234
+ it('calls updateLastSubmittedIndex() after a successful upload', async () => {
235
+ await webex.internal.support.submitLogs({});
236
+
237
+ assert.calledOnce(webex.logger.updateLastSubmittedIndex);
238
+ assert.notCalled(webex.logger.resetBufferToLastSuccessfulUpload);
239
+ });
240
+
241
+ it('resolves with the response body from upload', async () => {
242
+ const uploadResponse = {logId: 'abc123'};
243
+
244
+ webex.upload = sinon.stub().returns(Promise.resolve(uploadResponse));
245
+
246
+ const result = await webex.internal.support.submitLogs({});
247
+
248
+ assert.deepEqual(result, uploadResponse);
249
+ });
250
+
251
+ it('adds userId from the session to the returned body if not already present', async () => {
252
+ const uploadResponse = {};
253
+
254
+ webex.upload = sinon.stub().callsFake((opts) => {
255
+ opts.phases.finalize.$body({userId: 'session-user-id', logFilename: 'file.txt'});
256
+
257
+ return Promise.resolve(uploadResponse);
258
+ });
259
+
260
+ const result = await webex.internal.support.submitLogs({});
261
+
262
+ assert.equal(result.userId, 'session-user-id');
263
+ });
264
+
265
+ it('does not overwrite userId in the returned body if already present', async () => {
266
+ const uploadResponse = {userId: 'existing-user-id'};
267
+
268
+ webex.upload = sinon.stub().callsFake((opts) => {
269
+ opts.phases.finalize.$body({userId: 'session-user-id', logFilename: 'file.txt'});
270
+
271
+ return Promise.resolve(uploadResponse);
272
+ });
273
+
274
+ const result = await webex.internal.support.submitLogs({});
275
+
276
+ assert.equal(result.userId, 'existing-user-id');
277
+ });
278
+
279
+ [
280
+ {incrementalLogs: true, retryFailedLogUploadsAtNextInterval: true, shouldReset: true},
281
+ {incrementalLogs: false, retryFailedLogUploadsAtNextInterval: true, shouldReset: false},
282
+ {incrementalLogs: true, retryFailedLogUploadsAtNextInterval: false, shouldReset: false},
283
+ {incrementalLogs: false, retryFailedLogUploadsAtNextInterval: false, shouldReset: false},
284
+ ].forEach(({incrementalLogs, retryFailedLogUploadsAtNextInterval, shouldReset}) => {
285
+ it(`${
286
+ shouldReset ? 'calls' : 'does not call'
287
+ } resetBufferToLastSuccessfulUpload() when upload fails with incrementalLogs=${incrementalLogs} and retryFailedLogUploadsAtNextInterval=${retryFailedLogUploadsAtNextInterval}`, async () => {
288
+ const uploadError = new Error('upload failed');
289
+
290
+ webex.upload = sinon.stub().returns(Promise.reject(uploadError));
291
+ webex.internal.support.config.incrementalLogs = incrementalLogs;
292
+ webex.internal.support.config.retryFailedLogUploadsAtNextInterval =
293
+ retryFailedLogUploadsAtNextInterval;
294
+
295
+ await webex.internal.support.submitLogs({}).catch(() => {});
296
+
297
+ assert.notCalled(webex.logger.updateLastSubmittedIndex);
298
+ if (shouldReset) {
299
+ assert.calledOnce(webex.logger.resetBufferToLastSuccessfulUpload);
300
+ } else {
301
+ assert.notCalled(webex.logger.resetBufferToLastSuccessfulUpload);
302
+ }
303
+ });
304
+ });
305
+
306
+ [
307
+ {
308
+ type: 'diff',
309
+ incrementalLogs: false,
310
+ retryFailedLogUploadsAtNextInterval: true,
311
+ shouldReset: true,
312
+ },
313
+ {
314
+ type: 'diff',
315
+ incrementalLogs: false,
316
+ retryFailedLogUploadsAtNextInterval: false,
317
+ shouldReset: false,
318
+ },
319
+ {
320
+ type: 'full',
321
+ incrementalLogs: true,
322
+ retryFailedLogUploadsAtNextInterval: true,
323
+ shouldReset: false,
324
+ },
325
+ {
326
+ type: 'full',
327
+ incrementalLogs: true,
328
+ retryFailedLogUploadsAtNextInterval: false,
329
+ shouldReset: false,
330
+ },
331
+ ].forEach(({type, incrementalLogs, retryFailedLogUploadsAtNextInterval, shouldReset}) => {
332
+ it(`${
333
+ shouldReset ? 'calls' : 'does not call'
334
+ } resetBufferToLastSuccessfulUpload() when upload fails with options.type=${type}, incrementalLogs=${incrementalLogs}, retryFailedLogUploadsAtNextInterval=${retryFailedLogUploadsAtNextInterval}`, async () => {
335
+ const uploadError = new Error('upload failed');
336
+
337
+ webex.upload = sinon.stub().returns(Promise.reject(uploadError));
338
+ webex.internal.support.config.incrementalLogs = incrementalLogs;
339
+ webex.internal.support.config.retryFailedLogUploadsAtNextInterval =
340
+ retryFailedLogUploadsAtNextInterval;
341
+
342
+ await webex.internal.support.submitLogs({}, undefined, {type}).catch(() => {});
343
+
344
+ assert.notCalled(webex.logger.updateLastSubmittedIndex);
345
+ if (shouldReset) {
346
+ assert.calledOnce(webex.logger.resetBufferToLastSuccessfulUpload);
347
+ } else {
348
+ assert.notCalled(webex.logger.resetBufferToLastSuccessfulUpload);
349
+ }
350
+ });
351
+ });
352
+
353
+ it('logs an error and rejects the promise when upload fails with incrementalLogs and retryFailedLogUploadsAtNextInterval both true', async () => {
354
+ const uploadError = new Error('upload failed');
355
+
356
+ webex.upload = sinon.stub().returns(Promise.reject(uploadError));
357
+ webex.internal.support.config.incrementalLogs = true;
358
+ webex.internal.support.config.retryFailedLogUploadsAtNextInterval = true;
359
+
360
+ await assert.isRejected(webex.internal.support.submitLogs({}), uploadError);
361
+
362
+ assert.calledOnce(webex.logger.error);
363
+ assert.match(webex.logger.error.args[0][0], /Failed to upload logs/);
364
+ });
365
+
366
+ it('rejects the promise when upload fails even without retry config', async () => {
367
+ const uploadError = new Error('upload failed');
368
+
369
+ webex.upload = sinon.stub().returns(Promise.reject(uploadError));
370
+ webex.internal.support.config.incrementalLogs = false;
371
+ webex.internal.support.config.retryFailedLogUploadsAtNextInterval = false;
372
+
373
+ await assert.isRejected(webex.internal.support.submitLogs({}), uploadError);
374
+
375
+ assert.notCalled(webex.logger.error);
376
+ });
230
377
  });
231
378
  });