Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

952 B
Raw Blame
import { DateTime } from 'luxon'

import { CyclotronInvocationQueueParametersSendPushNotificationSchema } from '~/cdp/schema/cyclotron'

import { registerAsyncFunction } from '../async-function-registry'

registerAsyncFunction('sendPushNotification', {
    execute: (args, _context, result) => {
        result.invocation.queueParameters = CyclotronInvocationQueueParametersSendPushNotificationSchema.parse({
            ...args[0],
            type: 'sendPushNotification',
        })
    },

    mock: (args, logs) => {
        logs.push({
            level: 'info',
            timestamp: DateTime.now(),
            message: `Async function 'sendPushNotification' was mocked with arguments:`,
        })
        logs.push({
            level: 'info',
            timestamp: DateTime.now(),
            message: `sendPushNotification(${JSON.stringify(args[0], null, 2)})`,
        })

        return {
            success: true,
        }
    },
})