Giter VIP home page Giter VIP logo

deloreanup's People

Contributors

sabbio93 avatar

Watchers

 avatar  avatar  avatar

deloreanup's Issues

Swagger autogenerated client apis issue

The swagger autogenerated client apis have an issue that is the impossibility to change the host in which perform the routes in a cleaned way.

Here a bad solution in which it's changed the value of the property basePath of the ContainerApi object.

The problem is also the fact that from each node I can get only the host (eg. http://localhost:5555) but the basePath include also the fixed part of the api's path (ie. api/v{version}).
In this bad solution this fixed part is hard coded and appended to the host of the node. It's necessary to find a better solution.

const basePath = '/api/v1.0.0'
/**
* Method to call inside a node the route `/api/{version}/containers` that return the list of active containers
* @param {DocNode} node - {@link DocNode} object
* @returns {AxiosPromise} - promise of the get response, resolved with the list and reject in case of errors
*/
const getContainersList = (node) => {
return new Promise((resolve, reject) => {
const containerApi = new ContainerApi()
containerApi.apiClient.basePath = node.getUrl() + basePath
containerApi.containersGET((err, data, response) => {
if (err) {
reject(err)
}
resolve(data)
})
})
}

docNodesCache responses not aligned with backend responses

In Frontend/src/plugins/cache/docNodesCache.js the response of the methods that maps the API of the backend should return the same objects of the backend's API.

For example the method getNodes() should return the following object:

{
   nodes: Array<Node>
}

Now, it return this Array<Node> instead of the above example.

A full reference to the objects to be returned can founded here Backend/swagger-v2.yml looking at the responses of the path routes.

Separate utility function from application function

The file should be divided into two separate files, one containing general method to interact with the browser cache (eg. cacheUtility) and second one containing the application function such as getNodes() (eg. docNodes).

// @flow
// alternative for all API: to return connection.tx.complete (is a promise) instead our standard promise
const IDB = window.indexedDB
const DB_NAME = 'DeloreanStorage'
const STORE_NAME = 'nodeOS'
const OS_KEY = 'id'
const VERSION = 1
/**
* Standard object containing the response from the api, parameters:
* - @type {boolean} success - `true` when the response doesn't contain errors otherwise `false`
* - @type {Object} data - object containing the response either in case of errors or success
* N.b. If the response return a 500 error it will raise an exception otherwise the error is sent on the response object
* with `success: false`
*/
type ResponseObject = {
success: boolean,
data: Object
}
/**
* Object containing the IndexedDB's connection informations
* - @type {Object} result - result of the attempt to connect
* - @type {Object} tx - transaction object containing all the operations to do in this openend connection, if an operation inside a transactions fail the changes are deleted
* - @type {Object} store - bucket (object store) containing records, can be compared to a table in relational databases
*/
type IndexedDatabaseConnection = {
result: Object,
tx: Object,
store: Object
}
const openDatabase = () => {
if (!('indexedDB' in window)) {
alert('IndexedDB not supported')
return
}
let dbRequest = IDB.open(DB_NAME, VERSION)
dbRequest.onupgradeneeded = (event) => {
let db = event.target.result
if (!db.objectStoreNames.contains(STORE_NAME)) {
db.createObjectStore(STORE_NAME, { keyPath: OS_KEY })
}
}
return dbRequest
}
const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
let connection: IndexedDatabaseConnection = {}
connection.result = openedDB.result
connection.tx = connection.result.transaction(STORE_NAME, 'readwrite')
connection.store = connection.tx.objectStore(STORE_NAME)
return connection
}
/**
* Function that deletes the IndexedDB with all objects stores. It is reversible because the database is recreated when a new connection is opened.
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function deleteCache (): Promise<ResponseObject> {
let response: ResponseObject = {}
return new Promise((resolve, reject) => {
let dbRequest = IDB.deleteDatabase(DB_NAME)
dbRequest.onsuccess = (event) => {
response.data = event.type
response.success = true
resolve(response)
}
dbRequest.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
})
}
/**
* Function that deletes the records inside Node's Object Storage (delorean frontend cache).
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function clearCache (): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let result = connection.store.clear()
dbRequest.onsuccess = (event) => {
response.data = event.type
response.success = true
resolve(response)
}
dbRequest.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that adds a Node element to the NodeOS.
* @param {string} node - a string representing the node information
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function addNode (node: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let result = connection.store.put(node)
dbRequest.onsuccess = (event) => {
response.data = event.type
response.success = true
resolve(response)
}
dbRequest.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that sets a container list inside a specific Node record.
* @param {string} nodeId - a string with the node's id
* @param {Array<string>} containers - a list with all containers record inside a specific node
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function addContainers (nodeId: string, containers: Array<string>): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let currentNode = connection.store.get(nodeId)
currentNode.onsuccess = (event) => {
let record = event.target.result
record.containers = containers
currentNode = connection.store.put(record)
currentNode.onsuccess = (event) => resolve(event.type)
currentNode.onerror = (event) => reject(event.type)
}
}
})
}
/**
* Function that returns all the nodes with all information inside the cache.
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodes (): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
let response: ResponseObject = {}
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let result = connection.store.getAll()
result.onsuccess = (event) => {
response.data = event.target.result
response.success = true
resolve(response)
}
result.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that returns the containers list of a specific container.
* @param {string} nodeId - a string with the node's id
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodeContainers (nodeId: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
let response: ResponseObject = {}
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let currentNode = connection.store.get(nodeId)
currentNode.onsuccess = (event) => {
response.data = event.target.result.containers
response.success = true
resolve(response)
}
currentNode.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that returns the informations about a single container inside a specific node.
* @param {string} nodeId - a string with the node's id
* @param {string} containerId - a string with the container's id
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodeContainerById (nodeId: string, containerId: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let response: ResponseObject = {}
getNodeContainers(nodeId).then(result => {
let container = result.data.containers.filter(cont => cont.Id === containerId)
response.data = container
response.success = true
resolve(response)
}).catch(err => {
response.data = err
response.success = false
reject(response)
})
})
}
/**
* Function that returns the mounts of a specific container inside a specific node.
* @param {string} nodeId - a string with the node's id
* @param {*} containerId - a string with the container's id
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodeContainerMounts (nodeId: string, containerId: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let response: ResponseObject = {}
getNodeContainerById(nodeId, containerId).then(result => {
response.data = result.data.shift().Mounts
response.success = true
resolve(response)
}).catch(err => {
response.data = err
response.success = false
reject(response)
})
})

General data adpter

It's necessary to create a general data adapter responsible for retrieving data. In particular, this adapter in its first version should simply:

  • check if the requested are in the cache, if it is return the data
  • if data are not in the cache, it has to retrive them using the backendAdapter plugin and then save them in the cache for future requests

Flow and linter errors

Running the commands to check the correctness of flow and linter raise many errors related to this file.

Note: it is possible to run the checks using:

  • yarn flow:status or npm run flow:status
  • yarn lint or npm run lint

// @flow
// alternative for all API: to return connection.tx.complete (is a promise) instead our standard promise
const IDB = window.indexedDB
const DB_NAME = 'DeloreanStorage'
const STORE_NAME = 'nodeOS'
const OS_KEY = 'id'
const VERSION = 1
/**
* Standard object containing the response from the api, parameters:
* - @type {boolean} success - `true` when the response doesn't contain errors otherwise `false`
* - @type {Object} data - object containing the response either in case of errors or success
* N.b. If the response return a 500 error it will raise an exception otherwise the error is sent on the response object
* with `success: false`
*/
type ResponseObject = {
success: boolean,
data: Object
}
/**
* Object containing the IndexedDB's connection informations
* - @type {Object} result - result of the attempt to connect
* - @type {Object} tx - transaction object containing all the operations to do in this openend connection, if an operation inside a transactions fail the changes are deleted
* - @type {Object} store - bucket (object store) containing records, can be compared to a table in relational databases
*/
type IndexedDatabaseConnection = {
result: Object,
tx: Object,
store: Object
}
const openDatabase = () => {
if (!('indexedDB' in window)) {
alert('IndexedDB not supported')
return
}
let dbRequest = IDB.open(DB_NAME, VERSION)
dbRequest.onupgradeneeded = (event) => {
let db = event.target.result
if (!db.objectStoreNames.contains(STORE_NAME)) {
db.createObjectStore(STORE_NAME, { keyPath: OS_KEY })
}
}
return dbRequest
}
const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
let connection: IndexedDatabaseConnection = {}
connection.result = openedDB.result
connection.tx = connection.result.transaction(STORE_NAME, 'readwrite')
connection.store = connection.tx.objectStore(STORE_NAME)
return connection
}
/**
* Function that deletes the IndexedDB with all objects stores. It is reversible because the database is recreated when a new connection is opened.
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function deleteCache (): Promise<ResponseObject> {
let response: ResponseObject = {}
return new Promise((resolve, reject) => {
let dbRequest = IDB.deleteDatabase(DB_NAME)
dbRequest.onsuccess = (event) => {
response.data = event.type
response.success = true
resolve(response)
}
dbRequest.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
})
}
/**
* Function that deletes the records inside Node's Object Storage (delorean frontend cache).
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function clearCache (): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let result = connection.store.clear()
dbRequest.onsuccess = (event) => {
response.data = event.type
response.success = true
resolve(response)
}
dbRequest.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that adds a Node element to the NodeOS.
* @param {string} node - a string representing the node information
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function addNode (node: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let result = connection.store.put(node)
dbRequest.onsuccess = (event) => {
response.data = event.type
response.success = true
resolve(response)
}
dbRequest.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that sets a container list inside a specific Node record.
* @param {string} nodeId - a string with the node's id
* @param {Array<string>} containers - a list with all containers record inside a specific node
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function addContainers (nodeId: string, containers: Array<string>): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let currentNode = connection.store.get(nodeId)
currentNode.onsuccess = (event) => {
let record = event.target.result
record.containers = containers
currentNode = connection.store.put(record)
currentNode.onsuccess = (event) => resolve(event.type)
currentNode.onerror = (event) => reject(event.type)
}
}
})
}
/**
* Function that returns all the nodes with all information inside the cache.
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodes (): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
let response: ResponseObject = {}
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let result = connection.store.getAll()
result.onsuccess = (event) => {
response.data = event.target.result
response.success = true
resolve(response)
}
result.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that returns the containers list of a specific container.
* @param {string} nodeId - a string with the node's id
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodeContainers (nodeId: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let db = openDatabase()
let response: ResponseObject = {}
db.onsuccess = () => {
let connection = getDatabaseConnection(db)
let currentNode = connection.store.get(nodeId)
currentNode.onsuccess = (event) => {
response.data = event.target.result.containers
response.success = true
resolve(response)
}
currentNode.onerror = (event) => {
response.data = event.type
response.success = false
reject(response)
}
}
})
}
/**
* Function that returns the informations about a single container inside a specific node.
* @param {string} nodeId - a string with the node's id
* @param {string} containerId - a string with the container's id
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodeContainerById (nodeId: string, containerId: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let response: ResponseObject = {}
getNodeContainers(nodeId).then(result => {
let container = result.data.containers.filter(cont => cont.Id === containerId)
response.data = container
response.success = true
resolve(response)
}).catch(err => {
response.data = err
response.success = false
reject(response)
})
})
}
/**
* Function that returns the mounts of a specific container inside a specific node.
* @param {string} nodeId - a string with the node's id
* @param {*} containerId - a string with the container's id
* @return {Promise<ResponseObject>} - promise resolved with the container object or with error
*/
export function getNodeContainerMounts (nodeId: string, containerId: string): Promise<ResponseObject> {
return new Promise((resolve, reject) => {
let response: ResponseObject = {}
getNodeContainerById(nodeId, containerId).then(result => {
response.data = result.data.shift().Mounts
response.success = true
resolve(response)
}).catch(err => {
response.data = err
response.success = false
reject(response)
})
})

Update

Flow error log:

> flow status --quiet

Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:51:58

Cannot assign function to `getDatabaseConnection` because:
 - property `result` is missing in function [1] but exists in `IndexedDatabaseConnection` [2].
 - property `store` is missing in function [1] but exists in `IndexedDatabaseConnection` [2].
 - property `tx` is missing in function [1] but exists in `IndexedDatabaseConnection` [2].

   src/plugins/cache/docNodesCache.js:51:58
                                                                v--------------
   51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
   52|   let connection: IndexedDatabaseConnection = {}
   53|
   54|   connection.result = openedDB.result
   55|   connection.tx = connection.result.transaction(STORE_NAME, 'readwrite')
   56|   connection.store = connection.tx.objectStore(STORE_NAME)
   57|
   58|   return connection
   59| }
       ^ [1]

