mirror of https://github.com/portainer/portainer
18 lines
368 B
TypeScript
18 lines
368 B
TypeScript
|
type TableMeta = {
|
||
|
serviceName: string;
|
||
|
table: 'tasks';
|
||
|
};
|
||
|
|
||
|
export function getTableMeta(meta: unknown): TableMeta {
|
||
|
return isTableMeta(meta) ? meta : { table: 'tasks', serviceName: '' };
|
||
|
}
|
||
|
|
||
|
function isTableMeta(meta: unknown): meta is TableMeta {
|
||
|
return (
|
||
|
!!meta &&
|
||
|
typeof meta === 'object' &&
|
||
|
'table' in meta &&
|
||
|
meta.table === 'tasks'
|
||
|
);
|
||
|
}
|