[upd] plankton
This commit is contained in:
parent
2ac6f63e1d
commit
a8c321b60e
617
lib/plankton/plankton.d.ts
vendored
617
lib/plankton/plankton.d.ts
vendored
|
|
@ -733,3 +733,620 @@ declare namespace lib_plankton.call {
|
|||
seconds: (null | float);
|
||||
}>;
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
interface interface_code<type_from, type_to> {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
encode(x: type_from): type_to;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
decode(x: type_to): type_from;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
type type_code<type_from, type_to> = {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
encode: (x: type_from) => type_to;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
decode: (x: type_to) => type_from;
|
||||
};
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function inverse_encode<type_from, type_to>(decode: (to: type_to) => type_from, to: type_to): type_from;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function inverse_decode<type_from, type_to>(encode: (from: type_from) => type_to, from: type_from): type_to;
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
class class_code_inverse<type_from, type_to> implements interface_code<type_to, type_from> {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected subject: interface_code<type_from, type_to>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor(subject: interface_code<type_from, type_to>);
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
encode(to: type_to): type_from;
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
decode(from: type_from): type_to;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function pair_encode<type_from, type_between, type_to>(encode_first: (from: type_from) => type_between, encode_second: (between: type_between) => type_to, from: type_from): type_to;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function pair_decode<type_from, type_between, type_to>(decode_first: (between: type_between) => type_from, decode_second: (to: type_to) => type_between, to: type_to): type_from;
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
class class_code_pair<type_from, type_between, type_to> implements interface_code<type_from, type_to> {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected first: interface_code<type_from, type_between>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected second: interface_code<type_between, type_to>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor(first: interface_code<type_from, type_between>, second: interface_code<type_between, type_to>);
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
encode(from: type_from): type_to;
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
decode(to: type_to): type_from;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function chain_encode(encode_links: Array<(from: any) => any>, from: any): any;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function chain_decode(decode_links: Array<(to: any) => any>, to: any): any;
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
class class_code_chain implements interface_code<any, any> {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected links: Array<interface_code<any, any>>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor(links: Array<interface_code<any, any>>);
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
encode(from: any): any;
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
decode(to: any): any;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author Christian Fraß <frass@greenscale.de>
|
||||
*/
|
||||
type type_flatten_from = Array<{
|
||||
[name: string]: any;
|
||||
}>;
|
||||
/**
|
||||
* @author Christian Fraß <frass@greenscale.de>
|
||||
*/
|
||||
type type_flatten_to = {
|
||||
keys: Array<string>;
|
||||
data: Array<Array<any>>;
|
||||
};
|
||||
/**
|
||||
* @author Christian Fraß <frass@greenscale.de>
|
||||
*/
|
||||
function flatten_encode(from: type_flatten_from, keys?: Array<string>): type_flatten_to;
|
||||
/**
|
||||
* @author Christian Fraß <frass@greenscale.de>
|
||||
*/
|
||||
function flatten_decode(to: type_flatten_to): type_flatten_from;
|
||||
}
|
||||
declare namespace lib_plankton.code {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
class class_code_flatten implements interface_code<type_flatten_from, type_flatten_to> {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
encode(x: type_flatten_from): type_flatten_to;
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
decode(x: type_flatten_to): type_flatten_from;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.json {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function encode(x: any, formatted?: boolean): string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function decode(x: string): any;
|
||||
}
|
||||
declare namespace lib_plankton.json {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
class class_json implements lib_plankton.code.interface_code<any, string> {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
encode(x: any): string;
|
||||
/**
|
||||
* @implementation
|
||||
* @author fenris
|
||||
*/
|
||||
decode(x: string): any;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.file {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function read(path: string): Promise<string>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function read_buffer(path: string): Promise<Buffer>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function read_stdin(): Promise<string>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function write(path: string, content: string, options?: {
|
||||
encoding?: string;
|
||||
}): Promise<void>;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function write_buffer(path: string, content: Buffer, options?: {}): Promise<void>;
|
||||
/**
|
||||
*/
|
||||
function delete_(path: string): Promise<void>;
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
*/
|
||||
enum enum_level {
|
||||
debug = 0,
|
||||
info = 1,
|
||||
notice = 2,
|
||||
warning = 3,
|
||||
error = 4
|
||||
}
|
||||
/**
|
||||
*/
|
||||
function level_order(level1: enum_level, level2: enum_level): boolean;
|
||||
/**
|
||||
*/
|
||||
function level_show(level: enum_level): string;
|
||||
/**
|
||||
*/
|
||||
type type_entry = {
|
||||
level: enum_level;
|
||||
incident: string;
|
||||
details: Record<string, any>;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @todo remove
|
||||
*/
|
||||
declare namespace lib_plankton.log {
|
||||
function level_push(level: int): void;
|
||||
function level_pop(): void;
|
||||
function indent_push(indent: int): void;
|
||||
function indent_pop(): void;
|
||||
function indent_inc(): void;
|
||||
function indent_dec(): void;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
function write({ "message": message, "type": type, "prefix": prefix, "level": level, "indent": indent, }: {
|
||||
message?: string;
|
||||
type?: string;
|
||||
prefix?: string;
|
||||
level?: int;
|
||||
indent?: int;
|
||||
}): void;
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
*/
|
||||
abstract class class_channel {
|
||||
/**
|
||||
*/
|
||||
abstract add(entry: type_entry): void;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
* output for writing log entries to stdout
|
||||
*/
|
||||
class class_channel_stdout extends class_channel {
|
||||
/**
|
||||
*/
|
||||
add(entry: type_entry): void;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
*/
|
||||
class class_channel_file extends class_channel {
|
||||
/**
|
||||
* the path of the log file
|
||||
*/
|
||||
private path;
|
||||
/**
|
||||
* [constructor]
|
||||
*/
|
||||
constructor(path: string);
|
||||
/**
|
||||
*/
|
||||
add(entry: type_entry): void;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
* output for desktop notifications via "libnotify"
|
||||
*/
|
||||
class class_channel_notify extends class_channel {
|
||||
/**
|
||||
*/
|
||||
add(entry: type_entry): void;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
* decorator for filtering out log entries below a certain level threshold
|
||||
*/
|
||||
class class_channel_minlevel extends class_channel {
|
||||
/**
|
||||
*/
|
||||
private core;
|
||||
/**
|
||||
*/
|
||||
private threshold;
|
||||
/**
|
||||
*/
|
||||
constructor(core: class_channel, threshold: enum_level);
|
||||
/**
|
||||
*/
|
||||
add(entry: type_entry): void;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
*/
|
||||
function channel_make(description: {
|
||||
kind: string;
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
}): class_channel;
|
||||
/**
|
||||
*/
|
||||
type type_configuration = Array<class_channel>;
|
||||
/**
|
||||
*/
|
||||
function conf_default(): type_configuration;
|
||||
}
|
||||
declare namespace lib_plankton.log {
|
||||
/**
|
||||
* pushes a new configuration on the stack and activates it
|
||||
*/
|
||||
function conf_push(channels: type_configuration): void;
|
||||
/**
|
||||
* pops the current active configuration from the stack
|
||||
*/
|
||||
function conf_pop(): void;
|
||||
/**
|
||||
* consumes a log entry, i.e. sends it to the currently active outputs
|
||||
*/
|
||||
function add(entry: type_entry): void;
|
||||
/**
|
||||
*/
|
||||
function debug(incident: string, details?: Record<string, any>): void;
|
||||
/**
|
||||
*/
|
||||
function info(incident: string, details?: Record<string, any>): void;
|
||||
/**
|
||||
*/
|
||||
function notice(incident: string, details?: Record<string, any>): void;
|
||||
/**
|
||||
*/
|
||||
function warning(incident: string, details?: Record<string, any>): void;
|
||||
/**
|
||||
*/
|
||||
function error(incident: string, details?: Record<string, any>): void;
|
||||
}
|
||||
declare namespace lib_plankton.args {
|
||||
/**
|
||||
*/
|
||||
enum enum_environment {
|
||||
cli = "cli",
|
||||
url = "url"
|
||||
}
|
||||
/**
|
||||
*/
|
||||
enum enum_kind {
|
||||
positional = "positional",
|
||||
volatile = "volatile"
|
||||
}
|
||||
/**
|
||||
*/
|
||||
enum enum_type {
|
||||
boolean = "boolean",
|
||||
integer = "int",
|
||||
float = "float",
|
||||
string = "string"
|
||||
}
|
||||
/**
|
||||
*/
|
||||
enum enum_mode {
|
||||
replace = "replace",
|
||||
accumulate = "accumulate"
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.args {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
class class_argument {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected name: string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected kind: enum_kind;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected type: enum_type;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected mode: enum_mode;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected default_: any;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected info: string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected parameters: Object;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected hidden: boolean;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor({ "name": name, "type": type, "kind": kind, "mode": mode, "default": default_, "info": info, "parameters": parameters, "hidden": hidden, }: {
|
||||
name: string;
|
||||
type?: enum_type;
|
||||
kind?: enum_kind;
|
||||
mode?: enum_mode;
|
||||
default?: any;
|
||||
info?: string;
|
||||
parameters?: Object;
|
||||
hidden?: boolean;
|
||||
});
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
static positional({ "name": name, "type": type, "mode": mode, "default": default_, "info": info, "hidden": hidden, "index": index, }: {
|
||||
name: string;
|
||||
type?: enum_type;
|
||||
mode?: enum_mode;
|
||||
default?: any;
|
||||
info?: string;
|
||||
hidden?: boolean;
|
||||
index: int;
|
||||
}): class_argument;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
static volatile({ "name": name, "type": type, "mode": mode, "default": default_, "info": info, "hidden": hidden, "indicators_short": indicators_short, "indicators_long": indicators_long, }: {
|
||||
name: string;
|
||||
type?: enum_type;
|
||||
mode?: enum_mode;
|
||||
default?: any;
|
||||
info?: string;
|
||||
hidden?: boolean;
|
||||
indicators_short: Array<string>;
|
||||
indicators_long: Array<string>;
|
||||
}): class_argument;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
check(): boolean;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
name_get(): string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
kind_get(): enum_kind;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
type_get(): enum_type;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
mode_get(): enum_mode;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
default_get(): any;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
parameters_get(): Object;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
hidden_get(): boolean;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
indicator_main(): string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
pattern_value(): string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
extract(raw: string): any;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
assign(data: Object, target: string, raw: string): void;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
make(data: Object, target: string): string;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
generate_help(): string;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.args {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
var verbosity: int;
|
||||
/**
|
||||
* @author fenris
|
||||
* @todo check validity
|
||||
*/
|
||||
class class_handler {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
protected arguments_: {
|
||||
[name: string]: class_argument;
|
||||
};
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
constructor(arguments_: {
|
||||
[name: string]: class_argument;
|
||||
});
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
filter(kind: enum_kind): {
|
||||
[name: string]: class_argument;
|
||||
};
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
read(environment: enum_environment, input: string, data?: {
|
||||
[name: string]: any;
|
||||
}): {
|
||||
[name: string]: any;
|
||||
};
|
||||
/**
|
||||
* @author fenris
|
||||
* @todo handle if the data object doesn't have the required field or the type is wrong or sth.
|
||||
*/
|
||||
write(environment: enum_environment, data: {
|
||||
[name: string]: any;
|
||||
}): string;
|
||||
/**
|
||||
* @desc manpage-like info-sheet
|
||||
* @author fenris
|
||||
*/
|
||||
generate_help({ "programname": programname, "author": author, "description": description, "executable": executable, }: {
|
||||
programname?: string;
|
||||
author?: string;
|
||||
description?: string;
|
||||
executable?: string;
|
||||
}): string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -10,11 +10,14 @@ dir="lib/plankton"
|
|||
modules=""
|
||||
modules="${modules} base"
|
||||
modules="${modules} call"
|
||||
modules="${modules} json"
|
||||
modules="${modules} file"
|
||||
modules="${modules} args"
|
||||
|
||||
|
||||
## exec
|
||||
|
||||
mkdir -p ${dir}
|
||||
mkdir --parents ${dir}
|
||||
cd ${dir}
|
||||
ptk bundle node ${modules}
|
||||
cd - > /dev/null
|
||||
|
|
|
|||
Loading…
Reference in a new issue