References:
   src/plugins/cache/docNodesCache.js:51:30
   51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^ [2]


Error -------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:91:5

Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].

   src/plugins/cache/docNodesCache.js:91:5
   91|     db.onsuccess = () => {
           ^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:37:5
   37|     return
           ^^^^^^ [1]


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:92:24

Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].

   src/plugins/cache/docNodesCache.js:92:24
   92|       let connection = getDatabaseConnection(db)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:51:30
   51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error -------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:94:7

Cannot resolve name `dbRequest`.

   94|       dbRequest.onsuccess = (event) => {
             ^^^^^^^^^


Error -------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:95:9

Cannot resolve name `response`.

   95|         response.data = event.type
               ^^^^^^^^


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:100:9

Cannot resolve name `response`.

   100|         response.data = event.type
                ^^^^^^^^


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:117:5

Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].

   src/plugins/cache/docNodesCache.js:117:5
   117|     db.onsuccess = () => {
            ^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:37:5
    37|     return
            ^^^^^^ [1]


Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:118:24

Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].

   src/plugins/cache/docNodesCache.js:118:24
   118|       let connection = getDatabaseConnection(db)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:51:30
    51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:120:7

Cannot resolve name `dbRequest`.

   120|       dbRequest.onsuccess = (event) => {
              ^^^^^^^^^


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:121:9

Cannot resolve name `response`.

   121|         response.data = event.type
                ^^^^^^^^


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:126:9

Cannot resolve name `response`.

   126|         response.data = event.type
                ^^^^^^^^


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:144:5

Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].

   src/plugins/cache/docNodesCache.js:144:5
   144|     db.onsuccess = () => {
            ^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:37:5
    37|     return
            ^^^^^^ [1]


Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:145:24

Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].

   src/plugins/cache/docNodesCache.js:145:24
   145|       let connection = getDatabaseConnection(db)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:51:30
    51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:167:5

Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].

   src/plugins/cache/docNodesCache.js:167:5
   167|     db.onsuccess = () => {
            ^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:37:5
    37|     return
            ^^^^^^ [1]


Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:168:24

Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].

   src/plugins/cache/docNodesCache.js:168:24
   168|       let connection = getDatabaseConnection(db)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:51:30
    51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:193:5

Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].

   src/plugins/cache/docNodesCache.js:193:5
   193|     db.onsuccess = () => {
            ^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:37:5
    37|     return
            ^^^^^^ [1]


Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:194:24

Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].

   src/plugins/cache/docNodesCache.js:194:24
   194|       let connection = getDatabaseConnection(db)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   src/plugins/cache/docNodesCache.js:51:30
    51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^ [1]



