2024-07-02 15:02:35 +02:00
|
|
|
/*
|
|
|
|
|
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
|
|
|
|
<info@greenscale.de>
|
|
|
|
|
|
|
|
|
|
»heimdall« is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
»heimdall« is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with »heimdall«. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2023-06-19 18:40:13 +02:00
|
|
|
namespace _heimdall.notification_kinds.console
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
function parameters_schema(
|
|
|
|
|
) : _heimdall.helpers.json_schema.type_schema
|
|
|
|
|
{
|
|
|
|
|
return {
|
|
|
|
|
"type": "object",
|
|
|
|
|
"additionalProperties": false,
|
|
|
|
|
"properties": {
|
|
|
|
|
},
|
|
|
|
|
"required": [
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
function normalize_order_node(
|
|
|
|
|
node : any
|
|
|
|
|
) : any
|
|
|
|
|
{
|
|
|
|
|
return Object.assign(
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
node
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
function notify(
|
|
|
|
|
parameters : any,
|
|
|
|
|
name : string,
|
|
|
|
|
check : type_check,
|
|
|
|
|
state : type_item_state,
|
|
|
|
|
info : any
|
|
|
|
|
) : Promise<void>
|
|
|
|
|
{
|
|
|
|
|
process.stdout.write(
|
|
|
|
|
lib_plankton.string.coin(
|
|
|
|
|
"[{{title}}] <{{condition}}> {{info}}\n",
|
|
|
|
|
{
|
2023-07-27 17:37:45 +02:00
|
|
|
"title": check.name,
|
2023-06-19 18:40:13 +02:00
|
|
|
"condition": _heimdall.condition_show(state.condition),
|
|
|
|
|
"info": lib_plankton.json.encode(info, true),
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
return Promise.resolve<void>(undefined);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
2023-08-03 08:34:33 +02:00
|
|
|
register_implementation(
|
|
|
|
|
"console",
|
|
|
|
|
{
|
2023-06-19 18:40:13 +02:00
|
|
|
"parameters_schema": parameters_schema,
|
|
|
|
|
"normalize_order_node": normalize_order_node,
|
|
|
|
|
"notify": notify,
|
2023-08-03 08:34:33 +02:00
|
|
|
}
|
|
|
|
|
);
|
2023-06-19 18:40:13 +02:00
|
|
|
|
|
|
|
|
}
|