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

spica

Package Overview
Dependencies
Maintainers
1
Versions
804
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spica - npm Package Compare versions

Comparing version 0.0.796 to 0.0.797

2

channel.ts

@@ -5,3 +5,3 @@ import { AtomicPromise } from './promise';

const fail = () => AtomicPromise.reject(new Error('Spica: Channel: Closed.'));
const fail = () => AtomicPromise.reject(new Error('Spica: Channel: Closed'));

@@ -8,0 +8,0 @@ export class Channel<T = undefined> implements AsyncIterable<T> {

@@ -41,3 +41,3 @@ import { isArray } from './alias';

results.length === 0
? this[Coroutine.terminate](new Error(`Spica: Coaggregator: No result.`))
? this[Coroutine.terminate](new Error(`Spica: Coaggregator: No result`))
: this[Coroutine.exit](reducer(results));

@@ -44,0 +44,0 @@ return never;

@@ -30,3 +30,3 @@ import { isArray } from './alias';

results.length === 0
? void this[Coroutine.terminate](new Error(`Spica: Copropagator: No result.`))
? void this[Coroutine.terminate](new Error(`Spica: Copropagator: No result`))
: void this[Coroutine.exit](reducer(results)),

@@ -33,0 +33,0 @@ reason =>

@@ -108,3 +108,3 @@ import { Structural, DeepImmutable, DeepRequired } from './type';

assert(!core.alive);
reply(AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled.`)));
reply(AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled`)));
}

@@ -222,3 +222,3 @@ catch (reason) {

try {
reply(AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled.`)));
reply(AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled`)));
}

@@ -270,4 +270,4 @@ catch (reason) {

const core = this[internal].co[internal];
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled.`));
if (core.settings.capacity < 0) return AtomicPromise.reject(new Error(`Spica: Coroutine: Overflowed.`));
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled`));
if (core.settings.capacity < 0) return AtomicPromise.reject(new Error(`Spica: Coroutine: Overflowed`));
assert(core.sendBuffer instanceof Channel);

@@ -286,3 +286,3 @@ core.settings.capacity >= 0 && core.reception === 0 && ++core.reception && core.recvBuffer.take();

const core = this[internal].co[internal];
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled.`));
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled`));
++core.reception;

@@ -297,4 +297,4 @@ return Promise.resolve(core.recvBuffer.take())

const core = this[internal].co[internal];
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled.`));
if (core.settings.capacity < 0) return AtomicPromise.reject(new Error(`Spica: Coroutine: Overflowed.`));
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled`));
if (core.settings.capacity < 0) return AtomicPromise.reject(new Error(`Spica: Coroutine: Overflowed`));
assert(core.sendBuffer instanceof Channel);

@@ -307,3 +307,3 @@ core.settings.capacity >= 0 && core.reception === 0 && ++core.reception && core.recvBuffer.take();

