New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@qio/core

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qio/core - npm Package Compare versions

Comparing version 29.2.1 to 30.0.0

lib/internals/IDGenerator.d.ts

22

CHANGELOG.md

@@ -6,2 +6,24 @@ # Change Log

# [30.0.0](https://github.com/tusharmath/qio/compare/v29.2.1...v30.0.0) (2019-12-29)
### Bug Fixes
* **package:** export TestRuntime as a parameter ([4a7a9e6](https://github.com/tusharmath/qio/commit/4a7a9e6ea32d3ee8d6cbde3d445ce4100cdadcdf))
### Features
* **qio:** add \`QIO.tap\` ([9c68d80](https://github.com/tusharmath/qio/commit/9c68d80a0bbad51df9c83916df9076224898a0ee))
### BREAKING CHANGES
* **qio:** \`QIO.tap\` signature has been updated to accept a function that doesn't return a \`QIO\`. Use
\`QIO.tapM\` if you still want to pass a function that returns a \`QIO\`.
## [29.2.1](https://github.com/tusharmath/qio/compare/v29.2.0...v29.2.1) (2019-12-28)

@@ -8,0 +30,0 @@

2

index.d.ts

@@ -13,2 +13,2 @@ export { Await } from './lib/main/Await';

export { Snapshot } from './lib/main/Snapshot';
export { testRuntime } from './lib/runtimes/TestRuntime';
export { testRuntime, TestRuntime } from './lib/runtimes/TestRuntime';

@@ -27,1 +27,2 @@ "use strict";

exports.testRuntime = TestRuntime_1.testRuntime;
exports.TestRuntime = TestRuntime_1.TestRuntime;

@@ -9,2 +9,3 @@ "use strict";

const CancellationList_1 = require("./CancellationList");
const IDGenerator_1 = require("./IDGenerator");
const YieldStrategy_1 = require("./YieldStrategy");

@@ -23,6 +24,6 @@ const D = debug_1.debug('qio:fiber');

})(FiberStatus || (FiberStatus = {}));
let FIBER_ID = 0;
const FIBER_ID = new IDGenerator_1.IDGenerator();
class Fiber {
constructor() {
this.id = FIBER_ID++;
this.id = FIBER_ID.create();
}

@@ -29,0 +30,0 @@ get join() {

import { QIO } from './QIO';
export declare class Await<A, E> {
get get(): QIO<A, E>;
get isSet(): QIO<boolean>;
private get wait();
static of<A = never, E = never>(): QIO<Await<A, E>>;
private flag;
private readonly id;
private readonly Q;
private result;
get get(): QIO<A, E>;
get isSet(): QIO<boolean>;
set(io: QIO<A, E>): QIO<boolean>;
private get wait();
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const debug_1 = require("debug");
const standard_data_structures_1 = require("standard-data-structures");
const IDGenerator_1 = require("../internals/IDGenerator");
const QIO_1 = require("./QIO");

@@ -11,11 +13,11 @@ var AwaitStatus;

})(AwaitStatus || (AwaitStatus = {}));
const AWAIT_ID = new IDGenerator_1.IDGenerator();
const D = (id, scope, ...t) => debug_1.debug('qio:await')(id, scope, ...t);
class Await {
constructor() {
this.flag = AwaitStatus.PENDING;
this.id = AWAIT_ID.create();
this.Q = standard_data_structures_1.DoublyLinkedList.of();
this.result = standard_data_structures_1.Option.none();
}
static of() {
return QIO_1.QIO.lift(() => new Await());
}
get get() {

@@ -29,4 +31,22 @@ return QIO_1.QIO.tryM(() => this.result

}
get wait() {
return QIO_1.QIO.interruptible((res, rej) => {
const id = this.Q.add([res, rej]);
D(this.id, 'add wait');
D(this.id, 'this.Q.length', this.Q.length);
return {
cancel: () => {
this.Q.remove(id);
D(this.id, 'remove wait');
D(this.id, 'this.Q.length', this.Q.length);
}
};
});
}
static of() {
return QIO_1.QIO.lift(() => new Await());
}
set(io) {
return QIO_1.QIO.tryM(() => {
D(this.id, 'set', 'status', AwaitStatus[this.flag]);
if (this.flag > AwaitStatus.PENDING) {

@@ -36,4 +56,6 @@ return QIO_1.QIO.resolve(false);

this.flag = AwaitStatus.STARTED;
D(this.id, 'set', 'status', AwaitStatus[this.flag]);
return io.asEither.encase(either => {
this.flag = AwaitStatus.COMPLETED;
D(this.id, 'set', 'status', AwaitStatus[this.flag]);
this.result = standard_data_structures_1.Option.some(either);

@@ -50,11 +72,3 @@ while (this.Q.length > 0) {

}
get wait() {
return QIO_1.QIO.interruptible((res, rej) => {
const id = this.Q.add([res, rej]);
return {
cancel: () => this.Q.remove(id)
};
});
}
}
exports.Await = Await;
export declare abstract class Chunk<A> {
static empty<A>(): Chunk<A>;
static from<A>(arr: A[]): Chunk<A>;
static of<A>(A: A): Chunk<A>;
abstract readonly length: number;

@@ -5,0 +6,0 @@ chain<B>(fn: (A: A) => Chunk<B>): Chunk<B>;

@@ -10,2 +10,5 @@ "use strict";

}
static of(A) {
return new Value(A);
}
chain(fn) {

@@ -71,1 +74,17 @@ return this.fold(Chunk.empty(), (AA, SS) => SS.concat(fn(AA)));

}
class Value extends Chunk {
constructor(value) {
super();
this.value = value;
this.length = 1;
}
filter(fn) {
return fn(this.value) ? new Value(this.value) : new Empty();
}
fold(S, fn) {
return fn(this.value, S);
}
map(fn) {
return new Value(fn(this.value));
}
}

@@ -81,3 +81,4 @@ import { Either } from 'standard-data-structures';

rejectWith<E2>(error: E2): QIO<A1, E1 | E2, R1>;
tap<E2, R2>(io: (A1: A1) => QIO<unknown, E2, R2>): QIO<A1, E1 | E2, R1 & R2>;
tap(fn: (A: A1) => void): QIO<A1, E1, R1>;
tapM<E2, R2>(io: (A1: A1) => QIO<unknown, E2, R2>): QIO<A1, E1 | E2, R1 & R2>;
zip<A2, E2, R2>(that: QIO<A2, E2, R2>): QIO<[A1, A2], E1 | E2, R1 & R2>;

@@ -84,0 +85,0 @@ zipWith<A2, E2, R2, C>(that: QIO<A2, E2, R2>, c: (a1: A1, a2: A2) => C): QIO<C, E1 | E2, R1 & R2>;

@@ -248,3 +248,6 @@ "use strict";

}
tap(io) {
tap(fn) {
return this.tapM(QIO.encase(fn));
}
tapM(io) {
return this.chain(_ => io(_).const(_));

@@ -251,0 +254,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const debug_1 = require("debug");
const standard_data_structures_1 = require("standard-data-structures");
const Await_1 = require("./Await");
const QIO_1 = require("./QIO");
const D = (scope, f, ...t) => debug_1.debug('qio:queue')(scope, f, ...t);
class Queue {

@@ -40,2 +42,3 @@ constructor(capacity) {

this.Q.add(a);
D('offer', 'Q.add()', a);
return QIO_1.QIO.void();

@@ -47,2 +50,3 @@ }

if (standard_data_structures_1.Option.isSome(item)) {
D('offer', 'Q.shift()', a);
io.push(item.value.set(QIO_1.QIO.resolve(a)));

@@ -49,0 +53,0 @@ }

@@ -18,5 +18,5 @@ {

},
"version": "29.2.1",
"version": "30.0.0",
"dependencies": {
"@qio/prelude": "^29.0.5",
"@qio/prelude": "^30.0.0",
"debug": "^4.1.1",

@@ -39,3 +39,3 @@ "in-node": "^1.0.0",

},
"gitHead": "7535d15d5089e57b8e6190f122ca4904affe06c9"
"gitHead": "654980acbdf0ece50081a635d45540c0932feeb4"
}
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