0.9.1 • Published 9 days ago

@e-mc/task v0.9.1

Weekly downloads
-
License
BSD 3-Clause
Repository
github
Last release
9 days ago

@e-mc/task

  • NodeJS 16
  • ES2020

General Usage

Interface

import type { IFileManager, IHost, ModuleConstructor } from "./index";
import type { ExternalAsset, IFileThread } from "./asset";
import type { IClient } from "./core";
import type { TaskModule } from "./settings";
import type { Command, SpawnResult } from "./task";

interface ITask extends IClient<IHost, TaskModule> {
    using?(data: IFileThread): Promise<unknown>;
    collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
    map?(tasks: Command[]): Promise<SpawnResult | void>[];
    series?(tasks: Command[]): Promise<unknown>;
    parallel?(tasks: Command[]): Promise<unknown>;
    spawn?(task: Record<string | number | symbol, unknown>, callback: (result?: SpawnResult) => void): void;
    execute?(manager: IFileManager, task: Record<string | number | symbol, unknown>, callback: (value?: unknown) => void): void;
}

interface TaskConstructor extends ModuleConstructor {
    finalize(this: IHost, instance: ITask, assets: ExternalAsset[]): Promise<unknown>;
    readonly prototype: ITask;
    new(module?: TaskModule, ...args: unknown[]): ITask;
}

Settings

import type { PermittedDirectories } from "./core";

interface TaskModule {
    // handler: "@pi-r/gulp";
    settings?: {
        broadcast_id?: string | string[];
        users?: Record<string, Record<string, unknown>>;
        exec?: {
            uid?: number;
            gid?: number;
        };
    };
    permission?: PermittedDirectories;
}

Example usage

NOTE: Usage without a Host is conducted through static methods. The using class method is called by the Host to perform the transformation.

References

LICENSE

BSD 3-Clause

0.8.9

9 days ago

0.8.8

9 days ago

0.7.6

9 days ago

0.7.5

9 days ago

0.8.10

9 days ago

0.6.3

9 days ago

0.7.4

9 days ago

0.5.6

9 days ago

0.9.1

9 days ago

0.9.0

10 days ago

0.8.7

1 month ago

0.6.2

1 month ago

0.7.3

1 month ago

0.5.5

1 month ago

0.8.6

2 months ago

0.7.2

2 months ago

0.5.4

2 months ago

0.6.1

2 months ago

0.8.5

2 months ago

0.8.4

3 months ago

0.8.3

3 months ago

0.8.2

3 months ago

0.8.1

4 months ago

0.8.0

5 months ago

0.7.1

5 months ago

0.7.0

5 months ago

0.6.0

9 months ago

0.5.3

12 months ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0

1 year ago

0.4.2

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago