/** * @author fenris */ type int = number; /** * @author fenris */ type float = number; /** * @author fenris */ type type_time = { hours: int; minutes: int; seconds: int; }; 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 = { value: type_value; }; /** * @author fenris */ declare function pseudopointer_null(): type_pseudopointer; /** * @author fenris */ declare function pseudopointer_make(value: type_value): type_pseudopointer; /** * @author fenris */ declare function pseudopointer_isset(pseudopointer: type_pseudopointer): boolean; /** * @author fenris */ declare function pseudopointer_read(pseudopointer: type_pseudopointer): type_value; /** * @author fenris */ declare function pseudopointer_write(pseudopointer: type_pseudopointer, 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 { /** * @author fenris */ _collate(value: type_value): boolean; } /** * @author fenris */ declare function instance_collate(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 { /** * @author fenris */ _compare(value: type_value): boolean; } /** * @author fenris */ declare function instance_compare(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 { /** * @author fenris */ _clone(): type_value; } /** * @author fenris */ declare function instance_clone(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(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(value: (type_value & { _show?: (() => string); })): string; /** * @author frac */ interface interface_decorator { /** * @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; /** * @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 */ declare module lib_maybe { /** * @author fenris */ type type_maybe = { kind: string; parameters: Object; }; /** * @author fenris */ function make_nothing(): type_maybe; /** * @author fenris */ function make_just(value: type_value): type_maybe; /** * @author fenris */ function is_nothing(maybe: type_maybe): boolean; /** * @author fenris */ function is_just(maybe: type_maybe): boolean; /** * @author fenris */ function cull(maybe: type_maybe): type_value; /** * @author fenris */ function propagate(maybe: type_maybe, function_: (value: type_value) => type_maybe): type_maybe; } /** * @author fenris */ declare class class_maybe implements interface_showable { /** * @desc whether the wrapper is nothing * @author fenris */ is_nothing(): boolean; /** * @desc whether the wrapper is just * @author fenris */ is_just(): boolean; /** * @desc return the value, stored in the maybe-wrapper * @author fenris */ cull(): type_value; /** * @author fenris */ toString(): string; /** * @author fenris */ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; /** * @author fenris */ propagate(action: (value: type_value) => class_maybe): class_maybe; /** * @desc [implementation] * @author fenris */ _show(): string; } /** * @author fenris */ declare class class_nothing extends class_maybe { /** * @author fenris */ private reason; /** * @author fenris */ constructor(reason?: string); /** * @author fenris */ is_nothing(): boolean; /** * @author fenris */ is_just(): boolean; /** * @author fenris */ cull(): type_value; /** * @author fenris */ toString(): string; /** * @author fenris */ reason_get(): string; /** * @author fenris */ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; /** * @author fenris */ propagate(action: (value: type_value) => class_maybe): class_maybe; } /** * @author fenris */ declare class class_just extends class_maybe { /** * @author fenris */ private value; /** * @author fenris */ constructor(value: type_value); /** * @author fenris */ is_nothing(): boolean; /** * @author fenris */ is_just(): boolean; /** * @author fenris */ cull(): type_value; /** * @author fenris */ toString(): string; /** * @author fenris */ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; /** * @author fenris */ propagate(action: (value: type_value) => class_maybe): class_maybe; } /** * @author frac */ declare class class_error extends Error { /** * @author frac */ protected suberrors: Array; /** * @author frac */ protected mess: string; /** * @author frac */ constructor(message: string, suberrors?: Array); /** * @override * @author frac */ toString(): string; } declare namespace lib_plankton.base { /** * returns the current UNIX timestamp * * @author fenris */ function get_current_timestamp(rounded?: boolean): int; /** */ function object_merge(core: Record, mantle: Record): Record; } 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; }; } /** * @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; /** */ 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): void; /** */ function info(incident: string, details?: Record): void; /** */ function notice(incident: string, details?: Record): void; /** */ function warning(incident: string, details?: Record): void; /** */ function error(incident: string, details?: Record): void; } 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; /** * @desc splits a string, but returns an empty list, if the string is empty * @param {string} chain * @param {string} separator * @return {Array} * @author fenris */ function split(chain: string, separator?: string): Array; /** * @author neu3no */ function explode(str: string, needle: string, max: int): Array; /** * @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 */ function cut(str: string, length: int, delimiter?: string): 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, 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, 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; declare namespace lib_plankton.code { /** * @author fenris */ interface interface_code { /** * @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 = { /** * @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(decode: (to: type_to) => type_from, to: type_to): type_from; /** * @author fenris */ function inverse_decode(encode: (from: type_from) => type_to, from: type_from): type_to; } declare namespace lib_plankton.code { /** * @author fenris */ class class_code_inverse implements interface_code { /** * @author fenris */ protected subject: interface_code; /** * @author fenris */ constructor(subject: interface_code); /** * @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(encode_first: (from: type_from) => type_between, encode_second: (between: type_between) => type_to, from: type_from): type_to; /** * @author fenris */ function pair_decode(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 implements interface_code { /** * @author fenris */ protected first: interface_code; /** * @author fenris */ protected second: interface_code; /** * @author fenris */ constructor(first: interface_code, second: interface_code); /** * @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 { /** * @author fenris */ protected links: Array>; /** * @author fenris */ constructor(links: Array>); /** * @implementation * @author fenris */ encode(from: any): any; /** * @implementation * @author fenris */ decode(to: any): any; } } declare namespace lib_plankton.code { /** * @author Christian Fraß */ type type_flatten_from = Array<{ [name: string]: any; }>; /** * @author Christian Fraß */ type type_flatten_to = { keys: Array; data: Array>; }; /** * @author Christian Fraß */ function flatten_encode(from: type_flatten_from, keys?: Array): type_flatten_to; /** * @author Christian Fraß */ function flatten_decode(to: type_flatten_to): type_flatten_from; } declare namespace lib_plankton.code { /** * @author fenris */ class class_code_flatten implements interface_code { /** * @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 { /** * @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; /** * @author fenris */ function read_buffer(path: string): Promise; /** * @author fenris */ function read_stdin(): Promise; /** * @author fenris */ function write(path: string, content: string, options?: { encoding?: string; }): Promise; /** * @author fenris */ function write_buffer(path: string, content: Buffer, options?: {}): Promise; } declare namespace lib_plankton.prog { /** */ abstract class struct_expression { } } declare namespace lib_plankton.prog { /** */ class struct_expression_variable extends struct_expression { name: string; constructor(name: string); } } declare namespace lib_plankton.prog { /** */ class struct_expression_literal extends struct_expression { value: any; constructor(value: any); } } declare namespace lib_plankton.prog { /** */ class struct_expression_function_application extends struct_expression { head: struct_expression; arguments: Array; constructor(head: struct_expression, arguments_: Array); } } declare namespace lib_plankton.prog { /** */ class struct_expression_operation_comparison extends struct_expression { left: struct_expression; right: struct_expression; constructor(left: struct_expression, right: struct_expression); } } declare namespace lib_plankton.prog { /** */ abstract class struct_type { } } declare namespace lib_plankton.prog { /** */ class struct_type_literal extends struct_type { value: struct_expression; constructor(value: struct_expression); } } declare namespace lib_plankton.prog { /** */ class struct_type_void extends struct_type { } } declare namespace lib_plankton.prog { /** */ class struct_type_boolean extends struct_type { } } declare namespace lib_plankton.prog { /** */ class struct_type_integer extends struct_type { constructor(); } } declare namespace lib_plankton.prog { /** */ class struct_type_string extends struct_type { } } declare namespace lib_plankton.prog { /** */ class struct_type_list extends struct_type { element: struct_type; constructor(element: struct_type); } } declare namespace lib_plankton.prog { /** */ class struct_type_map extends struct_type { key: struct_type; value: struct_type; constructor(key: struct_type, value: struct_type); } } declare namespace lib_plankton.prog { /** */ class struct_type_record extends struct_type { fields: Array<{ name: string; type: struct_type; mandatory: boolean; }>; constructor(fields: Array<{ name: string; type: struct_type; mandatory: boolean; }>); } } declare namespace lib_plankton.prog { /** */ class struct_type_function extends struct_type { arguments: Array; target: struct_type; } } declare namespace lib_plankton.prog { /** */ class struct_type_construction extends struct_type { name: string; arguments: (null | Array); constructor(name: string, arguments_: (null | Array)); } } declare namespace lib_plankton.prog { /** */ class struct_type_union extends struct_type { left: struct_type; right: struct_type; constructor(left: struct_type, right: struct_type); } } declare namespace lib_plankton.prog { /** */ class struct_type_intersection extends struct_type { left: struct_type; right: struct_type; } } declare namespace lib_plankton.prog { /** */ abstract class struct_statement { } } declare namespace lib_plankton.prog { /** */ class struct_statement_type_definition extends struct_statement { name: string; type: struct_type; constructor(name: string, type: struct_type); } } declare namespace lib_plankton.prog { /** */ class struct_statement_declaration extends struct_statement { constant: boolean; name: string; type: (null | struct_type); value: (null | struct_expression); constructor(constant: boolean, name: string, type: (null | struct_type), value: (null | struct_expression)); } } declare namespace lib_plankton.prog { /** */ class struct_statement_assignment extends struct_statement { name: string; value: (null | struct_expression); } } declare namespace lib_plankton.prog { /** */ class struct_statement_function_definition extends struct_statement { name: string; arguments: Array<{ name: string; type: (null | struct_type); }>; output_type: (null | struct_type); body: struct_statement; constructor(name: string, arguments_: Array<{ name: string; type: (null | struct_type); }>, output_type: (null | struct_type), body: struct_statement); } } declare namespace lib_plankton.prog { /** */ class struct_statement_return extends struct_statement { expression: struct_expression; constructor(expression: struct_expression); } } declare namespace lib_plankton.prog { /** */ class struct_program { statements: Array; constructor(statements: Array); } } declare namespace lib_plankton.prog { /** */ type type_output = { render_expression: ((expression: struct_expression) => string); render_type: ((type: struct_type) => string); render_statement: ((program: struct_statement) => string); render_program: ((program: struct_program) => string); }; } declare namespace lib_plankton.prog { /** */ function render_expression(expression: struct_expression): string; /** */ function render_type(type: struct_type): string; /** */ function render_statement(statement: struct_statement, options?: { indentation?: int; }): string; /** */ function render_program(program: struct_program): string; /** */ function output_typescript(): type_output; } 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; indicators_long: Array; }): 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; } }