const core = this[internal].co[internal];
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled.`));
if (!core.alive) return AtomicPromise.reject(new Error(`Spica: Coroutine: Canceled`));
return (async () => {

@@ -371,3 +371,3 @@ core.settings.capacity >= 0 && core.reception === 0 && ++core.reception && core.recvBuffer.take();

namespace BroadcastChannel {
export const fail = () => AtomicPromise.reject(new Error('Spica: Channel: Closed.'));
export const fail = () => AtomicPromise.reject(new Error('Spica: Channel: Closed'));
export class Internal<T> {

@@ -374,0 +374,0 @@ public alive: boolean = true;

@@ -29,3 +29,3 @@ import { AtomicPromise, Internal, internal } from './promise';

else if (this.strict) {
throw new Error(`Spica: Future: Cannot rebind the value.`);
throw new Error(`Spica: Future: Cannot rebind the value`);
}

@@ -52,3 +52,3 @@ return this;

else if (this.strict) {
throw new Error(`Spica: AtomicFuture: Cannot rebind the value.`);
throw new Error(`Spica: AtomicFuture: Cannot rebind the value`);
}

@@ -55,0 +55,0 @@ return this;

@@ -89,3 +89,3 @@ import { AtomicPromise } from './promise';

if (nothing !== undefined) return nothing();
throw new Error(`Spica: Maybe: Nothing value is extracted.`);
throw new Error(`Spica: Maybe: Nothing value is extracted`);
assert(just);

@@ -92,0 +92,0 @@ }

@@ -121,3 +121,3 @@ import { Monad } from './monad';

function throwCallError(): never {
throw new Error(`Spica: Either: Invalid thunk call.`);
throw new Error(`Spica: Either: Invalid thunk call`);
}

@@ -124,3 +124,3 @@ import { MonadPlus } from './monadplus';

if (nothing !== undefined) return nothing();
throw new Error(`Spica: Maybe: Nothing value is extracted.`);
throw new Error(`Spica: Maybe: Nothing value is extracted`);
}

@@ -138,3 +138,3 @@ }

function throwCallError(): never {
throw new Error(`Spica: Maybe: Invalid thunk call.`);
throw new Error(`Spica: Maybe: Invalid thunk call`);
}

@@ -134,11 +134,11 @@ import { MonadPlus } from '../monadplus';

console.error(args, args.length, args[0], args[1]);
return new TypeError(`Spica: Sequence: Invalid parameters of cons.`);
return new TypeError(`Spica: Sequence: Invalid parameters of cons`);
}
export function invalidDataError(data: unknown[]): TypeError {
console.error(data);
return new TypeError(`Spica: Sequence: Invalid data.`);
return new TypeError(`Spica: Sequence: Invalid data`);
}
export function invalidThunkError(thunk: Sequence.Thunk<unknown>): TypeError {
console.error(thunk);
return new TypeError(`Spica: Sequence: Invalid thunk.`);
return new TypeError(`Spica: Sequence: Invalid thunk`);
}

@@ -149,3 +149,3 @@ }

function throwCallError(): never {
throw new Error(`Spica: Sequence: Invalid thunk call.`);
throw new Error(`Spica: Sequence: Invalid thunk call`);
}

@@ -132,3 +132,3 @@ import { MAX_SAFE_INTEGER } from './alias';

const monitors = node.monitors;
if (monitors.length === this.limit) throw new Error(`Spica: Observation: Exceeded max listener limit.`);
if (monitors.length === this.limit) throw new Error(`Spica: Observation: Exceeded max listener limit`);
node.mid === MAX_SAFE_INTEGER && node.reset(monitors);

@@ -148,3 +148,3 @@ const inode = monitors.push(new Node({

const subscribers = node.subscribers;
if (subscribers.length === this.limit) throw new Error(`Spica: Observation: Exceeded max listener limit.`);
if (subscribers.length === this.limit) throw new Error(`Spica: Observation: Exceeded max listener limit`);
node.sid === MAX_SAFE_INTEGER && node.reset(subscribers);

@@ -193,3 +193,3 @@ const inode = subscribers.push(new Node({

assert(!this.relaies.has(source));
if (this.relaies.has(source)) throw new Error(`Spica: Observation: Relay source is already registered.`);
if (this.relaies.has(source)) throw new Error(`Spica: Observation: Relay source is already registered`);
this.relaies.add(source);

@@ -196,0 +196,0 @@ return source.monitor([] as Inits<N>, (data, namespace) =>

{
"name": "spica",
"version": "0.0.796",
"version": "0.0.797",
"description": "Supervisor, Coroutine, Channel, select, AtomicPromise, Cancellation, Cache, List, Queue, Stack, and some utils.",

@@ -5,0 +5,0 @@ "private": false,

@@ -65,3 +65,3 @@ import { DeepImmutable, DeepRequired } from './type';

this.name = this.settings.name;
if (this.constructor === Supervisor) throw new Error(`Spica: Supervisor: <${this.name}>: Cannot instantiate abstract classes.`);
if (this.constructor === Supervisor) throw new Error(`Spica: Supervisor: <${this.name}>: Cannot instantiate abstract classes`);
this.constructor.instances.add(this);

@@ -122,3 +122,3 @@ }

private throwErrorIfNotAvailable(): void {
if (!this.available) throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use terminated supervisors.`);
if (!this.available) throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use terminated supervisors`);
}

@@ -191,3 +191,3 @@ // Workaround for #36053

}
if (this.workers.has(name)) throw new Error(`Spica: Supervisor: <${this.name}/${name}>: Cannot register another process with tha same name.`);
if (this.workers.has(name)) throw new Error(`Spica: Supervisor: <${this.name}/${name}>: Cannot register another process with tha same name`);
this.schedule();

@@ -225,3 +225,3 @@ const worker: Worker<N, P, R, S> = new Worker(

try {
callback(new Error(`Spica: Supervisor: <${this.name}>: Message overflowed.`), undefined);
callback(new Error(`Spica: Supervisor: <${this.name}>: Message overflowed`), undefined);
}

@@ -296,6 +296,6 @@ catch (reason) {

public override [Coroutine.port] = {
ask: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port.`); },
recv: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port.`); },
send: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port.`); },
connect: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port.`); },
ask: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port`); },
recv: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port`); },
send: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port`); },
connect: () => { throw new Error(`Spica: Supervisor: <${this.name}>: Cannot use coroutine port`); },
} as const;

@@ -340,3 +340,3 @@ private scheduled = false;

() =>
void callback(new Error(`Spica: Supervisor: <${this.name}>: Process failed.`), undefined));
void callback(new Error(`Spica: Supervisor: <${this.name}>: Process failed`), undefined));
}

@@ -346,3 +346,3 @@ else {

try {
callback(new Error(`Spica: Supervisor: <${this.name}>: Message expired.`), undefined);
callback(new Error(`Spica: Supervisor: <${this.name}>: Message expired`), undefined);
}

@@ -349,0 +349,0 @@ catch (reason) {

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