Socket
Socket
Sign inDemoInstall

@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.2 to 1.0.3

79

index.js

@@ -12,47 +12,48 @@ const objectHash = require('object-hash')

export function spawn (query, prop) {
const ds = this
const hash = hashObject(query)
module.exports = {
spawn (query, prop) {
const ds = this
const hash = hashObject(query)
return Observable.using(
() => ({
unsubscribe: ds.record.provide(`${hash}:agent.query`, () => Observable.of(query))
}),
() => ds.record.observe(`${hash}:agent${prop ? `.${prop}` : ``}`))
}
return Observable.using(
() => ({
unsubscribe: ds.record.provide(`${hash}:agent.query`, () => Observable.of(query))
}),
() => ds.record.observe(`${hash}:agent${prop ? `.${prop}` : ``}`))
},
provide (matcher) {
const ds = this
return ds.record.provide(`^.+:agent(\\.methods|\\.stats|\\.result)?$`, key => {
const [ , id, prop ] = key.match(/^(.+):agent(?:\.(stats|result|description))?/)
export function provide (matcher) {
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`)
.filter(x => Object.keys(x).length > 0)
.switchMap(({ type, parent, description }) => {
if (matcher && !matcher({ type, parent, description })) {
return Observable.of(null)
}
return ds.record
.observe(`${id}:agent.query`)
.filter(x => Object.keys(x).length > 0)
.switchMap(({ type, parent, description }) => {
if (!matcher({ type, parent, description })) {
return Observable.of(null)
}
if (!description.scene || Object.keys(description.scene).length === 0) {
return Observable.of({ error: 'invalid_scene' })
}
if (!description.scene || Object.keys(description.scene).length === 0) {
return Observable.of({ error: 'invalid_scene' })
}
if (!prop) {
return Observable.of({ type, parent })
}
if (!prop) {
return Observable.of({ type, parent })
}
const name = `${objectHash(description)}:agent-${type}`
const name = `${objectHash(description)}:agent-${type}`
return Observable
.using(
() => ({
unsubscribe: ds.record.provide(`${name}.query`, () => Observable.of({ parent, description }))
}),
() => ds.record.observe(name)
)
.pluck(prop)
.map(x => x || {})
})
})
return Observable
.using(
() => ({
unsubscribe: ds.record.provide(`${name}.query`, () => Observable.of({ parent, description }))
}),
() => ds.record.observe(name)
)
.pluck(prop)
.map(x => x || {})
})
})
}
}
{
"name": "@nxtedition/agent",
"version": "1.0.2",
"version": "1.0.3",
"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