git.schokokeks.org
Repositories
Help
Report an Issue
wirc-backend.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
a277bab
Branches
Tags
master
wirc-backend.git
lib
plankton
plankton.d.ts
[mod] logging [mod] code structure [mod] use hashed IP address as username
Christian Fraß
commited
a277bab
at 2021-11-19 10:18:07
plankton.d.ts
Blame
History
Raw
/** * @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<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; 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<type_value> { /** * @author fenris */ _collate(value: type_value): boolean; } /** * @author fenris */ declare function instance_collate<type_value>(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<type_value> { /** * @author fenris */ _compare(value: type_value): boolean; } /** * @author fenris */ declare function instance_compare<type_value>(value1: type_value, 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): 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): 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): string; /** * @todo outsource to dedicated plankton-lib */ declare module lib_log { /** * @author fenris */ function log(...args: Array<any>): void; /** * @author fenris */ function info(...args: Array<any>): void; /** * @author fenris */ function warn(...args: Array<any>): void; /** * @author fenris */ function error(...args: Array<any>): void; } /** * @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 */ declare module lib_maybe { /** * @author fenris */ type type_maybe<type_value> = { kind: string; parameters: Object; }; /** * @author fenris */ function make_nothing<type_value>(): type_maybe<type_value>; /** * @author fenris */ function make_just<type_value>(value: type_value): type_maybe<type_value>; /** * @author fenris */ function is_nothing<type_value>(maybe: type_maybe<type_value>): boolean; /** * @author fenris */ function is_just<type_value>(maybe: type_maybe<type_value>): boolean; /** * @author fenris */ function cull<type_value>(maybe: type_maybe<type_value>): type_value; /** * @author fenris */ function propagate<type_value, type_value_>(maybe: type_maybe<type_value>, function_: (value: type_value) => type_maybe<type_value_>): type_maybe<type_value_>; } /** * @author fenris */ declare class class_maybe<type_value> 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<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>; /** * @desc [implementation] * @author fenris */ _show(): string; } /** * @author fenris */ declare class class_nothing<type_value> extends class_maybe<type_value> { /** * @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<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>; } /** * @author fenris */ declare class class_just<type_value> extends class_maybe<type_value> { /** * @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<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>; } /** * @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 module lib_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 module lib_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 module lib_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 module lib_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 module lib_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 module lib_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 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<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 module lib_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 module lib_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 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<any, string> { /** * @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<string>; /** * @author fenris */ function read_stdin(): Promise<string>; /** * @author fenris */ function write(path: string, content: string): Promise<void>; } declare module lib_http { /** * @author fenris <frass@greenscale.de> */ enum enum_method { get = "get", post = "post", options = "options" } /** * @author fenris <frass@greenscale.de> */ type type_request = { host: string; query: string; method: enum_method; headers: { [name: string]: string; }; body: string; }; /** * @author fenris <frass@greenscale.de> */ type type_response = { statuscode: int; headers: { [name: string]: string; }; body: string; }; } declare module lib_http { /** * @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; } declare module lib_http { /** * @author fenris */ class class_http_request implements lib_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_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 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<string>; verbosity: int; serverobj: any; }; /** * @author fenris */ function make(port: int, handle: (input: string, metadata?: type_metadata) => Promise<string>, verbosity?: int): type_subject; /** * @author fenris */ function start(subject: type_subject): Promise<void>; /** * @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<string>, verbosity?: int); /** * @author fenris */ start(): Promise<void>; /** * @author fenris */ kill(): void; } }