0.3.0 bump version to 0.3.0 in anticipation of use in 3-2020 light deployment

working without bugs
master
David Kebler 2020-03-15 14:57:02 -07:00
parent 205f9a2ccd
commit 7730a94d3d
2 changed files with 3 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@uci-utils/ready",
"version": "0.1.10",
"version": "0.3.0",
"description": "A Class to Observe the reduced to boolean combined state of a map of observables",
"main": "src/ready.js",
"scripts": {
@ -31,7 +31,7 @@
"devDependencies": {
"chai": "^4.2.0",
"esm": "^3.2.25",
"mocha": "^7.0.1",
"mocha": "^7.1.0",
"nodemon": "^2.0.2"
}
}

View File

@ -29,7 +29,6 @@ class Ready extends Map {
if (opts.verbose||process.env.UCI_READY_VERBOSE==='true') this.logger.subscribe(console.log)
this.handler = opts.handler || ((ready) => {console.log('default handler', ready)})
this._first = true // tracks first emission
console.log('@uci-utils/ready package tag 0.1.10')
}
get observers(){return Array.from(this.keys())}
@ -37,16 +36,11 @@ class Ready extends Map {
get all() { return this._all}
get failed() {
// console.log('making failures from',this.state)
let failed = this.state
.filter(([,ready]) => {
// console.log('in filter', ready)
// return !await this.getValue(name)
// ret = obs[0]
return !ready
})
.map(obs=> {return {name:obs[0], details: this.getObserverDetails(obs[0])} })
// console.log('failed as filtered', failed)
return failed.length ? failed : '__none__'
}
@ -66,7 +60,6 @@ class Ready extends Map {
getObserver(name) {
return (this.get(name) || {}).obs
// return (name==null ||'__all__') ? this._all : ( (this.get(name) || {}).obs || this._combinations.get(name) || false )
}
getCombination(name) {
@ -99,14 +92,11 @@ class Ready extends Map {
if (!obs || !isObservable(obs)) return false
let xobs = obs.pipe(
tap(val => this.log(`${name} emitted/resolved the value =>${JSON.stringify(val)}`)),
// tap(val => console.log(`${name} emitted/resolved the value =>${JSON.stringify(val)}`)),
// TODO retain plain object if it has a ready property
map(condition),
// tap(val => console.log(`boolean: ${val}`)),
tap(val => this.log(`boolean: ${val}`)),
map(val => {
// if (opts.reverse) console.log('reversing', val, opts.reverse ? !val : val)
return opts.reverse ? !val : val}),
map(val => {return opts.reverse ? !val : val}),
startWith(false),
// shareReplay({refCount:true, bufferSize:1}),
shareReplay(1),
@ -125,7 +115,6 @@ class Ready extends Map {
if (!(obs || {})._readyType) obs = this.makeObserver(obs, opts)
if (!isObservable(obs)) return false
let sub = obs.subscribe() // internal subscriber
// let sub = null
this.set(name, {obs:obs, sub:sub})
this.setObserverDetails(name,opts.details)
this._combineAll()
@ -178,8 +167,6 @@ class Ready extends Map {
if (!names) names = this.combinations // remove all
if (!Array.isArray(names)) names = [names]
names.forEach(name => {
// const sub = (this._combinations.get(name)||{}).sub
// if (sub) sub.unsubscribe() // remove attached subscription
this.unsubscribe(name) // remove any resigtered subscription
this._combinations.delete(name)
})