1
0
Fork 0

Remove unnecessary properties from submitted data

This commit is contained in:
Krzysztof Sikorski 2021-11-16 00:33:17 +01:00
parent c1e1ae0403
commit 83d45fdcc7
Signed by: krzysztof-sikorski
GPG Key ID: 4EB564BD08FE8476
5 changed files with 2 additions and 36 deletions

View File

@ -1,14 +1,6 @@
/* global NexusDataQueue, NexusDataSender, Preferences, WebRequestMonitor */ /* global NexusDataQueue, NexusDataSender, Preferences, WebRequestMonitor */
'use strict' 'use strict'
function generateSessionId() {
const timestamp = Date.now()
const suffix = 1000000 * Math.random()
return `${timestamp}_${suffix}`
}
const sessionId = generateSessionId()
const preferences = new Preferences() const preferences = new Preferences()
preferences.load() preferences.load()
preferences.listenForStorageChanges() preferences.listenForStorageChanges()
@ -17,5 +9,5 @@ const nexusDataQueue = new NexusDataQueue()
const nexusDataSender = new NexusDataSender(preferences) const nexusDataSender = new NexusDataSender(preferences)
const webRequestMonitor = new WebRequestMonitor(sessionId, nexusDataQueue, nexusDataSender) const webRequestMonitor = new WebRequestMonitor(nexusDataQueue, nexusDataSender)
webRequestMonitor.addListeners() webRequestMonitor.addListeners()

View File

@ -3,9 +3,7 @@
class NexusData { class NexusData {
constructor() { constructor() {
this._sessionId = null
this._requestId = null this._requestId = null
this._previousRequestId = null
this._requestStartedAt = null this._requestStartedAt = null
this._responseCompletedAt = null this._responseCompletedAt = null
this._method = null this._method = null
@ -14,14 +12,6 @@ class NexusData {
this._responseBodyParts = [] this._responseBodyParts = []
} }
get sessionId() {
return this._sessionId
}
set sessionId(value) {
this._sessionId = value
}
get requestId() { get requestId() {
return this._requestId return this._requestId
} }
@ -30,14 +20,6 @@ class NexusData {
this._requestId = value this._requestId = value
} }
get previousRequestId() {
return this._previousRequestId
}
set previousRequestId(value) {
this._previousRequestId = value
}
get requestStartedAt() { get requestStartedAt() {
return this._requestStartedAt return this._requestStartedAt
} }

View File

@ -5,15 +5,12 @@
class NexusDataQueue { class NexusDataQueue {
constructor() { constructor() {
this._data = new Map() this._data = new Map()
this._currentRequestId = null
} }
push(nexusData) { push(nexusData) {
if (!(nexusData instanceof NexusData)) { if (!(nexusData instanceof NexusData)) {
window.console.error('[NexusDataQueue] push: argument is not an instance of NexusData!') window.console.error('[NexusDataQueue] push: argument is not an instance of NexusData!')
} }
nexusData.previousRequestId = this._currentRequestId
this._currentRequestId = nexusData.requestId
this._data.set(nexusData.requestId, nexusData) this._data.set(nexusData.requestId, nexusData)
} }

View File

@ -25,9 +25,6 @@ class NexusDataSender {
} }
const jsonData = { const jsonData = {
sessionId: nexusData.sessionId,
requestId: nexusData.requestId,
previousRequestId: nexusData.previousRequestId,
requestStartedAt: this._formatDate(nexusData.requestStartedAt), requestStartedAt: this._formatDate(nexusData.requestStartedAt),
responseCompletedAt: this._formatDate(nexusData.responseCompletedAt), responseCompletedAt: this._formatDate(nexusData.responseCompletedAt),
method: nexusData.method, method: nexusData.method,

View File

@ -3,14 +3,13 @@
'use strict' 'use strict'
class WebRequestMonitor { class WebRequestMonitor {
constructor(sessionId, nexusDataQueue, nexusDataSender) { constructor(nexusDataQueue, nexusDataSender) {
if (!(nexusDataQueue instanceof NexusDataQueue)) { if (!(nexusDataQueue instanceof NexusDataQueue)) {
window.console.error('[NexusDataSender] constructor: argument is not an instance of NexusDataQueue!') window.console.error('[NexusDataSender] constructor: argument is not an instance of NexusDataQueue!')
} }
if (!(nexusDataSender instanceof NexusDataSender)) { if (!(nexusDataSender instanceof NexusDataSender)) {
window.console.error('[NexusDataSender] constructor: argument is not an instance of NexusDataSender!') window.console.error('[NexusDataSender] constructor: argument is not an instance of NexusDataSender!')
} }
this._sessionId = sessionId
this._nexusDataQueue = nexusDataQueue this._nexusDataQueue = nexusDataQueue
this._nexusDataSender = nexusDataSender this._nexusDataSender = nexusDataSender
} }
@ -34,7 +33,6 @@ class WebRequestMonitor {
_onBeforeRequest(details) { _onBeforeRequest(details) {
const nexusData = new NexusData() const nexusData = new NexusData()
nexusData.sessionId = this._sessionId
nexusData.requestId = details.requestId nexusData.requestId = details.requestId
nexusData.requestStartedAt = details.timeStamp nexusData.requestStartedAt = details.timeStamp
nexusData.method = details.method nexusData.method = details.method