core/source/logic/serialization/_factory.ts

59 lines
1.3 KiB
TypeScript

/*
This file is part of »mimir«.
Copyright 2025 kcf <fenris@folksprak.org>
»mimir« is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
»mimir« 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with »mimir«. If not, see <http://www.gnu.org/licenses/>.
*/
namespace _mimir.serialization
{
/**
*/
export function get_logic(
concern : _mimir.conf.type_concern
) : type_logic
{
switch (concern.kind)
{
default:
{
throw (new Error("unhandled concern kind: " + concern["kind"]));
break;
}
case "files":
{
return _mimir.serialization.files.logic(
{
"path": concern.parameters.path,
}
);
break;
}
case "postgresql_dump":
{
return _mimir.serialization.postgresql_dump.logic(
{
"credentials": concern.parameters.credentials,
}
);
break;
}
}
}
}