[upd] plankton

This commit is contained in:
Fenris Wolf 2024-11-28 23:06:57 +01:00
parent ef879bb81b
commit b86e1b62e2
2 changed files with 571 additions and 456 deletions

View file

@ -1588,7 +1588,7 @@ declare namespace lib_plankton.string {
* @return {Array<string>}
* @author fenris
*/
function split(chain: string, separator?: string): Array<string>;
function split(chain: string, separator: string): Array<string>;
/**
* @author neu3no
*/
@ -3651,60 +3651,38 @@ declare namespace lib_plankton.http {
declare namespace lib_plankton.xml {
/**
*/
abstract class class_node {
/**
*/
abstract compile(depth?: int): string;
}
/**
*/
class class_node_text extends class_node {
/**
*/
protected content: string;
/**
*/
constructor(content: string);
/**
*/
compile(depth?: int): string;
}
/**
*/
class class_node_comment extends class_node {
/**
*/
protected content: string;
/**
*/
constructor(content: string);
/**
*/
compile(depth?: int): string;
}
/**
*/
class class_node_complex extends class_node {
/**
*/
protected name: string;
/**
*/
protected attributes: {
[key: string]: string;
type type_node_data = ({
kind: "root";
data: {
version: string;
encoding: string;
content: type_node_data;
};
/**
*/
protected children: Array<class_node>;
/**
*/
constructor(name: string, attributes?: {
[key: string]: string;
}, children?: any[]);
/**
*/
compile(depth?: int): string;
}
} | {
kind: "comment";
data: string;
} | {
kind: "text";
data: string;
} | {
kind: "complex";
data: {
tag: string;
attributes: Record<string, string>;
children: Array<type_node_data>;
};
});
/**
*/
type type_node_logic = {
compile: ((depths: int) => string);
};
/**
*/
function get_node_logic(node_data: type_node_data): type_node_logic;
/**
*/
function parse(xml_string: string): Promise<type_node_data>;
}
declare namespace lib_plankton.webdav {
/**
@ -3794,12 +3772,33 @@ declare namespace lib_plankton.webdav {
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_status
*/
type type_data_status = string;
/**
*/
type type_data_prop_value = ({
kind: "none";
data: null;
} | {
kind: "primitive";
data: string;
} | {
kind: "href";
data: string;
} | {
kind: "resourcetype";
data: {
kind: string;
type: string;
};
} | {
kind: "privileges";
data: Array<string>;
});
/**
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_prop
*/
type type_data_prop = {
name: string;
value: (null | string);
value: type_data_prop_value;
};
/**
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_propstat
@ -3838,7 +3837,6 @@ declare namespace lib_plankton.webdav {
}
declare namespace lib_plankton.webdav {
/**
* @author roydfalk <roydfalk@folksprak.org>
*/
function is_special_method(method: enum_method): boolean;
/**
@ -3865,6 +3863,10 @@ declare namespace lib_plankton.webdav {
/**
*/
function encode_request(request: type_request): string;
/**
* @todo description
*/
function data_multistatus_encode_xml(data_multistatus: type_data_multistatus): lib_plankton.xml.type_node_data;
/**
*/
function data_multistatus_encode(data_multistatus: type_data_multistatus): string;
@ -4165,7 +4167,6 @@ declare namespace lib_plankton.rest_base {
/**
*/
type type_execution<type_input, type_output> = ((stuff: {
version: (null | string);
headers: Record<string, string>;
path_parameters: Record<string, string>;
query_parameters: Record<string, string>;
@ -4178,7 +4179,6 @@ declare namespace lib_plankton.rest_base {
/**
*/
type type_restriction<type_input> = ((stuff: {
version: (null | string);
headers: Record<string, string>;
path_parameters: Record<string, string>;
query_parameters: Record<string, string>;
@ -4187,22 +4187,22 @@ declare namespace lib_plankton.rest_base {
*/
type type_operation<type_input, type_output> = {
action_name: string;
query_parameters: ((version: string) => Array<{
query_parameters: ((version: (null | string)) => Array<{
name: string;
description: (null | string);
required: boolean;
}>);
input_schema: ((version: (null | string)) => type_oas_schema);
output_schema: ((version: (null | string)) => type_oas_schema);
request_body_mimetype: string;
request_body_decode: ((http_request_body: Buffer, http_request_header_content_type: (null | string)) => any);
response_body_mimetype: string;
response_body_encode: ((output: any) => (null | Buffer));
request_body_mimetype: ((version: (null | string)) => string);
request_body_decode: ((version: (null | string)) => (http_request_body: Buffer, http_request_header_content_type: (null | string)) => any);
response_body_mimetype: ((version: (null | string)) => string);
response_body_encode: ((version: (null | string)) => ((output: any) => (null | Buffer)));
};
/**
*/
type type_routenode = {
operations: Record</*lib_plankton.http.enum_method*/ string, type_operation<any, any>>;
operations: Record<string, type_operation<any, any>>;
sub_branch: Record<string, type_routenode>;
sub_wildcard: (null | {
name: string;
@ -4225,19 +4225,39 @@ declare namespace lib_plankton.rest_base {
set_access_control_headers: boolean;
authentication: ({
kind: "none";
parameters: {};
data: {};
} | {
kind: "key_header";
parameters: {
data: {
name: string;
};
});
};
/**
*/
type type_action_options<type_input, type_output> = {
active?: ((version: (null | string)) => boolean);
restriction?: ((version: (null | string)) => type_restriction<type_input>);
execution?: ((version: (null | string)) => type_execution<type_input, (null | type_output)>);
title?: ((version: (null | string)) => (null | string));
description?: ((version: (null | string)) => (null | string));
query_parameters?: ((version: (null | string)) => Array<{
name: string;
description: (null | string);
required: boolean;
}>);
input_schema?: ((version: (null | string)) => type_oas_schema);
output_schema?: ((version: (null | string)) => type_oas_schema);
request_body_mimetype?: ((version: (null | string)) => string);
request_body_decode?: ((version: (null | string)) => (http_request_body: Buffer, http_request_header_content_type: (null | string)) => Promise<any>);
response_body_mimetype?: ((version: (null | string)) => string);
response_body_encode?: ((version: (null | string)) => (output: any) => Promise<Buffer>);
};
}
declare namespace lib_plankton.rest_base {
/**
*/
function make<type_http_method>(encode_http_method: ((http_method: type_http_method) => string), options?: {
function make<type_http_method>(encode_http_method: ((http_method: type_http_method) => string), { "title": option_title, "versioning_method": option_versioning_method, "versioning_header_name": option_versioning_header_name, "versioning_query_key": option_versioning_query_key, "header_parameters": option_header_parameters, "set_access_control_headers": option_set_access_control_headers, "authentication": option_authentication, "actions": option_actions, }?: {
title?: (null | string);
versioning_method?: ("none" | "path" | "header" | "query");
versioning_header_name?: (null | string);
@ -4250,56 +4270,26 @@ declare namespace lib_plankton.rest_base {
set_access_control_headers?: boolean;
authentication?: ({
kind: "none";
parameters: {};
data: {};
} | {
kind: "key_header";
parameters: {
data: {
name: string;
};
});
actions?: Array<{
http_method: type_http_method;
path: string;
options: {
active?: ((version: string) => boolean);
restriction?: (null | type_restriction<any>);
execution?: type_execution<any, any>;
title?: (null | string);
description?: (null | string);
query_parameters?: ((version: string) => Array<{
name: string;
description: (null | string);
required: boolean;
}>);
input_schema?: ((version: string) => type_oas_schema);
output_schema?: ((version: string) => type_oas_schema);
request_body_mimetype?: string;
request_body_decode?: ((http_request_body: Buffer, http_request_header_content_type: (null | string)) => any);
response_body_mimetype?: string;
response_body_encode?: ((output: any) => Buffer);
};
options: type_action_options<any, any>;
}>;
}): type_rest;
/**
*/
function register<type_http_method, type_input, type_output>(encode_http_method: ((http_method: type_http_method) => string), rest: type_rest, http_method: type_http_method, path: string, options: {
active?: ((version: string) => boolean);
restriction?: (null | type_restriction<type_input>);
execution?: type_execution<type_input, type_output>;
title?: (null | string);
description?: (null | string);
query_parameters?: ((version: string) => Array<{
name: string;
description: (null | string);
required: boolean;
}>);
input_schema?: ((version: (null | string)) => type_oas_schema);
output_schema?: ((version: (null | string)) => type_oas_schema);
request_body_mimetype?: string;
request_body_decode?: ((http_request_body: Buffer, http_request_header_content_type: (null | string)) => any);
response_body_mimetype?: string;
response_body_encode?: ((output: any) => Buffer);
}): void;
function register<type_http_method, type_input, type_output>(encode_http_method: ((http_method: type_http_method) => string), rest: type_rest, http_method: type_http_method, path: string, { "active": option_active, "execution": option_execution, "restriction": option_restriction, "title": option_title, "description": option_description, "query_parameters": option_query_parameters, "input_schema": option_input_schema, "output_schema": option_output_schema, "request_body_mimetype": option_request_body_mimetype, "request_body_decode": option_request_body_decode, "response_body_mimetype": option_response_body_mimetype,
/**
* @todo no "from"?
*/
"response_body_encode": option_response_body_encode, }?: type_action_options<type_input, type_output>): void;
/**
* @todo check request body mimetype?
* @todo check query paramater validity
@ -4354,56 +4344,22 @@ declare namespace lib_plankton.rest_caldav {
set_access_control_headers?: boolean;
authentication?: ({
kind: "none";
parameters: {};
data: {};
} | {
kind: "key_header";
parameters: {
data: {
name: string;
};
});
actions?: Array<{
http_method: lib_plankton.caldav.enum_method;
path: string;
options: {
active?: ((version: string) => boolean);
restriction?: (null | type_restriction<any>);
execution?: type_execution<any, any>;
title?: (null | string);
description?: (null | string);
query_parameters?: ((version: string) => Array<{
name: string;
description: (null | string);
required: boolean;
}>);
input_schema?: ((version: string) => type_oas_schema);
output_schema?: ((version: string) => type_oas_schema);
request_body_mimetype?: string;
request_body_decode?: ((http_request_body: Buffer, http_request_header_content_type: (null | string)) => any);
response_body_mimetype?: string;
response_body_encode?: ((output: any) => Buffer);
};
options: lib_plankton.rest_base.type_action_options<any, any>;
}>;
}): type_rest;
/**
*/
function register<type_input, type_output>(rest: type_rest, http_method: lib_plankton.caldav.enum_method, path: string, options: {
active?: ((version: string) => boolean);
restriction?: (null | type_restriction<type_input>);
execution?: type_execution<type_input, type_output>;
title?: (null | string);
description?: (null | string);
query_parameters?: ((version: string) => Array<{
name: string;
description: (null | string);
required: boolean;
}>);
input_schema?: ((version: (null | string)) => type_oas_schema);
output_schema?: ((version: (null | string)) => type_oas_schema);
request_body_mimetype?: string;
request_body_decode?: ((http_request_body: Buffer, http_request_header_content_type: (null | string)) => any);
response_body_mimetype?: string;
response_body_encode?: ((output: any) => Buffer);
}): void;
function register<type_input, type_output>(rest: type_rest, http_method: lib_plankton.caldav.enum_method, path: string, options: lib_plankton.rest_base.type_action_options<type_input, type_output>): void;
/**
* @todo check request body mimetype?
* @todo check query paramater validity

File diff suppressed because it is too large Load diff