Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nxtedition/agent

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nxtedition/agent - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

55

index.js
const objectHash = require('object-hash')
const { Observable } = require('rxjs')

@@ -11,2 +12,4 @@ function hashObject (obj) {

const providers = new Map()
module.exports = {

@@ -26,3 +29,55 @@ spawn (query, prop) {

)
},
init () {
const ds = this
return ds.record.provide(`^.+:agent(\\.methods|\\.stats|\\.result)?$`, key => {
const [ , id, prop ] = key.match(/^(.+):agent(?:\.(stats|result|description))?/)
return ds.record
.observe(`${id}:agent.query`)
.first(x => Object.keys(x).length > 0)
.switchMap(({ type, parent, description }) => {
if (!prop) {
return Observable.of({ type, parent })
}
if (prop === 'description') {
return Observable.of(description)
}
const name = `${hashObject(description)}:agent-${type}`
return Observable
.using(
() => {
let provider = providers.get(name)
if (!provider) {
provider = {
unsubscribe: ds.record.provide(`${name}\\.query`, () => Observable.of({ parent, description })),
refs: 0
}
providers.set(name, provider)
}
provider.refs += 1
return {
unsubscribe: () => {
provider.refs -= 1
if (providers.refs === 0) {
provider.unsubscribe()
providers.delete(key)
}
}
}
},
() => ds.record.observe(name)
)
.pluck(prop)
.map(x => x || {})
})
.catch(err => Observable.of({ error: err.message || err }))
})
}
}

2

package.json
{
"name": "@nxtedition/agent",
"version": "1.0.8",
"version": "1.0.9",
"main": "index.js",

@@ -5,0 +5,0 @@ "author": "Robert Nagy <robert.nagy@boffins.se>",

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