[ini]
Christian Fraß authored 2 years ago
|
1) /**
2) * @author fenris
3) */
4) declare type int = number;
5) /**
6) * @author fenris
7) */
8) declare type float = number;
9) /**
10) * @author fenris
11) */
12) declare type type_time = {
13) hours: int;
14) minutes: int;
15) seconds: int;
16) };
17) /**
18) * @author fenris
19) */
20) declare type type_pseudopointer<type_value> = {
21) value: type_value;
22) };
23) /**
24) * @author fenris
25) */
26) declare function pseudopointer_null<type_value>(): type_pseudopointer<type_value>;
27) /**
28) * @author fenris
29) */
30) declare function pseudopointer_make<type_value>(value: type_value): type_pseudopointer<type_value>;
31) /**
32) * @author fenris
33) */
34) declare function pseudopointer_isset<type_value>(pseudopointer: type_pseudopointer<type_value>): boolean;
35) /**
36) * @author fenris
37) */
38) declare function pseudopointer_read<type_value>(pseudopointer: type_pseudopointer<type_value>): type_value;
39) /**
40) * @author fenris
41) */
42) declare function pseudopointer_write<type_value>(pseudopointer: type_pseudopointer<type_value>, value: type_value): void;
43) declare var process: any;
44) declare var require: any;
45) declare class Buffer {
46) constructor(x: string, modifier?: string);
47) toString(modifier?: string): string;
48) }
49) declare var java: any;
50) declare module lib_base {
51) /**
52) * @author fenris
53) */
54) function environment(): string;
55) }
56) /**
57) * @author fenris
58) */
59) declare var instance_verbosity: int;
60) /**
61) * @desc the ability to check for equality with another element of the same domain
62) * @author fenris
63) */
64) interface interface_collatable<type_value> {
65) /**
66) * @author fenris
67) */
68) _collate(value: type_value): boolean;
69) }
70) /**
71) * @author fenris
72) */
73) declare function instance_collate<type_value>(value1: type_value, value2: type_value): boolean;
74) /**
75) * @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
76) * @author fenris
77) */
78) interface interface_comparable<type_value> {
79) /**
80) * @author fenris
81) */
82) _compare(value: type_value): boolean;
83) }
84) /**
85) * @author fenris
86) */
87) declare function instance_compare<type_value>(value1: type_value, value2: type_value): boolean;
88) /**
89) * @desc the ability to create an exact copy
90) * @author fenris
91) */
92) interface interface_cloneable<type_value> {
93) /**
94) * @author fenris
95) */
96) _clone(): type_value;
97) }
98) /**
99) * @author fenris
100) */
101) declare function instance_clone<type_value>(value: type_value): type_value;
102) /**
103) * @author fenris
104) */
105) interface interface_hashable {
106) /**
107) * @author fenris
108) */
109) _hash(): string;
110) }
111) /**
112) * @desc the ability to generate a string out of the element, which identifies it to a high degree
113) * @author fenris
114) */
115) declare function instance_hash<type_value>(value: type_value): string;
116) /**
117) * @author fenris
118) */
119) interface interface_showable {
120) /**
121) * @author fenris
122) */
123) _show(): string;
124) }
125) /**
126) * @desc the ability to map the element to a textual representation (most likely not injective)
127) * @author fenris
128) */
129) declare function instance_show<type_value>(value: type_value): string;
130) /**
131) * @todo outsource to dedicated plankton-lib
132) */
133) declare module lib_log {
134) /**
135) * @author fenris
136) */
137) function log(...args: Array<any>): void;
138) /**
139) * @author fenris
140) */
141) function info(...args: Array<any>): void;
142) /**
143) * @author fenris
144) */
145) function warn(...args: Array<any>): void;
146) /**
147) * @author fenris
148) */
149) function error(...args: Array<any>): void;
150) }
151) /**
152) * @author frac
153) */
154) interface interface_decorator<type_core> {
155) /**
156) * @author frac
157) */
158) core: type_core;
159) }
160) /**
161) * @author frac
162) */
163) declare class class_observer {
164) /**
165) * @author frac
166) */
167) protected counter: int;
168) /**
169) * @author frac
170) */
171) protected actions: {
172) [id: string]: (information: Object) => void;
173) };
174) /**
175) * @author frac
176) */
177) protected buffer: Array<Object>;
178) /**
179) * @author frac
180) */
181) constructor();
182) /**
183) * @author frac
184) */
185) empty(): boolean;
186) /**
187) * @author frac
188) */
189) flush(): void;
190) /**
191) * @author frac
192) */
193) set(id: string, action: (information: Object) => void): void;
194) /**
195) * @author frac
196) */
197) del(id: string): void;
198) /**
199) * @author frac
200) */
201) add(action: (information: Object) => void): void;
202) /**
203) * @author frac
204) */
205) notify(information?: Object, delayed?: boolean): void;
206) /**
207) * @author frac
208) */
209) rollout(): void;
210) }
211) /**
212) * @author frac
213) */
214) /**
215) * @author frac
216) */
217) declare module lib_maybe {
218) /**
219) * @author fenris
220) */
221) type type_maybe<type_value> = {
222) kind: string;
223) parameters: Object;
224) };
225) /**
226) * @author fenris
227) */
228) function make_nothing<type_value>(): type_maybe<type_value>;
229) /**
230) * @author fenris
231) */
232) function make_just<type_value>(value: type_value): type_maybe<type_value>;
233) /**
234) * @author fenris
235) */
236) function is_nothing<type_value>(maybe: type_maybe<type_value>): boolean;
237) /**
238) * @author fenris
239) */
240) function is_just<type_value>(maybe: type_maybe<type_value>): boolean;
241) /**
242) * @author fenris
243) */
244) function cull<type_value>(maybe: type_maybe<type_value>): type_value;
245) /**
246) * @author fenris
247) */
248) function propagate<type_value, type_value_>(maybe: type_maybe<type_value>, function_: (value: type_value) => type_maybe<type_value_>): type_maybe<type_value_>;
249) }
250) /**
251) * @author fenris
252) */
253) declare class class_maybe<type_value> implements interface_showable {
254) /**
255) * @desc whether the wrapper is nothing
256) * @author fenris
257) */
258) is_nothing(): boolean;
259) /**
260) * @desc whether the wrapper is just
261) * @author fenris
262) */
263) is_just(): boolean;
264) /**
265) * @desc return the value, stored in the maybe-wrapper
266) * @author fenris
267) */
268) cull(): type_value;
269) /**
270) * @author fenris
271) */
272) toString(): string;
273) /**
274) * @author fenris
275) */
276) distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void;
277) /**
278) * @author fenris
279) */
280) propagate<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>;
281) /**
282) * @desc [implementation]
283) * @author fenris
284) */
285) _show(): string;
286) }
287) /**
288) * @author fenris
289) */
290) declare class class_nothing<type_value> extends class_maybe<type_value> {
291) /**
292) * @author fenris
293) */
294) private reason;
295) /**
296) * @author fenris
297) */
298) constructor(reason?: string);
299) /**
300) * @author fenris
301) */
302) is_nothing(): boolean;
303) /**
304) * @author fenris
305) */
306) is_just(): boolean;
307) /**
308) * @author fenris
309) */
310) cull(): type_value;
311) /**
312) * @author fenris
313) */
314) toString(): string;
315) /**
316) * @author fenris
317) */
318) reason_get(): string;
319) /**
320) * @author fenris
321) */
322) distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void;
323) /**
324) * @author fenris
325) */
326) propagate<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>;
327) }
328) /**
329) * @author fenris
330) */
331) declare class class_just<type_value> extends class_maybe<type_value> {
332) /**
333) * @author fenris
334) */
335) private value;
336) /**
337) * @author fenris
338) */
339) constructor(value: type_value);
340) /**
341) * @author fenris
342) */
343) is_nothing(): boolean;
344) /**
345) * @author fenris
346) */
347) is_just(): boolean;
348) /**
349) * @author fenris
350) */
351) cull(): type_value;
352) /**
353) * @author fenris
354) */
355) toString(): string;
356) /**
357) * @author fenris
358) */
359) distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void;
360) /**
361) * @author fenris
362) */
363) propagate<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>;
364) }
365) /**
366) * @author frac
367) */
368) declare class class_error extends Error {
369) /**
370) * @author frac
371) */
372) protected suberrors: Array<Error>;
373) /**
374) * @author frac
375) */
376) protected mess: string;
377) /**
378) * @author frac
379) */
380) constructor(message: string, suberrors?: Array<Error>);
381) /**
382) * @override
383) * @author frac
384) */
385) toString(): string;
386) }
387) declare module lib_code {
388) /**
389) * @author fenris
390) */
391) interface interface_code<type_from, type_to> {
392) /**
393) * @author fenris
394) */
395) encode(x: type_from): type_to;
396) /**
397) * @author fenris
398) */
399) decode(x: type_to): type_from;
400) }
401) }
402) declare module lib_code {
403) /**
404) * @author fenris
405) */
406) type type_code<type_from, type_to> = {
407) /**
408) * @author fenris
409) */
410) encode: (x: type_from) => type_to;
411) /**
412) * @author fenris
413) */
414) decode: (x: type_to) => type_from;
415) };
416) }
417) declare module lib_code {
418) /**
419) * @author fenris
420) */
421) function inverse_encode<type_from, type_to>(decode: (to: type_to) => type_from, to: type_to): type_from;
422) /**
423) * @author fenris
424) */
425) function inverse_decode<type_from, type_to>(encode: (from: type_from) => type_to, from: type_from): type_to;
426) }
427) declare module lib_code {
428) /**
429) * @author fenris
430) */
431) class class_code_inverse<type_from, type_to> implements interface_code<type_to, type_from> {
432) /**
433) * @author fenris
434) */
435) protected subject: interface_code<type_from, type_to>;
436) /**
437) * @author fenris
438) */
439) constructor(subject: interface_code<type_from, type_to>);
440) /**
441) * @implementation
442) * @author fenris
443) */
444) encode(to: type_to): type_from;
445) /**
446) * @implementation
447) * @author fenris
448) */
449) decode(from: type_from): type_to;
450) }
451) }
452) declare module lib_code {
453) /**
454) * @author fenris
455) */
456) 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;
457) /**
458) * @author fenris
459) */
460) 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;
461) }
462) declare module lib_code {
463) /**
464) * @author fenris
465) */
466) class class_code_pair<type_from, type_between, type_to> implements interface_code<type_from, type_to> {
467) /**
468) * @author fenris
469) */
470) protected first: interface_code<type_from, type_between>;
471) /**
472) * @author fenris
473) */
474) protected second: interface_code<type_between, type_to>;
475) /**
476) * @author fenris
477) */
478) constructor(first: interface_code<type_from, type_between>, second: interface_code<type_between, type_to>);
479) /**
480) * @implementation
481) * @author fenris
482) */
483) encode(from: type_from): type_to;
484) /**
485) * @implementation
486) * @author fenris
487) */
488) decode(to: type_to): type_from;
489) }
490) }
491) declare module lib_code {
492) /**
493) * @author fenris
494) */
495) function chain_encode(encode_links: Array<(from: any) => any>, from: any): any;
496) /**
497) * @author fenris
498) */
499) function chain_decode(decode_links: Array<(to: any) => any>, to: any): any;
500) }
501) declare module lib_code {
502) /**
503) * @author fenris
504) */
505) class class_code_chain implements interface_code<any, any> {
506) /**
507) * @author fenris
508) */
509) protected links: Array<interface_code<any, any>>;
510) /**
511) * @author fenris
512) */
513) constructor(links: Array<interface_code<any, any>>);
514) /**
515) * @implementation
516) * @author fenris
517) */
518) encode(from: any): any;
519) /**
520) * @implementation
521) * @author fenris
522) */
523) decode(to: any): any;
524) }
525) }
526) declare module lib_code {
527) /**
528) * @author Christian Fraß <frass@greenscale.de>
529) */
530) type type_flatten_from = Array<{
531) [name: string]: any;
532) }>;
533) /**
534) * @author Christian Fraß <frass@greenscale.de>
535) */
536) type type_flatten_to = {
537) keys: Array<string>;
538) data: Array<Array<any>>;
539) };
540) /**
541) * @author Christian Fraß <frass@greenscale.de>
542) */
543) function flatten_encode(from: type_flatten_from, keys?: Array<string>): type_flatten_to;
544) /**
545) * @author Christian Fraß <frass@greenscale.de>
546) */
547) function flatten_decode(to: type_flatten_to): type_flatten_from;
548) }
549) declare module lib_code {
550) /**
551) * @author fenris
552) */
553) class class_code_flatten implements interface_code<type_flatten_from, type_flatten_to> {
554) /**
555) * @author fenris
556) */
557) constructor();
558) /**
559) * @implementation
560) * @author fenris
561) */
562) encode(x: type_flatten_from): type_flatten_to;
563) /**
564) * @implementation
565) * @author fenris
566) */
567) decode(x: type_flatten_to): type_flatten_from;
568) }
569) }
|
[mod] logging [mod] code st...
Christian Fraß authored 2 years ago
|
570) declare module lib_json {
571) /**
572) * @author fenris
573) */
574) function encode(x: any, formatted?: boolean): string;
575) /**
576) * @author fenris
577) */
578) function decode(x: string): any;
579) }
580) declare module lib_json {
581) /**
582) * @author fenris
583) */
584) class class_json implements lib_code.interface_code<any, string> {
585) /**
586) * @author fenris
587) */
588) constructor();
589) /**
590) * @implementation
591) * @author fenris
592) */
593) encode(x: any): string;
594) /**
595) * @implementation
596) * @author fenris
597) */
598) decode(x: string): any;
599) }
600) }
601) declare namespace lib_sha256 {
602) /**
603) * @author fenris
604) */
605) function get(value: string, secret?: string): string;
606) }
607) declare namespace lib_plankton.file {
608) /**
609) * @author fenris
610) */
611) function read(path: string): Promise<string>;
612) /**
613) * @author fenris
614) */
615) function read_stdin(): Promise<string>;
616) /**
617) * @author fenris
618) */
619) function write(path: string, content: string): Promise<void>;
620) }
|
[ini]
Christian Fraß authored 2 years ago
|
621) declare module lib_http {
622) /**
623) * @author fenris <frass@greenscale.de>
624) */
625) enum enum_method {
626) get = "get",
627) post = "post",
628) options = "options"
629) }
630) /**
631) * @author fenris <frass@greenscale.de>
632) */
633) type type_request = {
634) host: string;
635) query: string;
636) method: enum_method;
637) headers: {
638) [name: string]: string;
639) };
640) body: string;
641) };
642) /**
643) * @author fenris <frass@greenscale.de>
644) */
645) type type_response = {
646) statuscode: int;
647) headers: {
648) [name: string]: string;
649) };
650) body: string;
651) };
652) }
653) declare module lib_http {
654) /**
655) * @author fenris <frass@greenscale.de>
656) */
657) function encode_request(request: type_request): string;
658) /**
659) * @author fenris <frass@greenscale.de>
660) */
661) function decode_request(request_raw: string): type_request;
662) /**
663) * @author fenris <frass@greenscale.de>
664) */
665) function encode_response(response: type_response): string;
666) /**
667) * @author fenris <frass@greenscale.de>
668) */
669) function decode_response(response_raw: string): type_response;
670) }
671) declare module lib_http {
672) /**
673) * @author fenris
674) */
675) class class_http_request implements lib_code.interface_code<type_request, string> {
676) /**
677) * @author fenris
678) */
679) constructor();
680) /**
681) * @implementation
682) * @author fenris
683) */
684) encode(x: type_request): string;
685) /**
686) * @implementation
687) * @author fenris
688) */
689) decode(x: string): type_request;
690) }
691) /**
692) * @author fenris
693) */
694) class class_http_response implements lib_code.interface_code<type_response, string> {
695) /**
696) * @author fenris
697) */
698) constructor();
699) /**
700) * @implementation
701) * @author fenris
702) */
703) encode(x: type_response): string;
704) /**
705) * @implementation
706) * @author fenris
707) */
708) decode(x: string): type_response;
709) }
710) }
711) declare module lib_server {
|