New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dewib/xhr-cache

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dewib/xhr-cache - npm Package Compare versions

Comparing version 3.3.0 to 4.1.0

13

lib/library.js

@@ -65,3 +65,2 @@ import { dirname } from 'path'

/* eslint-disable-next-line */
console.info(getLog(name, request, 'Fetch'))

@@ -77,3 +76,3 @@

error += ` Using provided default value ${request.catch}`
/* eslint-disable-next-line */
console.info(error)

@@ -84,3 +83,3 @@

/* eslint-disable-next-line */
console.error(error)

@@ -94,3 +93,3 @@

if (typeof request.catch !== 'undefined') {
/* eslint-disable-next-line */
console.error(getLog(name, request, 'Error on fetching', `returning catch value: ${request.catch}, ${logAxiosError(err)}`))

@@ -101,3 +100,3 @@

/* eslint-disable-next-line */
console.error(getLog(name, request, 'Error on fetching', `${logAxiosError(err)}`))

@@ -117,4 +116,4 @@

return JSON.parse(fs.readFileSync(path, 'UTF-8'))
} catch (err) {
/* eslint-disable-next-line */
} catch {
console.error(`${libPrefix} Unable to parse JSON from ${path}`)

@@ -121,0 +120,0 @@

@@ -0,2 +1,5 @@

/* eslint-disable no-undef */
import { clearInterval, setInterval } from 'timers'
import { join, resolve } from 'path'
import { URL } from 'url'
import rimraf from 'rimraf'

@@ -20,3 +23,3 @@ import { match } from 'path-to-regexp'

const path = join(conf.rootUrl, resource.name)
/* eslint-disable-next-line */
console.info(`${libPrefix} Serve '${resource.name}' resource to ${`${conf.serverUrl}/${join(path)}`}`)

@@ -66,3 +69,3 @@

} else {
/* eslint-disable-next-line */
console.info(`${libPrefix} Force refresh for identifier '${id}'`)

@@ -73,3 +76,3 @@

await resource.store()
/* eslint-disable-next-line */
console.info(`${libPrefix} Refresh for identifier '${id}' done`)

@@ -140,3 +143,3 @@ resource.ongoing = false

if (resource.active) { return false } else { resource.active = true }
/* eslint-disable-next-line */
console.info(`${libPrefix} Refresh url for '${name}' with id '${id}' is available at ${`${conf.serverUrl}/${join(conf.rootUrl, 'refresh', id)}?apiKey=${conf.apiKey}`}`)

@@ -157,3 +160,3 @@

resource.refresh.intervalId = false
/* eslint-disable-next-line */
if (logger) console.info(`${libPrefix} Stop auto refresh for '${name} with id '${id}'`)

@@ -175,3 +178,3 @@ }

if (resource.refresh.maxAge !== maxAge(response)) {
/* eslint-disable-next-line */
console.info(`${libPrefix} Update auto refresh for '${name} with id '${id}' from ${resource.refresh.maxAge}ms to ${maxAge(response)}ms`)

@@ -204,3 +207,3 @@ stop(false)

/* eslint-disable-next-line */
console.info(`${libPrefix} Resource '${name}' with context ${JSON.stringify(ctx)} got '${id}' identifier`)

@@ -227,3 +230,3 @@ }

/* eslint-disable-next-line */
if (!buildProcess) console.info(`${libPrefix} Register apiKey ${conf.apiKey}`)

@@ -290,3 +293,3 @@

res.end(JSON.stringify(response))
} catch (err) {
} catch {
res.writeHead(503)

@@ -299,3 +302,3 @@ res.end()

if (!buildProcess) {
/* eslint-disable-next-line */
console.info(`${libPrefix} Serve custom '${resource.name}' resource to ${`${conf.serverUrl}/${join(path)}`}`)

@@ -322,3 +325,3 @@ this.addServerMiddleware(middleware)

/* eslint-disable-next-line */
console.info(`${libPrefix} Resource '${resource.name}' got '${id}' identifier`)

@@ -325,0 +328,0 @@

@@ -0,4 +1,6 @@

/* eslint-disable no-undef */
export const libPrefix = '[xhr-cache]'
async function makeRequest (url, refresh) {
const response = await fetch(url)

@@ -5,0 +7,0 @@

{
"name": "@dewib/xhr-cache",
"version": "3.3.0",
"version": "4.1.0",
"license": "MIT",

@@ -15,3 +15,3 @@ "description": "Cache api resources and serve it as static resource",

"test": "yarn lint && jest",
"release": "yarn test && standard-version && git push --follow-tags && npm publish --access=public"
"release": "yarn test && standard-version && git push --follow-tags && npm publish"
},

@@ -52,3 +52,3 @@ "repository": {

"@babel/preset-env": "^7.9.5",
"@commitlint/cli": "latest",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "latest",

@@ -58,3 +58,2 @@ "@nuxtjs/eslint-config": "latest",

"babel-eslint": "latest",
"babel-jest": "^25.4.0",
"codecov": "latest",

@@ -70,9 +69,9 @@ "eslint": "latest",

"husky": "^4.2.5",
"jest": "^25.4.0",
"nuxt-edge": "^2.13.0-26465775.85383688",
"jest": "^29.0.0",
"nuxt-edge": "latest",
"standard-version": "latest"
},
"engines": {
"node": "^14.16.0"
"node": ">=16.0.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc