From d0263d229814725018c33976e52c6eeec20fec97 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Fri, 25 Jul 2025 17:31:43 -0400 Subject: [PATCH] add come online event to appview --- app/api/inngest/client.ts | 1 + app/api/inngest/functions/come_online.ts | 13 +++++++++++++ app/api/inngest/route.tsx | 3 ++- appview/index.ts | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 app/api/inngest/functions/come_online.ts diff --git a/app/api/inngest/client.ts b/app/api/inngest/client.ts index 1e407f12..b062a584 100644 --- a/app/api/inngest/client.ts +++ b/app/api/inngest/client.ts @@ -9,6 +9,7 @@ export type Events = { document_link: string; }; }; + "appview/come-online": { data: {} }; }; // Create a client to send and receive events diff --git a/app/api/inngest/functions/come_online.ts b/app/api/inngest/functions/come_online.ts new file mode 100644 index 00000000..e2874691 --- /dev/null +++ b/app/api/inngest/functions/come_online.ts @@ -0,0 +1,13 @@ +import { supabaseServerClient } from "supabase/serverClient"; +import { inngest } from "../client"; +import { AtpAgent, AtUri } from "@atproto/api"; +import { Json } from "supabase/database.types"; +import { ids } from "lexicons/api/lexicons"; + +export const come_online = inngest.createFunction( + { id: "come_online" }, + { event: "appview/come-online" }, + async ({ event, step }) => { + return { online: true }; + }, +); diff --git a/app/api/inngest/route.tsx b/app/api/inngest/route.tsx index ec0ea4c4..8ae9821a 100644 --- a/app/api/inngest/route.tsx +++ b/app/api/inngest/route.tsx @@ -1,9 +1,10 @@ import { serve } from "inngest/next"; import { inngest } from "app/api/inngest/client"; import { index_post_mention } from "./functions/index_post_mention"; +import { come_online } from "./functions/come_online"; // Create an API that serves zero functions export const { GET, POST, PUT } = serve({ client: inngest, - functions: [index_post_mention], + functions: [index_post_mention, come_online], }); diff --git a/appview/index.ts b/appview/index.ts index ad55e51b..0f07ab0d 100644 --- a/appview/index.ts +++ b/appview/index.ts @@ -215,4 +215,8 @@ async function main() { process.on("SIGTERM", cleanup); } +inngest.send({ + name: "appview/come-online", + data: {}, +}); main(); -- 2.54.0