Found 19 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! frontend@1.0.0 flow:status: `flow status --quiet`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the frontend@1.0.0 flow:status script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Lint error log:

> eslint --cache --format codeframe --ext mjs,jsx,js src test

error: 'result' is assigned a value but never used (no-unused-vars) at src/plugins/cache/docNodesCache.js:93:11:
  91 |     db.onsuccess = () => {
  92 |       let connection = getDatabaseConnection(db)
> 93 |       let result = connection.store.clear()
     |           ^
  94 |       dbRequest.onsuccess = (event) => {
  95 |         response.data = event.type
  96 |         response.success = true


error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:94:7:
  92 |       let connection = getDatabaseConnection(db)
  93 |       let result = connection.store.clear()
> 94 |       dbRequest.onsuccess = (event) => {
     |       ^
  95 |         response.data = event.type
  96 |         response.success = true
  97 |         resolve(response)


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:95:9:
  93 |       let result = connection.store.clear()
  94 |       dbRequest.onsuccess = (event) => {
> 95 |         response.data = event.type
     |         ^
  96 |         response.success = true
  97 |         resolve(response)
  98 |       }


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:96:9:
  94 |       dbRequest.onsuccess = (event) => {
  95 |         response.data = event.type
> 96 |         response.success = true
     |         ^
  97 |         resolve(response)
  98 |       }
  99 |       dbRequest.onerror = (event) => {


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:97:17:
   95 |         response.data = event.type
   96 |         response.success = true
>  97 |         resolve(response)
      |                 ^
   98 |       }
   99 |       dbRequest.onerror = (event) => {
  100 |         response.data = event.type


error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:99:7:
   97 |         resolve(response)
   98 |       }
>  99 |       dbRequest.onerror = (event) => {
      |       ^
  100 |         response.data = event.type
  101 |         response.success = false
  102 |         reject(response)


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:100:9:
   98 |       }
   99 |       dbRequest.onerror = (event) => {
> 100 |         response.data = event.type
      |         ^
  101 |         response.success = false
  102 |         reject(response)
  103 |       }


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:101:9:
   99 |       dbRequest.onerror = (event) => {
  100 |         response.data = event.type
> 101 |         response.success = false
      |         ^
  102 |         reject(response)
  103 |       }
  104 |     }


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:102:16:
  100 |         response.data = event.type
  101 |         response.success = false
> 102 |         reject(response)
      |                ^
  103 |       }
  104 |     }
  105 |   })


