/** * @author fenris */ declare type int = number; /** * @author fenris */ declare type float = number; /** * @author fenris */ declare type type_time = { hours: int; minutes: int; seconds: int; }; /** * @author fenris */ declare 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; declare var process: any; declare var require: any; declare class Buffer { constructor(x: string, modifier?: string); toString(modifier?: string): string; } declare var java: any; declare module lib_base { /** * @author fenris */ function environment(): string; } /** * @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, 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, 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): 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): 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): string; /** * @todo outsource to dedicated plankton-lib */ declare module lib_log { /** * @author fenris */ function log(...args: Array): void; /** * @author fenris */ function info(...args: Array): void; /** * @author fenris */ function warn(...args: Array): void; /** * @author fenris */ function error(...args: Array): void; } /** * @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 module lib_code { /** * @author fenris */ interface interface_code { /** * @author fenris */ encode(x: type_from): type_to; /** * @author fenris */ decode(x: type_to): type_from; } } declare module lib_code { /** * @author fenris */ type type_code = { /** * @author fenris */ encode: (x: type_from) => type_to; /** * @author fenris */ decode: (x: type_to) => type_from; }; } declare module lib_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 module lib_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 module lib_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 module lib_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 module lib_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 module lib_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 module lib_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 module lib_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 module lib_json { /** * @author fenris */ function encode(x: any, formatted?: boolean): string; /** * @author fenris */ function decode(x: string): any; } declare module lib_json { /** * @author fenris */ class class_json implements lib_code.interface_code { /** * @author fenris */ constructor(); /** * @implementation * @author fenris */ encode(x: any): string; /** * @implementation * @author fenris */ decode(x: string): any; } } declare namespace lib_sha256 { /** * @author fenris */ function get(value: string, secret?: string): string; } declare namespace lib_plankton.file { /** * @author fenris */ function read(path: string): Promise; /** * @author fenris */ function read_stdin(): Promise; /** * @author fenris */ function write(path: string, content: string): Promise; } declare module lib_http { /** * @author fenris */ enum enum_method { get = "get", post = "post", options = "options" } /** * @author fenris */ type type_request = { host: string; query: string; method: enum_method; headers: { [name: string]: string; }; body: string; }; /** * @author fenris */ type type_response = { statuscode: int; headers: { [name: string]: string; }; body: string; }; } declare module lib_http { /** * @author fenris */ function encode_request(request: type_request): string; /** * @author fenris */ function decode_request(request_raw: string): type_request; /** * @author fenris */ function encode_response(response: type_response): string; /** * @author fenris */ function decode_response(response_raw: string): type_response; } declare module lib_http { /** * @author fenris */ class class_http_request implements lib_code.interface_code { /** * @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_code.interface_code { /** * @author fenris */ constructor(); /** * @implementation * @author fenris */ encode(x: type_response): string; /** * @implementation * @author fenris */ decode(x: string): type_response; } } declare module lib_server { /** * @author fenris */ type type_metadata = { ip_address: string; }; /** * @author fenris */ type type_subject = { port: int; handle: (input: string, metadata?: type_metadata) => Promise; verbosity: int; serverobj: any; }; /** * @author fenris */ function make(port: int, handle: (input: string, metadata?: type_metadata) => Promise, verbosity?: int): type_subject; /** * @author fenris */ function start(subject: type_subject): Promise; /** * @author fenris */ function kill(subject: type_subject): void; } declare module lib_server { /** * @author fenris */ class class_server { /** * @author fenris */ protected subject: type_subject; /** * @author fenris */ constructor(port: int, handle: (input: string) => Promise, verbosity?: int); /** * @author fenris */ start(): Promise; /** * @author fenris */ kill(): void; } }