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

poolifier

Package Overview
Dependencies
Maintainers
1
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poolifier - npm Package Compare versions

Comparing version 2.0.0-beta.5 to 2.0.0-beta.6

6

lib/pools/abstract-pool.d.ts

@@ -85,4 +85,4 @@ /// <reference types="node" />

* @template Worker Type of worker which manages this pool.
* @template Data Type of data sent to the worker.
* @template Response Type of response of execution.
* @template Data Type of data sent to the worker. This can only be serializable data.
* @template Response Type of response of execution. This can only be serializable data.
*/

@@ -132,3 +132,3 @@ export declare abstract class AbstractPool<Worker extends IWorker, Data = unknown, Response = unknown> implements IPool<Data, Response> {

*
* @param data The input for the specified task.
* @param data The input for the specified task. This can only be serializable data.
* @returns Promise that will be resolved when the task is successfully completed.

@@ -135,0 +135,0 @@ */

/// <reference types="node" />
import type { Worker } from 'cluster';
import type { JSONValue } from '../../utility-types';
import type { ClusterPoolOptions } from './fixed';

@@ -12,4 +11,4 @@ import { FixedClusterPool } from './fixed';

*
* @template Data Type of data sent to the worker.
* @template Response Type of response of execution.
* @template Data Type of data sent to the worker. This can only be serializable data.
* @template Response Type of response of execution. This can only be serializable data.
*

@@ -19,3 +18,3 @@ * @author [Christopher Quadflieg](https://github.com/Shinigami92)

*/
export declare class DynamicClusterPool<Data extends JSONValue = JSONValue, Response extends JSONValue = JSONValue> extends FixedClusterPool<Data, Response> {
export declare class DynamicClusterPool<Data = unknown, Response = unknown> extends FixedClusterPool<Data, Response> {
readonly max: number;

@@ -22,0 +21,0 @@ /**

/// <reference types="node" />
import { Worker } from 'cluster';
import type { JSONValue, MessageValue } from '../../utility-types';
import type { MessageValue } from '../../utility-types';
import type { PoolOptions } from '../abstract-pool';

@@ -24,4 +24,4 @@ import { AbstractPool } from '../abstract-pool';

*
* @template Data Type of data sent to the worker.
* @template Response Type of response of execution.
* @template Data Type of data sent to the worker. This can only be serializable data.
* @template Response Type of response of execution. This can only be serializable data.
*

@@ -31,3 +31,3 @@ * @author [Christopher Quadflieg](https://github.com/Shinigami92)

*/
export declare class FixedClusterPool<Data extends JSONValue = JSONValue, Response extends JSONValue = JSONValue> extends AbstractPool<Worker, Data, Response> {
export declare class FixedClusterPool<Data = unknown, Response = unknown> extends AbstractPool<Worker, Data, Response> {
readonly opts: ClusterPoolOptions;

@@ -34,0 +34,0 @@ /**

/**
* Contract definition for a poolifier pool.
*
* @template Data Type of data sent to the worker.
* @template Response Type of response of execution.
* @template Data Type of data sent to the worker. This can only be serializable data.
* @template Response Type of response of execution. This can only be serializable data.
*/

@@ -11,3 +11,3 @@ export interface IPool<Data = unknown, Response = unknown> {

*
* @param data The input for the specified task.
* @param data The input for the specified task. This can only be serializable data.
* @returns Promise that will be resolved when the task is successfully completed.

@@ -14,0 +14,0 @@ */

@@ -1,2 +0,1 @@

import type { JSONValue } from '../../utility-types';
import type { PoolOptions } from '../abstract-pool';

@@ -11,4 +10,4 @@ import type { ThreadWorkerWithMessageChannel } from './fixed';

*
* @template Data Type of data sent to the worker.
* @template Response Type of response of execution.
* @template Data Type of data sent to the worker. This can only be serializable data.
* @template Response Type of response of execution. This can only be serializable data.
*

@@ -18,3 +17,3 @@ * @author [Alessandro Pio Ardizio](https://github.com/pioardi)

*/
export declare class DynamicThreadPool<Data extends JSONValue = JSONValue, Response extends JSONValue = JSONValue> extends FixedThreadPool<Data, Response> {
export declare class DynamicThreadPool<Data = unknown, Response = unknown> extends FixedThreadPool<Data, Response> {
readonly max: number;

@@ -21,0 +20,0 @@ /**

/// <reference types="node" />
import { MessageChannel, Worker } from 'worker_threads';
import type { Draft, JSONValue, MessageValue } from '../../utility-types';
import type { Draft, MessageValue } from '../../utility-types';
import type { PoolOptions } from '../abstract-pool';

@@ -17,4 +17,4 @@ import { AbstractPool } from '../abstract-pool';

*
* @template Data Type of data sent to the worker.
* @template Response Type of response of execution.
* @template Data Type of data sent to the worker. This can only be serializable data.
* @template Response Type of response of execution. This can only be serializable data.
*

@@ -24,3 +24,3 @@ * @author [Alessandro Pio Ardizio](https://github.com/pioardi)

*/
export declare class FixedThreadPool<Data extends JSONValue = JSONValue, Response extends JSONValue = JSONValue> extends AbstractPool<ThreadWorkerWithMessageChannel, Data, Response> {
export declare class FixedThreadPool<Data = unknown, Response = unknown> extends AbstractPool<ThreadWorkerWithMessageChannel, Data, Response> {
/**

@@ -27,0 +27,0 @@ * Constructs a new poolifier fixed thread pool.

@@ -12,20 +12,2 @@ /// <reference types="node" />

/**
* Serializable primitive JSON value.
*/
export declare type JSONPrimitive = number | boolean | string | null;
/**
* Serializable JSON value.
*/
export declare type JSONValue = JSONPrimitive | JSONArray | JSONObject;
/**
* Serializable JSON object.
*/
export declare type JSONObject = {
[k: string]: JSONValue;
};
/**
* Serializable JSON array.
*/
export declare type JSONArray = Array<JSONValue>;
/**
* Message object that is passed between worker and main worker.

@@ -32,0 +14,0 @@ */

@@ -11,4 +11,4 @@ /// <reference types="node" />

* @template MainWorker Type of main worker.
* @template Data Type of data this worker receives from pool's execution.
* @template Response Type of response the worker sends back to the main worker.
* @template Data Type of data this worker receives from pool's execution. This can only be serializable data.
* @template Response Type of response the worker sends back to the main worker. This can only be serializable data.
*/

@@ -15,0 +15,0 @@ export declare abstract class AbstractWorker<MainWorker extends Worker | MessagePort, Data = unknown, Response = unknown> extends AsyncResource {

/// <reference types="node" />
import type { Worker } from 'cluster';
import type { JSONValue, MessageValue } from '../utility-types';
import type { MessageValue } from '../utility-types';
import { AbstractWorker } from './abstract-worker';

@@ -15,4 +15,4 @@ import type { WorkerOptions } from './worker-options';

*
* @template Data Type of data this worker receives from pool's execution.
* @template Response Type of response the worker sends back to the main worker.
* @template Data Type of data this worker receives from pool's execution. This can only be serializable data.
* @template Response Type of response the worker sends back to the main worker. This can only be serializable data.
*

@@ -22,3 +22,3 @@ * @author [Christopher Quadflieg](https://github.com/Shinigami92)

*/
export declare class ClusterWorker<Data extends JSONValue = JSONValue, Response extends JSONValue = JSONValue> extends AbstractWorker<Worker, Data, Response> {
export declare class ClusterWorker<Data = unknown, Response = unknown> extends AbstractWorker<Worker, Data, Response> {
/**

@@ -25,0 +25,0 @@ * Constructs a new poolifier cluster worker.

/// <reference types="node" />
import type { MessagePort } from 'worker_threads';
import type { JSONValue, MessageValue } from '../utility-types';
import type { MessageValue } from '../utility-types';
import { AbstractWorker } from './abstract-worker';

@@ -15,4 +15,4 @@ import type { WorkerOptions } from './worker-options';

*
* @template Data Type of data this worker receives from pool's execution.
* @template Response Type of response the worker sends back to the main thread.
* @template Data Type of data this worker receives from pool's execution. This can only be serializable data.
* @template Response Type of response the worker sends back to the main thread. This can only be serializable data.
*

@@ -22,3 +22,3 @@ * @author [Alessandro Pio Ardizio](https://github.com/pioardi)

*/
export declare class ThreadWorker<Data extends JSONValue = JSONValue, Response extends JSONValue = JSONValue> extends AbstractWorker<MessagePort, Data, Response> {
export declare class ThreadWorker<Data = unknown, Response = unknown> extends AbstractWorker<MessagePort, Data, Response> {
/**

@@ -25,0 +25,0 @@ * Constructs a new poolifier thread worker.

{
"name": "poolifier",
"version": "v2.0.0-beta.5",
"version": "v2.0.0-beta.6",
"description": "A fast, easy to use Node.js Worker Thread Pool and Cluster Pool implementation",

@@ -20,3 +20,4 @@ "main": "lib/index.js",

"lint": "eslint .",
"lint:fix": "eslint . --fix"
"lint:fix": "eslint . --fix",
"prepublishOnly": "npm run build:prod"
},

@@ -64,3 +65,3 @@ "repository": {

"devDependencies": {
"@types/node": "^14.14.29",
"@types/node": "^14.14.30",
"@typescript-eslint/eslint-plugin": "^4.15.1",

@@ -67,0 +68,0 @@ "@typescript-eslint/parser": "^4.15.1",

<div align="center">
<img src="./docs/logo.png" width="475" height="400"/>
<img src="./docs/logo.png" width="340px" height="266px"/>
</div>

@@ -140,2 +140,4 @@

Remember that workers can only send and receive serializable (JSON) data.
## Node versions

@@ -142,0 +144,0 @@

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