2024-09-09 12:13:10 +02:00
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type int = number;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type float = number;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_date = {
|
|
|
|
year: int;
|
|
|
|
month: int;
|
|
|
|
day: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_time = {
|
|
|
|
hour: int;
|
|
|
|
minute: int;
|
|
|
|
second: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_datetimeobject = {
|
|
|
|
date: type_date;
|
|
|
|
time: type_time;
|
|
|
|
};
|
|
|
|
declare var process: any;
|
|
|
|
declare var require: any;
|
|
|
|
declare class Buffer {
|
|
|
|
constructor(x: string, modifier?: string);
|
|
|
|
toString(modifier?: string): string;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.base {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function environment(): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_pseudopointer<type_value> = {
|
|
|
|
value: type_value;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function pseudopointer_null<type_value>(): type_pseudopointer<type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function pseudopointer_make<type_value>(value: type_value): type_pseudopointer<type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function pseudopointer_isset<type_value>(pseudopointer: type_pseudopointer<type_value>): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function pseudopointer_read<type_value>(pseudopointer: type_pseudopointer<type_value>): type_value;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function pseudopointer_write<type_value>(pseudopointer: type_pseudopointer<type_value>, value: type_value): void;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare var instance_verbosity: int;
|
|
|
|
/**
|
|
|
|
* @desc the ability to check for equality with another element of the same domain
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
interface interface_collatable<type_value> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_collate(value: type_value): boolean;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function instance_collate<type_value>(value1: (type_value & {
|
|
|
|
_collate?: ((value: type_value) => boolean);
|
|
|
|
}), value2: type_value): boolean;
|
|
|
|
/**
|
|
|
|
* @desc the ability to compare with another element of the same domain for determining if the first is "smaller than or equal to" the latter
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
interface interface_comparable<type_value> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_compare(value: type_value): boolean;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function instance_compare<type_value>(value1: (type_value & {
|
|
|
|
_compare: ((value: type_value) => boolean);
|
|
|
|
}), value2: type_value): boolean;
|
|
|
|
/**
|
|
|
|
* @desc the ability to create an exact copy
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
interface interface_cloneable<type_value> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_clone(): type_value;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function instance_clone<type_value>(value: (type_value & {
|
|
|
|
_clone?: (() => type_value);
|
|
|
|
})): type_value;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
interface interface_hashable {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_hash(): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @desc the ability to generate a string out of the element, which identifies it to a high degree
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function instance_hash<type_value>(value: (type_value & {
|
|
|
|
_hash?: (() => string);
|
|
|
|
})): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
interface interface_showable {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_show(): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @desc the ability to map the element to a textual representation (most likely not injective)
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare function instance_show<type_value>(value: (type_value & {
|
|
|
|
_show?: (() => string);
|
|
|
|
})): string;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
interface interface_decorator<type_core> {
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
core: type_core;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
declare class class_observer {
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
protected counter: int;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
protected actions: {
|
|
|
|
[id: string]: (information: Object) => void;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
protected buffer: Array<Object>;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
constructor();
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
empty(): boolean;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
flush(): void;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
set(id: string, action: (information: Object) => void): void;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
del(id: string): void;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
add(action: (information: Object) => void): void;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
notify(information?: Object, delayed?: boolean): void;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
rollout(): void;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
declare class class_error extends Error {
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
protected suberrors: Array<Error>;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
protected mess: string;
|
|
|
|
/**
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
constructor(message: string, suberrors?: Array<Error>);
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
* @author frac
|
|
|
|
*/
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.base {
|
|
|
|
/**
|
|
|
|
* returns the current UNIX timestamp
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function get_current_timestamp(rounded?: boolean): float;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function object_merge(core: Record<string, any>, mantle: Record<string, any>): Record<string, any>;
|
|
|
|
}
|
|
|
|
declare module lib_plankton.pod {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_pod<type_value> = {
|
|
|
|
kind: ("empty" | "filled");
|
|
|
|
value?: type_value;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_empty<type_value>(): type_pod<type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_filled<type_value>(value: type_value): type_pod<type_value>;
|
|
|
|
/**
|
|
|
|
* whether the pod is filled
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function is_filled<type_value>(pod: type_pod<type_value>): boolean;
|
|
|
|
/**
|
|
|
|
* return the value, stored in the pod-wrapper
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function cull<type_value>(pod: type_pod<type_value>): type_value;
|
|
|
|
/**
|
|
|
|
* to pass on a empty-pod or to use a filled-pod
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function propagate<type_value, type_value_>(pod: type_pod<type_value>, function_: ((value: type_value) => type_value_)): type_pod<type_value_>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function distinguish<type_value, type_result>(pod: type_pod<type_value>, function_empty: (() => type_result), function_filled: ((value: type_value) => type_result)): type_result;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function show<type_value>(pod: type_pod<type_value>, options?: {
|
|
|
|
show_value?: ((value: type_value) => string);
|
|
|
|
}): string;
|
|
|
|
}
|
|
|
|
declare module lib_plankton.pod {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
class class_pod<type_value> {
|
|
|
|
private subject;
|
|
|
|
private constructor();
|
|
|
|
is_empty(): boolean;
|
|
|
|
is_filled(): boolean;
|
|
|
|
cull(): type_value;
|
|
|
|
show(show_value?: any): string;
|
|
|
|
toString(): string;
|
|
|
|
propagate<type_value_>(function_: ((value: type_value) => type_value_)): class_pod<type_value_>;
|
|
|
|
distinguish<type_result>(function_empty: (() => type_result), function_filled: ((value: type_value) => type_result)): type_result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* might be completely obsolete
|
|
|
|
*/
|
|
|
|
declare namespace lib_plankton.call {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_promise<type_result, type_reason> = Promise<type_result>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_reject<type_result, type_reason>(reason: type_reason): type_promise<type_result, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_resolve<type_result, type_reason>(result: type_result): type_promise<type_result, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_make<type_result, type_reason>(executor: (resolve: ((result?: type_result) => void), reject: ((reason?: type_reason) => void)) => void): type_promise<type_result, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_then_close<type_result, type_reason>(promise: type_promise<type_result, type_reason>, resolver: ((result: type_result) => void), rejector: ((reason: type_reason) => void)): void;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_then_append<type_result, type_reason, type_result_>(promise: type_promise<type_result, type_reason>, resolver: ((result: type_result) => type_promise<type_result_, type_reason>), rejector?: ((reason: type_reason) => type_promise<type_result_, type_reason>)): type_promise<type_result_, type_result>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_all<type_result, type_reason>(promises: Array<type_promise<type_result, type_reason>>): type_promise<Array<type_result>, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_chain<type_result, type_reason>(promises: (Array<(input: type_result) => type_promise<type_result, type_reason>>), start?: type_result): type_promise<type_result, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_condense<type_element, type_reason>(promises: Array<() => type_promise<type_element, type_reason>>): type_promise<Array<type_element>, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_group<type_reason>(promises: Record<string, (() => type_promise<any, type_reason>)>, options?: {
|
|
|
|
serial?: boolean;
|
|
|
|
}): type_promise<Record<string, any>, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_wrap<type_result_inner, type_result_outer, type_reason>(promise: type_promise<type_result_inner, type_reason>, transformator_result: ((reason: type_result_inner) => type_result_outer), transformator_reason?: ((reason: type_reason) => type_reason)): type_promise<type_result_outer, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_attach<type_reason>(state: Record<string, any>, promise: type_promise<any, type_reason>, name: string): type_promise<Record<string, any>, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function promise_delay<type_result, type_reason>(promise: type_promise<type_result, type_reason>, delay: int): type_promise<type_result, type_reason>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.call {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
class CancellablePromise<type_result> extends Promise<type_result> {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private cancelled;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private interval;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private subject;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
constructor(executor: ((resolve: any, reject: any) => void));
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private clear;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
then<type_next_resolved, type_next_rejected>(onfulfilled?: ((value: type_result) => (type_next_resolved | PromiseLike<type_next_resolved>)), onrejected?: ((reason: any) => (type_next_rejected | PromiseLike<type_next_rejected>))): Promise<type_next_resolved | type_next_rejected>;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
catch(x: any): Promise<type_result>;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
cancel(): void;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* initializer might be obsolete, since promises are reusable after having been resolved or rejected
|
|
|
|
*/
|
|
|
|
declare namespace lib_plankton.call {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
enum enum_initializer_state {
|
|
|
|
initial = 0,
|
|
|
|
waiting = 1,
|
|
|
|
successful = 2,
|
|
|
|
failed = 3
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_initializer<type_result, type_reason> = {
|
|
|
|
fetcher: (() => type_promise<type_result, type_reason>);
|
|
|
|
state?: enum_initializer_state;
|
|
|
|
queue: Array<{
|
|
|
|
resolve: ((result?: type_result) => void);
|
|
|
|
reject: ((reason?: type_reason) => void);
|
|
|
|
}>;
|
|
|
|
result?: type_result;
|
|
|
|
reason?: type_reason;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function initializer_make<type_result, type_reason>(fetcher: (() => type_promise<type_result, type_reason>)): type_initializer<type_result, type_reason>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function initializer_reset<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): void;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function initializer_state<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): enum_initializer_state;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function initializer_get<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): type_promise<type_result, type_reason>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.call {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_deferral<type_input, type_output> = {
|
|
|
|
representation: (input: type_input) => Promise<type_output>;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @desc activates the deferral and handles its output according to a given procedure
|
|
|
|
* @param {(value : type_value)=>void} procedure a function which receives the output of the deferral as argument
|
|
|
|
*/
|
|
|
|
function deferral_use<type_input, type_output>(deferral: type_deferral<type_input, type_output>, input: type_input, procedure: (output: type_output) => void): void;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @desc creates a deferral-subject (similar to "new Promise", where "convey" reflects "resolve"/"reject")
|
|
|
|
*/
|
|
|
|
function deferral_make<type_input, type_output>(handler: (input: type_input, convey: (output: type_output) => void) => void): type_deferral<type_input, type_output>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @desc wraps a simple function into a deferral (similar to "Promise.resolve"/"Promise.reject")
|
|
|
|
*/
|
|
|
|
function deferral_wrap<type_input, type_output>(function_: (input: type_input) => type_output): type_deferral<type_input, type_output>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function deferral_id<type_value>(): type_deferral<type_value, type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function deferral_const<type_value>(value: type_value): type_deferral<type_value, type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function deferral_delay<type_output>(output: type_output, delay: int): type_deferral<any, type_output>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @desc connects two deferrals to form a new one; the output of the first is taken as input for the second
|
|
|
|
* (similar to "Promise.then" when passing a function which returns a new promise)
|
|
|
|
* @param {type_deferral<type_value1>} first a simple deferral
|
|
|
|
* @param {(value1 : type_value1)=>type_deferral<type_value2>} second a function depending from a value returning a deferral
|
|
|
|
*/
|
|
|
|
function deferral_compose_serial<type_input, type_between, type_output>(first: type_deferral<type_input, type_between>, second: type_deferral<type_between, type_output>): type_deferral<type_input, type_output>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function deferral_compose_parallel<type_input, type_output_left, type_output_right>({ "left": deferral_left, "right": deferral_right, }: {
|
|
|
|
left: type_deferral<type_input, type_output_left>;
|
|
|
|
right: type_deferral<type_input, type_output_right>;
|
|
|
|
}): type_deferral<type_input, {
|
|
|
|
left: type_output_left;
|
|
|
|
right: type_output_right;
|
|
|
|
}>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @desc repeatedly applied serial composition
|
|
|
|
*/
|
|
|
|
function deferral_chain<type_value>(members: Array<type_deferral<type_value, type_value>>): type_deferral<type_value, type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.call {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_deferral<type_input, type_output> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private subject;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private constructor();
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private static _cram;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private static _tear;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static make<type_input, type_output>(handler: (input: type_input, convey: (value: type_output) => void) => void): class_deferral<type_input, type_output>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
use(input: type_input, procedure: (value: type_output) => void): void;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
compose_serial<type_output_>(second: class_deferral<type_output, type_output_>): class_deferral<type_input, type_output_>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static chain<type_value>(members: Array<class_deferral<type_value, type_value>>): class_deferral<type_value, type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static wrap<type_input, type_output>(function_: (input: type_input) => type_output): class_deferral<type_input, type_output>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static const_<type_value>(value: type_value): class_deferral<type_value, type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static delay<type_output>(output: type_output, delay: int): class_deferral<any, type_output>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.call {
|
|
|
|
/**
|
|
|
|
* converts the "arguments"-map into an array
|
|
|
|
*
|
|
|
|
* @param {Object} args
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function args2list(args: any): Array<any>;
|
|
|
|
/**
|
|
|
|
* just the empty function; useful for some callbacks etc.
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function nothing(): void;
|
|
|
|
/**
|
|
|
|
* just the identity; useful for some callbacks etc.; defined as function instead of const for using type parameters
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function id<type_value>(x: type_value): type_value;
|
|
|
|
/**
|
|
|
|
* just the identity; useful for some callbacks etc.
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function const_<type_value>(x: type_value): ((y: any) => type_value);
|
|
|
|
/**
|
|
|
|
* composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions)
|
|
|
|
*
|
|
|
|
* @param {function} function_f
|
|
|
|
* @param {function} function_g
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function compose<type_x, type_y, type_z>(function_f: ((type_x: any) => type_y), function_g: ((type_y: any) => type_z)): ((value: type_x) => type_z);
|
|
|
|
/**
|
|
|
|
* transforms a function with sequential input to a function with leveled input; example: add(2,3) = curryfy(add)(2)(3)
|
|
|
|
*
|
|
|
|
* @param {function} f
|
|
|
|
* @return {function} the currified version of the in put function
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function curryfy(f: Function): Function;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function convey(value: any, functions: Array<Function>): any;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function timeout(procedure: (() => void), delay_in_seconds: float): int;
|
|
|
|
/**
|
|
|
|
* Promise version of "setTimeout"
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function defer<type_result>(seconds: float, action: (() => type_result)): Promise<type_result>;
|
|
|
|
/**
|
|
|
|
* a definition for a value being "defined"
|
|
|
|
*
|
|
|
|
* @author neuc
|
|
|
|
*/
|
|
|
|
function is_def<type_value>(obj: type_value, options?: {
|
|
|
|
null_is_valid?: boolean;
|
|
|
|
}): boolean;
|
|
|
|
/**
|
|
|
|
* returns the value if set and, when a type is specified, if the type is correct, if not return default_value
|
|
|
|
*
|
|
|
|
* @author neuc
|
|
|
|
*/
|
|
|
|
function def_val(value: any, default_value: any, options?: {
|
|
|
|
type?: (null | string);
|
|
|
|
null_is_valid?: boolean;
|
|
|
|
}): any;
|
|
|
|
/**
|
|
|
|
* provides the call for an attribute of a class as a regular function; useful for processing lists of objects
|
|
|
|
*
|
|
|
|
* @param {string} name the name of the attribute
|
|
|
|
* @return {function}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function attribute<type_object, type_attribute>(name: string): ((object: type_object) => type_attribute);
|
|
|
|
/**
|
|
|
|
* provides a method of a class as a regular function; useful for processing lists of objects
|
|
|
|
*
|
|
|
|
* @param {string} name the name of the method
|
|
|
|
* @return {function}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function method<type_object, type_output>(name: string): ((object: type_object) => type_output);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_coproduct = {
|
|
|
|
kind: string;
|
|
|
|
data?: any;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function distinguish<type_output>(coproduct: type_coproduct, handlers: Record<string, ((data?: any) => type_output)>, options?: {
|
|
|
|
fallback?: (null | ((coproduct?: type_coproduct) => type_output));
|
|
|
|
}): type_output;
|
|
|
|
/**
|
|
|
|
* for rate_limit_check
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_mana_snapshot = {
|
|
|
|
timestamp: float;
|
|
|
|
value: float;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* rate limiting algorithm, based on the idea of mana (magic power) in video games:
|
|
|
|
* - an actor has a fixed mana capacity, i.e. the maximum amount of available power
|
|
|
|
* - an actor has a fixed rate of mana regeneration, i.e. how fast the power is filled up (linear growth)
|
|
|
|
* - an action has a defined mana heft, i.e. how much power is required and deducted in order to execute it
|
|
|
|
* - mana states are represented by snapshots, i.e. the amount of power at a certain point in time
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function rate_limit_check(setup: {
|
|
|
|
capacity: float;
|
|
|
|
regeneration_rate: float;
|
|
|
|
get_snapshot: (() => Promise<(null | type_mana_snapshot)>);
|
|
|
|
set_snapshot: ((snapshot: type_mana_snapshot) => Promise<void>);
|
|
|
|
update_snapshot: ((timestamp: float, value_increment: float) => Promise<void>);
|
|
|
|
}, heft: float): Promise<{
|
|
|
|
granted: boolean;
|
|
|
|
seconds: (null | float);
|
|
|
|
}>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.file {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function exists(path: string): Promise<boolean>;
|
|
|
|
/**
|
|
|
|
* @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.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.email {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function send(smtp_credentials: {
|
|
|
|
host: string;
|
|
|
|
port: int;
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
}, sender: string, receivers: Array<string>, subject: string, content: 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;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private human_readable;
|
|
|
|
/**
|
|
|
|
* [constructor]
|
|
|
|
*/
|
|
|
|
constructor(path: string, human_readable: boolean);
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
add(entry: type_entry): void;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.log {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
class class_channel_email extends class_channel {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private smtp_credentials;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private sender;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
private receivers;
|
|
|
|
/**
|
|
|
|
* [constructor]
|
|
|
|
*/
|
|
|
|
constructor(smtp_credentials: {
|
|
|
|
host: string;
|
|
|
|
port: int;
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
}, sender: string, receivers: Array<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.log {
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare var plain_text_to_html: (text: string) => string;
|
|
|
|
/**
|
|
|
|
* @desc makes a valid
|
|
|
|
*/
|
|
|
|
declare var format_sentence: (str: string, rtl?: boolean, caseSense?: boolean) => string;
|
|
|
|
declare var fill_string_template: (template_string: string, object: any, fabric: Function, delimiter: string, default_string: string, sloppy: boolean) => string;
|
|
|
|
declare var make_string_template: (_template: string, _fabrics?: Object) => (object: {
|
|
|
|
[key: string]: string;
|
|
|
|
}) => string;
|
|
|
|
declare var make_eml_header: (object: {
|
|
|
|
[key: string]: string;
|
|
|
|
}) => string;
|
|
|
|
declare var make_eml_body: Object;
|
|
|
|
declare namespace lib_plankton.string {
|
|
|
|
/**
|
|
|
|
* @author neuc,frac
|
|
|
|
*/
|
|
|
|
function empty(str: string): boolean;
|
|
|
|
/**
|
|
|
|
* @desc returns a unique string
|
|
|
|
* @param {string} prefix an optional prefix for the generated string
|
|
|
|
* @return {string}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function generate(prefix?: string): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function join(parts: Array<string>, glue?: string): string;
|
|
|
|
/**
|
|
|
|
* @desc splits a string, but returns an empty list, if the string is empty
|
|
|
|
* @param {string} chain
|
|
|
|
* @param {string} separator
|
|
|
|
* @return {Array<string>}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function split(chain: string, separator?: string): Array<string>;
|
|
|
|
/**
|
|
|
|
* @author neu3no
|
|
|
|
*/
|
|
|
|
function explode(str: string, needle: string, max: int): Array<string>;
|
|
|
|
/**
|
|
|
|
* @desc concats a given word with itself n times
|
|
|
|
* @param {string} word
|
|
|
|
* @param {int}
|
|
|
|
* @return {string}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function repeat(word: string, count: int): string;
|
|
|
|
/**
|
|
|
|
* @desc lengthens a string by repeatedly appending or prepending another string
|
|
|
|
* @param {string} word the string to pad
|
|
|
|
* @param {int} length the length, which the result shall have
|
|
|
|
* @param {string} symbol the string, which will be added (multiple times)
|
|
|
|
* @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false
|
|
|
|
* @return {string} the padded string
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function pad(word: string, length: int, symbol?: string, mode?: string): string;
|
|
|
|
/**
|
|
|
|
* @desc checks if a given string conttains a certain substring
|
|
|
|
* @param {string} string
|
|
|
|
* @param {string} part
|
|
|
|
* @return {boolean}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function contains(chain: string, part: string): boolean;
|
|
|
|
/**
|
|
|
|
* @desc checks if a given string starts with a certain substring
|
|
|
|
* @param {string} string
|
|
|
|
* @param {string} part
|
|
|
|
* @return {boolean}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function startsWith(chain: string, part: string): boolean;
|
|
|
|
/**
|
|
|
|
* @desc checks if a given string ends with a certain substring
|
|
|
|
* @param {string} string
|
|
|
|
* @param {string} part
|
|
|
|
* @return {boolean}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function endsWith(chain: string, part: string): boolean;
|
|
|
|
/**
|
|
|
|
* @desc count the occourrences of a string in a string
|
|
|
|
* @param string haystack_string the string wich should be examined
|
|
|
|
* @param string needle_string the string which should be counted
|
|
|
|
* @author neuc
|
|
|
|
*/
|
|
|
|
function count_occourrences(haystack_string: string, needle_string: string, check_escape: boolean): int;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function replace(str: string, replacements: Array<{
|
|
|
|
from: string;
|
|
|
|
to: string;
|
|
|
|
}>, options?: {}): string;
|
|
|
|
/**
|
|
|
|
* @desc replaces occurences of "{{name}}" in a string by the corresponding values of an argument object
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function coin(str: string, args: {
|
|
|
|
[id: string]: string;
|
|
|
|
}, options?: {
|
|
|
|
legacy?: boolean;
|
|
|
|
open?: string;
|
|
|
|
close?: string;
|
|
|
|
}): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @deprecated use limit
|
|
|
|
*/
|
|
|
|
function cut(str: string, length: int, delimiter?: string): string;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function limit(str: string, options?: {
|
|
|
|
length?: int;
|
|
|
|
indicator?: string;
|
|
|
|
}): string;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function slice(str: string, size: int): Array<string>;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
declare namespace lib_string {
|
|
|
|
const empty: typeof lib_plankton.string.empty;
|
|
|
|
const generate: typeof lib_plankton.string.generate;
|
|
|
|
const split: typeof lib_plankton.string.split;
|
|
|
|
const explode: typeof lib_plankton.string.repeat;
|
|
|
|
const repeat: typeof lib_plankton.string.repeat;
|
|
|
|
const pad: typeof lib_plankton.string.pad;
|
|
|
|
const contains: typeof lib_plankton.string.contains;
|
|
|
|
const startsWith: typeof lib_plankton.string.startsWith;
|
|
|
|
const endsWith: typeof lib_plankton.string.endsWith;
|
|
|
|
const count_occourrences: typeof lib_plankton.string.count_occourrences;
|
|
|
|
const coin: typeof lib_plankton.string.coin;
|
|
|
|
const stance: typeof lib_plankton.string.coin;
|
|
|
|
const cut: typeof lib_plankton.string.cut;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.string {
|
|
|
|
/**
|
|
|
|
* an implementation of c sprintf
|
|
|
|
* @param {string} string format string
|
|
|
|
* @param {array} args arguments which should be filled into
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
var sprintf: (input: string, args?: Array<any>, original?: any) => string;
|
|
|
|
/**
|
|
|
|
* an implementation of c printf
|
|
|
|
* @param {string} string format string
|
|
|
|
* @param {array} args arguments which should be filled into
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
function printf(format: any, args: any): void;
|
|
|
|
}
|
|
|
|
declare var sprintf: (input: string, args?: Array<any>, original?: any) => string;
|
|
|
|
declare var printf: typeof lib_plankton.string.printf;
|
|
|
|
declare var eml_log: any;
|
|
|
|
declare var track_exports: any;
|
|
|
|
declare var make_logger: (prefix: any, current_loglevel: any) => (obj: any, lvl: any) => void;
|
2024-09-09 21:00:52 +02:00
|
|
|
declare namespace lib_plankton.complex {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_complex = {
|
|
|
|
rea: float;
|
|
|
|
ima: float;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* erstellt eine komplexe Zahl anhand ihrer kartesianischen Koordinaten
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_cartesian(rea_: float, ima_: float): type_complex;
|
|
|
|
/**
|
|
|
|
* erstellt eine komplexe Zahl anhand ihrer Polar-Koordinaten
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_polar(abs: float, arg: float): type_complex;
|
|
|
|
/**
|
|
|
|
* alias zu "make_cartesian"
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make(rea_: float, ima_: float): type_complex;
|
|
|
|
/**
|
|
|
|
* erstellt die komplexe Null
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function nul(): type_complex;
|
|
|
|
/**
|
|
|
|
* erstellt die komplexe Eins
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function one(): type_complex;
|
|
|
|
/**
|
|
|
|
* gibt den Real-Teil einer komplexen Zahl zurück
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function rea(x: type_complex): float;
|
|
|
|
/**
|
|
|
|
* gibt den Imaginär-Teil einer komplexen Zahl zurück
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function ima(x: type_complex): float;
|
|
|
|
/**
|
|
|
|
* gibt die konjugierte komplexe Zahl zurück
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function con(x: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* gibt den Betrag einer komplexen Zahl zurück
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function abs(x: type_complex): float;
|
|
|
|
/**
|
|
|
|
* gibt das Argument einer komplexen Zahl zurück (auf dem Hauptzweig des komplexen Logarithmus)
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function arg(x: type_complex): float;
|
|
|
|
/**
|
|
|
|
* gibt eine skalierte komplexe Zahl zurück (das Produkt mit einer reellen Zahl)
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function scl(x: type_complex, s: float): type_complex;
|
|
|
|
/**
|
|
|
|
* errechnet die Summe zweier komplexer Zahl
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function add(x: type_complex, y: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* gibt die additiv inverse, also negierte komplexe Zahl zurück
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function neg(x: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt die Differenz zweier komplexer Zahlen
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function sub(x: type_complex, y: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt das Produkt zweier komplexer Zahlen
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function mul(x: type_complex, y: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt die multiplikativ inverse komplexe Zahl, also den Kehrwert
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function inv(x: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt den Quotienten zweier komplexer Zahlen
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function div(x: type_complex, y: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt die natürliche Potenz einer komplexen Zahl
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function npow(x: type_complex, n: int): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt die natürliche Potenz einer komplexen Zahl
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
* @deprecated use "npow" instead
|
|
|
|
* @todo remove
|
|
|
|
*/
|
|
|
|
function exp(x: type_complex, n: int): type_complex;
|
|
|
|
/**
|
|
|
|
* ermittelt die Potenz zweier komplexer Zahlen
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
* @todo Probleme der komplexen Exponentiation berücksichtigen
|
|
|
|
*/
|
|
|
|
function pow(x: type_complex, y: type_complex): type_complex;
|
|
|
|
/**
|
|
|
|
* gibt die n-ten komplexen Einheits-Wurzeln zurück ({x ∈ C | x^n = 1})
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function unitroots(n: int): Array<type_complex>;
|
|
|
|
/**
|
|
|
|
* {x ∈ C | x^n = y}
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function normroots(n: int, y: type_complex): Array<type_complex>;
|
|
|
|
/**
|
|
|
|
* ermittelt ob zwei komplexe Zahlen gleich sind
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function equ(x: type_complex, y: type_complex, threshold?: float): boolean;
|
|
|
|
/**
|
|
|
|
* gibt eine textuelle Repräsentation einer komplexen Zahl zurück
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function str(x: type_complex): string;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.complex {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_complex {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private subject;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private constructor();
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private static _cram;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private static _tear;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static make_cartesian(rea: float, ima: float): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static make_polar(abs: float, arg: float): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static make(rea: float, ima: float): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static nul(): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static one(): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
con(): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
abs(): float;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
arg(): float;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
scl(s: float): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
add(other: class_complex): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
neg(): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
sub(other: class_complex): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
mul(other: class_complex): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
inv(): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
div(other: class_complex): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
exp(n: int): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
pow(other: class_complex): class_complex;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
equ(other: class_complex): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
str(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.math {
|
|
|
|
/**
|
|
|
|
* @desc golden ratio (e.g. for generating colors)
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
const phi: float;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
const e: float;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
const pi: float;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
const tau: float;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.math {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function clamp(x: number, a?: number, b?: number): number;
|
|
|
|
/**
|
|
|
|
* @desc the mathematical sign-function
|
|
|
|
* @return {int} an element of {-1,0,+1}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function sgn(x: number): int;
|
|
|
|
/**
|
|
|
|
* @desc integer division
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function div(x: float, y: float): float;
|
|
|
|
/**
|
|
|
|
* @desc real modulo operator
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function mod(x: float, y: float): float;
|
|
|
|
/**
|
|
|
|
* @desc computes "x^y mod z" via square-and-multiply
|
|
|
|
* @param {int} base ("x")
|
|
|
|
* @param {int} exponent ("y")
|
|
|
|
* @param {int} modulus ("z")
|
|
|
|
* @return {int}
|
|
|
|
* @author fenris
|
|
|
|
* @todo handle invalid cases (e.g. "z < 1")
|
|
|
|
* @todo implement iteratively
|
|
|
|
*/
|
|
|
|
function modpow(base: int, exponent: int, modulus: int): int;
|
|
|
|
/**
|
|
|
|
* @desc determines if two integers are coprime, i.e. that they don't have a common divisor greater than 1
|
|
|
|
* @author fenris
|
|
|
|
* @todo write function "gcdx" and base on it
|
|
|
|
*/
|
|
|
|
function coprime(x: int, y: int): boolean;
|
|
|
|
/**
|
|
|
|
* @desc extended euclidean algorithm for computing multiplicative inverse elements
|
|
|
|
* @param {int} modulus
|
|
|
|
* @param {int} element
|
|
|
|
* @author fenris
|
|
|
|
* @todo write function "gcdx" and base on it
|
|
|
|
* @todo handle more invalid cases
|
|
|
|
*/
|
|
|
|
function inv(modulus: int, element: int, positive?: boolean): int;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function interpolate_linear(x: number, y: number, t?: number): number;
|
|
|
|
/**
|
|
|
|
* @desc kind of the inverse of linear interpolation; i.e. to find the coefficient "t" for given values x, y and
|
|
|
|
* their presumed interpolation v
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function appoint_linear(x: number, y: number, v: number): number;
|
|
|
|
/**
|
|
|
|
* continued fraction decomposition
|
|
|
|
*/
|
|
|
|
function cfd(x: float, n?: int): Array<int>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.math {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_relationparameters<type_value> = {
|
|
|
|
symbol?: string;
|
|
|
|
name?: string;
|
|
|
|
predicate?: (value: type_value, reference: type_value) => boolean;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_relation<type_value> implements interface_showable, interface_hashable, interface_collatable<class_relation<type_value>> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected id: string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected symbol: string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected name: string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected predicate: (value: type_value, reference: type_value) => boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
check(value: type_value, reference: type_value): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor(id: string, { "symbol": symbol, "name": name, "predicate": predicate, }: type_relationparameters<type_value>);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
id_get(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
symbol_get(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
name_get(): string;
|
|
|
|
/**
|
|
|
|
* @desc [accessor] [implementation]
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_show(): string;
|
|
|
|
/**
|
|
|
|
* @desc [accessor] [implementation]
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_hash(): string;
|
|
|
|
/**
|
|
|
|
* @desc [accessor] [implementation]
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_collate(relation: class_relation<type_value>): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
toString(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected static pool<type_value>(): {
|
|
|
|
[id: string]: type_relationparameters<type_value>;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static get<type_value>(id: string): class_relation<type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static available(): Array<string>;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_filtrationitem<type_value> implements interface_showable {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected extract: (dataset: Object) => type_value;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected relation: class_relation<type_value>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected reference: type_value;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor({ "extract": extract, "relation": relation, "reference": reference, }: {
|
|
|
|
extract: (dataset: Object) => type_value;
|
|
|
|
relation: class_relation<type_value>;
|
|
|
|
reference: type_value;
|
|
|
|
});
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
check(dataset: Object): boolean;
|
|
|
|
/**
|
|
|
|
* @desc [implementation]
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_show(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @desc disjunctive normal form
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_filtration implements interface_showable {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected clauses: Array<Array<class_filtrationitem<any>>>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor(clauses: Array<Array<class_filtrationitem<any>>>);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
check(dataset: Object): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
use(datasets: Array<Object>): Array<Object>;
|
|
|
|
/**
|
|
|
|
* @desc [implementation]
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
_show(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
function comparator_to_relation<type_value>(comparator: (x: type_value, y: type_value) => int): (x: type_value, y: type_value) => boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
function relation_to_comparator<type_value>(relation: (x: type_value, y: type_value) => boolean): (x: type_value, y: type_value) => int;
|
|
|
|
}
|
|
|
|
declare module lib_calculus {
|
|
|
|
/**
|
|
|
|
* @class Calculus
|
|
|
|
* @desc Ensure precision of mathematical operations
|
|
|
|
*/
|
|
|
|
class Calculus {
|
|
|
|
/** @desc only for typescript
|
|
|
|
*/
|
|
|
|
private NORM;
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
* @þaram {number} norm
|
|
|
|
*/
|
|
|
|
constructor(norm?: number);
|
|
|
|
/**
|
|
|
|
* normalize
|
|
|
|
* @param {number} value
|
|
|
|
* @return {number}
|
|
|
|
*/
|
|
|
|
normalize(value: number): number;
|
|
|
|
/**
|
|
|
|
* denormalize
|
|
|
|
* @param {number} value
|
|
|
|
* @return {number}
|
|
|
|
*/
|
|
|
|
denormalize(value: number): number;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.math {
|
|
|
|
/**
|
|
|
|
* {x ∈ C | 0 = ax³ + bx² + cx + d}
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function cubic_solve(a: lib_plankton.complex.type_complex, b: lib_plankton.complex.type_complex, c: lib_plankton.complex.type_complex, d: lib_plankton.complex.type_complex): Array<lib_plankton.complex.type_complex>;
|
|
|
|
/**
|
|
|
|
* {x ∈ C | 0 = ax³ + bx² + cx + d}
|
|
|
|
*
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function cubic_solve_real(a: float, b: float, c: float, d: float): Array<lib_plankton.complex.type_complex>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.color {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_model_hsv = {
|
|
|
|
hue: float;
|
|
|
|
saturation: float;
|
|
|
|
value: float;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_model_hsl = {
|
|
|
|
hue: float;
|
|
|
|
saturation: float;
|
|
|
|
lightness: float;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_model_rgb = {
|
|
|
|
red: float;
|
|
|
|
green: float;
|
|
|
|
blue: float;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_color = {
|
|
|
|
model: type_model_rgb;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_hsv({ "hue": hue, "saturation": saturation, "value": value }: {
|
|
|
|
hue?: float;
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_hsl(model_hsl: type_model_hsl): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function make_rgb(model_rgb: type_model_rgb): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_hsv(color: type_color): type_model_hsv;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_hsl(color: type_color): type_model_hsl;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_rgb(color: type_color): type_model_rgb;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_cmyk(color: type_color): type_model_rgb;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function add(color1: type_color, color2: type_color): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function multiply(color1: type_color, color2: type_color): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @todo blend through other model?
|
|
|
|
*/
|
|
|
|
function blend(color1: type_color, color2: type_color, strength?: float): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function mix(color1: type_color, color2: type_color, strength1?: float, strength2?: float): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function output_rgb(color: type_color): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function output_hex(color: type_color): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function output_dot(color: type_color): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_generic({ "n": n, "offset": offset, "saturation": saturation, "value": value, }: {
|
|
|
|
n: int;
|
|
|
|
offset?: float;
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_gray(value?: float): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_black(): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_white(): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_red({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_green({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_blue({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_yellow({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_cyan({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function give_magenta({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): type_color;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.color {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_color {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private subject;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected constructor(subject: type_color);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private static _cram;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
private static _tear;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static make_hsv({ "hue": hue, "saturation": saturation, "value": value }: {
|
|
|
|
hue?: float;
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
blend(color: class_color, strength?: float): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
output_rgb(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
output_hex(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
output_dot(): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_generic({ "n": n, "offset": offset, "saturation": saturation, "value": value, }: {
|
|
|
|
n: int;
|
|
|
|
offset?: float;
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
static generic(x: any): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_gray(value?: float): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_black(): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_white(): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_red({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_green({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_blue({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_yellow({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_cyan({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static give_magenta({ "saturation": saturation, "value": value, }?: {
|
|
|
|
saturation?: float;
|
|
|
|
value?: float;
|
|
|
|
}): class_color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
declare namespace lib_plankton.xml {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
abstract class class_node {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
abstract compile(depth?: int): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_node_text extends class_node {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected content: string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor(content: string);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
compile(depth?: int): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_node_comment extends class_node {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected content: string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor(content: string);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
compile(depth?: int): string;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_node_complex extends class_node {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected name: string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected attributes: {
|
|
|
|
[key: string]: string;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected children: Array<class_node>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor(name: string, attributes?: {
|
|
|
|
[key: string]: string;
|
|
|
|
}, children?: any[]);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
compile(depth?: int): string;
|
|
|
|
}
|
|
|
|
}
|
2024-09-10 01:11:51 +02:00
|
|
|
declare module lib_et {
|
|
|
|
/**
|
|
|
|
* @desc type of extended timestamp
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_et = {
|
|
|
|
era: int;
|
|
|
|
stamp: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @desc type of UNIX timestamp
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_timestamp = int;
|
|
|
|
/**
|
|
|
|
* @desc type of Javascript Date object
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_jsdate = Date;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_components = {
|
|
|
|
year: int;
|
|
|
|
month: int;
|
|
|
|
day: int;
|
|
|
|
hour: int;
|
|
|
|
minute: int;
|
|
|
|
second: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_ywd = {
|
|
|
|
year: int;
|
|
|
|
week: int;
|
|
|
|
day: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function part(et1: type_et, et2: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @desc less
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function before(reference: type_et, et: type_et): boolean;
|
|
|
|
/**
|
|
|
|
* @desc greater
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function after(reference: type_et, et: type_et): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function between(begin: type_et, end: type_et, et: type_et): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function intersect(begin1: type_et, end1: type_et, begin2: type_et, end2: type_et): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function move(base: type_et, span: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @desc currified version of "move"
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function move_(span: type_et): (base: type_et) => type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function from_timestamp(timestamp: type_timestamp): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_timestamp(et: type_et): type_timestamp;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function from_jsdate(jsdate: type_jsdate): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_jsdate(et: type_et): type_jsdate;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function from_components(components: type_components): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_components(et: type_et): type_components;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function now(): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_string(et: type_et): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function to_string_ywd(et: type_et): string;
|
|
|
|
/**
|
|
|
|
* @desc retrieve week of year
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function get_woy(et: type_et): int;
|
|
|
|
/**
|
|
|
|
* @desc retrieve day of week
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function get_dow(et: type_et): int;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function trunc_minute(et?: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function trunc_hour(et?: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function trunc_day(et?: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function trunc_month(et?: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function trunc_year(et?: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function trunc_week(et?: type_et): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function span_second(seconds?: int): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function span_minute(minutes?: int): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function span_hour(hours?: int): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function span_day(days?: int): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function span_week(weeks?: int): type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function span_year(years?: int): type_et;
|
|
|
|
}
|
|
|
|
declare module lib_et {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_et {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
protected subject: type_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor(subject: type_et);
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
move(et: class_et): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
before(et: class_et): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
after(et: class_et): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
between(et1: class_et, et2: class_et): boolean;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
trunc_minute(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
trunc_hour(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
trunc_day(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
trunc_month(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
trunc_year(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
trunc_week(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static now(): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static span_second(count?: int): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static span_minute(count?: int): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static span_hour(count?: int): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static span_day(count?: int): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static span_week(count?: int): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static span_year(count?: int): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static from_timestamp(timestamp: type_timestamp): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
to_timestamp(): type_timestamp;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static from_jsdate(jsdate: type_jsdate): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
to_jsdate(): type_jsdate;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
static from_components(components: type_components): class_et;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
to_components(): type_components;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
get_woy(): int;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
get_dow(): int;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
to_string(): string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare var global_config: any;
|
|
|
|
/**
|
|
|
|
* @author neuc
|
|
|
|
*/
|
|
|
|
declare namespace lib_plankton.date {
|
|
|
|
/**
|
|
|
|
* @author neu3no, fenris
|
|
|
|
*/
|
|
|
|
function set_days(day_names: Array<string>): void;
|
|
|
|
/**
|
|
|
|
* @author neu3no, fenris
|
|
|
|
*/
|
|
|
|
function set_months(month_names: Array<string>): void;
|
|
|
|
/**
|
|
|
|
* @desc week of year
|
|
|
|
* @param {Date} date
|
|
|
|
* @return {int}
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function get_week(date: Date): int;
|
|
|
|
/**
|
|
|
|
* @author neu3no, fenris
|
|
|
|
*/
|
|
|
|
function set_currentDate(date: Date): void;
|
|
|
|
/**
|
|
|
|
* @author neu3no, fenris
|
|
|
|
*/
|
|
|
|
function parse(format: string, date?: Date): string;
|
|
|
|
/**
|
|
|
|
* @author neu3no, fenris
|
|
|
|
*/
|
|
|
|
function locale_date(date?: Date, ignore_error?: boolean): string;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_unixtimestamp = int;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_components = {
|
|
|
|
timezone_offset: int;
|
|
|
|
year: int;
|
|
|
|
month: int;
|
|
|
|
day: int;
|
|
|
|
hour: int;
|
|
|
|
minute: int;
|
|
|
|
second: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function now(): type_unixtimestamp;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function from_components(components: type_components): type_unixtimestamp;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function to_components(unixtimestamp: type_unixtimestamp): type_components;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function get_timestamp_from_year_and_week_and_day(year: int, week: int, day: int): type_unixtimestamp;
|
|
|
|
}
|
|
|
|
declare var strftime: typeof lib_plankton.date;
|
|
|
|
declare namespace lib_plankton.ical {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_rrule = {
|
|
|
|
freq?: string;
|
|
|
|
byday?: string;
|
|
|
|
bymonth?: string;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_offset = string;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export enum enum_class {
|
|
|
|
public = "public",
|
|
|
|
private = "private",
|
|
|
|
confidential = "confidential"
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export enum enum_event_status {
|
|
|
|
tentative = "tentative",
|
|
|
|
confirmed = "confirmed",
|
|
|
|
cancelled = "cancelled"
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export enum enum_transp {
|
|
|
|
opaque = "opaque",
|
|
|
|
transparent = "transparent"
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_tzid = string;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export type type_date = {
|
|
|
|
year: int;
|
|
|
|
month: int;
|
|
|
|
day: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export type type_time = {
|
|
|
|
hour: int;
|
|
|
|
minute: int;
|
|
|
|
second: int;
|
|
|
|
utc: boolean;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export type type_datetime = {
|
|
|
|
date: type_date;
|
|
|
|
time: (null | type_time);
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export type type_dt = {
|
|
|
|
tzid: type_tzid;
|
|
|
|
value: type_datetime;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_duration = {
|
|
|
|
negative: boolean;
|
|
|
|
weeks?: int;
|
|
|
|
days?: int;
|
|
|
|
hours?: int;
|
|
|
|
minutes?: int;
|
|
|
|
seconds?: int;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
type type_vtimezone = {
|
|
|
|
tzid?: type_tzid;
|
|
|
|
standard?: {
|
|
|
|
dtstart: type_datetime;
|
|
|
|
rrule: type_rrule;
|
|
|
|
tzoffsetfrom?: type_offset;
|
|
|
|
tzoffsetto?: type_offset;
|
|
|
|
};
|
|
|
|
daylight?: {
|
|
|
|
dtstart: type_datetime;
|
|
|
|
rrule: type_rrule;
|
|
|
|
tzoffsetfrom?: type_offset;
|
|
|
|
tzoffsetto?: type_offset;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @see https://www.rfc-editor.org/rfc/rfc5545#section-3.6.1
|
|
|
|
*/
|
|
|
|
export type type_vevent = {
|
|
|
|
uid: string;
|
|
|
|
dtstamp: type_datetime;
|
|
|
|
dtstart?: type_dt;
|
|
|
|
class?: enum_class;
|
|
|
|
created?: type_datetime;
|
|
|
|
description?: string;
|
|
|
|
geo?: {
|
|
|
|
latitude: float;
|
|
|
|
longitude: float;
|
|
|
|
};
|
|
|
|
last_modified?: type_datetime;
|
|
|
|
location?: string;
|
|
|
|
organizer?: {
|
|
|
|
cn?: string;
|
|
|
|
value?: string;
|
|
|
|
};
|
|
|
|
priority?: int;
|
|
|
|
sequence?: int;
|
|
|
|
status?: enum_event_status;
|
|
|
|
summary?: string;
|
|
|
|
transp?: enum_transp;
|
|
|
|
url?: string;
|
|
|
|
recurid?: any;
|
|
|
|
rrule?: type_rrule;
|
|
|
|
dtend?: type_dt;
|
|
|
|
duration?: type_duration;
|
|
|
|
attach?: any;
|
|
|
|
attendee?: string;
|
|
|
|
categories?: Array<string>;
|
|
|
|
comment?: any;
|
|
|
|
contact?: any;
|
|
|
|
exdate?: any;
|
|
|
|
rstatus?: any;
|
|
|
|
related?: any;
|
|
|
|
resources?: any;
|
|
|
|
rdate?: any;
|
|
|
|
x_props?: Record<string, string>;
|
|
|
|
iana_props?: Record<string, string>;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @see https://www.rfc-editor.org/rfc/rfc5545#section-3.4
|
|
|
|
*/
|
|
|
|
export type type_vcalendar = {
|
|
|
|
version: string;
|
|
|
|
prodid: string;
|
|
|
|
vevents: Array<type_vevent>;
|
|
|
|
calscale?: string;
|
|
|
|
method?: string;
|
|
|
|
vtimezone?: type_vtimezone;
|
|
|
|
x_props?: Record<string, string>;
|
|
|
|
iana_props?: Record<string, string>;
|
|
|
|
};
|
|
|
|
export {};
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.ical {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function datetime_to_unixtimestamp(datetime: type_datetime): lib_plankton.date.type_unixtimestamp;
|
|
|
|
/**
|
|
|
|
* @see https://www.rfc-editor.org/rfc/rfc5545
|
|
|
|
* @see https://icalendar.org/iCalendar-RFC-5545/
|
|
|
|
* @todo implement edge cases
|
|
|
|
*/
|
|
|
|
function ics_decode(ics: string, options?: {
|
|
|
|
debug?: boolean;
|
|
|
|
}): type_vcalendar;
|
|
|
|
/**
|
|
|
|
* @todo method
|
|
|
|
* @todo add missing fields
|
|
|
|
*/
|
|
|
|
function ics_encode(vcalendar: type_vcalendar): string;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.http {
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
enum enum_method {
|
|
|
|
options = "options",
|
|
|
|
head = "head",
|
|
|
|
get = "get",
|
|
|
|
delete = "delete",
|
|
|
|
post = "post",
|
|
|
|
put = "put",
|
|
|
|
patch = "patch"
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
type type_request = {
|
|
|
|
scheme: ("http" | "https");
|
|
|
|
host: (null | string);
|
|
|
|
path: string;
|
|
|
|
version: string;
|
|
|
|
method: enum_method;
|
|
|
|
query: (null | string);
|
|
|
|
headers: Record<string, string>;
|
|
|
|
body: (null | Buffer);
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
type type_response = {
|
|
|
|
version: (null | string);
|
|
|
|
status_code: int;
|
|
|
|
headers: Record<string, string>;
|
|
|
|
body: Buffer;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.http {
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
function encode_method(method: enum_method): string;
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
function encode_request(request: type_request): string;
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
function decode_request(request_raw: string): type_request;
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
function encode_response(response: type_response): string;
|
|
|
|
/**
|
|
|
|
* @author fenris <frass@greenscale.de>
|
|
|
|
*/
|
|
|
|
function decode_response(response_raw: string): type_response;
|
|
|
|
/**
|
|
|
|
* executes an HTTP request
|
|
|
|
*
|
|
|
|
* @todo define type_signal
|
|
|
|
*/
|
|
|
|
function call(request: type_request, options?: {
|
|
|
|
timeout?: (null | float);
|
|
|
|
follow_redirects?: boolean;
|
|
|
|
implementation?: ("fetch" | "http_module");
|
|
|
|
}): Promise<type_response>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.http {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_http_request implements lib_plankton.code.interface_code<type_request, string> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor();
|
|
|
|
/**
|
|
|
|
* @implementation
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
encode(x: type_request): string;
|
|
|
|
/**
|
|
|
|
* @implementation
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
decode(x: string): type_request;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_http_response implements lib_plankton.code.interface_code<type_response, string> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor();
|
|
|
|
/**
|
|
|
|
* @implementation
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
encode(x: type_response): string;
|
|
|
|
/**
|
|
|
|
* @implementation
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
decode(x: string): type_response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.url {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
type type_url = {
|
|
|
|
scheme: (null | string);
|
|
|
|
host: (null | string);
|
|
|
|
username: (null | string);
|
|
|
|
password: (null | string);
|
|
|
|
port: (null | int);
|
|
|
|
path: (null | string);
|
|
|
|
query: (null | string);
|
|
|
|
hash: (null | string);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.url {
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function query_args_encode(query_args: Record<string, string>): string;
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
function query_args_decode(query: string): Record<string, string>;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function encode(url: type_url): string;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
* @todo arguments
|
|
|
|
*/
|
|
|
|
function decode(url_raw: string): type_url;
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
function implementation_code(): lib_plankton.code.type_code<type_url, string>;
|
|
|
|
}
|
|
|
|
declare namespace lib_plankton.url {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
class class_url implements lib_plankton.code.interface_code<type_url, string> {
|
|
|
|
/**
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
constructor();
|
|
|
|
/**
|
|
|
|
* @implementation
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
encode(x: any): string;
|
|
|
|
/**
|
|
|
|
* @implementation
|
|
|
|
* @author fenris
|
|
|
|
*/
|
|
|
|
decode(x: string): any;
|
|
|
|
}
|
|
|
|
}
|