error: 'result' is assigned a value but never used (no-unused-vars) at src/plugins/cache/docNodesCache.js:119:11:
  117 |     db.onsuccess = () => {
  118 |       let connection = getDatabaseConnection(db)
> 119 |       let result = connection.store.put(node)
      |           ^
  120 |       dbRequest.onsuccess = (event) => {
  121 |         response.data = event.type
  122 |         response.success = true


error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:120:7:
  118 |       let connection = getDatabaseConnection(db)
  119 |       let result = connection.store.put(node)
> 120 |       dbRequest.onsuccess = (event) => {
      |       ^
  121 |         response.data = event.type
  122 |         response.success = true
  123 |         resolve(response)


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:121:9:
  119 |       let result = connection.store.put(node)
  120 |       dbRequest.onsuccess = (event) => {
> 121 |         response.data = event.type
      |         ^
  122 |         response.success = true
  123 |         resolve(response)
  124 |       }


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:122:9:
  120 |       dbRequest.onsuccess = (event) => {
  121 |         response.data = event.type
> 122 |         response.success = true
      |         ^
  123 |         resolve(response)
  124 |       }
  125 |       dbRequest.onerror = (event) => {


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:123:17:
  121 |         response.data = event.type
  122 |         response.success = true
> 123 |         resolve(response)
      |                 ^
  124 |       }
  125 |       dbRequest.onerror = (event) => {
  126 |         response.data = event.type


error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:125:7:
  123 |         resolve(response)
  124 |       }
> 125 |       dbRequest.onerror = (event) => {
      |       ^
  126 |         response.data = event.type
  127 |         response.success = false
  128 |         reject(response)


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:126:9:
  124 |       }
  125 |       dbRequest.onerror = (event) => {
> 126 |         response.data = event.type
      |         ^
  127 |         response.success = false
  128 |         reject(response)
  129 |       }


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:127:9:
  125 |       dbRequest.onerror = (event) => {
  126 |         response.data = event.type
> 127 |         response.success = false
      |         ^
  128 |         reject(response)
  129 |       }
  130 |     }


error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:128:16:
  126 |         response.data = event.type
  127 |         response.success = false
> 128 |         reject(response)
      |                ^
  129 |       }
  130 |     }
  131 |   })


18 errors found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@1.0.0 lint: `eslint --cache --format codeframe --ext mjs,jsx,js src test`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the frontend@1.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.