[mod]
This commit is contained in:
parent
944043d873
commit
e552560887
5
lib/plankton/plankton.d.ts
vendored
5
lib/plankton/plankton.d.ts
vendored
|
|
@ -229,9 +229,10 @@ declare namespace lib_plankton.base {
|
||||||
function object_merge(core: Record<string, any>, mantle: Record<string, any>): Record<string, any>;
|
function object_merge(core: Record<string, any>, mantle: Record<string, any>): Record<string, any>;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function buffer_show(buffer: Buffer, { "block_size": option_block_size, "break_char": option_break_char, }?: {
|
function buffer_show(buffer: Buffer, { "block_size": option_block_size, "break_char": option_break_char, "render_readable_characters": render_readable_characters, }?: {
|
||||||
block_size?: int;
|
block_size?: int;
|
||||||
break_char?: string;
|
break_char?: string;
|
||||||
|
render_readable_characters?: boolean;
|
||||||
}): string;
|
}): string;
|
||||||
}
|
}
|
||||||
declare module lib_plankton.pod {
|
declare module lib_plankton.pod {
|
||||||
|
|
@ -4128,7 +4129,7 @@ declare namespace lib_plankton.server {
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function make(handle: ((input: string, metadata?: type_metadata) => Promise<string>), options?: {
|
function make(handle: ((input: string, metadata?: type_metadata) => Promise<string>), { "host": host, "port": port, "threshold": threshold, }?: {
|
||||||
host?: string;
|
host?: string;
|
||||||
port?: int;
|
port?: int;
|
||||||
threshold?: (null | float);
|
threshold?: (null | float);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,14 @@
|
||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"log": [
|
"log": [
|
||||||
|
{
|
||||||
|
"kind": "file",
|
||||||
|
"data": {
|
||||||
|
"path": "/tmp/zeitbild/log.jsonl",
|
||||||
|
"threshold": "info",
|
||||||
|
"format": "jsonl_structured"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"kind": "stdout",
|
"kind": "stdout",
|
||||||
"data": {
|
"data": {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "LV Lampukistan",
|
"name": "LV Lampukistan",
|
||||||
|
"hue": 0.0000,
|
||||||
"access": {
|
"access": {
|
||||||
"public": true,
|
"public": true,
|
||||||
"default_level": "view",
|
"default_level": "view",
|
||||||
|
|
@ -120,6 +121,7 @@
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "KV Zepettel-Region",
|
"name": "KV Zepettel-Region",
|
||||||
|
"hue": 0.3333,
|
||||||
"access": {
|
"access": {
|
||||||
"public": false,
|
"public": false,
|
||||||
"default_level": "view",
|
"default_level": "view",
|
||||||
|
|
@ -191,6 +193,7 @@
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"name": "OV Kawanda",
|
"name": "OV Kawanda",
|
||||||
|
"hue": 0.6667,
|
||||||
"access": {
|
"access": {
|
||||||
"public": false,
|
"public": false,
|
||||||
"default_level": "view",
|
"default_level": "view",
|
||||||
|
|
@ -235,6 +238,7 @@
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"name": "KV Zepettel-Region | intern",
|
"name": "KV Zepettel-Region | intern",
|
||||||
|
"hue": 0.8333,
|
||||||
"access": {
|
"access": {
|
||||||
"public": false,
|
"public": false,
|
||||||
"default_level": "none",
|
"default_level": "none",
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ namespace _zeitbild.api
|
||||||
hue : float;
|
hue : float;
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : ("none" | "view" | "edit" | "admin");
|
default_level : string;
|
||||||
attributed : Array<
|
attributed : Array<
|
||||||
{
|
{
|
||||||
user_id : int;
|
user_id : int;
|
||||||
level : ("none" | "view" | "edit" | "admin");
|
level : string;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,10 @@ namespace _zeitbild.api
|
||||||
register<
|
register<
|
||||||
_zeitbild.type_event_object, // TODO aufdröseln
|
_zeitbild.type_event_object, // TODO aufdröseln
|
||||||
(
|
(
|
||||||
null
|
{
|
||||||
|
local_resource_event_id : (null | int);
|
||||||
|
hash : string;
|
||||||
|
}
|
||||||
|
|
|
|
||||||
string
|
string
|
||||||
)
|
)
|
||||||
|
|
@ -88,10 +91,12 @@ namespace _zeitbild.api
|
||||||
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
||||||
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
||||||
|
|
||||||
if (stuff.input === null) {
|
if (stuff.input === null)
|
||||||
|
{
|
||||||
return Promise.reject(new Error("impossible"));
|
return Promise.reject(new Error("impossible"));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return (
|
return (
|
||||||
_zeitbild.service.calendar.event_add(
|
_zeitbild.service.calendar.event_add(
|
||||||
parseInt(stuff.path_parameters["calendar_id"]),
|
parseInt(stuff.path_parameters["calendar_id"]),
|
||||||
|
|
@ -99,9 +104,9 @@ namespace _zeitbild.api
|
||||||
user_id
|
user_id
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
() => Promise.resolve({
|
(data) => Promise.resolve({
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": null,
|
"data": data,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
// TODO distinguish
|
// TODO distinguish
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,12 @@ namespace _zeitbild.api
|
||||||
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
||||||
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
||||||
|
|
||||||
if (stuff.input === null) {
|
if (stuff.input === null)
|
||||||
|
{
|
||||||
return Promise.reject(new Error("impossible"));
|
return Promise.reject(new Error("impossible"));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return (
|
return (
|
||||||
_zeitbild.service.calendar.event_change(
|
_zeitbild.service.calendar.event_change(
|
||||||
parseInt(stuff.path_parameters["calendar_id"]),
|
parseInt(stuff.path_parameters["calendar_id"]),
|
||||||
|
|
@ -100,17 +102,21 @@ namespace _zeitbild.api
|
||||||
user_id
|
user_id
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
() => Promise.resolve({
|
() => Promise.resolve(
|
||||||
"status_code": 200,
|
{
|
||||||
"data": null,
|
"status_code": 200,
|
||||||
})
|
"data": null,
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
// TODO distinguish
|
// TODO distinguish
|
||||||
.catch(
|
.catch(
|
||||||
(reason) => Promise.resolve({
|
(reason) => Promise.resolve(
|
||||||
"status_code": 403,
|
{
|
||||||
"data": String(reason),
|
"status_code": 403,
|
||||||
})
|
"data": String(reason),
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ namespace _zeitbild.api
|
||||||
name : string;
|
name : string;
|
||||||
hue : float;
|
hue : float;
|
||||||
access : {
|
access : {
|
||||||
|
public : boolean;
|
||||||
default_level : string;
|
default_level : string;
|
||||||
attributed : Array<
|
attributed : Array<
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ namespace _zeitbild.api
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
logged_in : boolean;
|
logged_in : boolean;
|
||||||
|
name : (null | string);
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
rest_subject,
|
rest_subject,
|
||||||
|
|
@ -47,9 +48,14 @@ namespace _zeitbild.api
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
},
|
},
|
||||||
|
"name": {
|
||||||
|
"nullable": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"logged_in",
|
"logged_in",
|
||||||
|
"name",
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
"restriction": restriction_none,
|
"restriction": restriction_none,
|
||||||
|
|
@ -64,11 +70,19 @@ namespace _zeitbild.api
|
||||||
)
|
)
|
||||||
.catch(x => Promise.resolve(null))
|
.catch(x => Promise.resolve(null))
|
||||||
);
|
);
|
||||||
|
const user_object : (null | _zeitbild.type_user_object) = (
|
||||||
|
(user_id === null)
|
||||||
|
?
|
||||||
|
null
|
||||||
|
:
|
||||||
|
await _zeitbild.service.user.get(user_id)
|
||||||
|
);
|
||||||
return Promise.resolve(
|
return Promise.resolve(
|
||||||
{
|
{
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": {
|
"data": {
|
||||||
"logged_in": (user_id !== null),
|
"logged_in": (user_id !== null),
|
||||||
|
"name": ((user_object === null) ? null : user_object.name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,51 @@ namespace _zeitbild.conf
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"kind": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["file"]
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"threshold": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"notice",
|
||||||
|
"warning",
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"default": "info"
|
||||||
|
},
|
||||||
|
"format": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"human_readable",
|
||||||
|
"jsonl",
|
||||||
|
"jsonl_structured",
|
||||||
|
],
|
||||||
|
"default": "human_readable",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": [
|
"default": [
|
||||||
|
|
@ -291,7 +335,8 @@ namespace _zeitbild.conf
|
||||||
"url_token",
|
"url_token",
|
||||||
"url_userinfo",
|
"url_userinfo",
|
||||||
"client_id",
|
"client_id",
|
||||||
"client_secret"
|
"client_secret",
|
||||||
|
"backend_url_base"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,46 @@ async function main(
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "file": {
|
||||||
|
return {
|
||||||
|
"kind": "minlevel",
|
||||||
|
"data": {
|
||||||
|
"core": {
|
||||||
|
"kind": "file",
|
||||||
|
"data": {
|
||||||
|
"path": log_output.data.path,
|
||||||
|
"format": lib_plankton.call.distinguish(
|
||||||
|
{
|
||||||
|
"kind": log_output.data.format,
|
||||||
|
"data": null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jsonl": () => ({
|
||||||
|
"kind": "jsonl",
|
||||||
|
"data": {
|
||||||
|
"structured": false,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
"jsonl_structured": () => ({
|
||||||
|
"kind": "jsonl",
|
||||||
|
"data": {
|
||||||
|
"structured": true,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
"human_readable": () => ({
|
||||||
|
"kind": "human_readable",
|
||||||
|
"data": {
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"threshold": log_output.data.threshold,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
throw (new Error("unhandled"));
|
throw (new Error("unhandled"));
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,7 @@ namespace _zeitbild.repository.calendar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function read(
|
export function read(
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace _zeitbild.service.calendar
|
||||||
return _zeitbild.repository.calendar.overview(user_id);
|
return _zeitbild.repository.calendar.overview(user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export async function get(
|
export async function get(
|
||||||
|
|
@ -212,21 +212,31 @@ namespace _zeitbild.service.calendar
|
||||||
calendar_id : _zeitbild.type_calendar_id,
|
calendar_id : _zeitbild.type_calendar_id,
|
||||||
event_object : _zeitbild.type_event_object,
|
event_object : _zeitbild.type_event_object,
|
||||||
user_id : _zeitbild.type_user_id
|
user_id : _zeitbild.type_user_id
|
||||||
) : Promise<void>
|
) : Promise<
|
||||||
|
{
|
||||||
|
local_resource_event_id : (null | type_local_resource_event_id);
|
||||||
|
hash : type_event_hash;
|
||||||
|
}
|
||||||
|
>
|
||||||
{
|
{
|
||||||
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(
|
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(
|
||||||
calendar_id
|
calendar_id
|
||||||
);
|
);
|
||||||
return wrap_check_access_level<void>(
|
return wrap_check_access_level(
|
||||||
calendar_object,
|
calendar_object,
|
||||||
user_id,
|
user_id,
|
||||||
_zeitbild.enum_access_level.edit,
|
_zeitbild.enum_access_level.edit,
|
||||||
async () => {
|
async () => {
|
||||||
/*const event_id : _zeitbild.type_local_resource_event_id = */await _zeitbild.service.resource.event_add(
|
const local_resource_event_id : _zeitbild.type_local_resource_event_id = await _zeitbild.service.resource.event_add(
|
||||||
calendar_object.resource_id,
|
calendar_object.resource_id,
|
||||||
event_object
|
event_object
|
||||||
);
|
);
|
||||||
return Promise.resolve<void>(undefined);
|
return Promise.resolve(
|
||||||
|
{
|
||||||
|
"local_resource_event_id": local_resource_event_id,
|
||||||
|
"hash": get_event_hash_local(calendar_id, local_resource_event_id),
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -286,6 +296,45 @@ namespace _zeitbild.service.calendar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function get_event_hash_local(
|
||||||
|
calendar_id : _zeitbild.type_calendar_id,
|
||||||
|
local_resource_event_id : _zeitbild.type_local_resource_event_id
|
||||||
|
) : string
|
||||||
|
{
|
||||||
|
return lib_plankton.string.coin(
|
||||||
|
"{{calendar_id}}:{{event_id}}",
|
||||||
|
{
|
||||||
|
"calendar_id": calendar_id.toFixed(0),
|
||||||
|
"event_id": local_resource_event_id.toFixed(0),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function get_event_hash_ics_feed(
|
||||||
|
calendar_id : _zeitbild.type_calendar_id,
|
||||||
|
event_object : _zeitbild.type_event_object
|
||||||
|
) : string
|
||||||
|
{
|
||||||
|
return lib_plankton.string.coin(
|
||||||
|
"{{calendar_id}}~{{hash}}",
|
||||||
|
{
|
||||||
|
"calendar_id": calendar_id.toFixed(0),
|
||||||
|
"hash": lib_plankton.call.convey(
|
||||||
|
event_object,
|
||||||
|
[
|
||||||
|
(x : any) => lib_plankton.json.encode(x),
|
||||||
|
(x : string) => lib_plankton.base64.encode(x),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo optimize by reducing the number of database queries
|
* @todo optimize by reducing the number of database queries
|
||||||
*/
|
*/
|
||||||
|
|
@ -326,12 +375,9 @@ namespace _zeitbild.service.calendar
|
||||||
(event_object) => Promise.resolve(
|
(event_object) => Promise.resolve(
|
||||||
{
|
{
|
||||||
"id": event_id,
|
"id": event_id,
|
||||||
"hash": lib_plankton.string.coin(
|
"hash": get_event_hash_local(
|
||||||
"{{calendar_id}}:{{event_id}}",
|
calendar_id,
|
||||||
{
|
event_id,
|
||||||
"calendar_id": calendar_id.toFixed(0),
|
|
||||||
"event_id": event_id.toFixed(0),
|
|
||||||
}
|
|
||||||
),
|
),
|
||||||
"object": event_object,
|
"object": event_object,
|
||||||
}
|
}
|
||||||
|
|
@ -457,19 +503,7 @@ namespace _zeitbild.service.calendar
|
||||||
.map(
|
.map(
|
||||||
(event) => ({
|
(event) => ({
|
||||||
"id": null,
|
"id": null,
|
||||||
"hash": lib_plankton.string.coin(
|
"hash": get_event_hash_ics_feed(calendar_id, event),
|
||||||
"{{calendar_id}}~{{hash}}",
|
|
||||||
{
|
|
||||||
"calendar_id": calendar_id.toFixed(0),
|
|
||||||
"hash": lib_plankton.call.convey(
|
|
||||||
event,
|
|
||||||
[
|
|
||||||
(x : any) => lib_plankton.json.encode(x),
|
|
||||||
(x : string) => lib_plankton.base64.encode(x),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
),
|
|
||||||
"object": event,
|
"object": event,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue