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

@cycle/run

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cycle/run - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="3.1.0"></a>
# 3.1.0 (2017-03-24)
### Features
* **run:** sinks to support TypeScript interface ([c59ec55](https://github.com/cyclejs/cyclejs/tree/master/run/commit/c59ec55))
<a name="3.0.0"></a>

@@ -2,0 +12,0 @@ # 3.0.0 (2017-03-05)

9

lib/index.d.ts

@@ -27,4 +27,7 @@ import { MemoryStream } from 'xstream';

export declare type Sinks = {
[name: string]: FantasyObservable;
[name: string]: any;
};
export declare type FantasySinks<Si> = {
[S in keyof Si]: FantasyObservable;
};
/**

@@ -81,3 +84,3 @@ * Sink proxies should be MemoryStreams in order to fix race conditions for

*/
export declare function setup<So extends Sources, Si extends Sinks>(main: (sources: So) => Si, drivers: Drivers<So, Si>): CycleProgram<So, Si>;
export declare function setup<So extends Sources, Si extends FantasySinks<Si>>(main: (sources: So) => Si, drivers: Drivers<So, Si>): CycleProgram<So, Si>;
/**

@@ -110,3 +113,3 @@ * Takes a `main` function and circularly connects it to the given collection

*/
export declare function run<So extends Sources, Si extends Sinks>(main: (sources: So) => Si, drivers: Drivers<So, Si>): DisposeFunction;
export declare function run<So extends Sources, Si extends FantasySinks<Si>>(main: (sources: So) => Si, drivers: Drivers<So, Si>): DisposeFunction;
export default run;
{
"name": "@cycle/run",
"version": "3.0.0",
"version": "3.1.0",
"description": "The Cycle.js run() function to use with xstream",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -37,5 +37,9 @@ import xs, {Stream, MemoryStream} from 'xstream';

export type Sinks = {
[name: string]: FantasyObservable;
[name: string]: any;
};
export type FantasySinks<Si> = {
[S in keyof Si]: FantasyObservable;
};
/**

@@ -216,3 +220,3 @@ * Sink proxies should be MemoryStreams in order to fix race conditions for

*/
export function setup<So extends Sources, Si extends Sinks>(
export function setup<So extends Sources, Si extends FantasySinks<Si>>(
main: (sources: So) => Si,

@@ -278,3 +282,3 @@ drivers: Drivers<So, Si>): CycleProgram<So, Si> {

*/
export function run<So extends Sources, Si extends Sinks>(
export function run<So extends Sources, Si extends FantasySinks<Si>>(
main: (sources: So) => Si,

@@ -281,0 +285,0 @@ drivers: Drivers<So, Si>): DisposeFunction {

@@ -91,2 +91,41 @@ import 'mocha';

it('should type-check keyof sources and sinks, supporting interfaces', function () {
interface Sources {
str: Stream<string>;
obj: Stream<object>;
};
interface Sinks {
str: Stream<string>;
num: Stream<number>;
};
function app(sources: Sources): Sinks {
return {
str: sources.str.take(1).startWith('a'), // good
// str: sources.obj.mapTo('good'), // good
// strTYPO: sources.str.take(1).startWith('a'), // bad
// str: xs.of(123), // bad
num: xs.of(100), // good
// numTYPO: xs.of(100), // bad
// num: xs.of('BAD TYPE'), // bad
};
}
const stringDriver: Driver<Stream<string>, Stream<string>> =
(sink: Stream<string>) => xs.of('b');
const numberWriteOnlyDriver: Driver<Stream<number>, void> =
(sink: Stream<number>) => {};
const objectReadOnlyDriver: Driver<void, Stream<object>> =
() => xs.of({});
setup(app, {
str: stringDriver,
num: numberWriteOnlyDriver,
obj: objectReadOnlyDriver,
});
});
it('should type-check and allow more drivers than sinks', function () {

@@ -93,0 +132,0 @@ type Sources = {

Sorry, the diff of this file is not supported yet

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