Christian Fraß commited on 2021-03-12 22:00:08
Zeige 25 geänderte Dateien mit 484 Einfügungen und 2665 Löschungen.
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 | 4 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () { |
14 | 14 |
/* |
15 | 15 |
This file is part of »bacterio-plankton:base«. |
16 | 16 |
|
17 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
17 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
18 | 18 |
<info@greenscale.de> |
19 | 19 |
|
20 | 20 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -34,7 +34,7 @@ along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/ |
34 | 34 |
/* |
35 | 35 |
This file is part of »bacterio-plankton:base«. |
36 | 36 |
|
37 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
37 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
38 | 38 |
<info@greenscale.de> |
39 | 39 |
|
40 | 40 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -93,7 +93,7 @@ along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/ |
93 | 93 |
/* |
94 | 94 |
This file is part of »bacterio-plankton:base«. |
95 | 95 |
|
96 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
96 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
97 | 97 |
<info@greenscale.de> |
98 | 98 |
|
99 | 99 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -160,7 +160,7 @@ var lib_base; |
160 | 160 |
/* |
161 | 161 |
This file is part of »bacterio-plankton:base«. |
162 | 162 |
|
163 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
163 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
164 | 164 |
<info@greenscale.de> |
165 | 165 |
|
166 | 166 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -291,7 +291,7 @@ function instance_show(value) { |
291 | 291 |
/* |
292 | 292 |
This file is part of »bacterio-plankton:base«. |
293 | 293 |
|
294 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
294 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
295 | 295 |
<info@greenscale.de> |
296 | 296 |
|
297 | 297 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -360,7 +360,7 @@ var lib_log; |
360 | 360 |
/* |
361 | 361 |
This file is part of »bacterio-plankton:base«. |
362 | 362 |
|
363 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
363 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
364 | 364 |
<info@greenscale.de> |
365 | 365 |
|
366 | 366 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -471,7 +471,7 @@ export interface interface_writeable<type_value> { |
471 | 471 |
/* |
472 | 472 |
This file is part of »bacterio-plankton:base«. |
473 | 473 |
|
474 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
474 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
475 | 475 |
<info@greenscale.de> |
476 | 476 |
|
477 | 477 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -726,7 +726,7 @@ var lib_maybe; |
726 | 726 |
/* |
727 | 727 |
This file is part of »bacterio-plankton:base«. |
728 | 728 |
|
729 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
729 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
730 | 730 |
<info@greenscale.de> |
731 | 731 |
|
732 | 732 |
»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1,394 +0,0 @@ |
1 |
-declare module lib_call { |
|
2 |
- /** |
|
3 |
- * @desc hacked class for postfix function application |
|
4 |
- * @author fenris |
|
5 |
- */ |
|
6 |
- class class_valuewrapper<type_value> { |
|
7 |
- /** |
|
8 |
- * @author fenris |
|
9 |
- */ |
|
10 |
- protected value: type_value; |
|
11 |
- /** |
|
12 |
- * @desc [constructor] |
|
13 |
- * @author fenris |
|
14 |
- */ |
|
15 |
- constructor(value: type_value); |
|
16 |
- /** |
|
17 |
- * @desc [accessor] applies a function and returns a new valuewrapper |
|
18 |
- * @author fenris |
|
19 |
- */ |
|
20 |
- pass<type_value_>(function_: (value: type_value) => type_value_): class_valuewrapper<type_value_>; |
|
21 |
- /** |
|
22 |
- * @desc [accessor] gives the wrapped value |
|
23 |
- * @author fenris |
|
24 |
- */ |
|
25 |
- extract(): type_value; |
|
26 |
- } |
|
27 |
- /** |
|
28 |
- * @desc shortcut for constructing a valuewrapper-object |
|
29 |
- * @author fenris |
|
30 |
- */ |
|
31 |
- function vw<type_value>(value: type_value): class_valuewrapper<type_value>; |
|
32 |
- /** |
|
33 |
- * @author fenris |
|
34 |
- */ |
|
35 |
- function use<type_input, type_output>(input: type_input, function_: (input: type_input) => type_output): type_output; |
|
36 |
- /** |
|
37 |
- * @desc just the identity; useful for some callbacks etc. |
|
38 |
- * @author fenris |
|
39 |
- */ |
|
40 |
- function id<type_value>(x: type_value): type_value; |
|
41 |
- /** |
|
42 |
- * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions) |
|
43 |
- * @param {function} function_f |
|
44 |
- * @param {function} function_g |
|
45 |
- * @author fenris |
|
46 |
- */ |
|
47 |
- 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; |
|
48 |
- /** |
|
49 |
- * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3) |
|
50 |
- * @param {function} f |
|
51 |
- * @param {int} n (don't set manually) |
|
52 |
- * @return {function} the currified version of the in put function |
|
53 |
- * @author fenris |
|
54 |
- */ |
|
55 |
- function curryfy(f: Function, n?: int): Function; |
|
56 |
-} |
|
57 |
-declare module lib_call { |
|
58 |
- /** |
|
59 |
- * @author fenris |
|
60 |
- */ |
|
61 |
- type type_executor<type_result, type_reason> = ((resolve: (result?: type_result) => any, reject?: (reason?: type_reason) => void) => void); |
|
62 |
- /** |
|
63 |
- * @author fenris |
|
64 |
- */ |
|
65 |
- function executor_resolve<type_result, type_reason>(result: type_result): type_executor<type_result, type_reason>; |
|
66 |
- /** |
|
67 |
- * @author fenris |
|
68 |
- */ |
|
69 |
- function executor_reject<type_result, type_reason>(reason: type_reason): type_executor<type_result, type_reason>; |
|
70 |
- /** |
|
71 |
- * @author fenris |
|
72 |
- */ |
|
73 |
- function executor_transform<type_result_from, type_error_from, type_result_to, type_error_to>(executor: type_executor<type_result_from, type_error_from>, transform_result: (result_from: type_result_from) => type_result_to, transform_reason: (error_from: type_error_from) => type_error_to): type_executor<type_result_to, type_error_to>; |
|
74 |
- /** |
|
75 |
- * @author fenris |
|
76 |
- */ |
|
77 |
- function executor_transform_default<type_result_from, type_result_to>(executor: type_executor<type_result_from, Error>, transform_result: (result_from: type_result_from) => type_result_to, wrap_string?: string): type_executor<type_result_to, Error>; |
|
78 |
- /** |
|
79 |
- * @author fenris |
|
80 |
- */ |
|
81 |
- function executor_compose_sequential<type_result_first, type_result_second, type_reason>(first: type_executor<type_result_first, type_reason>, second: (result: type_result_first) => type_executor<type_result_second, type_reason>): type_executor<type_result_second, type_reason>; |
|
82 |
- /** |
|
83 |
- * @author fenris |
|
84 |
- */ |
|
85 |
- function executor_chain<type_state, type_error>(state: type_state, executors: Array<(state: type_state) => type_executor<type_state, type_error>>): type_executor<type_state, type_error>; |
|
86 |
- /** |
|
87 |
- * @author fenris |
|
88 |
- */ |
|
89 |
- function executor_first<type_result, type_reason>(executors: Array<type_executor<type_result, type_reason>>): type_executor<type_result, Array<type_reason>>; |
|
90 |
- /** |
|
91 |
- * @author fenris |
|
92 |
- */ |
|
93 |
- function executor_condense<type_element>(executors: Array<type_executor<type_element, Error>>): type_executor<Array<type_element>, Error>; |
|
94 |
- /** |
|
95 |
- * @author fenris |
|
96 |
- * @deprecated use condense |
|
97 |
- */ |
|
98 |
- function executor_filter<type_element>(executors: Array<type_executor<type_element, Error>>, predicate: (element: type_element) => boolean): type_executor<Array<type_element>, Error>; |
|
99 |
- /** |
|
100 |
- * @author fenris |
|
101 |
- * @deprecated use condense |
|
102 |
- */ |
|
103 |
- function executor_map<type_element1, type_element2>(executors: Array<type_executor<type_element1, Error>>, transformator: (element1: type_element1) => type_element2): type_executor<Array<type_element2>, Error>; |
|
104 |
- /** |
|
105 |
- * @author fenris |
|
106 |
- * @deprecated use condense |
|
107 |
- */ |
|
108 |
- function executor_reduce<type_element, type_result>(executors: Array<type_executor<type_element, Error>>, initial: type_result, accumulator: (result: type_result, element: type_element) => type_result): type_executor<type_result, Error>; |
|
109 |
-} |
|
110 |
-declare module lib_call { |
|
111 |
- /** |
|
112 |
- * @author fenris |
|
113 |
- */ |
|
114 |
- type type_promise<type_result, type_reason> = Promise<type_result>; |
|
115 |
- /** |
|
116 |
- * @author fenris |
|
117 |
- */ |
|
118 |
- function promise_reject<type_result, type_reason>(reason: type_reason): type_promise<type_result, type_reason>; |
|
119 |
- /** |
|
120 |
- * @author fenris |
|
121 |
- */ |
|
122 |
- function promise_resolve<type_result, type_reason>(result: type_result): type_promise<type_result, type_reason>; |
|
123 |
- /** |
|
124 |
- * @author fenris |
|
125 |
- */ |
|
126 |
- 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>; |
|
127 |
- /** |
|
128 |
- * @author fenris |
|
129 |
- */ |
|
130 |
- 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; |
|
131 |
- /** |
|
132 |
- * @author fenris |
|
133 |
- */ |
|
134 |
- 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>; |
|
135 |
- /** |
|
136 |
- * @author fenris |
|
137 |
- */ |
|
138 |
- function promise_all<type_result, type_reason>(promises: Array<type_promise<type_result, type_reason>>): type_promise<Array<type_result>, type_reason>; |
|
139 |
- /** |
|
140 |
- * @author fenris |
|
141 |
- */ |
|
142 |
- 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>; |
|
143 |
- /** |
|
144 |
- * @author fenris |
|
145 |
- */ |
|
146 |
- function promise_condense<type_element, type_reason>(promises: Array<() => type_promise<type_element, type_reason>>): type_promise<Array<type_element>, type_reason>; |
|
147 |
- /** |
|
148 |
- * @author fenris |
|
149 |
- */ |
|
150 |
- function promise_group<type_reason>(promises: { |
|
151 |
- [name: string]: () => type_promise<any, type_reason>; |
|
152 |
- }, serial?: boolean): type_promise<{ |
|
153 |
- [name: string]: any; |
|
154 |
- }, type_reason>; |
|
155 |
- /** |
|
156 |
- * @author fenris |
|
157 |
- */ |
|
158 |
- 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): Promise<type_result_outer>; |
|
159 |
- /** |
|
160 |
- * @author fenris |
|
161 |
- */ |
|
162 |
- function promise_show<type_result, type_reason>(label: string): (result: type_result) => type_promise<type_result, type_reason>; |
|
163 |
- /** |
|
164 |
- * @author fenris |
|
165 |
- */ |
|
166 |
- function promise_log<type_result, type_reason>(result: type_result): (result: type_result) => type_promise<type_result, type_reason>; |
|
167 |
- /** |
|
168 |
- * @author fenris |
|
169 |
- */ |
|
170 |
- function promise_attach<type_reason>(state: { |
|
171 |
- [name: string]: any; |
|
172 |
- }, promise: type_promise<any, type_reason>, name: string): type_promise<{ |
|
173 |
- [name: string]: any; |
|
174 |
- }, type_reason>; |
|
175 |
- /** |
|
176 |
- * @author fenris |
|
177 |
- */ |
|
178 |
- function promise_delay<type_result, type_reason>(promise: type_promise<type_result, type_reason>, delay: int): Promise<type_result>; |
|
179 |
- /** |
|
180 |
- * @author fenris |
|
181 |
- */ |
|
182 |
- function promise_to_executor<type_result, type_reason>(promise: type_promise<type_result, type_reason>): type_executor<type_result, type_reason>; |
|
183 |
-} |
|
184 |
-declare module lib_call { |
|
185 |
- /** |
|
186 |
- * @author fenris |
|
187 |
- */ |
|
188 |
- type type_initializer_state = int; |
|
189 |
- const initializer_state_initial: type_initializer_state; |
|
190 |
- const initializer_state_waiting: type_initializer_state; |
|
191 |
- const initializer_state_successful: type_initializer_state; |
|
192 |
- const initializer_state_failed: type_initializer_state; |
|
193 |
- /** |
|
194 |
- * @author fenris |
|
195 |
- */ |
|
196 |
- type type_initializer<type_result, type_reason> = { |
|
197 |
- fetcher: () => type_promise<type_result, type_reason>; |
|
198 |
- state?: type_initializer_state; |
|
199 |
- queue: Array<{ |
|
200 |
- resolve: (result?: type_result) => void; |
|
201 |
- reject: (reason?: type_reason) => void; |
|
202 |
- }>; |
|
203 |
- result?: type_result; |
|
204 |
- reason?: type_reason; |
|
205 |
- }; |
|
206 |
- /** |
|
207 |
- * @author fenris |
|
208 |
- */ |
|
209 |
- function initializer_make<type_result, type_reason>(fetcher: () => type_promise<type_result, type_reason>): type_initializer<type_result, type_reason>; |
|
210 |
- /** |
|
211 |
- * @author fenris |
|
212 |
- */ |
|
213 |
- function initializer_reset<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): void; |
|
214 |
- /** |
|
215 |
- * @author fenris |
|
216 |
- */ |
|
217 |
- function initializer_state<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): type_initializer_state; |
|
218 |
- /** |
|
219 |
- * @author fenris |
|
220 |
- */ |
|
221 |
- function initializer_get<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): type_promise<type_result, type_reason>; |
|
222 |
-} |
|
223 |
-declare module lib_call { |
|
224 |
- /** |
|
225 |
- * @author fenris |
|
226 |
- */ |
|
227 |
- type type_deferral<type_input, type_output> = { |
|
228 |
- representation: (input: type_input) => Promise<type_output>; |
|
229 |
- }; |
|
230 |
- /** |
|
231 |
- * @author fenris |
|
232 |
- * @desc activates the deferral and handles its output according to a given procedure |
|
233 |
- * @param {(value : type_value)=>void} procedure a function which receives the output of the deferral as argument |
|
234 |
- */ |
|
235 |
- function deferral_use<type_input, type_output>(deferral: type_deferral<type_input, type_output>, input: type_input, procedure: (output: type_output) => void): void; |
|
236 |
- /** |
|
237 |
- * @author fenris |
|
238 |
- * @desc creates a deferral-subject (similar to "new Promise", where "convey" reflects "resolve"/"reject") |
|
239 |
- */ |
|
240 |
- function deferral_make<type_input, type_output>(handler: (input: type_input, convey: (output: type_output) => void) => void): type_deferral<type_input, type_output>; |
|
241 |
- /** |
|
242 |
- * @author fenris |
|
243 |
- * @desc wraps a simple function into a deferral (similar to "Promise.resolve"/"Promise.reject") |
|
244 |
- */ |
|
245 |
- function deferral_wrap<type_input, type_output>(function_: (input: type_input) => type_output): type_deferral<type_input, type_output>; |
|
246 |
- /** |
|
247 |
- * @author fenris |
|
248 |
- */ |
|
249 |
- function deferral_id<type_value>(): type_deferral<type_value, type_value>; |
|
250 |
- /** |
|
251 |
- * @author fenris |
|
252 |
- */ |
|
253 |
- function deferral_const<type_value>(value: type_value): type_deferral<type_value, type_value>; |
|
254 |
- /** |
|
255 |
- * @author fenris |
|
256 |
- */ |
|
257 |
- function deferral_delay<type_output>(output: type_output, delay: int): type_deferral<any, type_output>; |
|
258 |
- /** |
|
259 |
- * @author fenris |
|
260 |
- * @desc connects two deferrals to form a new one; the output of the first is taken as input for the second |
|
261 |
- * (similar to "Promise.then" when passing a function which returns a new promise) |
|
262 |
- * @param {type_deferral<type_value1>} first a simple deferral |
|
263 |
- * @param {(value1 : type_value1)=>type_deferral<type_value2>} second a function depending from a value returning a deferral |
|
264 |
- */ |
|
265 |
- 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>; |
|
266 |
- /** |
|
267 |
- * @author fenris |
|
268 |
- */ |
|
269 |
- function deferral_compose_parallel<type_input, type_output_left, type_output_right>({ "left": deferral_left, "right": deferral_right, }: { |
|
270 |
- left: type_deferral<type_input, type_output_left>; |
|
271 |
- right: type_deferral<type_input, type_output_right>; |
|
272 |
- }): type_deferral<type_input, { |
|
273 |
- left: type_output_left; |
|
274 |
- right: type_output_right; |
|
275 |
- }>; |
|
276 |
- /** |
|
277 |
- * @author fenris |
|
278 |
- * @desc repeatedly applied serial composition |
|
279 |
- */ |
|
280 |
- function deferral_chain<type_value>(members: Array<type_deferral<type_value, type_value>>): type_deferral<type_value, type_value>; |
|
281 |
- /** |
|
282 |
- * @author fenris |
|
283 |
- */ |
|
284 |
-} |
|
285 |
-declare module lib_call { |
|
286 |
- /** |
|
287 |
- * @author fenris |
|
288 |
- */ |
|
289 |
- class class_deferral<type_input, type_output> { |
|
290 |
- /** |
|
291 |
- * @author fenris |
|
292 |
- */ |
|
293 |
- private subject; |
|
294 |
- /** |
|
295 |
- * @author fenris |
|
296 |
- */ |
|
297 |
- private constructor(); |
|
298 |
- /** |
|
299 |
- * @author fenris |
|
300 |
- */ |
|
301 |
- private static _cram; |
|
302 |
- /** |
|
303 |
- * @author fenris |
|
304 |
- */ |
|
305 |
- private static _tear; |
|
306 |
- /** |
|
307 |
- * @author fenris |
|
308 |
- */ |
|
309 |
- static make<type_input, type_output>(handler: (input: type_input, convey: (value: type_output) => void) => void): class_deferral<type_input, type_output>; |
|
310 |
- /** |
|
311 |
- * @author fenris |
|
312 |
- */ |
|
313 |
- use(input: type_input, procedure: (value: type_output) => void): void; |
|
314 |
- /** |
|
315 |
- * @author fenris |
|
316 |
- */ |
|
317 |
- compose_serial<type_output_>(second: class_deferral<type_output, type_output_>): class_deferral<type_input, type_output_>; |
|
318 |
- /** |
|
319 |
- * @author fenris |
|
320 |
- */ |
|
321 |
- static chain<type_value>(members: Array<class_deferral<type_value, type_value>>): class_deferral<type_value, type_value>; |
|
322 |
- /** |
|
323 |
- * @author fenris |
|
324 |
- */ |
|
325 |
- static wrap<type_input, type_output>(function_: (input: type_input) => type_output): class_deferral<type_input, type_output>; |
|
326 |
- /** |
|
327 |
- * @author fenris |
|
328 |
- */ |
|
329 |
- static const_<type_value>(value: type_value): class_deferral<type_value, type_value>; |
|
330 |
- /** |
|
331 |
- * @author fenris |
|
332 |
- */ |
|
333 |
- static delay<type_output>(output: type_output, delay: int): class_deferral<any, type_output>; |
|
334 |
- } |
|
335 |
-} |
|
336 |
-declare module lib_call { |
|
337 |
- /** |
|
338 |
- * @author fenris |
|
339 |
- */ |
|
340 |
- function timeout(function_: () => void, delay: int): int; |
|
341 |
- /** |
|
342 |
- * @desc a definition for a value being "defined" |
|
343 |
- * @author neuc |
|
344 |
- */ |
|
345 |
- function is_def<type_value>(obj: type_value, null_is_valid?: boolean): boolean; |
|
346 |
- /** |
|
347 |
- * @desc returns the value if set and, when a type is specified, if the type is correct, if not return default_value |
|
348 |
- * @author neuc |
|
349 |
- */ |
|
350 |
- function def_val(value: any, default_value: any, type?: string, null_is_valid?: boolean): any; |
|
351 |
- /** |
|
352 |
- * @desc just the empty function; useful for some callbacks etc. |
|
353 |
- * @author fenris |
|
354 |
- */ |
|
355 |
- function nothing(): void; |
|
356 |
- /** |
|
357 |
- * @desc outputs |
|
358 |
- * @author fenris |
|
359 |
- */ |
|
360 |
- function output(...args: Array<any>): void; |
|
361 |
- /** |
|
362 |
- * @desc converts the "arguments"-map into an array |
|
363 |
- * @param {Object} args |
|
364 |
- * @author fenris |
|
365 |
- */ |
|
366 |
- function args2list(args: any): Array<any>; |
|
367 |
- /** |
|
368 |
- * @desc provides the call for an attribute of a class as a regular function |
|
369 |
- * @param {string} name the name of the attribute |
|
370 |
- * @return {*} |
|
371 |
- * @author fenris |
|
372 |
- */ |
|
373 |
- function attribute<type_object, type_attribute>(name: string): (object: type_object) => type_attribute; |
|
374 |
- /** |
|
375 |
- * @desc provides a method of a class as a regular function |
|
376 |
- * @param {string} name the name of the method |
|
377 |
- * @return {function} |
|
378 |
- * @author fenris |
|
379 |
- */ |
|
380 |
- function method<type_object, type_output>(name: string): (object: type_object) => type_output; |
|
381 |
- /** |
|
382 |
- * @author fenris |
|
383 |
- */ |
|
384 |
- type type_unival = { |
|
385 |
- kind: string; |
|
386 |
- data?: any; |
|
387 |
- }; |
|
388 |
- /** |
|
389 |
- * @author fenris |
|
390 |
- */ |
|
391 |
- function distinguish(unival: type_unival, handlers: { |
|
392 |
- [kind: string]: (data?: any) => any; |
|
393 |
- }, fallback?: (unival?: type_unival) => any): any; |
|
394 |
-} |
... | ... |
@@ -1,992 +0,0 @@ |
1 |
-/* |
|
2 |
-This file is part of »bacterio-plankton:call«. |
|
3 |
- |
|
4 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
-<info@greenscale.de> |
|
6 |
- |
|
7 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
8 |
-it under the terms of the GNU Lesser General Public License as published by |
|
9 |
-the Free Software Foundation, either version 3 of the License, or |
|
10 |
-(at your option) any later version. |
|
11 |
- |
|
12 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
13 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
-GNU Lesser General Public License for more details. |
|
16 |
- |
|
17 |
-You should have received a copy of the GNU Lesser General Public License |
|
18 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
- */ |
|
20 |
-"use strict"; |
|
21 |
-/* |
|
22 |
-This file is part of »bacterio-plankton:call«. |
|
23 |
- |
|
24 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
25 |
-<info@greenscale.de> |
|
26 |
- |
|
27 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
28 |
-it under the terms of the GNU Lesser General Public License as published by |
|
29 |
-the Free Software Foundation, either version 3 of the License, or |
|
30 |
-(at your option) any later version. |
|
31 |
- |
|
32 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
33 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
34 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
35 |
-GNU Lesser General Public License for more details. |
|
36 |
- |
|
37 |
-You should have received a copy of the GNU Lesser General Public License |
|
38 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
39 |
- */ |
|
40 |
-var lib_call; |
|
41 |
-(function (lib_call) { |
|
42 |
- /** |
|
43 |
- * @desc hacked class for postfix function application |
|
44 |
- * @author fenris |
|
45 |
- */ |
|
46 |
- class class_valuewrapper { |
|
47 |
- /** |
|
48 |
- * @desc [constructor] |
|
49 |
- * @author fenris |
|
50 |
- */ |
|
51 |
- constructor(value) { |
|
52 |
- this.value = value; |
|
53 |
- } |
|
54 |
- /** |
|
55 |
- * @desc [accessor] applies a function and returns a new valuewrapper |
|
56 |
- * @author fenris |
|
57 |
- */ |
|
58 |
- pass(function_) { |
|
59 |
- return (new class_valuewrapper(function_(this.value))); |
|
60 |
- } |
|
61 |
- /** |
|
62 |
- * @desc [accessor] gives the wrapped value |
|
63 |
- * @author fenris |
|
64 |
- */ |
|
65 |
- extract() { |
|
66 |
- return this.value; |
|
67 |
- } |
|
68 |
- } |
|
69 |
- lib_call.class_valuewrapper = class_valuewrapper; |
|
70 |
- /** |
|
71 |
- * @desc shortcut for constructing a valuewrapper-object |
|
72 |
- * @author fenris |
|
73 |
- */ |
|
74 |
- function vw(value) { |
|
75 |
- return (new class_valuewrapper(value)); |
|
76 |
- } |
|
77 |
- lib_call.vw = vw; |
|
78 |
- /** |
|
79 |
- * @author fenris |
|
80 |
- */ |
|
81 |
- function use(input, function_) { |
|
82 |
- return function_(input); |
|
83 |
- } |
|
84 |
- lib_call.use = use; |
|
85 |
- /** |
|
86 |
- * @desc just the identity; useful for some callbacks etc. |
|
87 |
- * @author fenris |
|
88 |
- */ |
|
89 |
- function id(x) { |
|
90 |
- return x; |
|
91 |
- } |
|
92 |
- lib_call.id = id; |
|
93 |
- /** |
|
94 |
- * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions) |
|
95 |
- * @param {function} function_f |
|
96 |
- * @param {function} function_g |
|
97 |
- * @author fenris |
|
98 |
- */ |
|
99 |
- function compose(function_f, function_g) { |
|
100 |
- return (function (x) { |
|
101 |
- // return function_g(function_f(x)); |
|
102 |
- return function_g(function_f.apply(function_f, lib_call.args2list(arguments))); |
|
103 |
- }); |
|
104 |
- } |
|
105 |
- lib_call.compose = compose; |
|
106 |
- /** |
|
107 |
- * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3) |
|
108 |
- * @param {function} f |
|
109 |
- * @param {int} n (don't set manually) |
|
110 |
- * @return {function} the currified version of the in put function |
|
111 |
- * @author fenris |
|
112 |
- */ |
|
113 |
- function curryfy(f, n = f.length) { |
|
114 |
- switch (n) { |
|
115 |
- case 0: { |
|
116 |
- throw (new Error("[curryfy] impossible")); |
|
117 |
- // break; |
|
118 |
- } |
|
119 |
- case 1: { |
|
120 |
- return f; |
|
121 |
- // break; |
|
122 |
- } |
|
123 |
- default: { |
|
124 |
- return (function (x) { |
|
125 |
- return (curryfy(function () { return f.apply(f, [x].concat(lib_call.args2list(arguments))); }, n - 1)); |
|
126 |
- }); |
|
127 |
- // break; |
|
128 |
- } |
|
129 |
- } |
|
130 |
- } |
|
131 |
- lib_call.curryfy = curryfy; |
|
132 |
-})(lib_call || (lib_call = {})); |
|
133 |
-var lib_call; |
|
134 |
-(function (lib_call) { |
|
135 |
- /** |
|
136 |
- * @author fenris |
|
137 |
- */ |
|
138 |
- function executor_resolve(result) { |
|
139 |
- return ((resolve, reject) => resolve(result)); |
|
140 |
- } |
|
141 |
- lib_call.executor_resolve = executor_resolve; |
|
142 |
- /** |
|
143 |
- * @author fenris |
|
144 |
- */ |
|
145 |
- function executor_reject(reason) { |
|
146 |
- return ((resolve, reject) => reject(reason)); |
|
147 |
- } |
|
148 |
- lib_call.executor_reject = executor_reject; |
|
149 |
- /** |
|
150 |
- * @author fenris |
|
151 |
- */ |
|
152 |
- function executor_transform(executor, transform_result, transform_reason) { |
|
153 |
- return ((resolve, reject) => { |
|
154 |
- executor(result => resolve(transform_result(result)), reason => reject(transform_reason(reason))); |
|
155 |
- }); |
|
156 |
- } |
|
157 |
- lib_call.executor_transform = executor_transform; |
|
158 |
- /** |
|
159 |
- * @author fenris |
|
160 |
- */ |
|
161 |
- function executor_transform_default(executor, transform_result, wrap_string = null) { |
|
162 |
- let transform_reason = (error => ((wrap_string == null) ? error : new class_error(wrap_string, [error]))); |
|
163 |
- return (executor_transform(executor, transform_result, transform_reason)); |
|
164 |
- } |
|
165 |
- lib_call.executor_transform_default = executor_transform_default; |
|
166 |
- /** |
|
167 |
- * @author fenris |
|
168 |
- */ |
|
169 |
- function executor_compose_sequential(first, second) { |
|
170 |
- return ((resolve, reject) => { |
|
171 |
- first(result => { |
|
172 |
- second(result)(resolve, reject); |
|
173 |
- }, reason => { |
|
174 |
- reject(reason); |
|
175 |
- }); |
|
176 |
- }); |
|
177 |
- } |
|
178 |
- lib_call.executor_compose_sequential = executor_compose_sequential; |
|
179 |
- /** |
|
180 |
- * @author fenris |
|
181 |
- */ |
|
182 |
- function executor_chain(state, executors) { |
|
183 |
- return ((resolve, reject) => { |
|
184 |
- if (executors.length == 0) { |
|
185 |
- return resolve(state); |
|
186 |
- } |
|
187 |
- else { |
|
188 |
- return executors[0](state)(result => { |
|
189 |
- executor_chain(result, executors.slice(1))(resolve, reject); |
|
190 |
- }, reject); |
|
191 |
- } |
|
192 |
- }); |
|
193 |
- /* |
|
194 |
- */ |
|
195 |
- /* |
|
196 |
- if (executors.length == 0) { |
|
197 |
- return executor_resolve<type_state, type_error>(state); |
|
198 |
- } |
|
199 |
- else if (executors.length == 1) { |
|
200 |
- return executors[0](state); |
|
201 |
- } |
|
202 |
- else { |
|
203 |
- return ( |
|
204 |
- executor_chain<type_state, type_error>( |
|
205 |
- state, |
|
206 |
- [ |
|
207 |
- state => (resolve, reject) => executors[0](state)(result => executors[1](result)(resolve, reject), reject) |
|
208 |
- ].concat(executors.slice(2)) |
|
209 |
- ) |
|
210 |
- ); |
|
211 |
- } |
|
212 |
- */ |
|
213 |
- /* |
|
214 |
- return ( |
|
215 |
- executors.reduce( |
|
216 |
- (chain, current) => executor_compose_sequential<type_state, type_state, type_error>(chain, current, deferred), |
|
217 |
- executor_resolve<type_state, type_error>(state) |
|
218 |
- ) |
|
219 |
- ); |
|
220 |
- */ |
|
221 |
- } |
|
222 |
- lib_call.executor_chain = executor_chain; |
|
223 |
- /** |
|
224 |
- * @author fenris |
|
225 |
- */ |
|
226 |
- function executor_first(executors) { |
|
227 |
- /* |
|
228 |
- return ( |
|
229 |
- (resolve, reject) => { |
|
230 |
- if (executors.length == 0) { |
|
231 |
- reject(new Error("all failed")); |
|
232 |
- } |
|
233 |
- else { |
|
234 |
- executors[0]( |
|
235 |
- result => { |
|
236 |
- resolve(result); |
|
237 |
- }, |
|
238 |
- reason => { |
|
239 |
- executor_first<type_result, type_reason>(executors.slice(1))(resolve, reject); |
|
240 |
- } |
|
241 |
- ) |
|
242 |
- } |
|
243 |
- } |
|
244 |
- ); |
|
245 |
- */ |
|
246 |
- return ((resolve, reject) => { |
|
247 |
- executor_chain([], executors.map(executor => reasons => (resolve_, reject_) => { |
|
248 |
- executor(result => reject_(result), reason => resolve_(reasons.concat([reason]))); |
|
249 |
- }))(errors => reject(errors), result => resolve(result)); |
|
250 |
- }); |
|
251 |
- } |
|
252 |
- lib_call.executor_first = executor_first; |
|
253 |
- /** |
|
254 |
- * @author fenris |
|
255 |
- */ |
|
256 |
- function executor_condense(executors) { |
|
257 |
- return (executor_chain([], executors.map(executor => result => (resolve, reject) => { |
|
258 |
- executor(element => resolve(result.concat([element])), reject); |
|
259 |
- }))); |
|
260 |
- } |
|
261 |
- lib_call.executor_condense = executor_condense; |
|
262 |
- /** |
|
263 |
- * @author fenris |
|
264 |
- * @deprecated use condense |
|
265 |
- */ |
|
266 |
- function executor_filter(executors, predicate) { |
|
267 |
- return (executor_chain([], executors.map(executor => result => (resolve, reject) => { |
|
268 |
- executor(element => resolve(predicate(element) ? result.concat([element]) : result), reject); |
|
269 |
- }))); |
|
270 |
- } |
|
271 |
- lib_call.executor_filter = executor_filter; |
|
272 |
- /** |
|
273 |
- * @author fenris |
|
274 |
- * @deprecated use condense |
|
275 |
- */ |
|
276 |
- function executor_map(executors, transformator) { |
|
277 |
- return (executor_chain([], executors.map(executor => result => (resolve, reject) => { |
|
278 |
- executor(element1 => resolve(result.concat([transformator(element1)])), reject); |
|
279 |
- }))); |
|
280 |
- } |
|
281 |
- lib_call.executor_map = executor_map; |
|
282 |
- /** |
|
283 |
- * @author fenris |
|
284 |
- * @deprecated use condense |
|
285 |
- */ |
|
286 |
- function executor_reduce(executors, initial, accumulator) { |
|
287 |
- return (executor_chain(initial, executors.map(executor => result => (resolve, reject) => { |
|
288 |
- executor(element => resolve(accumulator(result, element)), reject); |
|
289 |
- }))); |
|
290 |
- } |
|
291 |
- lib_call.executor_reduce = executor_reduce; |
|
292 |
-})(lib_call || (lib_call = {})); |
|
293 |
-/* |
|
294 |
-This file is part of »bacterio-plankton:call«. |
|
295 |
- |
|
296 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
297 |
-<info@greenscale.de> |
|
298 |
- |
|
299 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
300 |
-it under the terms of the GNU Lesser General Public License as published by |
|
301 |
-the Free Software Foundation, either version 3 of the License, or |
|
302 |
-(at your option) any later version. |
|
303 |
- |
|
304 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
305 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
306 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
307 |
-GNU Lesser General Public License for more details. |
|
308 |
- |
|
309 |
-You should have received a copy of the GNU Lesser General Public License |
|
310 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
311 |
- */ |
|
312 |
-var lib_call; |
|
313 |
-(function (lib_call) { |
|
314 |
- /** |
|
315 |
- * @author fenris |
|
316 |
- */ |
|
317 |
- function promise_reject(reason) { |
|
318 |
- return Promise.reject(reason); |
|
319 |
- } |
|
320 |
- lib_call.promise_reject = promise_reject; |
|
321 |
- /** |
|
322 |
- * @author fenris |
|
323 |
- */ |
|
324 |
- function promise_resolve(result) { |
|
325 |
- return Promise.resolve(result); |
|
326 |
- } |
|
327 |
- lib_call.promise_resolve = promise_resolve; |
|
328 |
- /** |
|
329 |
- * @author fenris |
|
330 |
- */ |
|
331 |
- function promise_make(executor) { |
|
332 |
- return (new Promise(executor)); |
|
333 |
- } |
|
334 |
- lib_call.promise_make = promise_make; |
|
335 |
- /** |
|
336 |
- * @author fenris |
|
337 |
- */ |
|
338 |
- function promise_then_close(promise, resolver, rejector) { |
|
339 |
- promise.then(resolver, rejector); |
|
340 |
- } |
|
341 |
- lib_call.promise_then_close = promise_then_close; |
|
342 |
- /** |
|
343 |
- * @author fenris |
|
344 |
- */ |
|
345 |
- function promise_then_append(promise, resolver, rejector = null) { |
|
346 |
- if (rejector == null) { |
|
347 |
- rejector = (reason) => promise_reject(reason); |
|
348 |
- } |
|
349 |
- return (promise.then(resolver, rejector)); |
|
350 |
- } |
|
351 |
- lib_call.promise_then_append = promise_then_append; |
|
352 |
- /** |
|
353 |
- * @author fenris |
|
354 |
- */ |
|
355 |
- function promise_all(promises) { |
|
356 |
- return Promise.all(promises); |
|
357 |
- } |
|
358 |
- lib_call.promise_all = promise_all; |
|
359 |
- /** |
|
360 |
- * @author fenris |
|
361 |
- */ |
|
362 |
- function promise_chain(promises, start = undefined) { |
|
363 |
- return (promises.reduce((chain, promise) => promise_then_append(chain, promise), promise_resolve(start))); |
|
364 |
- } |
|
365 |
- lib_call.promise_chain = promise_chain; |
|
366 |
- /** |
|
367 |
- * @author fenris |
|
368 |
- */ |
|
369 |
- function promise_condense(promises) { |
|
370 |
- return (promise_chain(promises.map(promise => result => promise_then_append(promise(), element => promise_resolve(result.concat([element])))), [])); |
|
371 |
- } |
|
372 |
- lib_call.promise_condense = promise_condense; |
|
373 |
- /** |
|
374 |
- * @author fenris |
|
375 |
- */ |
|
376 |
- function promise_group(promises, serial = false) { |
|
377 |
- const decorate = function (promise, name) { |
|
378 |
- return (() => promise_then_append(promise(), value => promise_resolve({ "key": name, "value": value }))); |
|
379 |
- }; |
|
380 |
- const convert = function (array) { |
|
381 |
- let object = {}; |
|
382 |
- array.forEach(({ "key": key, "value": value }) => { object[key] = value; }); |
|
383 |
- return object; |
|
384 |
- }; |
|
385 |
- if (serial) { |
|
386 |
- return (promise_then_append(promise_condense(Object.keys(promises) |
|
387 |
- .map(name => decorate(promises[name], name))), list => promise_resolve(convert(list)))); |
|
388 |
- } |
|
389 |
- else { |
|
390 |
- return (promise_then_append(promise_all(Object.keys(promises) |
|
391 |
- .map(name => decorate(promises[name], name)) |
|
392 |
- .map(promise => promise())), list => promise_resolve(convert(list)))); |
|
393 |
- } |
|
394 |
- } |
|
395 |
- lib_call.promise_group = promise_group; |
|
396 |
- /** |
|
397 |
- * @author fenris |
|
398 |
- */ |
|
399 |
- function promise_wrap(promise, transformator_result, transformator_reason = lib_call.id) { |
|
400 |
- return (promise_make((resolve, reject) => { |
|
401 |
- promise_then_close(promise, result => resolve(transformator_result(result)), reason => reject(transformator_reason(reason))); |
|
402 |
- })); |
|
403 |
- } |
|
404 |
- lib_call.promise_wrap = promise_wrap; |
|
405 |
- /** |
|
406 |
- * @author fenris |
|
407 |
- */ |
|
408 |
- function promise_show(label) { |
|
409 |
- return (result => promise_make((resolve, reject) => { |
|
410 |
- lib_log.info(label + ": " + instance_show(result)); |
|
411 |
- resolve(result); |
|
412 |
- })); |
|
413 |
- } |
|
414 |
- lib_call.promise_show = promise_show; |
|
415 |
- /** |
|
416 |
- * @author fenris |
|
417 |
- */ |
|
418 |
- function promise_log(result) { |
|
419 |
- return promise_show("log"); |
|
420 |
- } |
|
421 |
- lib_call.promise_log = promise_log; |
|
422 |
- /** |
|
423 |
- * @author fenris |
|
424 |
- */ |
|
425 |
- function promise_attach(state, promise, name) { |
|
426 |
- return (promise_wrap(promise, result => { |
|
427 |
- state[name] = result; |
|
428 |
- return state; |
|
429 |
- })); |
|
430 |
- } |
|
431 |
- lib_call.promise_attach = promise_attach; |
|
432 |
- /** |
|
433 |
- * @author fenris |
|
434 |
- */ |
|
435 |
- function promise_delay(promise, delay) { |
|
436 |
- return promise_make((resolve, reject) => { |
|
437 |
- lib_call.timeout(() => { |
|
438 |
- promise_then_close(promise, resolve, reject); |
|
439 |
- return null; |
|
440 |
- }, delay); |
|
441 |
- }); |
|
442 |
- } |
|
443 |
- lib_call.promise_delay = promise_delay; |
|
444 |
- /** |
|
445 |
- * @author fenris |
|
446 |
- */ |
|
447 |
- function promise_to_executor(promise) { |
|
448 |
- return ((resolve, reject) => promise.then(resolve, reject)); |
|
449 |
- } |
|
450 |
- lib_call.promise_to_executor = promise_to_executor; |
|
451 |
-})(lib_call || (lib_call = {})); |
|
452 |
-/* |
|
453 |
-This file is part of »bacterio-plankton:call«. |
|
454 |
- |
|
455 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
456 |
-<info@greenscale.de> |
|
457 |
- |
|
458 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
459 |
-it under the terms of the GNU Lesser General Public License as published by |
|
460 |
-the Free Software Foundation, either version 3 of the License, or |
|
461 |
-(at your option) any later version. |
|
462 |
- |
|
463 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
464 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
465 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
466 |
-GNU Lesser General Public License for more details. |
|
467 |
- |
|
468 |
-You should have received a copy of the GNU Lesser General Public License |
|
469 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
470 |
- */ |
|
471 |
-var lib_call; |
|
472 |
-(function (lib_call) { |
|
473 |
- lib_call.initializer_state_initial = 0; |
|
474 |
- lib_call.initializer_state_waiting = 1; |
|
475 |
- lib_call.initializer_state_successful = 2; |
|
476 |
- lib_call.initializer_state_failed = 3; |
|
477 |
- /** |
|
478 |
- * @author fenris |
|
479 |
- */ |
|
480 |
- function initializer_make(fetcher) { |
|
481 |
- let subject = { |
|
482 |
- "fetcher": fetcher, |
|
483 |
- "state": lib_call.initializer_state_initial, |
|
484 |
- "queue": [], |
|
485 |
- "result": undefined, |
|
486 |
- "reason": undefined, |
|
487 |
- }; |
|
488 |
- return subject; |
|
489 |
- } |
|
490 |
- lib_call.initializer_make = initializer_make; |
|
491 |
- /** |
|
492 |
- * @author fenris |
|
493 |
- */ |
|
494 |
- function initializer_actuate(subject) { |
|
495 |
- switch (subject.state) { |
|
496 |
- case lib_call.initializer_state_successful: { |
|
497 |
- subject.queue.forEach(entry => entry.resolve(subject.result)); |
|
498 |
- break; |
|
499 |
- } |
|
500 |
- case lib_call.initializer_state_failed: { |
|
501 |
- subject.queue.forEach(entry => entry.reject(subject.reason)); |
|
502 |
- break; |
|
503 |
- } |
|
504 |
- default: { |
|
505 |
- let message = `unhandled state ${subject.state}`; |
|
506 |
- throw (new Error(message)); |
|
507 |
- break; |
|
508 |
- } |
|
509 |
- } |
|
510 |
- } |
|
511 |
- /** |
|
512 |
- * @author fenris |
|
513 |
- */ |
|
514 |
- function initializer_reset(subject) { |
|
515 |
- subject.state = lib_call.initializer_state_initial; |
|
516 |
- subject.queue = []; |
|
517 |
- } |
|
518 |
- lib_call.initializer_reset = initializer_reset; |
|
519 |
- /** |
|
520 |
- * @author fenris |
|
521 |
- */ |
|
522 |
- function initializer_state(subject) { |
|
523 |
- return subject.state; |
|
524 |
- } |
|
525 |
- lib_call.initializer_state = initializer_state; |
|
526 |
- /** |
|
527 |
- * @author fenris |
|
528 |
- */ |
|
529 |
- function initializer_get(subject) { |
|
530 |
- switch (subject.state) { |
|
531 |
- case lib_call.initializer_state_initial: { |
|
532 |
- subject.state = lib_call.initializer_state_waiting; |
|
533 |
- return (lib_call.promise_make((resolve, reject) => { |
|
534 |
- subject.queue.push({ "resolve": resolve, "reject": reject }); |
|
535 |
- subject.fetcher().then(result => { |
|
536 |
- subject.state = lib_call.initializer_state_successful; |
|
537 |
- subject.result = result; |
|
538 |
- initializer_actuate(subject); |
|
539 |
- }, reason => { |
|
540 |
- subject.state = lib_call.initializer_state_failed; |
|
541 |
- subject.reason = reason; |
|
542 |
- initializer_actuate(subject); |
|
543 |
- }); |
|
544 |
- })); |
|
545 |
- break; |
|
546 |
- } |
|
547 |
- case lib_call.initializer_state_waiting: { |
|
548 |
- return (lib_call.promise_make((resolve, reject) => { |
|
549 |
- subject.queue.push({ "resolve": resolve, "reject": reject }); |
|
550 |
- })); |
|
551 |
- break; |
|
552 |
- } |
|
553 |
- case lib_call.initializer_state_successful: { |
|
554 |
- return (lib_call.promise_resolve(subject.result)); |
|
555 |
- break; |
|
556 |
- } |
|
557 |
- case lib_call.initializer_state_failed: { |
|
558 |
- return (lib_call.promise_reject(subject.reason)); |
|
559 |
- break; |
|
560 |
- } |
|
561 |
- default: { |
|
562 |
- let message = `unhandled state ${subject.state}`; |
|
563 |
- throw (new Error(message)); |
|
564 |
- break; |
|
565 |
- } |
|
566 |
- } |
|
567 |
- } |
|
568 |
- lib_call.initializer_get = initializer_get; |
|
569 |
- /** |
|
570 |
- * @author fenris |
|
571 |
- */ |
|
572 |
- function initializer_get_sync(subject) { |
|
573 |
- switch (subject.state) { |
|
574 |
- case lib_call.initializer_state_successful: { |
|
575 |
- return subject.result; |
|
576 |
- break; |
|
577 |
- } |
|
578 |
- case lib_call.initializer_state_failed: { |
|
579 |
- throw subject.reason; |
|
580 |
- break; |
|
581 |
- } |
|
582 |
- default: { |
|
583 |
- let message = `unhandled state ${subject.state}`; |
|
584 |
- throw (new Error(message)); |
|
585 |
- break; |
|
586 |
- } |
|
587 |
- } |
|
588 |
- } |
|
589 |
- /** |
|
590 |
- * @author fenris |
|
591 |
- */ |
|
592 |
- function initializer_set_sync(subject, result) { |
|
593 |
- switch (subject.state) { |
|
594 |
- case lib_call.initializer_state_successful: { |
|
595 |
- subject.result = result; |
|
596 |
- break; |
|
597 |
- } |
|
598 |
- case lib_call.initializer_state_failed: { |
|
599 |
- subject.state = lib_call.initializer_state_successful; |
|
600 |
- subject.result = result; |
|
601 |
- break; |
|
602 |
- } |
|
603 |
- default: { |
|
604 |
- let message = `unhandled state ${subject.state}`; |
|
605 |
- throw (new Error(message)); |
|
606 |
- break; |
|
607 |
- } |
|
608 |
- } |
|
609 |
- } |
|
610 |
-})(lib_call || (lib_call = {})); |
|
611 |
-/* |
|
612 |
-This file is part of »bacterio-plankton:call«. |
|
613 |
- |
|
614 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
615 |
-<info@greenscale.de> |
|
616 |
- |
|
617 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
618 |
-it under the terms of the GNU Lesser General Public License as published by |
|
619 |
-the Free Software Foundation, either version 3 of the License, or |
|
620 |
-(at your option) any later version. |
|
621 |
- |
|
622 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
623 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
624 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
625 |
-GNU Lesser General Public License for more details. |
|
626 |
- |
|
627 |
-You should have received a copy of the GNU Lesser General Public License |
|
628 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
629 |
- */ |
|
630 |
-var lib_call; |
|
631 |
-(function (lib_call) { |
|
632 |
- /* |
|
633 |
- The core idea of this library is to provide means for asynchronous program flow. The old-school way to do is, |
|
634 |
- is to use callbacks. While this approach is simple and easy to understand, it has some disadvantages. As an |
|
635 |
- attempt to relief and improve this, the promise-system was introduced. In principle it solves most of the |
|
636 |
- problems found in the callback-approach; however it has some downsides as well: |
|
637 |
- |
|
638 |
- - Convolution of multiple principles |
|
639 |
- Promises unite the ideas of asynchronous program flow and error handling. |
|
640 |
- |
|
641 |
- - Instant execution |
|
642 |
- Creating a promise results in the instant execution of the given executor prodecure. While this might be |
|
643 |
- convenient in some cases, it can be quite disturbing and counter-intuitive in others. |
|
644 |
- |
|
645 |
- - Broken typing |
|
646 |
- The Promise system doesn't distinguish between an appending "then" (i.e. passing a function, which returns a |
|
647 |
- new promise) and a closing "then" (i.e. passing a function, which has no return value). On top of that it |
|
648 |
- allows returning simple values in an appending "then", which results in an implicit call of the executors |
|
649 |
- "resolve"-function. The price for these "pragmatic" features is that the whole system can't be typed well. |
|
650 |
- And even though JavaScript is not a strictly typed language, it was a quite questionable decision to design |
|
651 |
- the promise system in a way, which breaks typing from the start. |
|
652 |
- |
|
653 |
- The deferral-system forseeks to solve these issues while retaining the advantages of the promise-system. |
|
654 |
- */ |
|
655 |
- /** |
|
656 |
- * @author fenris |
|
657 |
- * @desc activates the deferral and handles its output according to a given procedure |
|
658 |
- * @param {(value : type_value)=>void} procedure a function which receives the output of the deferral as argument |
|
659 |
- */ |
|
660 |
- function deferral_use(deferral, input, procedure) { |
|
661 |
- deferral.representation(input).then(value => { |
|
662 |
- procedure(value); |
|
663 |
- }, reason => { |
|
664 |
- throw reason; |
|
665 |
- }); |
|
666 |
- } |
|
667 |
- lib_call.deferral_use = deferral_use; |
|
668 |
- /** |
|
669 |
- * @author fenris |
|
670 |
- * @desc creates a deferral-subject (similar to "new Promise", where "convey" reflects "resolve"/"reject") |
|
671 |
- */ |
|
672 |
- function deferral_make(handler) { |
|
673 |
- return ({ |
|
674 |
- "representation": ((input) => (new Promise((resolve, reject) => { |
|
675 |
- handler(input, resolve); |
|
676 |
- }))) |
|
677 |
- }); |
|
678 |
- } |
|
679 |
- lib_call.deferral_make = deferral_make; |
|
680 |
- /** |
|
681 |
- * @author fenris |
|
682 |
- * @desc wraps a simple function into a deferral (similar to "Promise.resolve"/"Promise.reject") |
|
683 |
- */ |
|
684 |
- function deferral_wrap(function_) { |
|
685 |
- return (deferral_make((input, convey) => convey(function_(input)))); |
|
686 |
- } |
|
687 |
- lib_call.deferral_wrap = deferral_wrap; |
|
688 |
- /** |
|
689 |
- * @author fenris |
|
690 |
- */ |
|
691 |
- function deferral_id() { |
|
692 |
- return (deferral_make((input, convey) => convey(input))); |
|
693 |
- } |
|
694 |
- lib_call.deferral_id = deferral_id; |
|
695 |
- /** |
|
696 |
- * @author fenris |
|
697 |
- */ |
|
698 |
- function deferral_const(value) { |
|
699 |
- return (deferral_make((input, convey) => convey(value))); |
|
700 |
- } |
|
701 |
- lib_call.deferral_const = deferral_const; |
|
702 |
- /** |
|
703 |
- * @author fenris |
|
704 |
- */ |
|
705 |
- function deferral_delay(output, delay) { |
|
706 |
- return (deferral_make((input, convey) => { |
|
707 |
- setTimeout(() => convey(output), delay); |
|
708 |
- })); |
|
709 |
- } |
|
710 |
- lib_call.deferral_delay = deferral_delay; |
|
711 |
- /** |
|
712 |
- * @author fenris |
|
713 |
- * @desc connects two deferrals to form a new one; the output of the first is taken as input for the second |
|
714 |
- * (similar to "Promise.then" when passing a function which returns a new promise) |
|
715 |
- * @param {type_deferral<type_value1>} first a simple deferral |
|
716 |
- * @param {(value1 : type_value1)=>type_deferral<type_value2>} second a function depending from a value returning a deferral |
|
717 |
- */ |
|
718 |
- function deferral_compose_serial(first, second) { |
|
719 |
- return { |
|
720 |
- "representation": ((input) => first.representation(input).then((between) => second.representation(between))) |
|
721 |
- }; |
|
722 |
- } |
|
723 |
- lib_call.deferral_compose_serial = deferral_compose_serial; |
|
724 |
- /** |
|
725 |
- * @author fenris |
|
726 |
- */ |
|
727 |
- function deferral_compose_parallel({ "left": deferral_left, "right": deferral_right, }) { |
|
728 |
- return (deferral_make((input, convey) => { |
|
729 |
- let object = { |
|
730 |
- "left": lib_maybe.make_nothing(), |
|
731 |
- "right": lib_maybe.make_nothing(), |
|
732 |
- }; |
|
733 |
- let finish = function () { |
|
734 |
- if (lib_maybe.is_just(object.left) |
|
735 |
- && |
|
736 |
- lib_maybe.is_just(object.right)) { |
|
737 |
- let result = { |
|
738 |
- "left": lib_maybe.cull(object.left), |
|
739 |
- "right": lib_maybe.cull(object.right), |
|
740 |
- }; |
|
741 |
- convey(result); |
|
742 |
- } |
|
743 |
- else { |
|
744 |
- // do nothing |
|
745 |
- } |
|
746 |
- }; |
|
747 |
- deferral_use(deferral_left, input, output_left => { |
|
748 |
- object.left = lib_maybe.make_just(output_left); |
|
749 |
- finish(); |
|
750 |
- }); |
|
751 |
- deferral_use(deferral_right, input, output_right => { |
|
752 |
- object.right = lib_maybe.make_just(output_right); |
|
753 |
- finish(); |
|
754 |
- }); |
|
755 |
- })); |
|
756 |
- } |
|
757 |
- lib_call.deferral_compose_parallel = deferral_compose_parallel; |
|
758 |
- /** |
|
759 |
- * @author fenris |
|
760 |
- * @desc repeatedly applied serial composition |
|
761 |
- */ |
|
762 |
- function deferral_chain(members) { |
|
763 |
- return (members.reduce( |
|
764 |
- // (result, current) => deferral_compose_serial<type_value, type_value, type_value>(result, current), |
|
765 |
- deferral_compose_serial, deferral_id())); |
|
766 |
- } |
|
767 |
- lib_call.deferral_chain = deferral_chain; |
|
768 |
- /** |
|
769 |
- * @author fenris |
|
770 |
- */ |
|
771 |
- /* |
|
772 |
- export function deferral_bunch<type_input, type_output>( |
|
773 |
- members : {[name : string] : type_deferral<type_input, type_output>} |
|
774 |
- ) : type_deferral<type_input, {[name : string] : type_output}> { |
|
775 |
- |
|
776 |
- } |
|
777 |
- */ |
|
778 |
-})(lib_call || (lib_call = {})); |
|
779 |
-/* |
|
780 |
-This file is part of »bacterio-plankton:call«. |
|
781 |
- |
|
782 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
783 |
-<info@greenscale.de> |
|
784 |
- |
|
785 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
786 |
-it under the terms of the GNU Lesser General Public License as published by |
|
787 |
-the Free Software Foundation, either version 3 of the License, or |
|
788 |
-(at your option) any later version. |
|
789 |
- |
|
790 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
791 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
792 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
793 |
-GNU Lesser General Public License for more details. |
|
794 |
- |
|
795 |
-You should have received a copy of the GNU Lesser General Public License |
|
796 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
797 |
- */ |
|
798 |
-var lib_call; |
|
799 |
-(function (lib_call) { |
|
800 |
- /** |
|
801 |
- * @author fenris |
|
802 |
- */ |
|
803 |
- class class_deferral { |
|
804 |
- /** |
|
805 |
- * @author fenris |
|
806 |
- */ |
|
807 |
- constructor(subject) { |
|
808 |
- this.subject = subject; |
|
809 |
- } |
|
810 |
- /** |
|
811 |
- * @author fenris |
|
812 |
- */ |
|
813 |
- static _cram(subject) { |
|
814 |
- return (new class_deferral(subject)); |
|
815 |
- } |
|
816 |
- /** |
|
817 |
- * @author fenris |
|
818 |
- */ |
|
819 |
- static _tear(instance) { |
|
820 |
- return instance.subject; |
|
821 |
- } |
|
822 |
- /** |
|
823 |
- * @author fenris |
|
824 |
- */ |
|
825 |
- static make(handler) { |
|
826 |
- return (class_deferral._cram(lib_call.deferral_make(handler))); |
|
827 |
- } |
|
828 |
- /** |
|
829 |
- * @author fenris |
|
830 |
- */ |
|
831 |
- use(input, procedure) { |
|
832 |
- return (lib_call.deferral_use(class_deferral._tear(this), input, procedure)); |
|
833 |
- } |
|
834 |
- /** |
|
835 |
- * @author fenris |
|
836 |
- */ |
|
837 |
- compose_serial(second) { |
|
838 |
- return (class_deferral._cram(lib_call.deferral_compose_serial(class_deferral._tear(this), class_deferral._tear(second)))); |
|
839 |
- } |
|
840 |
- /** |
|
841 |
- * @author fenris |
|
842 |
- */ |
|
843 |
- static chain(members) { |
|
844 |
- return (class_deferral._cram(lib_call.deferral_chain(members.map(member => class_deferral._tear(member))))); |
|
845 |
- } |
|
846 |
- /** |
|
847 |
- * @author fenris |
|
848 |
- */ |
|
849 |
- static wrap(function_) { |
|
850 |
- return (class_deferral._cram(lib_call.deferral_wrap(function_))); |
|
851 |
- } |
|
852 |
- /** |
|
853 |
- * @author fenris |
|
854 |
- */ |
|
855 |
- static const_(value) { |
|
856 |
- return (class_deferral._cram(lib_call.deferral_const(value))); |
|
857 |
- } |
|
858 |
- /** |
|
859 |
- * @author fenris |
|
860 |
- */ |
|
861 |
- static delay(output, delay) { |
|
862 |
- return (class_deferral._cram(lib_call.deferral_delay(output, delay))); |
|
863 |
- } |
|
864 |
- } |
|
865 |
- lib_call.class_deferral = class_deferral; |
|
866 |
-})(lib_call || (lib_call = {})); |
|
867 |
-/* |
|
868 |
-This file is part of »bacterio-plankton:call«. |
|
869 |
- |
|
870 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
871 |
-<info@greenscale.de> |
|
872 |
- |
|
873 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
874 |
-it under the terms of the GNU Lesser General Public License as published by |
|
875 |
-the Free Software Foundation, either version 3 of the License, or |
|
876 |
-(at your option) any later version. |
|
877 |
- |
|
878 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
879 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
880 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
881 |
-GNU Lesser General Public License for more details. |
|
882 |
- |
|
883 |
-You should have received a copy of the GNU Lesser General Public License |
|
884 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
885 |
- */ |
|
886 |
-var lib_call; |
|
887 |
-(function (lib_call) { |
|
888 |
- /** |
|
889 |
- * @author fenris |
|
890 |
- */ |
|
891 |
- function timeout(function_, delay) { |
|
892 |
- return ( |
|
893 |
- /*window.*/ setTimeout(function_, delay)); |
|
894 |
- } |
|
895 |
- lib_call.timeout = timeout; |
|
896 |
- /** |
|
897 |
- * @desc a definition for a value being "defined" |
|
898 |
- * @author neuc |
|
899 |
- */ |
|
900 |
- function is_def(obj, null_is_valid = false) { |
|
901 |
- return (!((typeof (obj) === "undefined") |
|
902 |
- || |
|
903 |
- (!null_is_valid && (obj === null)))); |
|
904 |
- } |
|
905 |
- lib_call.is_def = is_def; |
|
906 |
- /** |
|
907 |
- * @desc returns the value if set and, when a type is specified, if the type is correct, if not return default_value |
|
908 |
- * @author neuc |
|
909 |
- */ |
|
910 |
- function def_val(value, default_value, type = null, null_is_valid = false) { |
|
911 |
- if (is_def(value, null_is_valid) |
|
912 |
- && |
|
913 |
- (is_def(type) |
|
914 |
- ? ((typeof value === type) |
|
915 |
- || |
|
916 |
- ((value === null) |
|
917 |
- && |
|
918 |
- null_is_valid)) |
|
919 |
- : true)) { |
|
920 |
- return value; |
|
921 |
- } |
|
922 |
- else { |
|
923 |
- return default_value; |
|
924 |
- } |
|
925 |
- } |
|
926 |
- lib_call.def_val = def_val; |
|
927 |
- ; |
|
928 |
- /** |
|
929 |
- * @desc just the empty function; useful for some callbacks etc. |
|
930 |
- * @author fenris |
|
931 |
- */ |
|
932 |
- function nothing() { |
|
933 |
- } |
|
934 |
- lib_call.nothing = nothing; |
|
935 |
- /** |
|
936 |
- * @desc outputs |
|
937 |
- * @author fenris |
|
938 |
- */ |
|
939 |
- function output(...args) { |
|
940 |
- lib_log.info.apply(lib_log, args); |
|
941 |
- } |
|
942 |
- lib_call.output = output; |
|
943 |
- /** |
|
944 |
- * @desc converts the "arguments"-map into an array |
|
945 |
- * @param {Object} args |
|
946 |
- * @author fenris |
|
947 |
- */ |
|
948 |
- function args2list(args) { |
|
949 |
- return Object.keys(args).map(key => args[key]); |
|
950 |
- } |
|
951 |
- lib_call.args2list = args2list; |
|
952 |
- /** |
|
953 |
- * @desc provides the call for an attribute of a class as a regular function |
|
954 |
- * @param {string} name the name of the attribute |
|
955 |
- * @return {*} |
|
956 |
- * @author fenris |
|
957 |
- */ |
|
958 |
- function attribute(name) { |
|
959 |
- return ((object) => object[name]); |
|
960 |
- } |
|
961 |
- lib_call.attribute = attribute; |
|
962 |
- /** |
|
963 |
- * @desc provides a method of a class as a regular function |
|
964 |
- * @param {string} name the name of the method |
|
965 |
- * @return {function} |
|
966 |
- * @author fenris |
|
967 |
- */ |
|
968 |
- function method(name) { |
|
969 |
- return (function (object) { return object[name].apply(object, args2list(arguments).slice(1)); }); |
|
970 |
- } |
|
971 |
- lib_call.method = method; |
|
972 |
- /** |
|
973 |
- * @author fenris |
|
974 |
- */ |
|
975 |
- function distinguish(unival, handlers, fallback = null) { |
|
976 |
- if (unival.kind in handlers) { |
|
977 |
- let handler = handlers[unival.kind]; |
|
978 |
- return handler(unival.data); |
|
979 |
- } |
|
980 |
- else { |
|
981 |
- let message = ("unhandled kind '" + unival.kind + "'"); |
|
982 |
- if (fallback !== null) { |
|
983 |
- console.warn(message); |
|
984 |
- return fallback(unival); |
|
985 |
- } |
|
986 |
- else { |
|
987 |
- throw (new Error(message)); |
|
988 |
- } |
|
989 |
- } |
|
990 |
- } |
|
991 |
- lib_call.distinguish = distinguish; |
|
992 |
-})(lib_call || (lib_call = {})); |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 | 4 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -244,39 +244,6 @@ declare module lib_code { |
244 | 244 |
decode(x: string): Date; |
245 | 245 |
} |
246 | 246 |
} |
247 |
-declare module lib_code { |
|
248 |
- /** |
|
249 |
- * @author fenris |
|
250 |
- */ |
|
251 |
- function json_encode(x: any, formatted?: boolean): string; |
|
252 |
- /** |
|
253 |
- * @author fenris |
|
254 |
- */ |
|
255 |
- function json_decode(x: string): any; |
|
256 |
-} |
|
257 |
-declare module lib_code { |
|
258 |
-} |
|
259 |
-declare module lib_code { |
|
260 |
- /** |
|
261 |
- * @author fenris |
|
262 |
- */ |
|
263 |
- class class_code_json implements interface_code<any, string> { |
|
264 |
- /** |
|
265 |
- * @author fenris |
|
266 |
- */ |
|
267 |
- constructor(); |
|
268 |
- /** |
|
269 |
- * @implementation |
|
270 |
- * @author fenris |
|
271 |
- */ |
|
272 |
- encode(x: any): string; |
|
273 |
- /** |
|
274 |
- * @implementation |
|
275 |
- * @author fenris |
|
276 |
- */ |
|
277 |
- decode(x: string): any; |
|
278 |
- } |
|
279 |
-} |
|
280 | 247 |
declare module lib_code { |
281 | 248 |
/** |
282 | 249 |
* @author Christian Fraß <frass@greenscale.de> |
... | ... |
@@ -323,69 +290,3 @@ declare module lib_code { |
323 | 290 |
decode(x: string): type_csv_from; |
324 | 291 |
} |
325 | 292 |
} |
326 |
-declare module lib_code { |
|
327 |
- /** |
|
328 |
- * @author fenris |
|
329 |
- */ |
|
330 |
- function uri_encode(x: string): string; |
|
331 |
- /** |
|
332 |
- * @author fenris |
|
333 |
- */ |
|
334 |
- function uri_decode(x: string): string; |
|
335 |
-} |
|
336 |
-declare module lib_code { |
|
337 |
-} |
|
338 |
-declare module lib_code { |
|
339 |
- /** |
|
340 |
- * @author fenris |
|
341 |
- */ |
|
342 |
- class class_code_uri implements interface_code<string, string> { |
|
343 |
- /** |
|
344 |
- * @author fenris |
|
345 |
- */ |
|
346 |
- constructor(); |
|
347 |
- /** |
|
348 |
- * @implementation |
|
349 |
- * @author fenris |
|
350 |
- */ |
|
351 |
- encode(x: string): string; |
|
352 |
- /** |
|
353 |
- * @implementation |
|
354 |
- * @author fenris |
|
355 |
- */ |
|
356 |
- decode(x: string): string; |
|
357 |
- } |
|
358 |
-} |
|
359 |
-declare module lib_code { |
|
360 |
- /** |
|
361 |
- * @author fenris |
|
362 |
- */ |
|
363 |
- function base64_encode(x: string): string; |
|
364 |
- /** |
|
365 |
- * @author fenris |
|
366 |
- */ |
|
367 |
- function base64_decode(x: string): string; |
|
368 |
-} |
|
369 |
-declare module lib_code { |
|
370 |
-} |
|
371 |
-declare module lib_code { |
|
372 |
- /** |
|
373 |
- * @author fenris |
|
374 |
- */ |
|
375 |
- class class_code_base64 implements interface_code<string, string> { |
|
376 |
- /** |
|
377 |
- * @author fenris |
|
378 |
- */ |
|
379 |
- constructor(); |
|
380 |
- /** |
|
381 |
- * @implementation |
|
382 |
- * @author fenris |
|
383 |
- */ |
|
384 |
- encode(x: string): string; |
|
385 |
- /** |
|
386 |
- * @implementation |
|
387 |
- * @author fenris |
|
388 |
- */ |
|
389 |
- decode(x: string): string; |
|
390 |
- } |
|
391 |
-} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
This file is part of »bacterio-plankton:code«. |
3 | 3 |
|
4 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
4 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 | 5 |
<info@greenscale.de> |
6 | 6 |
|
7 | 7 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -20,7 +20,7 @@ along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/ |
20 | 20 |
/* |
21 | 21 |
This file is part of »bacterio-plankton:code«. |
22 | 22 |
|
23 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
23 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
24 | 24 |
<info@greenscale.de> |
25 | 25 |
|
26 | 26 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -88,7 +88,7 @@ var lib_code; |
88 | 88 |
/* |
89 | 89 |
This file is part of »bacterio-plankton:code«. |
90 | 90 |
|
91 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
91 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
92 | 92 |
<info@greenscale.de> |
93 | 93 |
|
94 | 94 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -124,7 +124,7 @@ var lib_code; |
124 | 124 |
/* |
125 | 125 |
This file is part of »bacterio-plankton:code«. |
126 | 126 |
|
127 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
127 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
128 | 128 |
<info@greenscale.de> |
129 | 129 |
|
130 | 130 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -173,7 +173,7 @@ var lib_code; |
173 | 173 |
/* |
174 | 174 |
This file is part of »bacterio-plankton:code«. |
175 | 175 |
|
176 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
176 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
177 | 177 |
<info@greenscale.de> |
178 | 178 |
|
179 | 179 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -209,7 +209,7 @@ var lib_code; |
209 | 209 |
/* |
210 | 210 |
This file is part of »bacterio-plankton:code«. |
211 | 211 |
|
212 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
212 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
213 | 213 |
<info@greenscale.de> |
214 | 214 |
|
215 | 215 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -249,7 +249,7 @@ var lib_code; |
249 | 249 |
/* |
250 | 250 |
This file is part of »bacterio-plankton:code«. |
251 | 251 |
|
252 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
252 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
253 | 253 |
<info@greenscale.de> |
254 | 254 |
|
255 | 255 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -297,7 +297,7 @@ var lib_code; |
297 | 297 |
/* |
298 | 298 |
This file is part of »bacterio-plankton:code«. |
299 | 299 |
|
300 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
300 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
301 | 301 |
<info@greenscale.de> |
302 | 302 |
|
303 | 303 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -337,7 +337,7 @@ var lib_code; |
337 | 337 |
/* |
338 | 338 |
This file is part of »bacterio-plankton:code«. |
339 | 339 |
|
340 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
340 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
341 | 341 |
<info@greenscale.de> |
342 | 342 |
|
343 | 343 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -377,7 +377,7 @@ var lib_code; |
377 | 377 |
/* |
378 | 378 |
This file is part of »bacterio-plankton:code«. |
379 | 379 |
|
380 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
380 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
381 | 381 |
<info@greenscale.de> |
382 | 382 |
|
383 | 383 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -426,7 +426,7 @@ var lib_code; |
426 | 426 |
/* |
427 | 427 |
This file is part of »bacterio-plankton:code«. |
428 | 428 |
|
429 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
429 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
430 | 430 |
<info@greenscale.de> |
431 | 431 |
|
432 | 432 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -473,7 +473,7 @@ var lib_code; |
473 | 473 |
/* |
474 | 474 |
This file is part of »bacterio-plankton:code«. |
475 | 475 |
|
476 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
476 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
477 | 477 |
<info@greenscale.de> |
478 | 478 |
|
479 | 479 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -521,7 +521,7 @@ var lib_code; |
521 | 521 |
/* |
522 | 522 |
This file is part of »bacterio-plankton:code«. |
523 | 523 |
|
524 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
524 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
525 | 525 |
<info@greenscale.de> |
526 | 526 |
|
527 | 527 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -577,7 +577,7 @@ var lib_code; |
577 | 577 |
/* |
578 | 578 |
This file is part of »bacterio-plankton:code«. |
579 | 579 |
|
580 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
580 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
581 | 581 |
<info@greenscale.de> |
582 | 582 |
|
583 | 583 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -624,7 +624,7 @@ var lib_code; |
624 | 624 |
/* |
625 | 625 |
This file is part of »bacterio-plankton:code«. |
626 | 626 |
|
627 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
627 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
628 | 628 |
<info@greenscale.de> |
629 | 629 |
|
630 | 630 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -681,7 +681,7 @@ var lib_code; |
681 | 681 |
/* |
682 | 682 |
This file is part of »bacterio-plankton:code«. |
683 | 683 |
|
684 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
684 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
685 | 685 |
<info@greenscale.de> |
686 | 686 |
|
687 | 687 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -721,7 +721,7 @@ var lib_code; |
721 | 721 |
/* |
722 | 722 |
This file is part of »bacterio-plankton:code«. |
723 | 723 |
|
724 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
724 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
725 | 725 |
<info@greenscale.de> |
726 | 726 |
|
727 | 727 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -768,130 +768,7 @@ var lib_code; |
768 | 768 |
/* |
769 | 769 |
This file is part of »bacterio-plankton:code«. |
770 | 770 |
|
771 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
772 |
-<info@greenscale.de> |
|
773 |
- |
|
774 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
775 |
-it under the terms of the GNU Lesser General Public License as published by |
|
776 |
-the Free Software Foundation, either version 3 of the License, or |
|
777 |
-(at your option) any later version. |
|
778 |
- |
|
779 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
780 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
781 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
782 |
-GNU Lesser General Public License for more details. |
|
783 |
- |
|
784 |
-You should have received a copy of the GNU Lesser General Public License |
|
785 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
786 |
- */ |
|
787 |
-var lib_code; |
|
788 |
-(function (lib_code) { |
|
789 |
- /** |
|
790 |
- * @author fenris |
|
791 |
- */ |
|
792 |
- function json_encode(x, formatted = false) { |
|
793 |
- return JSON.stringify(x, undefined, formatted ? "\t" : undefined); |
|
794 |
- } |
|
795 |
- lib_code.json_encode = json_encode; |
|
796 |
- /** |
|
797 |
- * @author fenris |
|
798 |
- */ |
|
799 |
- function json_decode(x) { |
|
800 |
- return JSON.parse(x); |
|
801 |
- } |
|
802 |
- lib_code.json_decode = json_decode; |
|
803 |
-})(lib_code || (lib_code = {})); |
|
804 |
-/* |
|
805 |
-This file is part of »bacterio-plankton:code«. |
|
806 |
- |
|
807 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
808 |
-<info@greenscale.de> |
|
809 |
- |
|
810 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
811 |
-it under the terms of the GNU Lesser General Public License as published by |
|
812 |
-the Free Software Foundation, either version 3 of the License, or |
|
813 |
-(at your option) any later version. |
|
814 |
- |
|
815 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
816 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
817 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
818 |
-GNU Lesser General Public License for more details. |
|
819 |
- |
|
820 |
-You should have received a copy of the GNU Lesser General Public License |
|
821 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
822 |
- */ |
|
823 |
-var lib_code; |
|
824 |
-(function (lib_code) { |
|
825 |
- /** |
|
826 |
- * @author fenris |
|
827 |
- */ |
|
828 |
- lib_trait.attend("code", "json", { |
|
829 |
- "from": { |
|
830 |
- "name": "any" |
|
831 |
- }, |
|
832 |
- "to": { |
|
833 |
- "name": "string" |
|
834 |
- } |
|
835 |
- }, { |
|
836 |
- "encode": () => (x) => { |
|
837 |
- return lib_code.json_encode(x); |
|
838 |
- }, |
|
839 |
- "decode": () => (y) => { |
|
840 |
- return lib_code.json_decode(y); |
|
841 |
- } |
|
842 |
- }); |
|
843 |
-})(lib_code || (lib_code = {})); |
|
844 |
-/* |
|
845 |
-This file is part of »bacterio-plankton:code«. |
|
846 |
- |
|
847 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
848 |
-<info@greenscale.de> |
|
849 |
- |
|
850 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
851 |
-it under the terms of the GNU Lesser General Public License as published by |
|
852 |
-the Free Software Foundation, either version 3 of the License, or |
|
853 |
-(at your option) any later version. |
|
854 |
- |
|
855 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
856 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
857 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
858 |
-GNU Lesser General Public License for more details. |
|
859 |
- |
|
860 |
-You should have received a copy of the GNU Lesser General Public License |
|
861 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
862 |
- */ |
|
863 |
-var lib_code; |
|
864 |
-(function (lib_code) { |
|
865 |
- /** |
|
866 |
- * @author fenris |
|
867 |
- */ |
|
868 |
- class class_code_json { |
|
869 |
- /** |
|
870 |
- * @author fenris |
|
871 |
- */ |
|
872 |
- constructor() { |
|
873 |
- } |
|
874 |
- /** |
|
875 |
- * @implementation |
|
876 |
- * @author fenris |
|
877 |
- */ |
|
878 |
- encode(x) { |
|
879 |
- return lib_code.json_encode(x); |
|
880 |
- } |
|
881 |
- /** |
|
882 |
- * @implementation |
|
883 |
- * @author fenris |
|
884 |
- */ |
|
885 |
- decode(x) { |
|
886 |
- return lib_code.json_decode(x); |
|
887 |
- } |
|
888 |
- } |
|
889 |
- lib_code.class_code_json = class_code_json; |
|
890 |
-})(lib_code || (lib_code = {})); |
|
891 |
-/* |
|
892 |
-This file is part of »bacterio-plankton:code«. |
|
893 |
- |
|
894 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
771 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
895 | 772 |
<info@greenscale.de> |
896 | 773 |
|
897 | 774 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -944,7 +821,7 @@ var lib_code; |
944 | 821 |
/* |
945 | 822 |
This file is part of »bacterio-plankton:code«. |
946 | 823 |
|
947 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
824 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
948 | 825 |
<info@greenscale.de> |
949 | 826 |
|
950 | 827 |
»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
... | ... |
@@ -988,249 +865,3 @@ var lib_code; |
988 | 865 |
} |
989 | 866 |
lib_code.class_code_csv = class_code_csv; |
990 | 867 |
})(lib_code || (lib_code = {})); |
991 |
-/* |
|
992 |
-This file is part of »bacterio-plankton:code«. |
|
993 |
- |
|
994 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
995 |
-<info@greenscale.de> |
|
996 |
- |
|
997 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
998 |
-it under the terms of the GNU Lesser General Public License as published by |
|
999 |
-the Free Software Foundation, either version 3 of the License, or |
|
1000 |
-(at your option) any later version. |
|
1001 |
- |
|
1002 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1003 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1004 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1005 |
-GNU Lesser General Public License for more details. |
|
1006 |
- |
|
1007 |
-You should have received a copy of the GNU Lesser General Public License |
|
1008 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1009 |
- */ |
|
1010 |
-var lib_code; |
|
1011 |
-(function (lib_code) { |
|
1012 |
- /** |
|
1013 |
- * @author fenris |
|
1014 |
- */ |
|
1015 |
- function uri_encode(x) { |
|
1016 |
- return encodeURIComponent(x); |
|
1017 |
- } |
|
1018 |
- lib_code.uri_encode = uri_encode; |
|
1019 |
- /** |
|
1020 |
- * @author fenris |
|
1021 |
- */ |
|
1022 |
- function uri_decode(x) { |
|
1023 |
- return decodeURIComponent(x); |
|
1024 |
- } |
|
1025 |
- lib_code.uri_decode = uri_decode; |
|
1026 |
-})(lib_code || (lib_code = {})); |
|
1027 |
-/* |
|
1028 |
-This file is part of »bacterio-plankton:code«. |
|
1029 |
- |
|
1030 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1031 |
-<info@greenscale.de> |
|
1032 |
- |
|
1033 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1034 |
-it under the terms of the GNU Lesser General Public License as published by |
|
1035 |
-the Free Software Foundation, either version 3 of the License, or |
|
1036 |
-(at your option) any later version. |
|
1037 |
- |
|
1038 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1039 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1040 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1041 |
-GNU Lesser General Public License for more details. |
|
1042 |
- |
|
1043 |
-You should have received a copy of the GNU Lesser General Public License |
|
1044 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1045 |
- */ |
|
1046 |
-var lib_code; |
|
1047 |
-(function (lib_code) { |
|
1048 |
- /** |
|
1049 |
- * @author fenris |
|
1050 |
- */ |
|
1051 |
- lib_trait.attend("code", "uri", { |
|
1052 |
- "from": { |
|
1053 |
- "name": "string" |
|
1054 |
- }, |
|
1055 |
- "to": { |
|
1056 |
- "name": "string" |
|
1057 |
- } |
|
1058 |
- }, { |
|
1059 |
- "encode": () => (x) => { |
|
1060 |
- return lib_code.uri_encode(x); |
|
1061 |
- }, |
|
1062 |
- "decode": () => (y) => { |
|
1063 |
- return lib_code.uri_decode(y); |
|
1064 |
- } |
|
1065 |
- }); |
|
1066 |
-})(lib_code || (lib_code = {})); |
|
1067 |
-/* |
|
1068 |
-This file is part of »bacterio-plankton:code«. |
|
1069 |
- |
|
1070 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1071 |
-<info@greenscale.de> |
|
1072 |
- |
|
1073 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1074 |
-it under the terms of the GNU Lesser General Public License as published by |
|
1075 |
-the Free Software Foundation, either version 3 of the License, or |
|
1076 |
-(at your option) any later version. |
|
1077 |
- |
|
1078 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1079 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1080 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1081 |
-GNU Lesser General Public License for more details. |
|
1082 |
- |
|
1083 |
-You should have received a copy of the GNU Lesser General Public License |
|
1084 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1085 |
- */ |
|
1086 |
-var lib_code; |
|
1087 |
-(function (lib_code) { |
|
1088 |
- /** |
|
1089 |
- * @author fenris |
|
1090 |
- */ |
|
1091 |
- class class_code_uri { |
|
1092 |
- /** |
|
1093 |
- * @author fenris |
|
1094 |
- */ |
|
1095 |
- constructor() { |
|
1096 |
- } |
|
1097 |
- /** |
|
1098 |
- * @implementation |
|
1099 |
- * @author fenris |
|
1100 |
- */ |
|
1101 |
- encode(x) { |
|
1102 |
- return lib_code.uri_encode(x); |
|
1103 |
- } |
|
1104 |
- /** |
|
1105 |
- * @implementation |
|
1106 |
- * @author fenris |
|
1107 |
- */ |
|
1108 |
- decode(x) { |
|
1109 |
- return lib_code.uri_decode(x); |
|
1110 |
- } |
|
1111 |
- } |
|
1112 |
- lib_code.class_code_uri = class_code_uri; |
|
1113 |
-})(lib_code || (lib_code = {})); |
|
1114 |
-/* |
|
1115 |
-This file is part of »bacterio-plankton:code«. |
|
1116 |
- |
|
1117 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1118 |
-<info@greenscale.de> |
|
1119 |
- |
|
1120 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1121 |
-it under the terms of the GNU Lesser General Public License as published by |
|
1122 |
-the Free Software Foundation, either version 3 of the License, or |
|
1123 |
-(at your option) any later version. |
|
1124 |
- |
|
1125 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1126 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1127 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1128 |
-GNU Lesser General Public License for more details. |
|
1129 |
- |
|
1130 |
-You should have received a copy of the GNU Lesser General Public License |
|
1131 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1132 |
- */ |
|
1133 |
-var lib_code; |
|
1134 |
-(function (lib_code) { |
|
1135 |
- /** |
|
1136 |
- * @author fenris |
|
1137 |
- */ |
|
1138 |
- function base64_encode(x) { |
|
1139 |
- return btoa(x); |
|
1140 |
- } |
|
1141 |
- lib_code.base64_encode = base64_encode; |
|
1142 |
- /** |
|
1143 |
- * @author fenris |
|
1144 |
- */ |
|
1145 |
- function base64_decode(x) { |
|
1146 |
- return atob(x); |
|
1147 |
- } |
|
1148 |
- lib_code.base64_decode = base64_decode; |
|
1149 |
-})(lib_code || (lib_code = {})); |
|
1150 |
-/* |
|
1151 |
-This file is part of »bacterio-plankton:code«. |
|
1152 |
- |
|
1153 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1154 |
-<info@greenscale.de> |
|
1155 |
- |
|
1156 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1157 |
-it under the terms of the GNU Lesser General Public License as published by |
|
1158 |
-the Free Software Foundation, either version 3 of the License, or |
|
1159 |
-(at your option) any later version. |
|
1160 |
- |
|
1161 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1162 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1163 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1164 |
-GNU Lesser General Public License for more details. |
|
1165 |
- |
|
1166 |
-You should have received a copy of the GNU Lesser General Public License |
|
1167 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1168 |
- */ |
|
1169 |
-var lib_code; |
|
1170 |
-(function (lib_code) { |
|
1171 |
- /** |
|
1172 |
- * @author fenris |
|
1173 |
- */ |
|
1174 |
- lib_trait.attend("code", "base64", { |
|
1175 |
- "from": { |
|
1176 |
- "name": "string" |
|
1177 |
- }, |
|
1178 |
- "to": { |
|
1179 |
- "name": "string" |
|
1180 |
- } |
|
1181 |
- }, { |
|
1182 |
- "encode": () => (x) => { |
|
1183 |
- return lib_code.base64_encode(x); |
|
1184 |
- }, |
|
1185 |
- "decode": () => (y) => { |
|
1186 |
- return lib_code.base64_decode(y); |
|
1187 |
- } |
|
1188 |
- }); |
|
1189 |
-})(lib_code || (lib_code = {})); |
|
1190 |
-/* |
|
1191 |
-This file is part of »bacterio-plankton:code«. |
|
1192 |
- |
|
1193 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1194 |
-<info@greenscale.de> |
|
1195 |
- |
|
1196 |
-»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1197 |
-it under the terms of the GNU Lesser General Public License as published by |
|
1198 |
-the Free Software Foundation, either version 3 of the License, or |
|
1199 |
-(at your option) any later version. |
|
1200 |
- |
|
1201 |
-»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1202 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1203 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1204 |
-GNU Lesser General Public License for more details. |
|
1205 |
- |
|
1206 |
-You should have received a copy of the GNU Lesser General Public License |
|
1207 |
-along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1208 |
- */ |
|
1209 |
-var lib_code; |
|
1210 |
-(function (lib_code) { |
|
1211 |
- /** |
|
1212 |
- * @author fenris |
|
1213 |
- */ |
|
1214 |
- class class_code_base64 { |
|
1215 |
- /** |
|
1216 |
- * @author fenris |
|
1217 |
- */ |
|
1218 |
- constructor() { |
|
1219 |
- } |
|
1220 |
- /** |
|
1221 |
- * @implementation |
|
1222 |
- * @author fenris |
|
1223 |
- */ |
|
1224 |
- encode(x) { |
|
1225 |
- return lib_code.base64_encode(x); |
|
1226 |
- } |
|
1227 |
- /** |
|
1228 |
- * @implementation |
|
1229 |
- * @author fenris |
|
1230 |
- */ |
|
1231 |
- decode(x) { |
|
1232 |
- return lib_code.base64_decode(x); |
|
1233 |
- } |
|
1234 |
- } |
|
1235 |
- lib_code.class_code_base64 = class_code_base64; |
|
1236 |
-})(lib_code || (lib_code = {})); |
... | ... |
@@ -1,163 +0,0 @@ |
1 |
-declare module lib_comm { |
|
2 |
-} |
|
3 |
-declare module lib_comm { |
|
4 |
- /** |
|
5 |
- * @author fenris |
|
6 |
- */ |
|
7 |
- interface interface_client<type_message_out, type_message_in> { |
|
8 |
- /** |
|
9 |
- * @desc prepare the client to a point where sending messages can be done without any more preparation |
|
10 |
- * @author fenris |
|
11 |
- */ |
|
12 |
- setup(): lib_call.type_promise<void, Error>; |
|
13 |
- /** |
|
14 |
- * @desc send a message |
|
15 |
- * @author fenris |
|
16 |
- */ |
|
17 |
- send(message: type_message_out): lib_call.type_promise<type_message_in, Error>; |
|
18 |
- } |
|
19 |
-} |
|
20 |
-declare module lib_comm { |
|
21 |
- /** |
|
22 |
- * @author fenris |
|
23 |
- */ |
|
24 |
- type type_response_client_http = { |
|
25 |
- code: int; |
|
26 |
- text: string; |
|
27 |
- }; |
|
28 |
- /** |
|
29 |
- * @author fenris |
|
30 |
- */ |
|
31 |
- type type_parameters_client_http = { |
|
32 |
- protocol?: string; |
|
33 |
- host?: string; |
|
34 |
- port?: int; |
|
35 |
- path?: string; |
|
36 |
- omit_protocol?: boolean; |
|
37 |
- content_type?: string; |
|
38 |
- with_credentials?: boolean; |
|
39 |
- }; |
|
40 |
- /** |
|
41 |
- * @author fenris |
|
42 |
- */ |
|
43 |
- var default_parameters_client_http: type_parameters_client_http; |
|
44 |
-} |
|
45 |
-declare module lib_comm { |
|
46 |
- /** |
|
47 |
- * @author fenris |
|
48 |
- */ |
|
49 |
- type type_client_http = { |
|
50 |
- parameters: type_parameters_client_http; |
|
51 |
- method: string; |
|
52 |
- headers: { |
|
53 |
- [key: string]: string; |
|
54 |
- }; |
|
55 |
- }; |
|
56 |
- /** |
|
57 |
- * @author fenris |
|
58 |
- */ |
|
59 |
- function client_http_construct(parameters?: type_parameters_client_http, method?: string, headers?: { |
|
60 |
- [key: string]: string; |
|
61 |
- }): type_client_http; |
|
62 |
- /** |
|
63 |
- * @author fenris |
|
64 |
- */ |
|
65 |
- function client_http_setup(subject: type_client_http): lib_call.type_promise<void, Error>; |
|
66 |
- /** |
|
67 |
- * @author fenris |
|
68 |
- */ |
|
69 |
- function client_http_send(subject: type_client_http, message: string): lib_call.type_promise<type_response_client_http, Error>; |
|
70 |
- /** |
|
71 |
- * @author Martin Springwald <springwald@greenscale.de> |
|
72 |
- * @author Christian Neubauer <neubauer@greenscale.de> |
|
73 |
- * @author Christian Fraß <frass@greenscale.de> |
|
74 |
- */ |
|
75 |
- function http_get_blob({ "url": url, "mime": type }: { |
|
76 |
- url: string; |
|
77 |
- mime: string; |
|
78 |
- }): lib_call.type_promise<Blob, void>; |
|
79 |
-} |
|
80 |
-declare module lib_comm { |
|
81 |
-} |
|
82 |
-declare module lib_comm { |
|
83 |
- /** |
|
84 |
- * @author fenris |
|
85 |
- */ |
|
86 |
- class class_client_http implements interface_client<string, type_response_client_http> { |
|
87 |
- /** |
|
88 |
- * @author fenris |
|
89 |
- */ |
|
90 |
- protected subject: type_client_http; |
|
91 |
- /** |
|
92 |
- * @author fenris |
|
93 |
- */ |
|
94 |
- constructor(parameters?: type_parameters_client_http, method?: string, headers?: { |
|
95 |
- [key: string]: string; |
|
96 |
- }); |
|
97 |
- /** |
|
98 |
- * @author fenris |
|
99 |
- * @implementation |
|
100 |
- */ |
|
101 |
- setup(): lib_call.type_promise<void, Error>; |
|
102 |
- /** |
|
103 |
- * @author fenris |
|
104 |
- * @implementation |
|
105 |
- */ |
|
106 |
- send(message: string): lib_call.type_promise<type_response_client_http, Error>; |
|
107 |
- } |
|
108 |
-} |
|
109 |
-declare module lib_comm { |
|
110 |
- /** |
|
111 |
- * @author fenris |
|
112 |
- */ |
|
113 |
- class class_client_mhttp implements interface_client<string, string> { |
|
114 |
- /** |
|
115 |
- * @author fenris |
|
116 |
- */ |
|
117 |
- protected core: class_client_http; |
|
118 |
- /** |
|
119 |
- * @author fenris |
|
120 |
- */ |
|
121 |
- constructor(parameters?: type_parameters_client_http); |
|
122 |
- /** |
|
123 |
- * @author fenris |
|
124 |
- * @implementation |
|
125 |
- */ |
|
126 |
- setup(): lib_call.type_promise<void, Error>; |
|
127 |
- /** |
|
128 |
- * @author fenris |
|
129 |
- * @implementation |
|
130 |
- */ |
|
131 |
- send(message: string): lib_call.type_promise<string, Error>; |
|
132 |
- } |
|
133 |
-} |
|
134 |
-declare module lib_comm { |
|
135 |
- /** |
|
136 |
- * @desc wrapper for string-based clients |
|
137 |
- * @author fenris |
|
138 |
- */ |
|
139 |
- class class_client_complex implements interface_client<any, any> { |
|
140 |
- /** |
|
141 |
- * @author fenris |
|
142 |
- */ |
|
143 |
- protected core: interface_client<string, string>; |
|
144 |
- /** |
|
145 |
- * @author fenris |
|
146 |
- */ |
|
147 |
- protected code: lib_code.interface_code<any, string>; |
|
148 |
- /** |
|
149 |
- * @author fenris |
|
150 |
- */ |
|
151 |
- constructor(core: interface_client<string, string>, code?: lib_code.interface_code<any, string>); |
|
152 |
- /** |
|
153 |
- * @author fenris |
|
154 |
- * @implementation |
|
155 |
- */ |
|
156 |
- setup(): lib_call.type_promise<void, Error>; |
|
157 |
- /** |
|
158 |
- * @author fenris |
|
159 |
- * @implementation |
|
160 |
- */ |
|
161 |
- send(message: any): lib_call.type_promise<any, Error>; |
|
162 |
- } |
|
163 |
-} |
... | ... |
@@ -1,478 +0,0 @@ |
1 |
-/* |
|
2 |
-This file is part of »bacterio-plankton:comm-client«. |
|
3 |
- |
|
4 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
-<info@greenscale.de> |
|
6 |
- |
|
7 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
8 |
-it under the terms of the GNU Lesser General Public License as published by |
|
9 |
-the Free Software Foundation, either version 3 of the License, or |
|
10 |
-(at your option) any later version. |
|
11 |
- |
|
12 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
13 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
-GNU Lesser General Public License for more details. |
|
16 |
- |
|
17 |
-You should have received a copy of the GNU Lesser General Public License |
|
18 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
- */ |
|
20 |
-var lib_comm; |
|
21 |
-(function (lib_comm) { |
|
22 |
- /** |
|
23 |
- * @author fenris |
|
24 |
- */ |
|
25 |
- lib_trait.define("comm-client", { |
|
26 |
- "state": null, |
|
27 |
- "message_in": null, |
|
28 |
- "message_out": null |
|
29 |
- }, { |
|
30 |
- "setup": { |
|
31 |
- "shape": { |
|
32 |
- "name": "function", |
|
33 |
- "parameters": { |
|
34 |
- "shape_input": { |
|
35 |
- "name": "variable", |
|
36 |
- "parameters": { |
|
37 |
- "name": "state" |
|
38 |
- } |
|
39 |
- }, |
|
40 |
- "shape_output": { |
|
41 |
- "name": "promise", |
|
42 |
- "parameters": { |
|
43 |
- "shape_result": { |
|
44 |
- "name": "variable", |
|
45 |
- "parameters": { |
|
46 |
- "name": "state" |
|
47 |
- } |
|
48 |
- }, |
|
49 |
- "shape_reason": { |
|
50 |
- "name": "any" |
|
51 |
- } |
|
52 |
- } |
|
53 |
- } |
|
54 |
- } |
|
55 |
- } |
|
56 |
- }, |
|
57 |
- "send": { |
|
58 |
- "shape": { |
|
59 |
- "name": "function", |
|
60 |
- "parameters": { |
|
61 |
- "shape_input": { |
|
62 |
- "name": "variable", |
|
63 |
- "parameters": { |
|
64 |
- "name": "state" |
|
65 |
- } |
|
66 |
- }, |
|
67 |
- "shape_output": { |
|
68 |
- "name": "function", |
|
69 |
- "parameters": { |
|
70 |
- "shape_input": { |
|
71 |
- "name": "variable", |
|
72 |
- "parameters": { |
|
73 |
- "name": "message_out" |
|
74 |
- } |
|
75 |
- }, |
|
76 |
- "shape_output": { |
|
77 |
- "name": "promise", |
|
78 |
- "parameters": { |
|
79 |
- "shape_result": { |
|
80 |
- "name": "variable", |
|
81 |
- "parameters": { |
|
82 |
- "name": "message_in" |
|
83 |
- } |
|
84 |
- }, |
|
85 |
- "shape_reason": { |
|
86 |
- "name": "any" |
|
87 |
- } |
|
88 |
- } |
|
89 |
- } |
|
90 |
- } |
|
91 |
- } |
|
92 |
- } |
|
93 |
- } |
|
94 |
- } |
|
95 |
- }); |
|
96 |
-})(lib_comm || (lib_comm = {})); |
|
97 |
-/* |
|
98 |
-This file is part of »bacterio-plankton:comm-client«. |
|
99 |
- |
|
100 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
101 |
-<info@greenscale.de> |
|
102 |
- |
|
103 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
104 |
-it under the terms of the GNU Lesser General Public License as published by |
|
105 |
-the Free Software Foundation, either version 3 of the License, or |
|
106 |
-(at your option) any later version. |
|
107 |
- |
|
108 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
109 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
110 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
111 |
-GNU Lesser General Public License for more details. |
|
112 |
- |
|
113 |
-You should have received a copy of the GNU Lesser General Public License |
|
114 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
115 |
- */ |
|
116 |
-/* |
|
117 |
-This file is part of »bacterio-plankton:comm-client«. |
|
118 |
- |
|
119 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
120 |
-<info@greenscale.de> |
|
121 |
- |
|
122 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
123 |
-it under the terms of the GNU Lesser General Public License as published by |
|
124 |
-the Free Software Foundation, either version 3 of the License, or |
|
125 |
-(at your option) any later version. |
|
126 |
- |
|
127 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
128 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
129 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
130 |
-GNU Lesser General Public License for more details. |
|
131 |
- |
|
132 |
-You should have received a copy of the GNU Lesser General Public License |
|
133 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
134 |
- */ |
|
135 |
-var lib_comm; |
|
136 |
-(function (lib_comm) { |
|
137 |
- /** |
|
138 |
- * @author fenris |
|
139 |
- */ |
|
140 |
- lib_comm.default_parameters_client_http = { |
|
141 |
- "protocol": "http", |
|
142 |
- "host": null, |
|
143 |
- "port": null, |
|
144 |
- "path": null, |
|
145 |
- "omit_protocol": false, |
|
146 |
- "content_type": "plain/text; charset=utf-8", |
|
147 |
- "with_credentials": false, |
|
148 |
- }; |
|
149 |
-})(lib_comm || (lib_comm = {})); |
|
150 |
-/* |
|
151 |
-This file is part of »bacterio-plankton:comm-client«. |
|
152 |
- |
|
153 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
154 |
-<info@greenscale.de> |
|
155 |
- |
|
156 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
157 |
-it under the terms of the GNU Lesser General Public License as published by |
|
158 |
-the Free Software Foundation, either version 3 of the License, or |
|
159 |
-(at your option) any later version. |
|
160 |
- |
|
161 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
162 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
163 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
164 |
-GNU Lesser General Public License for more details. |
|
165 |
- |
|
166 |
-You should have received a copy of the GNU Lesser General Public License |
|
167 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
168 |
- */ |
|
169 |
-var lib_comm; |
|
170 |
-(function (lib_comm) { |
|
171 |
- /** |
|
172 |
- * @author fenris |
|
173 |
- */ |
|
174 |
- function client_http_construct(parameters = {}, method = "POST", headers = {}) { |
|
175 |
- return { |
|
176 |
- "parameters": lib_object.patched(lib_comm.default_parameters_client_http, parameters), |
|
177 |
- "method": method.toLowerCase(), |
|
178 |
- "headers": headers, |
|
179 |
- }; |
|
180 |
- } |
|
181 |
- lib_comm.client_http_construct = client_http_construct; |
|
182 |
- /** |
|
183 |
- * @author fenris |
|
184 |
- */ |
|
185 |
- function client_http_setup(subject) { |
|
186 |
- return (lib_call.promise_resolve(undefined)); |
|
187 |
- } |
|
188 |
- lib_comm.client_http_setup = client_http_setup; |
|
189 |
- /** |
|
190 |
- * @author fenris |
|
191 |
- */ |
|
192 |
- function client_http_send(subject, message) { |
|
193 |
- return (lib_call.promise_make((resolve, reject) => { |
|
194 |
- if ((subject.method === "get") && (message !== null)) { |
|
195 |
- let message_ = "can not send data via GET"; |
|
196 |
- reject(new Error(message_)); |
|
197 |
- } |
|
198 |
- else { |
|
199 |
- let request = new XMLHttpRequest(); |
|
200 |
- let url = lib_string.make_url({ |
|
201 |
- "protocol": (subject.parameters.omit_protocol ? null : subject.parameters.protocol), |
|
202 |
- "host": subject.parameters.host, |
|
203 |
- "port": subject.parameters.port, |
|
204 |
- "path": subject.parameters.path, |
|
205 |
- }); |
|
206 |
- request.open(subject.method.toUpperCase(), url, true); |
|
207 |
- lib_object.to_array(subject.headers).forEach(({ "key": key, "value": value }) => { |
|
208 |
- request.setRequestHeader(key, value); |
|
209 |
- }); |
|
210 |
- request.setRequestHeader("Content-Type", subject.parameters.content_type); |
|
211 |
- if (subject.parameters.with_credentials) { |
|
212 |
- request.withCredentials = true; |
|
213 |
- } |
|
214 |
- /* |
|
215 |
- request.onerror = () => { |
|
216 |
- debugger; |
|
217 |
- reject(new Error("unhandled error")); |
|
218 |
- }; |
|
219 |
- */ |
|
220 |
- request.onreadystatechange = () => { |
|
221 |
- switch (request.readyState) { |
|
222 |
- case XMLHttpRequest.DONE: { |
|
223 |
- switch (request.status) { |
|
224 |
- case 0: { |
|
225 |
- reject(new Error("XMLHttpRequest failed")); |
|
226 |
- break; |
|
227 |
- } |
|
228 |
- default: { |
|
229 |
- let answer = { "code": request.status, "text": request.responseText }; |
|
230 |
- resolve(answer); |
|
231 |
- break; |
|
232 |
- } |
|
233 |
- } |
|
234 |
- break; |
|
235 |
- } |
|
236 |
- default: { |
|
237 |
- // console.warn(`unhandled readyState ${request.readyState}`); |
|
238 |
- break; |
|
239 |
- } |
|
240 |
- } |
|
241 |
- }; |
|
242 |
- request.send(message); |
|
243 |
- } |
|
244 |
- })); |
|
245 |
- } |
|
246 |
- lib_comm.client_http_send = client_http_send; |
|
247 |
- /** |
|
248 |
- * @author Martin Springwald <springwald@greenscale.de> |
|
249 |
- * @author Christian Neubauer <neubauer@greenscale.de> |
|
250 |
- * @author Christian Fraß <frass@greenscale.de> |
|
251 |
- */ |
|
252 |
- function http_get_blob({ "url": url, "mime": type }) { |
|
253 |
- let request = new XMLHttpRequest(); |
|
254 |
- return new Promise((resolve, reject) => { |
|
255 |
- request.open("GET", url, true); |
|
256 |
- request.responseType = "arraybuffer"; |
|
257 |
- request.onload = function () { |
|
258 |
- if (request.status === 200) { |
|
259 |
- resolve(new Blob([request.response], { "type": type })); |
|
260 |
- } |
|
261 |
- else { |
|
262 |
- reject(new Error("error on blob-load")); |
|
263 |
- } |
|
264 |
- }; |
|
265 |
- request.onerror = function () { |
|
266 |
- reject(undefined); |
|
267 |
- }; |
|
268 |
- request.send(); |
|
269 |
- }); |
|
270 |
- } |
|
271 |
- lib_comm.http_get_blob = http_get_blob; |
|
272 |
-})(lib_comm || (lib_comm = {})); |
|
273 |
-/* |
|
274 |
-This file is part of »bacterio-plankton:comm-client«. |
|
275 |
- |
|
276 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
277 |
-<info@greenscale.de> |
|
278 |
- |
|
279 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
280 |
-it under the terms of the GNU Lesser General Public License as published by |
|
281 |
-the Free Software Foundation, either version 3 of the License, or |
|
282 |
-(at your option) any later version. |
|
283 |
- |
|
284 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
285 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
286 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
287 |
-GNU Lesser General Public License for more details. |
|
288 |
- |
|
289 |
-You should have received a copy of the GNU Lesser General Public License |
|
290 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
291 |
- */ |
|
292 |
-var lib_comm; |
|
293 |
-(function (lib_comm) { |
|
294 |
- /** |
|
295 |
- * @author fenris |
|
296 |
- */ |
|
297 |
- lib_trait.attend("comm-client", "http", { |
|
298 |
- "state": { |
|
299 |
- "name": "any" |
|
300 |
- }, |
|
301 |
- "message_in": { |
|
302 |
- "name": "string" |
|
303 |
- }, |
|
304 |
- "message_out": { |
|
305 |
- "name": "any" // type_response_http |
|
306 |
- } |
|
307 |
- }, { |
|
308 |
- "setup": () => (state) => { |
|
309 |
- return lib_comm.client_http_setup(state).then(_ => lib_call.promise_resolve(state)); |
|
310 |
- }, |
|
311 |
- "send": () => (state) => (message) => { |
|
312 |
- return lib_comm.client_http_send(state, message); |
|
313 |
- } |
|
314 |
- }); |
|
315 |
-})(lib_comm || (lib_comm = {})); |
|
316 |
-/* |
|
317 |
-This file is part of »bacterio-plankton:comm-client«. |
|
318 |
- |
|
319 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
320 |
-<info@greenscale.de> |
|
321 |
- |
|
322 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
323 |
-it under the terms of the GNU Lesser General Public License as published by |
|
324 |
-the Free Software Foundation, either version 3 of the License, or |
|
325 |
-(at your option) any later version. |
|
326 |
- |
|
327 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
328 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
329 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
330 |
-GNU Lesser General Public License for more details. |
|
331 |
- |
|
332 |
-You should have received a copy of the GNU Lesser General Public License |
|
333 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
334 |
- */ |
|
335 |
-var lib_comm; |
|
336 |
-(function (lib_comm) { |
|
337 |
- /** |
|
338 |
- * @author fenris |
|
339 |
- */ |
|
340 |
- class class_client_http { |
|
341 |
- /** |
|
342 |
- * @author fenris |
|
343 |
- */ |
|
344 |
- constructor(parameters = lib_comm.default_parameters_client_http, method = "POST", headers = {}) { |
|
345 |
- this.subject = lib_comm.client_http_construct(parameters, method, headers); |
|
346 |
- } |
|
347 |
- /** |
|
348 |
- * @author fenris |
|
349 |
- * @implementation |
|
350 |
- */ |
|
351 |
- setup() { |
|
352 |
- return lib_comm.client_http_setup(this.subject); |
|
353 |
- } |
|
354 |
- /** |
|
355 |
- * @author fenris |
|
356 |
- * @implementation |
|
357 |
- */ |
|
358 |
- send(message) { |
|
359 |
- return lib_comm.client_http_send(this.subject, message); |
|
360 |
- } |
|
361 |
- } |
|
362 |
- lib_comm.class_client_http = class_client_http; |
|
363 |
-})(lib_comm || (lib_comm = {})); |
|
364 |
-/* |
|
365 |
-This file is part of »bacterio-plankton:comm-client«. |
|
366 |
- |
|
367 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
368 |
-<info@greenscale.de> |
|
369 |
- |
|
370 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
371 |
-it under the terms of the GNU Lesser General Public License as published by |
|
372 |
-the Free Software Foundation, either version 3 of the License, or |
|
373 |
-(at your option) any later version. |
|
374 |
- |
|
375 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
376 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
377 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
378 |
-GNU Lesser General Public License for more details. |
|
379 |
- |
|
380 |
-You should have received a copy of the GNU Lesser General Public License |
|
381 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
382 |
- */ |
|
383 |
-var lib_comm; |
|
384 |
-(function (lib_comm) { |
|
385 |
- /** |
|
386 |
- * @author fenris |
|
387 |
- */ |
|
388 |
- class class_client_mhttp { |
|
389 |
- /** |
|
390 |
- * @author fenris |
|
391 |
- */ |
|
392 |
- constructor(parameters = lib_comm.default_parameters_client_http) { |
|
393 |
- this.core = new lib_comm.class_client_http(parameters); |
|
394 |
- } |
|
395 |
- /** |
|
396 |
- * @author fenris |
|
397 |
- * @implementation |
|
398 |
- */ |
|
399 |
- setup() { |
|
400 |
- return this.core.setup(); |
|
401 |
- } |
|
402 |
- /** |
|
403 |
- * @author fenris |
|
404 |
- * @implementation |
|
405 |
- */ |
|
406 |
- send(message) { |
|
407 |
- return (this.core.send(message) |
|
408 |
- .then((answer) => { |
|
409 |
- switch (answer.code) { |
|
410 |
- case 200: { |
|
411 |
- return lib_call.promise_resolve(answer.text /*.toString()*/); |
|
412 |
- break; |
|
413 |
- } |
|
414 |
- default: { |
|
415 |
- return lib_call.promise_reject(new Error(`XMLHttpRequest failed; status was ${answer.code.toFixed(0)}`)); |
|
416 |
- break; |
|
417 |
- } |
|
418 |
- } |
|
419 |
- })); |
|
420 |
- } |
|
421 |
- } |
|
422 |
- lib_comm.class_client_mhttp = class_client_mhttp; |
|
423 |
-})(lib_comm || (lib_comm = {})); |
|
424 |
-/* |
|
425 |
-This file is part of »bacterio-plankton:comm-client«. |
|
426 |
- |
|
427 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
428 |
-<info@greenscale.de> |
|
429 |
- |
|
430 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
431 |
-it under the terms of the GNU Lesser General Public License as published by |
|
432 |
-the Free Software Foundation, either version 3 of the License, or |
|
433 |
-(at your option) any later version. |
|
434 |
- |
|
435 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
436 |
-but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
437 |
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
438 |
-GNU Lesser General Public License for more details. |
|
439 |
- |
|
440 |
-You should have received a copy of the GNU Lesser General Public License |
|
441 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
442 |
- */ |
|
443 |
-var lib_comm; |
|
444 |
-(function (lib_comm) { |
|
445 |
- /** |
|
446 |
- * @desc wrapper for string-based clients |
|
447 |
- * @author fenris |
|
448 |
- */ |
|
449 |
- class class_client_complex { |
|
450 |
- /** |
|
451 |
- * @author fenris |
|
452 |
- */ |
|
453 |
- constructor(core, code = new lib_code.class_code_pair(new lib_code.class_code_json(), new lib_code.class_code_uri())) { |
|
454 |
- this.core = core; |
|
455 |
- this.code = code; |
|
456 |
- } |
|
457 |
- /** |
|
458 |
- * @author fenris |
|
459 |
- * @implementation |
|
460 |
- */ |
|
461 |
- setup() { |
|
462 |
- return this.core.setup(); |
|
463 |
- } |
|
464 |
- /** |
|
465 |
- * @author fenris |
|
466 |
- * @implementation |
|
467 |
- */ |
|
468 |
- send(message) { |
|
469 |
- const message_out_raw = this.code.encode(message); |
|
470 |
- return (this.core.send(message_out_raw) |
|
471 |
- .then((message_in_raw) => { |
|
472 |
- const message_in = this.code.decode(message_in_raw); |
|
473 |
- return lib_call.promise_resolve(message_in); |
|
474 |
- })); |
|
475 |
- } |
|
476 |
- } |
|
477 |
- lib_comm.class_client_complex = class_client_complex; |
|
478 |
-})(lib_comm || (lib_comm = {})); |
... | ... |
@@ -1,18 +1,18 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 |
-»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
4 |
+»bacterio-plankton:json« is free software: you can redistribute it and/or modify |
|
5 | 5 |
it under the terms of the GNU Lesser General Public License as published by |
6 | 6 |
the Free Software Foundation, either version 3 of the License, or |
7 | 7 |
(at your option) any later version. |
8 | 8 |
|
9 |
-»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
9 |
+»bacterio-plankton:json« is distributed in the hope that it will be useful, |
|
10 | 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | 12 |
GNU Lesser General Public License for more details. |
13 | 13 |
|
14 | 14 |
You should have received a copy of the GNU Lesser General Public License |
15 |
-along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
15 |
+along with »bacterio-plankton:json«. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 |
|
17 | 17 |
|
18 | 18 |
|
... | ... |
@@ -0,0 +1,33 @@ |
1 |
+declare module lib_json { |
|
2 |
+ /** |
|
3 |
+ * @author fenris |
|
4 |
+ */ |
|
5 |
+ function encode(x: any, formatted?: boolean): string; |
|
6 |
+ /** |
|
7 |
+ * @author fenris |
|
8 |
+ */ |
|
9 |
+ function decode(x: string): any; |
|
10 |
+} |
|
11 |
+declare module lib_json { |
|
12 |
+} |
|
13 |
+declare module lib_json { |
|
14 |
+ /** |
|
15 |
+ * @author fenris |
|
16 |
+ */ |
|
17 |
+ class class_json implements lib_code.interface_code<any, string> { |
|
18 |
+ /** |
|
19 |
+ * @author fenris |
|
20 |
+ */ |
|
21 |
+ constructor(); |
|
22 |
+ /** |
|
23 |
+ * @implementation |
|
24 |
+ * @author fenris |
|
25 |
+ */ |
|
26 |
+ encode(x: any): string; |
|
27 |
+ /** |
|
28 |
+ * @implementation |
|
29 |
+ * @author fenris |
|
30 |
+ */ |
|
31 |
+ decode(x: string): any; |
|
32 |
+ } |
|
33 |
+} |
... | ... |
@@ -0,0 +1,123 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:json«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:json« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:json« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:json«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+var lib_json; |
|
21 |
+(function (lib_json) { |
|
22 |
+ /** |
|
23 |
+ * @author fenris |
|
24 |
+ */ |
|
25 |
+ function encode(x, formatted = false) { |
|
26 |
+ return JSON.stringify(x, undefined, formatted ? "\t" : undefined); |
|
27 |
+ } |
|
28 |
+ lib_json.encode = encode; |
|
29 |
+ /** |
|
30 |
+ * @author fenris |
|
31 |
+ */ |
|
32 |
+ function decode(x) { |
|
33 |
+ return JSON.parse(x); |
|
34 |
+ } |
|
35 |
+ lib_json.decode = decode; |
|
36 |
+})(lib_json || (lib_json = {})); |
|
37 |
+/* |
|
38 |
+This file is part of »bacterio-plankton:json«. |
|
39 |
+ |
|
40 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
41 |
+<info@greenscale.de> |
|
42 |
+ |
|
43 |
+»bacterio-plankton:json« is free software: you can redistribute it and/or modify |
|
44 |
+it under the terms of the GNU Lesser General Public License as published by |
|
45 |
+the Free Software Foundation, either version 3 of the License, or |
|
46 |
+(at your option) any later version. |
|
47 |
+ |
|
48 |
+»bacterio-plankton:json« is distributed in the hope that it will be useful, |
|
49 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
50 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
51 |
+GNU Lesser General Public License for more details. |
|
52 |
+ |
|
53 |
+You should have received a copy of the GNU Lesser General Public License |
|
54 |
+along with »bacterio-plankton:json«. If not, see <http://www.gnu.org/licenses/>. |
|
55 |
+ */ |
|
56 |
+var lib_json; |
|
57 |
+(function (lib_json) { |
|
58 |
+ /** |
|
59 |
+ * @author fenris |
|
60 |
+ */ |
|
61 |
+ lib_trait.attend("code", "json", { |
|
62 |
+ "from": { |
|
63 |
+ "name": "any" |
|
64 |
+ }, |
|
65 |
+ "to": { |
|
66 |
+ "name": "string" |
|
67 |
+ } |
|
68 |
+ }, { |
|
69 |
+ "encode": () => (x) => { |
|
70 |
+ return lib_json.encode(x); |
|
71 |
+ }, |
|
72 |
+ "decode": () => (y) => { |
|
73 |
+ return lib_json.decode(y); |
|
74 |
+ } |
|
75 |
+ }); |
|
76 |
+})(lib_json || (lib_json = {})); |
|
77 |
+/* |
|
78 |
+This file is part of »bacterio-plankton:json«. |
|
79 |
+ |
|
80 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
81 |
+<info@greenscale.de> |
|
82 |
+ |
|
83 |
+»bacterio-plankton:json« is free software: you can redistribute it and/or modify |
|
84 |
+it under the terms of the GNU Lesser General Public License as published by |
|
85 |
+the Free Software Foundation, either version 3 of the License, or |
|
86 |
+(at your option) any later version. |
|
87 |
+ |
|
88 |
+»bacterio-plankton:json« is distributed in the hope that it will be useful, |
|
89 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
91 |
+GNU Lesser General Public License for more details. |
|
92 |
+ |
|
93 |
+You should have received a copy of the GNU Lesser General Public License |
|
94 |
+along with »bacterio-plankton:json«. If not, see <http://www.gnu.org/licenses/>. |
|
95 |
+ */ |
|
96 |
+var lib_json; |
|
97 |
+(function (lib_json) { |
|
98 |
+ /** |
|
99 |
+ * @author fenris |
|
100 |
+ */ |
|
101 |
+ class class_json { |
|
102 |
+ /** |
|
103 |
+ * @author fenris |
|
104 |
+ */ |
|
105 |
+ constructor() { |
|
106 |
+ } |
|
107 |
+ /** |
|
108 |
+ * @implementation |
|
109 |
+ * @author fenris |
|
110 |
+ */ |
|
111 |
+ encode(x) { |
|
112 |
+ return lib_json.encode(x); |
|
113 |
+ } |
|
114 |
+ /** |
|
115 |
+ * @implementation |
|
116 |
+ * @author fenris |
|
117 |
+ */ |
|
118 |
+ decode(x) { |
|
119 |
+ return lib_json.decode(x); |
|
120 |
+ } |
|
121 |
+ } |
|
122 |
+ lib_json.class_json = class_json; |
|
123 |
+})(lib_json || (lib_json = {})); |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 | 4 |
»bacterio-plankton:object« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
This file is part of »bacterio-plankton:object«. |
3 | 3 |
|
4 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
4 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 | 5 |
<info@greenscale.de> |
6 | 6 |
|
7 | 7 |
»bacterio-plankton:object« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1,22 +1,22 @@ |
1 | 1 |
{ |
2 | 2 |
"logic-decl": [ |
3 | 3 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./base/logic-decl.d.ts", |
4 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./object/logic-decl.d.ts", |
|
4 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./string/logic-decl.d.ts", |
|
5 | 5 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./shape/logic-decl.d.ts", |
6 | 6 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./trait/logic-decl.d.ts", |
7 | 7 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./code/logic-decl.d.ts", |
8 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./string/logic-decl.d.ts", |
|
9 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./call/logic-decl.d.ts", |
|
10 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./comm-client/logic-decl.d.ts" |
|
8 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./json/logic-decl.d.ts", |
|
9 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./object/logic-decl.d.ts", |
|
10 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./url/logic-decl.d.ts" |
|
11 | 11 |
], |
12 | 12 |
"logic-impl": [ |
13 | 13 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./base/logic-impl.js", |
14 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./object/logic-impl.js", |
|
14 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./string/logic-impl.js", |
|
15 | 15 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./shape/logic-impl.js", |
16 | 16 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./trait/logic-impl.js", |
17 | 17 |
"/home/fenris/projekte/folksprak/words/client/lib/plankton/./code/logic-impl.js", |
18 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./string/logic-impl.js", |
|
19 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./call/logic-impl.js", |
|
20 |
- "/home/fenris/projekte/folksprak/words/client/lib/plankton/./comm-client/logic-impl.js" |
|
18 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./json/logic-impl.js", |
|
19 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./object/logic-impl.js", |
|
20 |
+ "/home/fenris/projekte/folksprak/words/client/lib/plankton/./url/logic-impl.js" |
|
21 | 21 |
] |
22 | 22 |
} |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 | 4 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
This file is part of »bacterio-plankton:shape«. |
3 | 3 |
|
4 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
4 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 | 5 |
<info@greenscale.de> |
6 | 6 |
|
7 | 7 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -191,7 +191,7 @@ var lib_shape; |
191 | 191 |
/* |
192 | 192 |
This file is part of »bacterio-plankton:shape«. |
193 | 193 |
|
194 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
194 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
195 | 195 |
<info@greenscale.de> |
196 | 196 |
|
197 | 197 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -272,7 +272,7 @@ var lib_shape; |
272 | 272 |
/* |
273 | 273 |
This file is part of »bacterio-plankton:shape«. |
274 | 274 |
|
275 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
275 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
276 | 276 |
<info@greenscale.de> |
277 | 277 |
|
278 | 278 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -399,7 +399,7 @@ var lib_shape; |
399 | 399 |
/* |
400 | 400 |
This file is part of »bacterio-plankton:shape«. |
401 | 401 |
|
402 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
402 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
403 | 403 |
<info@greenscale.de> |
404 | 404 |
|
405 | 405 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -483,7 +483,7 @@ var lib_shape; |
483 | 483 |
/* |
484 | 484 |
This file is part of »bacterio-plankton:shape«. |
485 | 485 |
|
486 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
486 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
487 | 487 |
<info@greenscale.de> |
488 | 488 |
|
489 | 489 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -569,7 +569,7 @@ var lib_shape; |
569 | 569 |
/* |
570 | 570 |
This file is part of »bacterio-plankton:shape«. |
571 | 571 |
|
572 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
572 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
573 | 573 |
<info@greenscale.de> |
574 | 574 |
|
575 | 575 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -665,7 +665,7 @@ var lib_shape; |
665 | 665 |
/* |
666 | 666 |
This file is part of »bacterio-plankton:shape«. |
667 | 667 |
|
668 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
668 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
669 | 669 |
<info@greenscale.de> |
670 | 670 |
|
671 | 671 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -778,7 +778,7 @@ var lib_shape; |
778 | 778 |
/* |
779 | 779 |
This file is part of »bacterio-plankton:shape«. |
780 | 780 |
|
781 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
781 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
782 | 782 |
<info@greenscale.de> |
783 | 783 |
|
784 | 784 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -879,7 +879,7 @@ var lib_shape; |
879 | 879 |
/* |
880 | 880 |
This file is part of »bacterio-plankton:shape«. |
881 | 881 |
|
882 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
882 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
883 | 883 |
<info@greenscale.de> |
884 | 884 |
|
885 | 885 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -976,7 +976,7 @@ var lib_shape; |
976 | 976 |
/* |
977 | 977 |
This file is part of »bacterio-plankton:shape«. |
978 | 978 |
|
979 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
979 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
980 | 980 |
<info@greenscale.de> |
981 | 981 |
|
982 | 982 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1072,7 +1072,7 @@ var lib_shape; |
1072 | 1072 |
/* |
1073 | 1073 |
This file is part of »bacterio-plankton:shape«. |
1074 | 1074 |
|
1075 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1075 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1076 | 1076 |
<info@greenscale.de> |
1077 | 1077 |
|
1078 | 1078 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1169,7 +1169,7 @@ var lib_shape; |
1169 | 1169 |
/* |
1170 | 1170 |
This file is part of »bacterio-plankton:shape«. |
1171 | 1171 |
|
1172 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1172 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1173 | 1173 |
<info@greenscale.de> |
1174 | 1174 |
|
1175 | 1175 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1266,7 +1266,7 @@ var lib_shape; |
1266 | 1266 |
/* |
1267 | 1267 |
This file is part of »bacterio-plankton:shape«. |
1268 | 1268 |
|
1269 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1269 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1270 | 1270 |
<info@greenscale.de> |
1271 | 1271 |
|
1272 | 1272 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1362,7 +1362,7 @@ var lib_shape; |
1362 | 1362 |
/* |
1363 | 1363 |
This file is part of »bacterio-plankton:shape«. |
1364 | 1364 |
|
1365 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1365 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1366 | 1366 |
<info@greenscale.de> |
1367 | 1367 |
|
1368 | 1368 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1481,7 +1481,7 @@ var lib_shape; |
1481 | 1481 |
/* |
1482 | 1482 |
This file is part of »bacterio-plankton:shape«. |
1483 | 1483 |
|
1484 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1484 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1485 | 1485 |
<info@greenscale.de> |
1486 | 1486 |
|
1487 | 1487 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1593,7 +1593,7 @@ var lib_shape; |
1593 | 1593 |
/* |
1594 | 1594 |
This file is part of »bacterio-plankton:shape«. |
1595 | 1595 |
|
1596 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1596 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1597 | 1597 |
<info@greenscale.de> |
1598 | 1598 |
|
1599 | 1599 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1694,7 +1694,7 @@ var lib_shape; |
1694 | 1694 |
/* |
1695 | 1695 |
This file is part of »bacterio-plankton:shape«. |
1696 | 1696 |
|
1697 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1697 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1698 | 1698 |
<info@greenscale.de> |
1699 | 1699 |
|
1700 | 1700 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1820,7 +1820,7 @@ var lib_shape; |
1820 | 1820 |
/* |
1821 | 1821 |
This file is part of »bacterio-plankton:shape«. |
1822 | 1822 |
|
1823 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1823 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1824 | 1824 |
<info@greenscale.de> |
1825 | 1825 |
|
1826 | 1826 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1946,7 +1946,7 @@ var lib_shape; |
1946 | 1946 |
/* |
1947 | 1947 |
This file is part of »bacterio-plankton:shape«. |
1948 | 1948 |
|
1949 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1949 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1950 | 1950 |
<info@greenscale.de> |
1951 | 1951 |
|
1952 | 1952 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -2062,7 +2062,7 @@ var lib_shape; |
2062 | 2062 |
/* |
2063 | 2063 |
This file is part of »bacterio-plankton:shape«. |
2064 | 2064 |
|
2065 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2065 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2066 | 2066 |
<info@greenscale.de> |
2067 | 2067 |
|
2068 | 2068 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -2188,7 +2188,7 @@ var lib_shape; |
2188 | 2188 |
/* |
2189 | 2189 |
This file is part of »bacterio-plankton:shape«. |
2190 | 2190 |
|
2191 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2191 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2192 | 2192 |
<info@greenscale.de> |
2193 | 2193 |
|
2194 | 2194 |
»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 | 4 |
»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
... | ... |
@@ -95,27 +95,6 @@ declare module lib_string { |
95 | 95 |
* @author fenris |
96 | 96 |
*/ |
97 | 97 |
var stance: typeof coin; |
98 |
- /** |
|
99 |
- * @author fenris |
|
100 |
- */ |
|
101 |
- function url_encode({ "protocol": protocol, "host": host, "port": port, "path": path, "arguments": arguments_, }?: { |
|
102 |
- protocol?: string; |
|
103 |
- host?: string; |
|
104 |
- port?: int; |
|
105 |
- path?: string; |
|
106 |
- arguments?: { |
|
107 |
- [key: string]: string; |
|
108 |
- }; |
|
109 |
- }): string; |
|
110 |
- /** |
|
111 |
- * @author fenris |
|
112 |
- */ |
|
113 |
- var make_url: typeof url_encode; |
|
114 |
- /** |
|
115 |
- * @author fenris |
|
116 |
- * @todo arguments |
|
117 |
- */ |
|
118 |
- function url_decode(url: string): Object; |
|
119 | 98 |
/** |
120 | 99 |
* @author fenris |
121 | 100 |
*/ |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
This file is part of »bacterio-plankton:string«. |
3 | 3 |
|
4 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
4 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 | 5 |
<info@greenscale.de> |
6 | 6 |
|
7 | 7 |
»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
... | ... |
@@ -166,7 +166,7 @@ var make_eml_body = (function () { |
166 | 166 |
/* |
167 | 167 |
This file is part of »bacterio-plankton:string«. |
168 | 168 |
|
169 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
169 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
170 | 170 |
<info@greenscale.de> |
171 | 171 |
|
172 | 172 |
»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
... | ... |
@@ -427,73 +427,6 @@ var lib_string; |
427 | 427 |
* @author fenris |
428 | 428 |
*/ |
429 | 429 |
lib_string.stance = coin; |
430 |
- /** |
|
431 |
- * @author fenris |
|
432 |
- */ |
|
433 |
- function url_encode(_a) { |
|
434 |
- var _b = _a === void 0 ? {} : _a, _c = _b["protocol"], protocol = _c === void 0 ? null : _c, _d = _b["host"], host = _d === void 0 ? null : _d, _e = _b["port"], port = _e === void 0 ? null : _e, _f = _b["path"], path = _f === void 0 ? null : _f, _g = _b["arguments"], arguments_ = _g === void 0 ? null : _g; |
|
435 |
- var url = ""; |
|
436 |
- // protocol |
|
437 |
- { |
|
438 |
- if (protocol != null) { |
|
439 |
- url = protocol + ":" + url; |
|
440 |
- } |
|
441 |
- } |
|
442 |
- // host |
|
443 |
- { |
|
444 |
- if (host != null) { |
|
445 |
- url = url + "//" + host; |
|
446 |
- } |
|
447 |
- } |
|
448 |
- // port |
|
449 |
- { |
|
450 |
- if (port != null) { |
|
451 |
- url = url + ":" + port.toString(); |
|
452 |
- } |
|
453 |
- } |
|
454 |
- // path |
|
455 |
- { |
|
456 |
- if (path != null) { |
|
457 |
- var path_ = encodeURI(path); |
|
458 |
- url = "" + url + path_; |
|
459 |
- } |
|
460 |
- } |
|
461 |
- // arguments |
|
462 |
- { |
|
463 |
- if (arguments_ != null) { |
|
464 |
- var suffix = Object.keys(arguments_).map(function (key) { return key + "=" + arguments_[key]; }).join("&"); |
|
465 |
- var suffix_ = encodeURI(suffix); |
|
466 |
- url = url + "?" + suffix_; |
|
467 |
- } |
|
468 |
- } |
|
469 |
- return url; |
|
470 |
- } |
|
471 |
- lib_string.url_encode = url_encode; |
|
472 |
- /** |
|
473 |
- * @author fenris |
|
474 |
- */ |
|
475 |
- lib_string.make_url = url_encode; |
|
476 |
- /** |
|
477 |
- * @author fenris |
|
478 |
- * @todo arguments |
|
479 |
- */ |
|
480 |
- function url_decode(url) { |
|
481 |
- var regexp = new RegExp("^([^:]*)://([^:]*):([^/]*)/(.*)$"); |
|
482 |
- var matching = regexp.exec(url); |
|
483 |
- if (matching === null) { |
|
484 |
- return null; |
|
485 |
- } |
|
486 |
- else { |
|
487 |
- var components = { |
|
488 |
- "protocol": matching[1], |
|
489 |
- "host": matching[2], |
|
490 |
- "port": parseInt(matching[3]), |
|
491 |
- "path": ("/" + matching[4]) |
|
492 |
- }; |
|
493 |
- return components; |
|
494 |
- } |
|
495 |
- } |
|
496 |
- lib_string.url_decode = url_decode; |
|
497 | 430 |
/** |
498 | 431 |
* @author fenris |
499 | 432 |
*/ |
... | ... |
@@ -511,7 +444,7 @@ var lib_string; |
511 | 444 |
/* |
512 | 445 |
This file is part of »bacterio-plankton:string«. |
513 | 446 |
|
514 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
447 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
515 | 448 |
<info@greenscale.de> |
516 | 449 |
|
517 | 450 |
»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
... | ... |
@@ -774,7 +707,7 @@ var printf = lib_string.printf; |
774 | 707 |
/* |
775 | 708 |
This file is part of »bacterio-plankton:string«. |
776 | 709 |
|
777 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
710 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
778 | 711 |
<info@greenscale.de> |
779 | 712 |
|
780 | 713 |
»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
1 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
2 | 2 |
|
3 | 3 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
4 | 4 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
This file is part of »bacterio-plankton:trait«. |
3 | 3 |
|
4 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
4 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
5 | 5 |
|
6 | 6 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
7 | 7 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -114,7 +114,7 @@ var lib_trait; |
114 | 114 |
/* |
115 | 115 |
This file is part of »bacterio-plankton:trait«. |
116 | 116 |
|
117 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
117 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
118 | 118 |
|
119 | 119 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
120 | 120 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -511,7 +511,7 @@ var lib_trait; |
511 | 511 |
/* |
512 | 512 |
This file is part of »bacterio-plankton:trait«. |
513 | 513 |
|
514 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
514 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
515 | 515 |
|
516 | 516 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
517 | 517 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -611,7 +611,7 @@ var lib_trait; |
611 | 611 |
/* |
612 | 612 |
This file is part of »bacterio-plankton:trait«. |
613 | 613 |
|
614 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
614 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
615 | 615 |
|
616 | 616 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
617 | 617 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -704,7 +704,7 @@ var lib_trait; |
704 | 704 |
/* |
705 | 705 |
This file is part of »bacterio-plankton:trait«. |
706 | 706 |
|
707 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
707 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
708 | 708 |
|
709 | 709 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
710 | 710 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -789,7 +789,7 @@ var lib_trait; |
789 | 789 |
/* |
790 | 790 |
This file is part of »bacterio-plankton:trait«. |
791 | 791 |
|
792 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
792 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
793 | 793 |
|
794 | 794 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
795 | 795 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -873,7 +873,7 @@ var lib_trait; |
873 | 873 |
/* |
874 | 874 |
This file is part of »bacterio-plankton:trait«. |
875 | 875 |
|
876 |
-Copyright 2016-2018 greenscale <info@greenscale.de> |
|
876 |
+Copyright 2016-2021 greenscale <info@greenscale.de> |
|
877 | 877 |
|
878 | 878 |
»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
879 | 879 |
it under the terms of the GNU Lesser General Public License as published by |
... | ... |
@@ -1,18 +1,18 @@ |
1 |
-Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 | 2 |
<info@greenscale.de> |
3 | 3 |
|
4 |
-»bacterio-plankton:comm-client« is free software: you can redistribute it and/or modify |
|
4 |
+»bacterio-plankton:url« is free software: you can redistribute it and/or modify |
|
5 | 5 |
it under the terms of the GNU Lesser General Public License as published by |
6 | 6 |
the Free Software Foundation, either version 3 of the License, or |
7 | 7 |
(at your option) any later version. |
8 | 8 |
|
9 |
-»bacterio-plankton:comm-client« is distributed in the hope that it will be useful, |
|
9 |
+»bacterio-plankton:url« is distributed in the hope that it will be useful, |
|
10 | 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | 12 |
GNU Lesser General Public License for more details. |
13 | 13 |
|
14 | 14 |
You should have received a copy of the GNU Lesser General Public License |
15 |
-along with »bacterio-plankton:comm-client«. If not, see <http://www.gnu.org/licenses/>. |
|
15 |
+along with »bacterio-plankton:url«. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 |
|
17 | 17 |
|
18 | 18 |
|
... | ... |
@@ -0,0 +1,56 @@ |
1 |
+declare module lib_url { |
|
2 |
+ /** |
|
3 |
+ * @author fenris |
|
4 |
+ */ |
|
5 |
+ type type_url = { |
|
6 |
+ protocol?: string; |
|
7 |
+ host?: string; |
|
8 |
+ port?: int; |
|
9 |
+ path?: string; |
|
10 |
+ arguments?: { |
|
11 |
+ [key: string]: string; |
|
12 |
+ }; |
|
13 |
+ }; |
|
14 |
+} |
|
15 |
+declare module lib_url { |
|
16 |
+ /** |
|
17 |
+ * @author fenris |
|
18 |
+ */ |
|
19 |
+ function encode(url: type_url, { "protocol": protocol, "host": host, "port": port, "path": path, "arguments": arguments_, }?: { |
|
20 |
+ protocol?: string; |
|
21 |
+ host?: string; |
|
22 |
+ port?: int; |
|
23 |
+ path?: string; |
|
24 |
+ arguments?: { |
|
25 |
+ [key: string]: string; |
|
26 |
+ }; |
|
27 |
+ }): string; |
|
28 |
+ /** |
|
29 |
+ * @author fenris |
|
30 |
+ * @todo arguments |
|
31 |
+ */ |
|
32 |
+ function decode(url_raw: string): type_url; |
|
33 |
+} |
|
34 |
+declare module lib_url { |
|
35 |
+} |
|
36 |
+declare module lib_url { |
|
37 |
+ /** |
|
38 |
+ * @author fenris |
|
39 |
+ */ |
|
40 |
+ class class_url implements lib_code.interface_code<type_url, string> { |
|
41 |
+ /** |
|
42 |
+ * @author fenris |
|
43 |
+ */ |
|
44 |
+ constructor(); |
|
45 |
+ /** |
|
46 |
+ * @implementation |
|
47 |
+ * @author fenris |
|
48 |
+ */ |
|
49 |
+ encode(x: any): string; |
|
50 |
+ /** |
|
51 |
+ * @implementation |
|
52 |
+ * @author fenris |
|
53 |
+ */ |
|
54 |
+ decode(x: string): any; |
|
55 |
+ } |
|
56 |
+} |
... | ... |
@@ -0,0 +1,190 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:url«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:url« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:url« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:url«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+/* |
|
21 |
+This file is part of »bacterio-plankton:url«. |
|
22 |
+ |
|
23 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
24 |
+<info@greenscale.de> |
|
25 |
+ |
|
26 |
+»bacterio-plankton:url« is free software: you can redistribute it and/or modify |
|
27 |
+it under the terms of the GNU Lesser General Public License as published by |
|
28 |
+the Free Software Foundation, either version 3 of the License, or |
|
29 |
+(at your option) any later version. |
|
30 |
+ |
|
31 |
+»bacterio-plankton:url« is distributed in the hope that it will be useful, |
|
32 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
33 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
34 |
+GNU Lesser General Public License for more details. |
|
35 |
+ |
|
36 |
+You should have received a copy of the GNU Lesser General Public License |
|
37 |
+along with »bacterio-plankton:url«. If not, see <http://www.gnu.org/licenses/>. |
|
38 |
+ */ |
|
39 |
+var lib_url; |
|
40 |
+(function (lib_url) { |
|
41 |
+ /** |
|
42 |
+ * @author fenris |
|
43 |
+ */ |
|
44 |
+ function encode(url, { "protocol": protocol = null, "host": host = null, "port": port = null, "path": path = null, "arguments": arguments_ = null, } = {}) { |
|
45 |
+ let result = ""; |
|
46 |
+ // protocol |
|
47 |
+ { |
|
48 |
+ if (url.hasOwnProperty("protocol") && (url.protocol !== null)) { |
|
49 |
+ result = `${url.protocol}:${result}`; |
|
50 |
+ } |
|
51 |
+ } |
|
52 |
+ // host |
|
53 |
+ { |
|
54 |
+ if (url.hasOwnProperty("host") && (url.host !== null)) { |
|
55 |
+ result = `${result}//${url.host}`; |
|
56 |
+ } |
|
57 |
+ } |
|
58 |
+ // port |
|
59 |
+ { |
|
60 |
+ if (url.hasOwnProperty("port") && (url.port !== null)) { |
|
61 |
+ result = `${result}:${url.port.toString()}`; |
|
62 |
+ } |
|
63 |
+ } |
|
64 |
+ // path |
|
65 |
+ { |
|
66 |
+ if (url.hasOwnProperty("path") && (url.path !== null)) { |
|
67 |
+ const path = encodeURI(url.path); |
|
68 |
+ result = `${result}${path}`; |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+ // arguments |
|
72 |
+ { |
|
73 |
+ if (url.hasOwnProperty("arguments") && (url.arguments !== null)) { |
|
74 |
+ const suffix = Object.keys(url.arguments).map(key => `${key}=${url.arguments[key]}`).join("&"); |
|
75 |
+ const suffix_ = encodeURI(suffix); |
|
76 |
+ result = `${result}?${suffix_}`; |
|
77 |
+ } |
|
78 |
+ } |
|
79 |
+ return result; |
|
80 |
+ } |
|
81 |
+ lib_url.encode = encode; |
|
82 |
+ /** |
|
83 |
+ * @author fenris |
|
84 |
+ * @todo arguments |
|
85 |
+ */ |
|
86 |
+ function decode(url_raw) { |
|
87 |
+ const regexp = new RegExp("^([^:]*)://([^:]*):([^/]*)/(.*)$"); |
|
88 |
+ const matching = regexp.exec(url_raw); |
|
89 |
+ if (matching === null) { |
|
90 |
+ throw (new Error("url could not be decoded")); |
|
91 |
+ } |
|
92 |
+ else { |
|
93 |
+ const url = { |
|
94 |
+ "protocol": matching[1], |
|
95 |
+ "host": matching[2], |
|
96 |
+ "port": parseInt(matching[3]), |
|
97 |
+ "path": ("/" + matching[4]), |
|
98 |
+ }; |
|
99 |
+ return url; |
|
100 |
+ } |
|
101 |
+ } |
|
102 |
+ lib_url.decode = decode; |
|
103 |
+})(lib_url || (lib_url = {})); |
|
104 |
+/* |
|
105 |
+This file is part of »bacterio-plankton:url«. |
|
106 |
+ |
|
107 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
108 |
+<info@greenscale.de> |
|
109 |
+ |
|
110 |
+»bacterio-plankton:url« is free software: you can redistribute it and/or modify |
|
111 |
+it under the terms of the GNU Lesser General Public License as published by |
|
112 |
+the Free Software Foundation, either version 3 of the License, or |
|
113 |
+(at your option) any later version. |
|
114 |
+ |
|
115 |
+»bacterio-plankton:url« is distributed in the hope that it will be useful, |
|
116 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
117 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
118 |
+GNU Lesser General Public License for more details. |
|
119 |
+ |
|
120 |
+You should have received a copy of the GNU Lesser General Public License |
|
121 |
+along with »bacterio-plankton:url«. If not, see <http://www.gnu.org/licenses/>. |
|
122 |
+ */ |
|
123 |
+var lib_url; |
|
124 |
+(function (lib_url) { |
|
125 |
+ /** |
|
126 |
+ * @author fenris |
|
127 |
+ */ |
|
128 |
+ lib_trait.attend("code", "url", { |
|
129 |
+ "from": { |
|
130 |
+ "name": "any" |
|
131 |
+ }, |
|
132 |
+ "to": { |
|
133 |
+ "name": "string" |
|
134 |
+ } |
|
135 |
+ }, { |
|
136 |
+ "encode": () => (x) => { |
|
137 |
+ return lib_url.encode(x); |
|
138 |
+ }, |
|
139 |
+ "decode": () => (y) => { |
|
140 |
+ return lib_url.decode(y); |
|
141 |
+ } |
|
142 |
+ }); |
|
143 |
+})(lib_url || (lib_url = {})); |
|
144 |
+/* |
|
145 |
+This file is part of »bacterio-plankton:url«. |
|
146 |
+ |
|
147 |
+Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
148 |
+<info@greenscale.de> |
|
149 |
+ |
|
150 |
+»bacterio-plankton:url« is free software: you can redistribute it and/or modify |
|
151 |
+it under the terms of the GNU Lesser General Public License as published by |
|
152 |
+the Free Software Foundation, either version 3 of the License, or |
|
153 |
+(at your option) any later version. |
|
154 |
+ |
|
155 |
+»bacterio-plankton:url« is distributed in the hope that it will be useful, |
|
156 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
157 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
158 |
+GNU Lesser General Public License for more details. |
|
159 |
+ |
|
160 |
+You should have received a copy of the GNU Lesser General Public License |
|
161 |
+along with »bacterio-plankton:url«. If not, see <http://www.gnu.org/licenses/>. |
|
162 |
+ */ |
|
163 |
+var lib_url; |
|
164 |
+(function (lib_url) { |
|
165 |
+ /** |
|
166 |
+ * @author fenris |
|
167 |
+ */ |
|
168 |
+ class class_url { |
|
169 |
+ /** |
|
170 |
+ * @author fenris |
|
171 |
+ */ |
|
172 |
+ constructor() { |
|
173 |
+ } |
|
174 |
+ /** |
|
175 |
+ * @implementation |
|
176 |
+ * @author fenris |
|
177 |
+ */ |
|
178 |
+ encode(x) { |
|
179 |
+ return lib_url.encode(x); |
|
180 |
+ } |
|
181 |
+ /** |
|
182 |
+ * @implementation |
|
183 |
+ * @author fenris |
|
184 |
+ */ |
|
185 |
+ decode(x) { |
|
186 |
+ return lib_url.decode(x); |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ lib_url.class_url = class_url; |
|
190 |
+})(lib_url || (lib_url = {})); |
|
0 | 191 |