import { getMe } from './me.ts' import { listArticles } from './articles.ts' import { listContacts } from './contacts.ts' import { listConversations } from './conversations.ts' /** * No-argument scheduled wrapper. Reads `/me` plus first-page counts only — * no writes. The `workspace-health` job is **disabled** by default. * @example * import scheduledWorkspaceHealth from 'kody:@kody/intercom/scheduled-workspace-health' * const snapshot = await scheduledWorkspaceHealth() */ export default async function scheduledWorkspaceHealth() { const [me, contacts, conversations, articles] = await Promise.all([ getMe(), listContacts({ perPage: 5 }), listConversations({ perPage: 5 }), listArticles({ perPage: 5 }), ]) return { hasAdminId: Boolean(me.id), region: me.app.region, contactCount: contacts.pageInfo.totalCount ?? contacts.items.length, conversationCount: conversations.pageInfo.totalCount ?? conversations.items.length, articleCount: articles.pageInfo.totalCount ?? articles.items.length, } }