CalDAV #1
413
lib/plankton/plankton.d.ts
vendored
413
lib/plankton/plankton.d.ts
vendored
|
|
@ -650,6 +650,9 @@ declare namespace lib_plankton.call {
|
||||||
value: (null | type_value);
|
value: (null | type_value);
|
||||||
error: (null | any);
|
error: (null | any);
|
||||||
}>;
|
}>;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function sleep(seconds: float): Promise<void>;
|
||||||
export {};
|
export {};
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.email {
|
declare namespace lib_plankton.email {
|
||||||
|
|
@ -1550,6 +1553,12 @@ declare namespace lib_plankton.conf {
|
||||||
} | {
|
} | {
|
||||||
not: type_schema;
|
not: type_schema;
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_sheet<type_content> = {
|
||||||
|
version: (null | string);
|
||||||
|
content: type_content;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
type type_report = {
|
type type_report = {
|
||||||
|
|
@ -1562,15 +1571,24 @@ declare namespace lib_plankton.conf {
|
||||||
reports: Array<type_report>;
|
reports: Array<type_report>;
|
||||||
result: lib_plankton.pod.type_pod<type_result>;
|
result: lib_plankton.pod.type_pod<type_result>;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
type type_migration<type_from, type_to> = (null | {
|
||||||
|
target: string;
|
||||||
|
function: ((content: type_from) => type_to);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.conf {
|
declare namespace lib_plankton.conf {
|
||||||
/**
|
/**
|
||||||
* @todo versioning
|
|
||||||
*/
|
*/
|
||||||
function refine<type_result>(schema: type_schema, value_raw: any): type_result;
|
function refine<type_result>(schema: type_schema, content: any): type_result;
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
function load<type_result>(schema: type_schema, path: (null | string)): Promise<type_result>;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function load(schema: type_schema, path: (null | string)): Promise<void>;
|
function load_versioned(path: string, get_schema: ((version: string) => type_schema), migrations: Record<string, type_migration<any, any>>): Promise<type_sheet<any>>;
|
||||||
}
|
}
|
||||||
declare var plain_text_to_html: (text: string) => string;
|
declare var plain_text_to_html: (text: string) => string;
|
||||||
/**
|
/**
|
||||||
|
|
@ -3189,18 +3207,45 @@ declare namespace lib_plankton.pit {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function is_before(pit: type_pit, reference: type_pit): boolean;
|
function is_before(pit: type_pit, reference: type_pit): boolean;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function is_after(pit: type_pit, reference: type_pit): boolean;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function is_equal_or_after(pit: type_pit, reference: type_pit): boolean;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function is_between(pit: type_pit, reference_left: type_pit, reference_right: type_pit): boolean;
|
function is_between(pit: type_pit, reference_left: type_pit, reference_right: type_pit): boolean;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function shift_hour(pit: type_pit, increment: int): type_pit;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function shift_day(pit: type_pit, increment: int): type_pit;
|
function shift_day(pit: type_pit, increment: int): type_pit;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function shift_week(pit: type_pit, increment: int): type_pit;
|
function shift_week(pit: type_pit, increment: int): type_pit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function shift_year(pit: type_pit, increment: int): type_pit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function trunc_minute(pit: type_pit): type_pit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function trunc_hour(pit: type_pit): type_pit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function trunc_day(pit: type_pit): type_pit;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function trunc_week(pit: type_pit): type_pit;
|
function trunc_week(pit: type_pit): type_pit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function trunc_month(pit: type_pit): type_pit;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function trunc_year(pit: type_pit): type_pit;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function now(): type_pit;
|
function now(): type_pit;
|
||||||
|
|
@ -3620,352 +3665,6 @@ declare namespace lib_plankton.http {
|
||||||
implementation?: ("fetch" | "http_module");
|
implementation?: ("fetch" | "http_module");
|
||||||
}): Promise<type_response>;
|
}): Promise<type_response>;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.xml {
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_node_data = ({
|
|
||||||
kind: "root";
|
|
||||||
data: {
|
|
||||||
version: string;
|
|
||||||
encoding: string;
|
|
||||||
content: type_node_data;
|
|
||||||
};
|
|
||||||
} | {
|
|
||||||
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 {
|
|
||||||
/**
|
|
||||||
* @todo try to base on lib_plankton.http.enum_method
|
|
||||||
*/
|
|
||||||
enum enum_method {
|
|
||||||
options = "options",
|
|
||||||
head = "head",
|
|
||||||
get = "get",
|
|
||||||
delete = "delete",
|
|
||||||
post = "post",
|
|
||||||
put = "put",
|
|
||||||
patch = "patch",
|
|
||||||
propfind = "propfind",
|
|
||||||
proppatch = "proppatch",
|
|
||||||
mkcol = "mkcol",
|
|
||||||
copy = "copy",
|
|
||||||
move = "move",
|
|
||||||
lock = "lock",
|
|
||||||
unlock = "unlock"
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @todo try to base on lib_plankton.http.enum_status_code
|
|
||||||
*/
|
|
||||||
enum enum_status_code {
|
|
||||||
continue_ = 100,
|
|
||||||
switching_protocols = 101,
|
|
||||||
early_hints = 103,
|
|
||||||
ok = 200,
|
|
||||||
created = 201,
|
|
||||||
accepted = 202,
|
|
||||||
non_authoritative_information = 203,
|
|
||||||
no_content = 204,
|
|
||||||
reset_content = 205,
|
|
||||||
partial_coentent = 206,
|
|
||||||
multistatus = 207,
|
|
||||||
multiple_choices = 300,
|
|
||||||
moved_permanently = 301,
|
|
||||||
found = 302,
|
|
||||||
see_other = 303,
|
|
||||||
not_modified = 304,
|
|
||||||
temporary_redirect = 307,
|
|
||||||
permanent_redirect = 308,
|
|
||||||
bad_request = 400,
|
|
||||||
unauthorized = 401,
|
|
||||||
payment_required = 402,
|
|
||||||
forbidden = 403,
|
|
||||||
not_found = 404,
|
|
||||||
method_not_allowed = 405,
|
|
||||||
not_acceptable = 406,
|
|
||||||
proxy_authentication_required = 407,
|
|
||||||
request_timeout = 408,
|
|
||||||
conflict = 409,
|
|
||||||
gone = 410,
|
|
||||||
length_required = 411,
|
|
||||||
precondition_failed = 412,
|
|
||||||
payload_too_large = 413,
|
|
||||||
uri_too_long = 414,
|
|
||||||
unsupported_media_type = 415,
|
|
||||||
range_not_satisfiable = 416,
|
|
||||||
expectation_failed = 417,
|
|
||||||
i_m_a_teapot = 418,
|
|
||||||
unprocessable_entity = 422,
|
|
||||||
too_early = 425,
|
|
||||||
upgrade_required = 426,
|
|
||||||
precondition_required = 428,
|
|
||||||
too_many_requests = 429,
|
|
||||||
request_header_fields_too_large = 431,
|
|
||||||
unavailable_for_legal_reasons = 451,
|
|
||||||
internal_server_error = 500,
|
|
||||||
not_implemented = 501,
|
|
||||||
bad_gateway = 502,
|
|
||||||
service_unavailable = 503,
|
|
||||||
gateway_timeout = 504,
|
|
||||||
http_version_not_supported = 505,
|
|
||||||
variant_also_negotiates = 506,
|
|
||||||
insufficient_storage = 507,
|
|
||||||
loop_detected = 508,
|
|
||||||
not_extended = 510,
|
|
||||||
network_authentication = 511
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_href
|
|
||||||
*/
|
|
||||||
type type_data_href = string;
|
|
||||||
/**
|
|
||||||
* @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>;
|
|
||||||
} | {
|
|
||||||
kind: "component_set";
|
|
||||||
data: {
|
|
||||||
name: string;
|
|
||||||
items: Array<string>;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_prop
|
|
||||||
*/
|
|
||||||
type type_data_prop = {
|
|
||||||
name: string;
|
|
||||||
value: type_data_prop_value;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_propstat
|
|
||||||
*/
|
|
||||||
type type_data_propstat = {
|
|
||||||
prop: Array<type_data_prop>;
|
|
||||||
status: string;
|
|
||||||
description: (null | string);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_response
|
|
||||||
*/
|
|
||||||
type type_data_response = {
|
|
||||||
href: type_data_href;
|
|
||||||
body: ({
|
|
||||||
hrefs: Array<type_data_href>;
|
|
||||||
status: string;
|
|
||||||
} | {
|
|
||||||
propstats: Array<type_data_propstat>;
|
|
||||||
});
|
|
||||||
description: (null | string);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @see http://www.webdav.org/specs/rfc2518.html#ELEMENT_multistatus
|
|
||||||
*/
|
|
||||||
type type_data_multistatus = {
|
|
||||||
responses: Array<type_data_response>;
|
|
||||||
description: (null | string);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_request = lib_plankton.http_base.type_request<enum_method>;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_response = lib_plankton.http_base.type_response<enum_status_code>;
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.webdav {
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function is_special_method(method: enum_method): boolean;
|
|
||||||
/**
|
|
||||||
* @author roydfalk <roydfalk@folksprak.org>
|
|
||||||
*/
|
|
||||||
function encode_method(method: enum_method): string;
|
|
||||||
/**
|
|
||||||
* @author roydfalk <roydfalk@folksprak.org>
|
|
||||||
*/
|
|
||||||
function decode_method(method_raw: string): enum_method;
|
|
||||||
/**
|
|
||||||
* @todo check
|
|
||||||
*/
|
|
||||||
function has_body(method: enum_method): boolean;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode_request(request_raw: string): type_request;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function encode_response(response: type_response): string;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode_response(response_raw: string): type_response;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.caldav {
|
|
||||||
/**
|
|
||||||
* @todo try to base on lib_plankton.webdav.enum_method
|
|
||||||
*/
|
|
||||||
enum enum_method {
|
|
||||||
options = "options",
|
|
||||||
head = "head",
|
|
||||||
get = "get",
|
|
||||||
delete = "delete",
|
|
||||||
post = "post",
|
|
||||||
put = "put",
|
|
||||||
patch = "patch",
|
|
||||||
propfind = "propfind",
|
|
||||||
proppatch = "proppatch",
|
|
||||||
mkcol = "mkcol",
|
|
||||||
copy = "copy",
|
|
||||||
move = "move",
|
|
||||||
lock = "lock",
|
|
||||||
unlock = "unlock",
|
|
||||||
report = "report",
|
|
||||||
mkcalendar = "mkcalendar",
|
|
||||||
acl = "acl"
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @todo try to base on lib_plankton.webdav.enum_status_code
|
|
||||||
*/
|
|
||||||
enum enum_status_code {
|
|
||||||
continue_ = 100,
|
|
||||||
switching_protocols = 101,
|
|
||||||
early_hints = 103,
|
|
||||||
ok = 200,
|
|
||||||
created = 201,
|
|
||||||
accepted = 202,
|
|
||||||
non_authoritative_information = 203,
|
|
||||||
no_content = 204,
|
|
||||||
reset_content = 205,
|
|
||||||
partial_coentent = 206,
|
|
||||||
multistatus = 207,
|
|
||||||
multiple_choices = 300,
|
|
||||||
moved_permanently = 301,
|
|
||||||
found = 302,
|
|
||||||
see_other = 303,
|
|
||||||
not_modified = 304,
|
|
||||||
temporary_redirect = 307,
|
|
||||||
permanent_redirect = 308,
|
|
||||||
bad_request = 400,
|
|
||||||
unauthorized = 401,
|
|
||||||
payment_required = 402,
|
|
||||||
forbidden = 403,
|
|
||||||
not_found = 404,
|
|
||||||
method_not_allowed = 405,
|
|
||||||
not_acceptable = 406,
|
|
||||||
proxy_authentication_required = 407,
|
|
||||||
request_timeout = 408,
|
|
||||||
conflict = 409,
|
|
||||||
gone = 410,
|
|
||||||
length_required = 411,
|
|
||||||
precondition_failed = 412,
|
|
||||||
payload_too_large = 413,
|
|
||||||
uri_too_long = 414,
|
|
||||||
unsupported_media_type = 415,
|
|
||||||
range_not_satisfiable = 416,
|
|
||||||
expectation_failed = 417,
|
|
||||||
i_m_a_teapot = 418,
|
|
||||||
unprocessable_entity = 422,
|
|
||||||
too_early = 425,
|
|
||||||
upgrade_required = 426,
|
|
||||||
precondition_required = 428,
|
|
||||||
too_many_requests = 429,
|
|
||||||
request_header_fields_too_large = 431,
|
|
||||||
unavailable_for_legal_reasons = 451,
|
|
||||||
internal_server_error = 500,
|
|
||||||
not_implemented = 501,
|
|
||||||
bad_gateway = 502,
|
|
||||||
service_unavailable = 503,
|
|
||||||
gateway_timeout = 504,
|
|
||||||
http_version_not_supported = 505,
|
|
||||||
variant_also_negotiates = 506,
|
|
||||||
insufficient_storage = 507,
|
|
||||||
loop_detected = 508,
|
|
||||||
not_extended = 510,
|
|
||||||
network_authentication = 511
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_request = lib_plankton.http_base.type_request<enum_method>;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_response = lib_plankton.http_base.type_response<enum_status_code>;
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.caldav {
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function is_special_method(method: enum_method): boolean;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function encode_method(method: enum_method): string;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode_method(method_raw: string): enum_method;
|
|
||||||
/**
|
|
||||||
* @todo check
|
|
||||||
*/
|
|
||||||
function has_body(method: enum_method): boolean;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function encode_request(request: type_request): string;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode_request(request_raw: string): type_request;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function encode_response(response: type_response): string;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode_response(response_raw: string): type_response;
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.markdown {
|
declare namespace lib_plankton.markdown {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
|
|
@ -3979,6 +3678,10 @@ declare namespace lib_plankton.markdown {
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
function sectionhead(level: int, content: string): string;
|
function sectionhead(level: int, content: string): string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
function list(level: int, elements: Array<string>): string;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.api {
|
declare namespace lib_plankton.api {
|
||||||
/**
|
/**
|
||||||
|
|
@ -4286,7 +3989,7 @@ declare namespace lib_plankton.rest_base {
|
||||||
servers?: Array<string>;
|
servers?: Array<string>;
|
||||||
}): any;
|
}): any;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.rest_caldav {
|
declare namespace lib_plankton.rest_http {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
type type_oas_schema = lib_plankton.rest_base.type_oas_schema;
|
type type_oas_schema = lib_plankton.rest_base.type_oas_schema;
|
||||||
|
|
@ -4306,7 +4009,7 @@ declare namespace lib_plankton.rest_caldav {
|
||||||
*/
|
*/
|
||||||
type type_rest = lib_plankton.rest_base.type_rest;
|
type type_rest = lib_plankton.rest_base.type_rest;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.rest_caldav {
|
declare namespace lib_plankton.rest_http {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function make(options?: {
|
function make(options?: {
|
||||||
|
|
@ -4330,25 +4033,25 @@ declare namespace lib_plankton.rest_caldav {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
actions?: Array<{
|
actions?: Array<{
|
||||||
http_method: lib_plankton.caldav.enum_method;
|
http_method: lib_plankton.http.enum_method;
|
||||||
path: string;
|
path: string;
|
||||||
options: lib_plankton.rest_base.type_action_options<any, any>;
|
options: lib_plankton.rest_base.type_action_options<any, any>;
|
||||||
}>;
|
}>;
|
||||||
}): type_rest;
|
}): type_rest;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
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;
|
function register<type_input, type_output>(rest: type_rest, http_method: lib_plankton.http.enum_method, path: string, options: lib_plankton.rest_base.type_action_options<type_input, type_output>): void;
|
||||||
/**
|
/**
|
||||||
* @todo check request body mimetype?
|
* @todo check request body mimetype?
|
||||||
* @todo check query paramater validity
|
* @todo check query paramater validity
|
||||||
* @todo improve status code mapping
|
* @todo improve status code mapping
|
||||||
*/
|
*/
|
||||||
function call(rest: type_rest, http_request: lib_plankton.caldav.type_request, { "checklevel_restriction": option_checklevel_restriction, "checklevel_input": option_checklevel_input, "checklevel_output": option_checklevel_output, "set_content_length": option_set_content_length, }?: {
|
function call(rest: type_rest, http_request: lib_plankton.http.type_request, { "checklevel_restriction": option_checklevel_restriction, "checklevel_input": option_checklevel_input, "checklevel_output": option_checklevel_output, "set_content_length": option_set_content_length, }?: {
|
||||||
checklevel_restriction?: lib_plankton.api.enum_checklevel;
|
checklevel_restriction?: lib_plankton.api.enum_checklevel;
|
||||||
checklevel_input?: lib_plankton.api.enum_checklevel;
|
checklevel_input?: lib_plankton.api.enum_checklevel;
|
||||||
checklevel_output?: lib_plankton.api.enum_checklevel;
|
checklevel_output?: lib_plankton.api.enum_checklevel;
|
||||||
set_content_length?: boolean;
|
set_content_length?: boolean;
|
||||||
}): Promise<lib_plankton.caldav.type_response>;
|
}): Promise<lib_plankton.http.type_response>;
|
||||||
/**
|
/**
|
||||||
* @see https://swagger.io/specification/#openrest-object
|
* @see https://swagger.io/specification/#openrest-object
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_add(
|
export function register_calendar_add(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
@ -29,10 +29,9 @@ namespace _zeitbild.api
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
{
|
{
|
||||||
kind : "caldav";
|
kind : "ics_feed";
|
||||||
data : {
|
data : {
|
||||||
url : string;
|
url : string;
|
||||||
read_only : boolean;
|
|
||||||
from_fucked_up_wordpress : boolean;
|
from_fucked_up_wordpress : boolean;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +63,8 @@ namespace _zeitbild.api
|
||||||
else {
|
else {
|
||||||
// TODO move logic to calendar service
|
// TODO move logic to calendar service
|
||||||
let resource_object : _zeitbild.type_resource_object;
|
let resource_object : _zeitbild.type_resource_object;
|
||||||
switch (stuff.input.resource.kind) {
|
switch (stuff.input.resource.kind)
|
||||||
|
{
|
||||||
case "local": {
|
case "local": {
|
||||||
resource_object = {
|
resource_object = {
|
||||||
"kind": "local",
|
"kind": "local",
|
||||||
|
|
@ -74,12 +74,11 @@ namespace _zeitbild.api
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
resource_object = {
|
resource_object = {
|
||||||
"kind": "caldav",
|
"kind": "ics_feed",
|
||||||
"data": {
|
"data": {
|
||||||
"url": stuff.input.resource.data.url,
|
"url": stuff.input.resource.data.url,
|
||||||
"read_only": stuff.input.resource.data.read_only,
|
|
||||||
"from_fucked_up_wordpress": stuff.input.resource.data.from_fucked_up_wordpress,
|
"from_fucked_up_wordpress": stuff.input.resource.data.from_fucked_up_wordpress,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_change(
|
export function register_calendar_change(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_event_add(
|
export function register_calendar_event_add(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_event_change(
|
export function register_calendar_event_change(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_event_get(
|
export function register_calendar_event_get(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_event_remove(
|
export function register_calendar_event_remove(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_get(
|
export function register_calendar_get(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_list(
|
export function register_calendar_list(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_calendar_remove(
|
export function register_calendar_remove(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_events(
|
export function register_events(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_export_ics(
|
export function register_export_ics(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_meta_ping(
|
export function register_meta_ping(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
lib_plankton.rest_caldav.register<
|
lib_plankton.rest_http.register<
|
||||||
null,
|
null,
|
||||||
string
|
string
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_meta_spec(
|
export function register_meta_spec(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
lib_plankton.rest_caldav.register<
|
lib_plankton.rest_http.register<
|
||||||
null,
|
null,
|
||||||
any
|
any
|
||||||
>
|
>
|
||||||
|
|
@ -27,7 +27,7 @@ namespace _zeitbild.api
|
||||||
"execution": () => () => {
|
"execution": () => () => {
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": lib_plankton.rest_caldav.to_oas(rest_subject),
|
"data": lib_plankton.rest_http.to_oas(rest_subject),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_session_begin(
|
export function register_session_begin(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
lib_plankton.rest_caldav.register<
|
lib_plankton.rest_http.register<
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
password : string;
|
password : string;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_session_end(
|
export function register_session_end(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<null, null>(
|
register<null, null>(
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_session_oidc(
|
export function register_session_oidc(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_session_prepare(
|
export function register_session_prepare(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
lib_plankton.rest_caldav.register<
|
lib_plankton.rest_http.register<
|
||||||
any,
|
any,
|
||||||
{
|
{
|
||||||
kind : string;
|
kind : string;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register_users(
|
export function register_users(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
register<
|
register<
|
||||||
|
|
|
||||||
|
|
@ -126,14 +126,14 @@ namespace _zeitbild.api
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export const restriction_none : lib_plankton.rest_caldav.type_restriction<any> = (
|
export const restriction_none : lib_plankton.rest_http.type_restriction<any> = (
|
||||||
(stuff) => Promise.resolve<boolean>(true)
|
(stuff) => Promise.resolve<boolean>(true)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export const restriction_web_auth : lib_plankton.rest_caldav.type_restriction<any> = (
|
export const restriction_web_auth : lib_plankton.rest_http.type_restriction<any> = (
|
||||||
stuff => (
|
stuff => (
|
||||||
user_from_web_auth(stuff)
|
user_from_web_auth(stuff)
|
||||||
.then(() => Promise.resolve<boolean>(true))
|
.then(() => Promise.resolve<boolean>(true))
|
||||||
|
|
@ -144,7 +144,7 @@ namespace _zeitbild.api
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export const restriction_logged_in : lib_plankton.rest_caldav.type_restriction<any> = (
|
export const restriction_logged_in : lib_plankton.rest_http.type_restriction<any> = (
|
||||||
(stuff) => (
|
(stuff) => (
|
||||||
session_from_stuff(stuff)
|
session_from_stuff(stuff)
|
||||||
.then(() => Promise.resolve<boolean>(true))
|
.then(() => Promise.resolve<boolean>(true))
|
||||||
|
|
@ -156,13 +156,13 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function register<type_input, type_output>(
|
export function register<type_input, type_output>(
|
||||||
rest_subject : lib_plankton.rest_caldav.type_rest,
|
rest_subject : lib_plankton.rest_http.type_rest,
|
||||||
http_method : lib_plankton.caldav.enum_method,
|
http_method : lib_plankton.http.enum_method,
|
||||||
path : string,
|
path : string,
|
||||||
options : {
|
options : {
|
||||||
active ?: ((version : (null | string)) => boolean);
|
active ?: ((version : (null | string)) => boolean);
|
||||||
restriction ?: (null | lib_plankton.rest_caldav.type_restriction<type_input>);
|
restriction ?: (null | lib_plankton.rest_http.type_restriction<type_input>);
|
||||||
execution ?: lib_plankton.rest_caldav.type_execution<type_input, type_output>;
|
execution ?: lib_plankton.rest_http.type_execution<type_input, type_output>;
|
||||||
title ?: (null | string);
|
title ?: (null | string);
|
||||||
description ?: (null | string);
|
description ?: (null | string);
|
||||||
query_parameters ?: ((version : (null | string)) => Array<
|
query_parameters ?: ((version : (null | string)) => Array<
|
||||||
|
|
@ -172,8 +172,8 @@ namespace _zeitbild.api
|
||||||
required : boolean;
|
required : boolean;
|
||||||
}
|
}
|
||||||
>);
|
>);
|
||||||
input_schema ?: ((version: (null | string)) => lib_plankton.rest_caldav.type_oas_schema);
|
input_schema ?: ((version: (null | string)) => lib_plankton.rest_http.type_oas_schema);
|
||||||
output_schema ?: ((version: (null | string)) => lib_plankton.rest_caldav.type_oas_schema);
|
output_schema ?: ((version: (null | string)) => lib_plankton.rest_http.type_oas_schema);
|
||||||
request_body_mimetype ?: (
|
request_body_mimetype ?: (
|
||||||
(version : (null | string))
|
(version : (null | string))
|
||||||
=>
|
=>
|
||||||
|
|
@ -200,7 +200,7 @@ namespace _zeitbild.api
|
||||||
},
|
},
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
lib_plankton.rest_caldav.register<type_input, type_output>(
|
lib_plankton.rest_http.register<type_input, type_output>(
|
||||||
rest_subject,
|
rest_subject,
|
||||||
http_method,
|
http_method,
|
||||||
(_zeitbild.conf.get().server.path_base + path),
|
(_zeitbild.conf.get().server.path_base + path),
|
||||||
|
|
@ -214,7 +214,7 @@ namespace _zeitbild.api
|
||||||
?
|
?
|
||||||
undefined
|
undefined
|
||||||
:
|
:
|
||||||
(version) => (options.restriction as lib_plankton.rest_caldav.type_restriction<type_input>)
|
(version) => (options.restriction as lib_plankton.rest_http.type_restriction<type_input>)
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
* @todo heed version
|
* @todo heed version
|
||||||
|
|
@ -224,7 +224,7 @@ namespace _zeitbild.api
|
||||||
?
|
?
|
||||||
undefined
|
undefined
|
||||||
:
|
:
|
||||||
(version) => (options.execution as lib_plankton.rest_caldav.type_execution<type_input, type_output>)
|
(version) => (options.execution as lib_plankton.rest_http.type_execution<type_input, type_output>)
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
* @todo heed version
|
* @todo heed version
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ namespace _zeitbild.api
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function make(
|
export function make(
|
||||||
) : lib_plankton.rest_caldav.type_rest
|
) : lib_plankton.rest_http.type_rest
|
||||||
{
|
{
|
||||||
const rest_subject : lib_plankton.rest_caldav.type_rest = lib_plankton.rest_caldav.make(
|
const rest_subject : lib_plankton.rest_http.type_rest = lib_plankton.rest_http.make(
|
||||||
{
|
{
|
||||||
"title": "zeitbild",
|
"title": "zeitbild",
|
||||||
"versioning_method": "header",
|
"versioning_method": "header",
|
||||||
|
|
@ -56,7 +56,6 @@ namespace _zeitbild.api
|
||||||
_zeitbild.api.register_events(rest_subject);
|
_zeitbild.api.register_events(rest_subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return rest_subject;
|
return rest_subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace _zeitbild.api
|
||||||
options : {
|
options : {
|
||||||
nullable ?: boolean;
|
nullable ?: boolean;
|
||||||
} = {}
|
} = {}
|
||||||
) : lib_plankton.rest_caldav.type_oas_schema
|
) : lib_plankton.rest_http.type_oas_schema
|
||||||
{
|
{
|
||||||
options = Object.assign(
|
options = Object.assign(
|
||||||
{
|
{
|
||||||
|
|
@ -49,7 +49,7 @@ namespace _zeitbild.api
|
||||||
options : {
|
options : {
|
||||||
nullable ?: boolean;
|
nullable ?: boolean;
|
||||||
} = {}
|
} = {}
|
||||||
) : lib_plankton.rest_caldav.type_oas_schema
|
) : lib_plankton.rest_http.type_oas_schema
|
||||||
{
|
{
|
||||||
options = Object.assign(
|
options = Object.assign(
|
||||||
{
|
{
|
||||||
|
|
@ -90,7 +90,7 @@ namespace _zeitbild.api
|
||||||
options : {
|
options : {
|
||||||
nullable ?: boolean;
|
nullable ?: boolean;
|
||||||
} = {}
|
} = {}
|
||||||
) : lib_plankton.rest_caldav.type_oas_schema
|
) : lib_plankton.rest_http.type_oas_schema
|
||||||
{
|
{
|
||||||
options = Object.assign(
|
options = Object.assign(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,9 @@ type type_data = {
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
{
|
{
|
||||||
kind : "caldav";
|
kind : "ics_feed";
|
||||||
data : {
|
data : {
|
||||||
url : string;
|
url : string;
|
||||||
read_only : boolean;
|
|
||||||
from_fucked_up_wordpress ?: boolean;
|
from_fucked_up_wordpress ?: boolean;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +68,8 @@ async function data_init(
|
||||||
"user": {},
|
"user": {},
|
||||||
"calendar": {},
|
"calendar": {},
|
||||||
};
|
};
|
||||||
for await (const user_raw of data.users) {
|
for await (const user_raw of data.users)
|
||||||
|
{
|
||||||
const user_object : _zeitbild.type_user_object = {
|
const user_object : _zeitbild.type_user_object = {
|
||||||
"name": user_raw.name,
|
"name": user_raw.name,
|
||||||
"email_address": user_raw.email_address,
|
"email_address": user_raw.email_address,
|
||||||
|
|
@ -84,11 +84,14 @@ async function data_init(
|
||||||
);
|
);
|
||||||
track.user[user_raw.id] = user_id;
|
track.user[user_raw.id] = user_id;
|
||||||
}
|
}
|
||||||
for await (const calendar_raw of data.calendars) {
|
for await (const calendar_raw of data.calendars)
|
||||||
|
{
|
||||||
let resource_object : _zeitbild.type_resource_object;
|
let resource_object : _zeitbild.type_resource_object;
|
||||||
let resource_id : _zeitbild.type_resource_id;
|
let resource_id : _zeitbild.type_resource_id;
|
||||||
switch (calendar_raw.resource.kind) {
|
switch (calendar_raw.resource.kind)
|
||||||
case "local": {
|
{
|
||||||
|
case "local":
|
||||||
|
{
|
||||||
resource_object = {
|
resource_object = {
|
||||||
"kind": "local",
|
"kind": "local",
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -106,12 +109,12 @@ async function data_init(
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed":
|
||||||
|
{
|
||||||
resource_object = {
|
resource_object = {
|
||||||
"kind": "caldav",
|
"kind": "ics_feed",
|
||||||
"data": {
|
"data": {
|
||||||
"url": calendar_raw.resource.data.url,
|
"url": calendar_raw.resource.data.url,
|
||||||
"read_only": calendar_raw.resource.data.read_only,
|
|
||||||
"from_fucked_up_wordpress": (calendar_raw.resource.data.from_fucked_up_wordpress ?? false),
|
"from_fucked_up_wordpress": (calendar_raw.resource.data.from_fucked_up_wordpress ?? false),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -121,7 +124,8 @@ async function data_init(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const calendar_object : _zeitbild.type_calendar_object = {
|
const calendar_object : _zeitbild.type_calendar_object =
|
||||||
|
{
|
||||||
"name": calendar_raw.name,
|
"name": calendar_raw.name,
|
||||||
"access": {
|
"access": {
|
||||||
"public": (calendar_raw.access.public ?? false),
|
"public": (calendar_raw.access.public ?? false),
|
||||||
|
|
@ -379,10 +383,10 @@ async function main(
|
||||||
}
|
}
|
||||||
case "api-doc": {
|
case "api-doc": {
|
||||||
lib_plankton.log.set_main_logger([]);
|
lib_plankton.log.set_main_logger([]);
|
||||||
const rest_subject : lib_plankton.rest_caldav.type_rest = _zeitbild.api.make();
|
const rest_subject : lib_plankton.rest_http.type_rest = _zeitbild.api.make();
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
lib_plankton.rest_caldav.to_oas(rest_subject),
|
lib_plankton.rest_http.to_oas(rest_subject),
|
||||||
undefined,
|
undefined,
|
||||||
"\t"
|
"\t"
|
||||||
)
|
)
|
||||||
|
|
@ -434,11 +438,11 @@ async function main(
|
||||||
|
|
||||||
await _zeitbild.auth.init();
|
await _zeitbild.auth.init();
|
||||||
|
|
||||||
const rest_subject : lib_plankton.rest_caldav.type_rest = _zeitbild.api.make();
|
const rest_subject : lib_plankton.rest_http.type_rest = _zeitbild.api.make();
|
||||||
const server : lib_plankton.server.type_subject = lib_plankton.server.make(
|
const server : lib_plankton.server.type_subject = lib_plankton.server.make(
|
||||||
async (input, metadata) => {
|
async (input, metadata) => {
|
||||||
const http_request : lib_plankton.caldav.type_request = lib_plankton.caldav.decode_request(input.toString());
|
const http_request : lib_plankton.http.type_request = lib_plankton.http.decode_request(input.toString());
|
||||||
const http_response : lib_plankton.caldav.type_response = await lib_plankton.rest_caldav.call(
|
const http_response : lib_plankton.http.type_response = await lib_plankton.rest_http.call(
|
||||||
rest_subject,
|
rest_subject,
|
||||||
http_request,
|
http_request,
|
||||||
{
|
{
|
||||||
|
|
@ -448,7 +452,7 @@ async function main(
|
||||||
"set_content_length": false,
|
"set_content_length": false,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const output : string = lib_plankton.caldav.encode_response(http_response);
|
const output : string = lib_plankton.http.encode_response(http_response);
|
||||||
return output;
|
return output;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace _zeitbild.repository.resource
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
var _caldav_resource_store : (
|
var _ics_feed_resource_store : (
|
||||||
null
|
null
|
||||||
|
|
|
|
||||||
lib_plankton.storage.type_store<
|
lib_plankton.storage.type_store<
|
||||||
|
|
@ -126,7 +126,7 @@ namespace _zeitbild.repository.resource
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function get_caldav_resource_store(
|
function get_ics_feed_resource_store(
|
||||||
) : lib_plankton.storage.type_store<
|
) : lib_plankton.storage.type_store<
|
||||||
int,
|
int,
|
||||||
Record<string, any>,
|
Record<string, any>,
|
||||||
|
|
@ -135,11 +135,11 @@ namespace _zeitbild.repository.resource
|
||||||
Record<string, any>
|
Record<string, any>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
if (_caldav_resource_store === null) {
|
if (_ics_feed_resource_store === null) {
|
||||||
_caldav_resource_store = lib_plankton.storage.sql_table_autokey_store(
|
_ics_feed_resource_store = lib_plankton.storage.sql_table_autokey_store(
|
||||||
{
|
{
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
"database_implementation": _zeitbild.database.get_implementation(),
|
||||||
"table_name": "caldav_resources",
|
"table_name": "ics_feed_resources",
|
||||||
"key_name": "id",
|
"key_name": "id",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -147,7 +147,7 @@ namespace _zeitbild.repository.resource
|
||||||
else {
|
else {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
return _caldav_resource_store;
|
return _ics_feed_resource_store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -358,15 +358,14 @@ namespace _zeitbild.repository.resource
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
const dataset_extra_caldav : Record<string, any> = await get_caldav_resource_store().read(dataset_core.sub_id);
|
const dataset_extra_ics_feed : Record<string, any> = await get_ics_feed_resource_store().read(dataset_core.sub_id);
|
||||||
return Promise.resolve<_zeitbild.type_resource_object>(
|
return Promise.resolve<_zeitbild.type_resource_object>(
|
||||||
{
|
{
|
||||||
"kind": "caldav",
|
"kind": "ics_feed",
|
||||||
"data": {
|
"data": {
|
||||||
"url": dataset_extra_caldav["url"],
|
"url": dataset_extra_ics_feed["url"],
|
||||||
"read_only": dataset_extra_caldav["read_only"],
|
"from_fucked_up_wordpress": dataset_extra_ics_feed["from_fucked_up_wordpress"],
|
||||||
"from_fucked_up_wordpress": dataset_extra_caldav["from_fucked_up_wordpress"],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -405,18 +404,17 @@ namespace _zeitbild.repository.resource
|
||||||
return Promise.resolve<_zeitbild.type_resource_id>(resource_id);
|
return Promise.resolve<_zeitbild.type_resource_id>(resource_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
const caldav_resource_id : int = await get_caldav_resource_store().create(
|
const ics_feed_resource_id : int = await get_ics_feed_resource_store().create(
|
||||||
{
|
{
|
||||||
"url": resource_object.data.url,
|
"url": resource_object.data.url,
|
||||||
"read_only": resource_object.data.read_only,
|
|
||||||
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
|
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const resource_id : _zeitbild.type_resource_id = await get_resource_core_store().create(
|
const resource_id : _zeitbild.type_resource_id = await get_resource_core_store().create(
|
||||||
{
|
{
|
||||||
"kind": "caldav",
|
"kind": "ics_feed",
|
||||||
"sub_id": caldav_resource_id,
|
"sub_id": ics_feed_resource_id,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
||||||
|
|
@ -491,12 +489,12 @@ namespace _zeitbild.repository.resource
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
await get_caldav_resource_store().update(
|
await get_ics_feed_resource_store().update(
|
||||||
dataset_core["sub_id"],
|
dataset_core["sub_id"],
|
||||||
{
|
{
|
||||||
"url": resource_object.data.url,
|
"url": resource_object.data.url,
|
||||||
"read_only": resource_object.data.read_only,
|
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
||||||
|
|
|
||||||
|
|
@ -1,511 +0,0 @@
|
||||||
|
|
||||||
namespace _zeitbild.service.caldav
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function get_answers(
|
|
||||||
) : Record<
|
|
||||||
string,
|
|
||||||
(stuff : any) => lib_plankton.webdav.type_data_prop_value
|
|
||||||
>
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
// RFC2518
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc2518#section-13.2
|
|
||||||
*/
|
|
||||||
"displayname": (stuff) => ({
|
|
||||||
"kind": "primitive",
|
|
||||||
"data": stuff["name"]
|
|
||||||
}),
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc2518#section-13.4
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
"getcontentlength": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc2518#section-13.5
|
|
||||||
*/
|
|
||||||
"getcontenttype": (stuff) => ({
|
|
||||||
"kind": "primitive",
|
|
||||||
"data": stuff["content_type"]
|
|
||||||
}),
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc2518#section-13.7
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
"getlastmodified": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc2518#section-13.9
|
|
||||||
*/
|
|
||||||
"resourcetype": (stuff) => ({
|
|
||||||
"kind": "resourcetype",
|
|
||||||
"data": {
|
|
||||||
"kind": "collection",
|
|
||||||
"type": "calendar",
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
// RFCP3744
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc3744#section-4.2
|
|
||||||
*/
|
|
||||||
"principal-url": (stuff) => ({
|
|
||||||
"kind": "href",
|
|
||||||
"data": "/caldav"
|
|
||||||
}),
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc3744#section-5.1
|
|
||||||
*/
|
|
||||||
"owner": (stuff) => ({
|
|
||||||
"kind": "primitive",
|
|
||||||
"data": ""
|
|
||||||
}),
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc3744#section-5.4
|
|
||||||
*/
|
|
||||||
"current-user-privilege-set": (stuff) => ({
|
|
||||||
"kind": "privileges",
|
|
||||||
"data": [
|
|
||||||
"read"
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
|
|
||||||
// RFC4791
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc4791#section-5.2.3
|
|
||||||
*/
|
|
||||||
"supported-calendar-component-set": (stuff) => ({
|
|
||||||
"kind": "component_set",
|
|
||||||
"data": {
|
|
||||||
"name": "C:supported-calendar-component-set",
|
|
||||||
"items": [
|
|
||||||
"VCALENDAR"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc4791#section-6.2.1
|
|
||||||
*/
|
|
||||||
"calendar-home-set": (stuff) => ({
|
|
||||||
"kind": "href",
|
|
||||||
"data": "/caldav/project"
|
|
||||||
}),
|
|
||||||
|
|
||||||
// RFC4918
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc4918#section-15.6
|
|
||||||
*/
|
|
||||||
"getetag": (stuff) => ({
|
|
||||||
"kind": "primitive",
|
|
||||||
"data": ""
|
|
||||||
}),
|
|
||||||
|
|
||||||
// RFC5397
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc5397#section-3
|
|
||||||
*/
|
|
||||||
"current-user-principal": (stuff) => ({
|
|
||||||
"kind": "href",
|
|
||||||
"data": "/caldav"
|
|
||||||
}),
|
|
||||||
|
|
||||||
// RFC6638
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see https://datatracker.ietf.org/doc/html/rfc6638#section-2.4.1
|
|
||||||
*/
|
|
||||||
"calendar-user-address-set": (stuff) => ({
|
|
||||||
"kind": "primitive",
|
|
||||||
"data": ""
|
|
||||||
}),
|
|
||||||
|
|
||||||
// unknown
|
|
||||||
|
|
||||||
/*
|
|
||||||
"calendar-color": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null
|
|
||||||
},
|
|
||||||
"executable": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null
|
|
||||||
},
|
|
||||||
"checked-in": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null
|
|
||||||
},
|
|
||||||
"checked-out": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo use pod for output
|
|
||||||
* @todo get api paths in props from config
|
|
||||||
* @todo consider to outsorce to plankton
|
|
||||||
*/
|
|
||||||
export function probe(
|
|
||||||
input : (null | lib_plankton.xml.type_node_data),
|
|
||||||
{
|
|
||||||
"force_props": force_props = null,
|
|
||||||
} : {
|
|
||||||
force_props ?: (null | Array<string>);
|
|
||||||
} = {
|
|
||||||
}
|
|
||||||
) : (null | lib_plankton.xml.type_node_data)
|
|
||||||
{
|
|
||||||
const http_protocol : string = "HTTP/1.1";
|
|
||||||
let props : (null | Array<string>);
|
|
||||||
if (force_props) {
|
|
||||||
props = force_props;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (
|
|
||||||
(input !== null)
|
|
||||||
&&
|
|
||||||
(input.kind === "complex")
|
|
||||||
&&
|
|
||||||
(
|
|
||||||
(input.data.tag.toLowerCase() === "d:propfind")
|
|
||||||
||
|
|
||||||
(input.data.tag.toLowerCase() === "propfind")
|
|
||||||
)
|
|
||||||
&&
|
|
||||||
(input.data.children.length === 1)
|
|
||||||
&&
|
|
||||||
(input.data.children[0].kind === "complex")
|
|
||||||
&&
|
|
||||||
(
|
|
||||||
(input.data.children[0].data.tag.toLowerCase() === "d:prop")
|
|
||||||
||
|
|
||||||
(input.data.children[0].data.tag.toLowerCase() === "prop")
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
props = input.data.children[0].data.children.map(
|
|
||||||
node => {
|
|
||||||
switch (node.kind) {
|
|
||||||
case "complex": {
|
|
||||||
return node.data.tag;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
throw (new Error("unexpected node type for prop"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
props.sort();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
props = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (props === null) {
|
|
||||||
lib_plankton.log.notice(
|
|
||||||
"service.caldav.probe.unexpected_input",
|
|
||||||
{
|
|
||||||
"input": input,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const answers : Record<
|
|
||||||
string,
|
|
||||||
(stuff : any) => lib_plankton.webdav.type_data_prop_value
|
|
||||||
> = get_answers();
|
|
||||||
return {
|
|
||||||
"kind": "root",
|
|
||||||
"data": {
|
|
||||||
"version": "1.0",
|
|
||||||
"encoding": "utf-8",
|
|
||||||
"content": lib_plankton.webdav.data_multistatus_encode_xml(
|
|
||||||
{
|
|
||||||
"responses": [
|
|
||||||
{
|
|
||||||
"href": "/caldav/project",
|
|
||||||
"body": {
|
|
||||||
/**
|
|
||||||
* @todo maybe propstats needs to be filled with props (.map …)
|
|
||||||
*/
|
|
||||||
"propstats": (
|
|
||||||
false
|
|
||||||
?
|
|
||||||
// probably the wrong way
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"prop": (props ?? []).map(
|
|
||||||
(prop) => {
|
|
||||||
const prop_parts : Array<string> = prop.toLowerCase().split(":");
|
|
||||||
const prop_normalized : string = ((prop_parts.length <= 1) ? prop_parts[0] : prop_parts.slice(1).join(":"));
|
|
||||||
if (! (prop_normalized in answers)) {
|
|
||||||
lib_plankton.log.error(
|
|
||||||
"api.caldav_probe.unhandled_prop",
|
|
||||||
prop_normalized
|
|
||||||
);
|
|
||||||
throw (new Error("unhandled prop: " + prop_normalized));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return {
|
|
||||||
"name": prop,
|
|
||||||
"value": (
|
|
||||||
answers[prop_normalized]({"name": "projects", "content_type": "text/xml"})
|
|
||||||
??
|
|
||||||
{
|
|
||||||
"kind": "none",
|
|
||||||
"data": null,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
"status": (http_protocol + " 200 OK"),
|
|
||||||
"description": null,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
:
|
|
||||||
// probably the right way
|
|
||||||
props.map(
|
|
||||||
(prop) => {
|
|
||||||
const prop_parts : Array<string> = prop.toLowerCase().split(":");
|
|
||||||
const prop_normalized : string = (
|
|
||||||
(prop_parts.length <= 1)
|
|
||||||
?
|
|
||||||
prop_parts[0]
|
|
||||||
:
|
|
||||||
prop_parts.slice(1).join(":")
|
|
||||||
);
|
|
||||||
if (! (prop_normalized in answers)) {
|
|
||||||
lib_plankton.log.notice(
|
|
||||||
"api.caldav_probe.unhandled_prop",
|
|
||||||
prop_normalized
|
|
||||||
);
|
|
||||||
/*
|
|
||||||
throw (new Error("unhandled prop: " + prop_normalized));
|
|
||||||
*/
|
|
||||||
return {
|
|
||||||
"prop": [
|
|
||||||
{
|
|
||||||
"name": prop,
|
|
||||||
"value": {
|
|
||||||
"kind": "none",
|
|
||||||
"data": null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"status": (http_protocol + " 404 Not Found"),
|
|
||||||
"description": null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return {
|
|
||||||
"prop": [
|
|
||||||
{
|
|
||||||
"name": prop,
|
|
||||||
"value": answers[prop_normalized]({"name": "projects", "content_type": "text/xml"}),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"status": (http_protocol + " 200 OK"),
|
|
||||||
"description": null,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
"description": null,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": null,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo heed input properly
|
|
||||||
*/
|
|
||||||
export function projects(
|
|
||||||
input : lib_plankton.xml.type_node_data,
|
|
||||||
user_id : type_user_id
|
|
||||||
) : Promise<lib_plankton.xml.type_node_data>
|
|
||||||
{
|
|
||||||
const http_protocol : string = "HTTP/1.1";
|
|
||||||
const answers : Record<
|
|
||||||
string,
|
|
||||||
(stuff : any) => lib_plankton.webdav.type_data_prop_value
|
|
||||||
> = get_answers();
|
|
||||||
/**
|
|
||||||
* @todo remove
|
|
||||||
*/
|
|
||||||
lib_plankton.log.info(
|
|
||||||
"service.caldav.input",
|
|
||||||
input
|
|
||||||
);
|
|
||||||
/**
|
|
||||||
* @todo check data structure
|
|
||||||
*/
|
|
||||||
if (
|
|
||||||
! (
|
|
||||||
(input.kind === "complex")
|
|
||||||
&&
|
|
||||||
(input.data.tag === "propfind")
|
|
||||||
&&
|
|
||||||
(input.data.children.length === 1)
|
|
||||||
&&
|
|
||||||
(input.data.children[0].kind === "complex")
|
|
||||||
&&
|
|
||||||
(input.data.children[0].data.tag === "prop")
|
|
||||||
&&
|
|
||||||
input.data.children[0].data.children.every(
|
|
||||||
node => (node.kind === "complex")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
throw (new Error("wrong input structure"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const props : Array<string> = (
|
|
||||||
input
|
|
||||||
.data.children
|
|
||||||
[0]
|
|
||||||
.data.children
|
|
||||||
.map(
|
|
||||||
(node) => node.data.tag
|
|
||||||
)
|
|
||||||
);
|
|
||||||
/**
|
|
||||||
* @todo remove
|
|
||||||
*/
|
|
||||||
lib_plankton.log.info(
|
|
||||||
"service.caldav.props",
|
|
||||||
props
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
_zeitbild.service.calendar.overview(user_id)
|
|
||||||
.then(
|
|
||||||
(data_raw) => Promise.resolve(
|
|
||||||
data_raw
|
|
||||||
.map(
|
|
||||||
(entry) => ({
|
|
||||||
"id": entry.id,
|
|
||||||
"name": entry.name,
|
|
||||||
"access_level": _zeitbild.value_object.access_level.to_string(entry.access_level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.then(
|
|
||||||
(data) => Promise.resolve(
|
|
||||||
{
|
|
||||||
"kind": "root",
|
|
||||||
"data": {
|
|
||||||
"version": "1.0",
|
|
||||||
"encoding": "utf-8",
|
|
||||||
"content": lib_plankton.webdav.data_multistatus_encode_xml(
|
|
||||||
{
|
|
||||||
"responses": data.map(
|
|
||||||
(entry) => ({
|
|
||||||
"href": lib_plankton.string.coin(
|
|
||||||
"/caldav/project/{{id}}",
|
|
||||||
{
|
|
||||||
"id": entry.id.toFixed(0),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
"body": {
|
|
||||||
"propstats": (
|
|
||||||
lib_plankton.call.wrap<Array<string>>(props)
|
|
||||||
.convey<Array<{found : boolean; prop : lib_plankton.webdav.type_data_prop;}>>(
|
|
||||||
(props_raw) => props_raw.map(
|
|
||||||
(prop_raw) => {
|
|
||||||
const prop_parts : Array<string> = prop_raw.toLowerCase().split(":");
|
|
||||||
const prop_normalized : string = ((prop_parts.length <= 1) ? prop_parts[0] : prop_parts.slice(1).join(":"));
|
|
||||||
return (
|
|
||||||
(prop_normalized in answers)
|
|
||||||
?
|
|
||||||
{
|
|
||||||
"found": true,
|
|
||||||
"prop": {
|
|
||||||
"name": prop_raw,
|
|
||||||
"value": answers[prop_normalized]({"name": entry.name, "content_type": "text/calendar"}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
:
|
|
||||||
{
|
|
||||||
"found": false,
|
|
||||||
"prop": {
|
|
||||||
"name": prop_raw,
|
|
||||||
"value": {"kind": "none", "data": null}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.convey<Array<Array<{found : boolean; prop : lib_plankton.webdav.type_data_prop;}>>>(
|
|
||||||
(props_transformed) => lib_plankton.list.group(
|
|
||||||
props_transformed,
|
|
||||||
(x, y) => (x.found === y.found)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.convey<Array<lib_plankton.webdav.type_data_propstat>>(
|
|
||||||
(props_grouped) => props_grouped.map(
|
|
||||||
group => (
|
|
||||||
group[0].found
|
|
||||||
?
|
|
||||||
{
|
|
||||||
"prop": group.map(member => member.prop),
|
|
||||||
"status": (http_protocol + " 200 OK"),
|
|
||||||
"description": null,
|
|
||||||
}
|
|
||||||
:
|
|
||||||
{
|
|
||||||
"prop": group.map(member => member.prop),
|
|
||||||
"status": (http_protocol + " 404 Not Found"),
|
|
||||||
"description": null,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.cull()
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"description": null,
|
|
||||||
})
|
|
||||||
),
|
|
||||||
"description": null,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -327,7 +327,7 @@ namespace _zeitbild.service.calendar
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
// TODO readonly
|
// TODO readonly
|
||||||
const vcalendar : lib_plankton.ical.type_vcalendar = await lib_plankton.cache.get<lib_plankton.ical.type_vcalendar>(
|
const vcalendar : lib_plankton.ical.type_vcalendar = await lib_plankton.cache.get<lib_plankton.ical.type_vcalendar>(
|
||||||
_zeitbild.cache_external_resources,
|
_zeitbild.cache_external_resources,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace _zeitbild.service.resource
|
||||||
return Promise.resolve<_zeitbild.type_event_object>(event_object);
|
return Promise.resolve<_zeitbild.type_event_object>(event_object);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
// TODO
|
// TODO
|
||||||
return Promise.reject(new Error("not implemented"));
|
return Promise.reject(new Error("not implemented"));
|
||||||
break;
|
break;
|
||||||
|
|
@ -63,14 +63,8 @@ namespace _zeitbild.service.resource
|
||||||
return Promise.resolve<_zeitbild.type_local_resource_event_id>(local_resource_event_id);
|
return Promise.resolve<_zeitbild.type_local_resource_event_id>(local_resource_event_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
if (resource_object.data.read_only) {
|
return Promise.reject(new Error("unavailable"));
|
||||||
return Promise.reject(new Error("can not add event to read only caldav resource"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// TODO
|
|
||||||
return Promise.reject(new Error("not implemented"));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
@ -102,14 +96,8 @@ namespace _zeitbild.service.resource
|
||||||
return Promise.resolve<void>(undefined);
|
return Promise.resolve<void>(undefined);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
if (resource_object.data.read_only) {
|
return Promise.reject(new Error("unavailable"));
|
||||||
return Promise.reject(new Error("can not change event of read only caldav resource"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// TODO
|
|
||||||
return Promise.reject(new Error("not implemented"));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
@ -139,14 +127,8 @@ namespace _zeitbild.service.resource
|
||||||
return Promise.resolve<void>(undefined);
|
return Promise.resolve<void>(undefined);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "caldav": {
|
case "ics_feed": {
|
||||||
if (resource_object.data.read_only) {
|
return Promise.reject(new Error("unavailable"));
|
||||||
return Promise.reject(new Error("can not delete event from read only caldav resource"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// TODO
|
|
||||||
return Promise.reject(new Error("not implemented"));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
|
||||||
|
|
@ -87,13 +87,9 @@ namespace _zeitbild
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
{
|
{
|
||||||
/**
|
kind : "ics_feed";
|
||||||
* @todo rename to "ics_feed" or sth.
|
|
||||||
*/
|
|
||||||
kind : "caldav";
|
|
||||||
data : {
|
data : {
|
||||||
url : string;
|
url : string;
|
||||||
read_only : boolean;
|
|
||||||
from_fucked_up_wordpress : boolean;
|
from_fucked_up_wordpress : boolean;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ ${dir_temp}/zeitbild-unlinked.js: \
|
||||||
${dir_source}/services/user.ts \
|
${dir_source}/services/user.ts \
|
||||||
${dir_source}/services/resource.ts \
|
${dir_source}/services/resource.ts \
|
||||||
${dir_source}/services/calendar.ts \
|
${dir_source}/services/calendar.ts \
|
||||||
${dir_source}/services/caldav.ts \
|
|
||||||
${dir_source}/api/base.ts \
|
${dir_source}/api/base.ts \
|
||||||
${dir_source}/api/transformations/datetime.ts \
|
${dir_source}/api/transformations/datetime.ts \
|
||||||
${dir_source}/api/actions/meta_ping.ts \
|
${dir_source}/api/actions/meta_ping.ts \
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## consts
|
## consts
|
||||||
|
|
||||||
dir=lib/plankton
|
dir=$(pwd)/lib/plankton
|
||||||
|
|
||||||
modules=""
|
modules=""
|
||||||
modules="${modules} base"
|
modules="${modules} base"
|
||||||
|
|
@ -21,12 +21,12 @@ modules="${modules} order"
|
||||||
modules="${modules} ical"
|
modules="${modules} ical"
|
||||||
modules="${modules} url"
|
modules="${modules} url"
|
||||||
modules="${modules} http"
|
modules="${modules} http"
|
||||||
modules="${modules} webdav"
|
# modules="${modules} webdav"
|
||||||
modules="${modules} caldav"
|
# modules="${modules} caldav"
|
||||||
modules="${modules} api"
|
modules="${modules} api"
|
||||||
# modules="${modules} rest_http"
|
modules="${modules} rest_http"
|
||||||
# modules="${modules} rest_webdav"
|
# modules="${modules} rest_webdav"
|
||||||
modules="${modules} rest_caldav"
|
# modules="${modules} rest_caldav"
|
||||||
modules="${modules} server"
|
modules="${modules} server"
|
||||||
modules="${modules} args"
|
modules="${modules} args"
|
||||||
modules="${modules} bcrypt"
|
modules="${modules} bcrypt"
|
||||||
|
|
@ -38,6 +38,13 @@ modules="${modules} sha256"
|
||||||
|
|
||||||
## exec
|
## exec
|
||||||
|
|
||||||
|
mkdir /tmp/sandbox -p
|
||||||
|
cd /tmp/sandbox
|
||||||
|
ptk fetch node ${modules}
|
||||||
|
schwamm --include=plankton.swm.json --output=dump:logic-decl > ${dir}/plankton.d.ts
|
||||||
|
schwamm --include=plankton.swm.json --output=dump:logic-impl > ${dir}/plankton.js
|
||||||
|
exit
|
||||||
|
|
||||||
mkdir -p ${dir}
|
mkdir -p ${dir}
|
||||||
cd ${dir}
|
cd ${dir}
|
||||||
ptk bundle node ${modules}
|
ptk bundle node ${modules}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue