@-0/spool
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -173,4 +173,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
error: e => { | ||
console.warn(e); | ||
return true; | ||
console.warn("error in `cmd$` stream:", e); | ||
return false; | ||
} | ||
@@ -181,5 +181,5 @@ }, { id: "cmd$_stream" }); | ||
error: e => { | ||
console.warn(e); | ||
return true; | ||
console.warn("error in `task$` stream:", e); | ||
return false; | ||
} | ||
}, { id: "task$_stream" }); |
@@ -1,6 +0,6 @@ | ||
import { Subscription } from "@thi.ng/rstream"; | ||
import { Subscription, ISubscription, PubSub } from "@thi.ng/rstream"; | ||
import { Command } from "@-0/keys"; | ||
export declare const log$: Subscription<any, any>; | ||
export declare const forwardUpstreamCMD$: any; | ||
export declare const registerCMD: (command?: Command) => { | ||
export declare const forwardUpstreamCMD$: (command: Command, downstream: PubSub<any>) => ISubscription<any, any>; | ||
export declare const registerCMD: (command?: Command, dev?: boolean) => { | ||
sub$: any; | ||
@@ -7,0 +7,0 @@ args: any; |
@@ -1,2 +0,1 @@ | ||
import { map } from "@thi.ng/transducers"; | ||
import { isFunction } from "@thi.ng/checks"; | ||
@@ -8,10 +7,18 @@ import { stream } from "@thi.ng/rstream"; | ||
export const log$ = stream(); | ||
export const forwardUpstreamCMD$ = (cmd, downstream) => { | ||
const upstream = cmd[CMD_SRC$]; | ||
const sub$ = cmd[CMD_SUB$]; | ||
const args = cmd[CMD_ARGS]; | ||
export const forwardUpstreamCMD$ = (command, downstream) => { | ||
const upstream = command[CMD_SRC$]; | ||
const sub$ = command[CMD_SUB$]; | ||
const args = command[CMD_ARGS]; | ||
const isFn = isFunction(args); | ||
const load = (x = null) => ({ [CMD_SUB$]: sub$, [CMD_ARGS]: x ? args(x) : args }); | ||
const xport = downstream => map(x => downstream.next(isFn ? load(x) : load())); | ||
return upstream.subscribe(xport(downstream)); | ||
const load = (dynamic = false) => ({ [CMD_SUB$]: sub$, [CMD_ARGS]: dynamic ? args(dynamic) : args }); | ||
return upstream.subscribe({ | ||
next: x => { | ||
console.log("forwardUpstreamCMD$ upstream emission from", sub$, ":", x); | ||
downstream.next(isFn ? load(x) : load()); | ||
}, | ||
error: e => { | ||
console.warn(`error from upstream \`${CMD_SRC$}\`: ${upstream.id}:`, e); | ||
return false; | ||
} | ||
}); | ||
}; | ||
@@ -42,3 +49,3 @@ const err_str = "command Registration `registerCMD`"; | ||
}; | ||
export const registerCMD = (command = null) => { | ||
export const registerCMD = (command = null, dev = true) => { | ||
const sub$ = command[CMD_SUB$]; | ||
@@ -60,3 +67,2 @@ const args = command[CMD_ARGS]; | ||
forwardUpstreamCMD$(command, out$); | ||
const sans_src = Object.assign(Object.assign({}, command), { [CMD_SRC$]: undefined }); | ||
const CMD = reso | ||
@@ -72,8 +78,12 @@ ? { | ||
next: x => { | ||
log$.next(x); | ||
if (dev) | ||
log$.next(x); | ||
return work(x[CMD_ARGS]); | ||
}, | ||
error: console.warn | ||
error: e => { | ||
console.warn("error in `out$` stream:", e); | ||
return false; | ||
} | ||
}); | ||
return CMD; | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "SPA framework built on top of http://thi.ng/umbrella ecosystem", | ||
@@ -35,4 +35,4 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@-0/keys": "^0.3.3", | ||
"@-0/utils": "^0.3.3" | ||
"@-0/keys": "^0.3.4", | ||
"@-0/utils": "^0.3.4" | ||
}, | ||
@@ -53,3 +53,3 @@ "peerDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.3.0", | ||
"@types/node": "^15.6.0", | ||
"@typescript-eslint/eslint-plugin": "^4.24.0", | ||
@@ -60,3 +60,3 @@ "@typescript-eslint/parser": "^4.24.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.26.0", | ||
"eslint": "^7.27.0", | ||
"gh-pages": "^3.1.0", | ||
@@ -63,0 +63,0 @@ "jest": "^26.6.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36878
299
Updated@-0/keys@^0.3.4
Updated@-0/utils@^0.3.4