Files
fredy/lib/notification/adapter/console.js
2026-04-21 19:42:39 +02:00

29 lines
916 B
JavaScript
Executable File

/*
* Copyright (c) 2026 by Christian Kellner.
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
*/
import { markdown2Html } from '../../services/markdown.js';
export const send = ({ serviceName, newListings, jobKey, baseUrl }) => {
/* eslint-disable no-console */
const fredyLinks = baseUrl ? newListings.map((l) => `${baseUrl}/listings/listing/${l.id}`).join(', ') : null;
return [
Promise.resolve(
console.info(
`Found entry from service ${serviceName}, Job: ${jobKey}:`,
newListings,
...(fredyLinks ? [`Open in Fredy: ${fredyLinks}`] : []),
),
),
];
/* eslint-enable no-console */
};
export const config = {
id: 'console',
name: 'Console',
description: 'This adapter sends new listings to the console. It is mostly useful for debugging.',
config: {},
readme: markdown2Html('lib/notification/adapter/console.md'),
};