From 1a7ce156aa96132ffb41e30016f5018fb38760b0 Mon Sep 17 00:00:00 2001 From: Brendan Asselstine Date: Tue, 24 Nov 2026 16:41:00 -0700 Subject: [PATCH] Organize Events and MCP subscriptions into dashboard views --- packages/api-client/src/schema.d.ts | 133 +++++++++++++- packages/api/src/api-contract.ts | 14 +- packages/api/src/api-service.ts | 13 +- packages/api/src/event-contracts.ts | 12 ++ .../postgres/event-subscription-repository.ts | 33 ++++ packages/api/test/mcp-events.postgres.test.ts | 46 +++++ .../app/src/features/auth/account-bar.tsx | 2 +- packages/app/src/features/events/events.tsx | 155 ++++++++++++++--- packages/app/src/features/events/queries.ts | 22 +++ packages/app/src/features/events/routes.tsx | 20 ++- .../features/events/subscriptions-table.tsx | 49 ++++++ .../features/settings/authorized-clients.tsx | 4 + packages/app/src/main.tsx | 2 +- .../app/test/functional/critical.spec.mjs | 72 +++++++- packages/docs/integrations/events.mdx | 7 + packages/docs/llms-full.txt | 7 + packages/docs/openapi.yaml | 162 +++++++++++++++++- 17 files changed, 712 insertions(+), 41 deletions(-) create mode 100644 packages/api/src/postgres/event-subscription-repository.ts create mode 100644 packages/app/src/features/events/queries.ts create mode 100644 packages/app/src/features/events/subscriptions-table.tsx diff --git a/packages/api-client/src/schema.d.ts b/packages/api-client/src/schema.d.ts index 3a0a076b..9e596bc3 100644 --- a/packages/api-client/src/schema.d.ts +++ b/packages/api-client/src/schema.d.ts @@ -1732,6 +1732,52 @@ export interface paths { patch?: never; trace?: never; }; + "/api/v1/event-subscriptions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List the signed-in owner's Event subscriptions in the current workspace + * @description Shows registration lifecycle, not current delivery capability. Does not expose webhook configuration. + * + * Requires the triggers:read scope. + * + * An interactive owner session is required; bearer tokens cannot call this operation. + */ + get: operations["get_api_v1_event_subscriptions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/api/v1/event-subscriptions/{subscriptionId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get a signed-in owner's Event subscription in the current workspace + * @description Requires the triggers:read scope. + * + * An interactive owner session is required; bearer tokens cannot call this operation. + */ + get: operations["get_api_v1_event_subscriptions_subscriptionId"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/api/v1/events": { parameters: { query?: never; @@ -1783,8 +1829,8 @@ export interface paths { put: operations["put_api_v1_events_eventId"]; post?: never; /** - * Delete an Event and its Triggers and occurrences - * @description Permanently deletes the Event, all attached Triggers, their input configurations, and the Event's occurrence history. + * Delete an Event, its Triggers, subscriptions, and occurrences + * @description Permanently deletes the Event, all attached Triggers, their input configurations, subscriptions, and the Event's occurrence history. * * Requires the triggers:write scope. * @@ -6287,6 +6333,89 @@ export interface operations { 503: components["responses"]["Error503"]; }; }; + get_api_v1_event_subscriptions: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Event subscriptions */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + /** Format: uuid */ + eventId: string; + eventName: string; + grantId: string; + /** @enum {string} */ + status: "active" | "expired" | "stopped"; + /** @enum {string} */ + acknowledgmentMode: "required" | "off"; + /** Format: date-time */ + expiresAt: string; + }[]; + }; + }; + 400: components["responses"]["Error400"]; + 401: components["responses"]["Error401"]; + 403: components["responses"]["Error403"]; + 404: components["responses"]["Error404"]; + 409: components["responses"]["Error409"]; + 429: components["responses"]["Error429"]; + 500: components["responses"]["Error500"]; + 503: components["responses"]["Error503"]; + }; + }; + get_api_v1_event_subscriptions_subscriptionId: { + parameters: { + query?: never; + header?: never; + path: { + subscriptionId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Event subscription */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + /** Format: uuid */ + eventId: string; + eventName: string; + grantId: string; + /** @enum {string} */ + status: "active" | "expired" | "stopped"; + /** @enum {string} */ + acknowledgmentMode: "required" | "off"; + /** Format: date-time */ + expiresAt: string; + }; + }; + }; + 400: components["responses"]["Error400"]; + 401: components["responses"]["Error401"]; + 403: components["responses"]["Error403"]; + /** @description Event subscription not found */ + 404: components["responses"]["Error404"]; + 409: components["responses"]["Error409"]; + 429: components["responses"]["Error429"]; + 500: components["responses"]["Error500"]; + 503: components["responses"]["Error503"]; + }; + }; get_api_v1_events: { parameters: { query?: never; diff --git a/packages/api/src/api-contract.ts b/packages/api/src/api-contract.ts index 197ce424..48194ef0 100644 --- a/packages/api/src/api-contract.ts +++ b/packages/api/src/api-contract.ts @@ -23,7 +23,7 @@ import { X_OAUTH_SCOPES } from "./x-oauth"; import document from "./api-document.json"; import { authInputs, authSuccess, continuationSuccess, connectionStartInput, connectionStartSuccess, connectionResumeInput, loginSuccess, sessionResponse, googleAvailability, googleStartResult, googlePendingResult, googleUsernameResult, totpStatusResponse, totpSetupResponse, totpEnabledResponse, type AuthAction } from "./auth-api"; import { flyConnectionInput, flyConnectionMetadata } from "./fly-account-client"; -import { eventDefinitionInput, eventDefinitionUpdate, eventDefinitionResponse, eventDefinitionList, eventOccurrenceQuery, eventOccurrencePage } from "./event-contracts"; +import { eventSubscription, eventSubscriptionId, eventSubscriptionList, eventDefinitionInput, eventDefinitionUpdate, eventDefinitionResponse, eventDefinitionList, eventOccurrenceQuery, eventOccurrencePage } from "./event-contracts"; import { vmGrantInput, vmGrantList, vmGrantRef, vmGrantResult, vmRevokeResult } from "./vm-grant-contracts"; type JsonSchema = Record; @@ -689,11 +689,21 @@ export const API_ROUTES: RouteContract[] = [ summary: "Get the current team", responses: { "200": { description: "Team", content: { "application/json": { schema: jsonSchema(teamResponse, "output") } } } }, }, service => service.getTeam()), + route("GET", "/api/v1/event-subscriptions", "triggers:read", { + summary: "List the signed-in owner's Event subscriptions in the current workspace", + description: "Shows registration lifecycle, not current delivery capability. Does not expose webhook configuration.", + responses: { "200": { description: "Event subscriptions", content: { "application/json": { schema: jsonSchema(eventSubscriptionList, "output") } } } }, + }, service => service.listDashboardEventSubscriptions(), { ownerSession: true }), + route("GET", "/api/v1/event-subscriptions/{subscriptionId}", "triggers:read", { + summary: "Get a signed-in owner's Event subscription in the current workspace", + responses: { "200": { description: "Event subscription", content: { "application/json": { schema: jsonSchema(eventSubscription, "output") } } }, "404": { description: "Event subscription not found" } }, + }, (service, { params }) => service.getDashboardEventSubscription(params.subscriptionId), + { ownerSession: true, parameters: z.object({ subscriptionId: eventSubscriptionId }) }), route("GET", "/api/v1/events", "triggers:read", { summary: "List Events", responses: { "200": { description: "Events and current revisions", content: { "application/json": { schema: jsonSchema(eventDefinitionList, "output") } } } } }, service => service.listEvents()), route("POST", "/api/v1/events", "triggers:write", { summary: "Create an Event", responses: { "201": { description: "Created Event", content: { "application/json": { schema: jsonSchema(eventDefinitionResponse, "output") } } } } }, (service, { body }) => service.createEvent(body), { body: eventDefinitionInput }), route("GET", "/api/v1/events/{eventId}", "triggers:read", { summary: "Get an Event", responses: { "200": { description: "Event", content: { "application/json": { schema: jsonSchema(eventDefinitionResponse, "output") } } } } }, (service, { params }) => service.getEvent(params.eventId), { parameters: z.object({ eventId: z.uuid() }) }), route("PUT", "/api/v1/events/{eventId}", "triggers:write", { summary: "Update an Event payload schema", responses: { "200": { description: "Updated Event", content: { "application/json": { schema: jsonSchema(eventDefinitionResponse, "output") } } } } }, (service, { params, body }) => service.updateEvent(params.eventId, body), { parameters: z.object({ eventId: z.uuid() }), body: eventDefinitionUpdate }), - route("DELETE", "/api/v1/events/{eventId}", "triggers:write", { summary: "Delete an Event and its Triggers and occurrences", description:"Permanently deletes the Event, all attached Triggers, their input configurations, and the Event's occurrence history.", responses: { "200": { description: "Deleted" } } }, (service, { params }) => service.deleteEvent(params.eventId), { parameters: z.object({ eventId: z.uuid() }) }), + route("DELETE", "/api/v1/events/{eventId}", "triggers:write", { summary: "Delete an Event, its Triggers, subscriptions, and occurrences", description:"Permanently deletes the Event, all attached Triggers, their input configurations, subscriptions, and the Event's occurrence history.", responses: { "200": { description: "Deleted" } } }, (service, { params }) => service.deleteEvent(params.eventId), { parameters: z.object({ eventId: z.uuid() }) }), route("GET", "/api/v1/events/{eventId}/occurrences", "triggers:read", { summary: "List durable Event occurrences", responses: { "200": { description: "Occurrences", content: { "application/json": { schema: jsonSchema(eventOccurrencePage, "output") } } } } }, (service, { params, query }) => service.listEventOccurrences(params.eventId, query.limit, query.cursor), { parameters: z.object({ eventId: z.uuid() }), query: eventOccurrenceQuery }), route( "GET", diff --git a/packages/api/src/api-service.ts b/packages/api/src/api-service.ts index 5c1b2a44..0168da24 100644 --- a/packages/api/src/api-service.ts +++ b/packages/api/src/api-service.ts @@ -53,7 +53,8 @@ import { ACCESS_SCOPES, AGENT_SCOPES, accessTokenDigest, issueAccessToken, norma import { EventMatchRepository, wakeMcpDeliveries } from "./postgres/event-match-repository"; import { EventDefinitionRepository, EventDefinitionConflict } from "./postgres/event-definition-repository"; -import { parseOccurrenceCursor, eventDefinitionInput, eventDefinitionUpdate, eventDefinitionResponse, eventDefinitionList, eventOccurrencePage } from "./event-contracts"; +import { readEventSubscriptions } from "./postgres/event-subscription-repository"; +import { eventSubscription, eventSubscriptionList, parseOccurrenceCursor, eventDefinitionInput, eventDefinitionUpdate, eventDefinitionResponse, eventDefinitionList, eventOccurrencePage } from "./event-contracts"; import { createFlyAccountClient, FlyAccountError, flyConnectionInput } from "./fly-account-client"; import { FlyConnectionRepository } from "./postgres/fly-connection-repository"; @@ -210,6 +211,16 @@ export class ApiService { async eventContextMetadata() { await this.authorize("triggers:read"); return eventContextCatalog; } private eventDefinitions() { return new EventDefinitionRepository(databaseFor(this.env), this.auth.tenantId); } async listEvents() { await this.authorize("triggers:read"); return publicValue(eventDefinitionList, await this.eventDefinitions().list()); } + async listDashboardEventSubscriptions() { + await this.authorizeOwnerSession("triggers:read"); + return publicValue(eventSubscriptionList, await readEventSubscriptions(databaseFor(this.env), this.auth.tenantId, this.auth.userId)); + } + async getDashboardEventSubscription(id: string) { + await this.authorizeOwnerSession("triggers:read"); + const [result] = await readEventSubscriptions(databaseFor(this.env), this.auth.tenantId, this.auth.userId, id); + if (!result) throw new ServiceError(404, "not_found", "Event subscription not found"); + return publicValue(eventSubscription, result); + } async getEvent(id: string) { await this.authorize("triggers:read"); const event = await this.eventDefinitions().get(id); if (!event) throw new ServiceError(404, "not_found", "Event not found"); return publicValue(eventDefinitionResponse, event); } async createEvent(input: unknown) { await this.authorize("triggers:write"); return publicValue(eventDefinitionResponse, await this.eventDefinitions().create(eventDefinitionInput.parse(input))); } async updateEvent(id: string, input: unknown) { await this.authorize("triggers:write"); const parsed = eventDefinitionUpdate.parse(input); try { const result = await this.eventDefinitions().update(id, parsed, parsed.expectedRevision); if (!result) throw new ServiceError(404, "not_found", "Event not found"); return publicValue(eventDefinitionResponse, result); } catch (error) { if (error instanceof EventDefinitionConflict) throw new ServiceError(409, "stale_event", "Event changed since it was loaded."); throw error; } } diff --git a/packages/api/src/event-contracts.ts b/packages/api/src/event-contracts.ts index 21e90048..2ff72b67 100644 --- a/packages/api/src/event-contracts.ts +++ b/packages/api/src/event-contracts.ts @@ -19,3 +19,15 @@ export function parseOccurrenceCursor(cursor: string, definitionId: string, sinc } catch { /* The caller converts malformed cursors to a validation error. */ } return null; } + +export const eventSubscriptionId = z.string().regex(/^sub_[a-f0-9]{64}$/); +export const eventSubscription = z.object({ + id: eventSubscriptionId, + eventId: z.uuid(), + eventName: z.string(), + grantId: z.string(), + status: z.enum(["active", "expired", "stopped"]), + acknowledgmentMode: z.enum(["required", "off"]), + expiresAt: z.iso.datetime(), +}); +export const eventSubscriptionList = z.array(eventSubscription); diff --git a/packages/api/src/postgres/event-subscription-repository.ts b/packages/api/src/postgres/event-subscription-repository.ts new file mode 100644 index 00000000..87e20c53 --- /dev/null +++ b/packages/api/src/postgres/event-subscription-repository.ts @@ -0,0 +1,33 @@ +import type { Database } from "./database"; + +type SubscriptionRow = { + id: string; + definition_id: string; + name: string; + grant_id: string; + status: "active" | "expired" | "stopped"; + acknowledgment_mode: "required" | "off"; + expires_at: Date; +}; + +// Dashboard metadata is visible to the same owner and workspace as the OAuth +// connection it belongs to. Never select webhook credentials, URL or arguments. +export async function readEventSubscriptions(db: Database, tenantId: string, userId: string, id?: string) { + const { rows } = await db.pool.query( + `SELECT s.id,s.definition_id,e.name,s.grant_id, + CASE WHEN s.status='stopped' THEN 'stopped' + WHEN s.expires_at<=statement_timestamp() THEN 'expired' + ELSE 'active' END AS status, + CASE WHEN s.ack_epoch IS NULL THEN 'off' ELSE 'required' END AS acknowledgment_mode, + s.expires_at + FROM app.mcp_event_subscriptions s + JOIN app.event_definitions e ON e.tenant_id=s.tenant_id AND e.id=s.definition_id + WHERE s.tenant_id=$1 AND s.user_id=$2 ${id ? "AND s.id=$3" : ""} + ORDER BY e.name,s.id`, + id ? [tenantId, userId, id] : [tenantId, userId], + ); + return rows.map(row => ({ + id: row.id, eventId: row.definition_id, eventName: row.name, grantId: row.grant_id, + status: row.status, acknowledgmentMode: row.acknowledgment_mode, expiresAt: row.expires_at.toISOString(), + })); +} diff --git a/packages/api/test/mcp-events.postgres.test.ts b/packages/api/test/mcp-events.postgres.test.ts index 134718a1..18bcd98b 100644 --- a/packages/api/test/mcp-events.postgres.test.ts +++ b/packages/api/test/mcp-events.postgres.test.ts @@ -326,6 +326,52 @@ describe.skipIf(!process.env.AUTH_TEST_DATABASE_URL)("MCP event webhook lifecycl const makeRecoveryDue = (occurrenceId: string) => f.db.pool.query( "UPDATE app.mcp_event_deliveries SET ack_due_at=now()-interval '1 second' WHERE occurrence_id=$1", [occurrenceId]); + it("lists only the signed-in owner's workspace subscriptions and redacts their transport configuration", async () => { + const active = (await subscribe()).message.result.id as string; + const expired = (await subscribe(otherReceiver)).message.result.id as string; + await configure(active, true); + await f.db.pool.query("UPDATE app.mcp_event_subscriptions SET expires_at=now()-interval '1 hour' WHERE tenant_id=$1 AND id=$2", [f.tenantId, expired]); + + const secondUser = crypto.randomUUID(); + const member = await new IdentityRepository(f.db, f.tenantId).upsertOwner(secondUser, "other@example.test"); + const otherOwner = await new IdentityRepository(f.db, f.otherTenant).upsertOwner(f.userId, "owner@example.test"); + const otherDefinition = await f.seedEventTrigger(f.otherTenant); + const hiddenInWorkspace = "sub_" + "1".repeat(64), hiddenInOtherWorkspace = "sub_" + "2".repeat(64); + for (const [tenantId, userId, definitionId, id] of [ + [f.tenantId, secondUser, source.definitionId, hiddenInWorkspace], + [f.otherTenant, f.userId, otherDefinition.definitionId, hiddenInOtherWorkspace], + ]) { + await f.db.pool.query(`INSERT INTO app.mcp_event_subscriptions + (tenant_id,id,user_id,session_version,grant_id,client_id,definition_id,arguments,callback_url, + encrypted_secret,secret_fingerprint,verified_at,generation,status,expires_at) + SELECT $1,$2,$3,session_version,grant_id,client_id,$4,arguments,callback_url,encrypted_secret, + secret_fingerprint,verified_at,generation,status,expires_at + FROM app.mcp_event_subscriptions WHERE tenant_id=$5 AND id=$6`, [tenantId, id, userId, definitionId, f.tenantId, active]); + } + const cookieFor = async (tenantId: string, userId: string, sessionVersion: number) => "factorize_session=" + await signSession({ + ...f.auth, tenantId, userId, sessionVersion, email: "owner@example.test", exp: Math.floor(Date.now() / 1000) + 60, + }, f.env.SESSION_SIGNING_SECRET); + const list = "/api/v1/event-subscriptions"; + const response = await f.request(list); + expect(response.status).toBe(200); + const rows = await response.json() as Record[]; + const expected = { eventId: source.definitionId, eventName: "fixture-event", grantId: "grant-1", expiresAt: expect.any(String) }; + expect(rows).toHaveLength(2); + expect(rows).toEqual(expect.arrayContaining([ + { ...expected, id: active, status: "active", acknowledgmentMode: "required" }, + { ...expected, id: expired, status: "expired", acknowledgmentMode: "off" }, + ])); + expect(await (await f.request(list + "/" + active)).json()).toEqual(rows.find(row => row.id === active)); + expect((await f.request(list, "")).status).toBe(401); + expect((await f.request(list, await cookieFor(f.tenantId, secondUser, member.sessionVersion))).status).toBe(401); + expect((await f.request(list + "/" + active, await cookieFor(f.otherTenant, f.userId, otherOwner.sessionVersion))).status).toBe(404); + expect((await f.request(list + "/" + hiddenInWorkspace)).status).toBe(404); + expect((await f.request(list + "/" + hiddenInOtherWorkspace)).status).toBe(404); + expect((await f.request(list + "/malformed")).status).toBe(400); + expect((await unsubscribe()).message.result).toBeDefined(); + expect(await (await f.request(list + "/" + active)).json()).toMatchObject({ status: "stopped" }); + }); + it("acknowledges exact durable work and recovers only the unresolved original occurrence", async () => { const id = (await subscribe()).message.result.id; expect((await processing("get_event_processing_acknowledgments", id)).structuredContent.enabled).toBe(false); diff --git a/packages/app/src/features/auth/account-bar.tsx b/packages/app/src/features/auth/account-bar.tsx index 07ac853f..7d191cd8 100644 --- a/packages/app/src/features/auth/account-bar.tsx +++ b/packages/app/src/features/auth/account-bar.tsx @@ -77,7 +77,7 @@ export function AccountBar() { : Account} - {authenticated && (["/", "/triggers", "/events", "/integrations", "/workloads"].includes(pathname) || pathname === "/apps" || pathname.startsWith("/workloads/") || (pathname === "/clients" || pathname.startsWith("/clients/")) || pathname.startsWith("/settings/") || pathname === "/settings") && } + {authenticated && (["/", "/triggers", "/events", "/integrations", "/workloads"].includes(pathname) || pathname.startsWith("/events/") || pathname === "/apps" || pathname.startsWith("/workloads/") || (pathname === "/clients" || pathname.startsWith("/clients/")) || pathname.startsWith("/settings/") || pathname === "/settings") && } {logout.isError &&

{logout.error.message}

} ; } diff --git a/packages/app/src/features/events/events.tsx b/packages/app/src/features/events/events.tsx index bfb2bcaf..02e3440a 100644 --- a/packages/app/src/features/events/events.tsx +++ b/packages/app/src/features/events/events.tsx @@ -1,29 +1,136 @@ -import { useState } from "react"; -import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { api } from "factorize-api-client"; -import { Button, Page, PageHeader } from "../../shared/ui"; +import type { ReactNode } from "react"; +import { Link, useNavigate, useParams } from "@tanstack/react-router"; +import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import { api, type paths } from "factorize-api-client"; +import { Button, Page, PageHeader, Table, tableCellClasses, tableHeadClasses, tableRowClasses } from "../../shared/ui"; +import { eventsQuery, subscriptionsQuery } from "./queries"; +import { EventSubscriptions, SubscriptionsTable, SubscriptionTime } from "./subscriptions-table"; + +const linkClass = "rounded-lg px-3 py-2 hover:bg-stone-100 dark:hover:bg-slate-800"; +const activeClass = "bg-factorize-50 text-factorize-700 dark:bg-factorize-500/10 dark:text-factorize-500"; +type OccurrencePage = paths["/api/v1/events/{eventId}/occurrences"]["get"]["responses"][200]["content"]["application/json"]; +function EventsLayout({ title, description, children, subscriptions }: { title: string; description?: string; children: ReactNode; subscriptions?: boolean }) { + return
+ +
{children}
+
; +} export function EventsPage() { - const client = useQueryClient(); - const [selected, setSelected] = useState(); - const events = useQuery({ queryKey: ["events"], queryFn: async ({ signal }) => { - const result = await api.GET("/api/v1/events", { signal }); - if (!result.data || result.error) throw new Error(result.error?.error?.message ?? "Could not load Events"); - return result.data; - }}); - const occurrences = useQuery({ queryKey: ["events", selected, "occurrences"], enabled: !!selected, queryFn: async ({ signal }) => { - const result = await api.GET("/api/v1/events/{eventId}/occurrences", { params: { path: { eventId: selected! }, query: { limit: 50 } }, signal }); - if (!result.data || result.error) throw new Error(result.error?.error?.message ?? "Could not load occurrences"); - return result.data; - }}); - const remove = useMutation({ mutationFn: async (eventId: string) => { - const result = await api.DELETE("/api/v1/events/{eventId}", { params: { path: { eventId } } }); - if (result.error) throw new Error(result.error.error?.message ?? "Could not delete Event"); - }, onSuccess: async (_result, eventId) => { if (selected === eventId) setSelected(undefined); await client.invalidateQueries({ queryKey: ["events"] }); } }); - return + const events = useQuery(eventsQuery); + const subscriptions = useQuery(subscriptionsQuery); + const counts = new Map(); + for (const row of subscriptions.data ?? []) if (row.status === "active") counts.set(row.eventId, (counts.get(row.eventId) ?? 0) + 1); + return + {events.isPending &&

Loading Events…

} + {events.error &&

{events.error.message}

} + {subscriptions.error &&

Subscriber counts could not be loaded.

} + {events.data?.length === 0 &&

No Events yet.

} + {!!events.data?.length && + {["Name", "Description", "Subscribers"].map(label => + )} + {events.data.map(item => + + + + )} +
{label}
{item.name}{item.description || "No description"}{subscriptions.error ? "—" : subscriptions.isPending ? "…" : counts.get(item.id) ?? 0}
} +
; +} + +export function EventPage() { + const { eventId } = useParams({ from: "/events/$eventId" }); + const cache = useQueryClient(); + const navigate = useNavigate(); + const events = useQuery({ ...eventsQuery, select: rows => rows.find(row => row.id === eventId) }); + const event = events.data; + const occurrences = useInfiniteQuery({ + queryKey: ["events", eventId, "occurrences"], enabled: !!event, initialPageParam: undefined as string | undefined, + getNextPageParam: (last: OccurrencePage) => last.nextCursor ?? undefined, + queryFn: async ({ signal, pageParam }): Promise => { + const { data, error } = await api.GET("/api/v1/events/{eventId}/occurrences", { + params: { path: { eventId }, query: { limit: 50, cursor: pageParam } }, signal, + }); + if (!data || error) throw new Error(error?.error?.message ?? "Could not load occurrences"); + return data; + }, + }); + const remove = useMutation({ + mutationFn: async () => { + const { error } = await api.DELETE("/api/v1/events/{eventId}", { params: { path: { eventId } } }); + if (error) throw new Error(error.error?.message ?? "Could not delete Event"); + }, + onSuccess: async () => { + await Promise.all([ + cache.invalidateQueries({ queryKey: eventsQuery.queryKey }), + cache.invalidateQueries({ queryKey: subscriptionsQuery.queryKey }), + ]); + cache.removeQueries({ queryKey: ["events", eventId, "occurrences"] }); + await navigate({ to: "/events" }); + }, + }); + const history = occurrences.data?.pages.flatMap(page => page.items); + return + {events.isPending &&

Loading Event…

} {events.error &&

{events.error.message}

} + {!events.isPending && !events.error && !event &&

Event not found.

} {remove.error &&

{remove.error.message}

} -

Defined Events

    {(events.data ?? []).map(item =>
  • )}
{events.data?.length === 0 &&

No Events yet.

}
-

Occurrences

{!selected ?

Select an Event to inspect its durable occurrences.

: occurrences.error ?

{occurrences.error.message}

:
    {(occurrences.data?.items ?? []).map(item =>
  1. {JSON.stringify(item.payload, null, 2)}
  2. )}
}
-
; + {event &&
+
+
Revision
{event.revision}
+
Triggers
{event.triggerCount}
+
Occurrences
{event.occurrenceCount}
+
Created
+
Updated
+
+

Payload schema

{JSON.stringify(event.payloadSchema, null, 2)}
+

Subscriptions

+

Occurrence history

+ {occurrences.isPending &&

Loading occurrences…

} + {occurrences.error &&

{occurrences.error.message}

} + {history?.length === 0 &&

No occurrences yet.

} + {!!history?.length &&
    {history.map(item =>
  1. + +
    {JSON.stringify(item.payload, null, 2)}
    +
  2. )}
} + {occurrences.hasNextPage && } +
+ +
} + ; +} + +export function SubscriptionsPage() { + return + + ; +} + +export function SubscriptionPage() { + const { subscriptionId } = useParams({ from: "/events/subscriptions/$subscriptionId" }); + const subscription = useQuery({ + queryKey: ["event-subscriptions", subscriptionId], + queryFn: async ({ signal }) => { + const { data, error, response } = await api.GET("/api/v1/event-subscriptions/{subscriptionId}", { params: { path: { subscriptionId } }, signal }); + if (response.status === 404) return null; + if (!data || error) throw new Error(error?.error?.message ?? "Could not load subscription"); + return data; + }, + }); + return + {subscription.isPending &&

Loading subscription…

} + {subscription.error &&

{subscription.error.message}

} + {subscription.data === null &&

Event subscription not found.

} + {subscription.data && <> +
Subscription ID
{subscription.data.id}
+ + } +
; } diff --git a/packages/app/src/features/events/queries.ts b/packages/app/src/features/events/queries.ts new file mode 100644 index 00000000..2775ba9d --- /dev/null +++ b/packages/app/src/features/events/queries.ts @@ -0,0 +1,22 @@ +import { queryOptions } from "@tanstack/react-query"; +import { api, type paths } from "factorize-api-client"; + +export type EventSubscription = paths["/api/v1/event-subscriptions/{subscriptionId}"]["get"]["responses"][200]["content"]["application/json"]; + +export const eventsQuery = queryOptions({ + queryKey: ["events", "definitions"], + queryFn: async ({ signal }) => { + const { data, error } = await api.GET("/api/v1/events", { signal }); + if (!data || error) throw new Error(error?.error?.message ?? "Could not load Events"); + return data; + }, +}); + +export const subscriptionsQuery = queryOptions({ + queryKey: ["event-subscriptions"], + queryFn: async ({ signal }) => { + const { data, error } = await api.GET("/api/v1/event-subscriptions", { signal }); + if (!data || error) throw new Error(error?.error?.message ?? "Could not load subscriptions"); + return data; + }, +}); diff --git a/packages/app/src/features/events/routes.tsx b/packages/app/src/features/events/routes.tsx index 7bd4daa8..de429d74 100644 --- a/packages/app/src/features/events/routes.tsx +++ b/packages/app/src/features/events/routes.tsx @@ -1,9 +1,21 @@ import { createRoute, lazyRouteComponent, redirect, type AnyRootRoute } from "@tanstack/react-router"; import { sessionQuery } from "../auth/session"; import { queryClient } from "../../shared/query-client"; + export function eventRoutes(root: AnyRootRoute) { - return createRoute({ getParentRoute: () => root, path: "/events", - beforeLoad: async ({ location }) => { if (!(await queryClient.ensureQueryData(sessionQuery)).authenticated) throw redirect({ to: "/auth/login", search: { returnTo: location.href, token: undefined } }); }, - component: lazyRouteComponent(() => import("./events"), "EventsPage"), - }); + const guard = async ({ location }: { location: { href: string } }) => { + if (!(await queryClient.ensureQueryData(sessionQuery)).authenticated) { + throw redirect({ to: "/auth/login", search: { returnTo: location.href, token: undefined } }); + } + }; + return [ + createRoute({ getParentRoute: () => root, path: "/events", beforeLoad: guard, + component: lazyRouteComponent(() => import("./events"), "EventsPage") }), + createRoute({ getParentRoute: () => root, path: "/events/subscriptions", beforeLoad: guard, + component: lazyRouteComponent(() => import("./events"), "SubscriptionsPage") }), + createRoute({ getParentRoute: () => root, path: "/events/subscriptions/$subscriptionId", beforeLoad: guard, + component: lazyRouteComponent(() => import("./events"), "SubscriptionPage") }), + createRoute({ getParentRoute: () => root, path: "/events/$eventId", beforeLoad: guard, + component: lazyRouteComponent(() => import("./events"), "EventPage") }), + ]; } diff --git a/packages/app/src/features/events/subscriptions-table.tsx b/packages/app/src/features/events/subscriptions-table.tsx new file mode 100644 index 00000000..ffa0c652 --- /dev/null +++ b/packages/app/src/features/events/subscriptions-table.tsx @@ -0,0 +1,49 @@ +import { Link } from "@tanstack/react-router"; +import { useQuery } from "@tanstack/react-query"; +import { Table, tableCellClasses, tableHeadClasses, tableRowClasses } from "../../shared/ui"; +import { clientsQuery } from "../settings/queries"; +import { subscriptionsQuery, type EventSubscription } from "./queries"; + +export const subscriptionStatus: Record = { + active: "Active", expired: "Expired", stopped: "Stopped", +}; + +export function SubscriptionTime({ value }: { value: string }) { + return ; +} + +export function EventSubscriptions({ eventId, grantId }: { eventId?: string; grantId?: string }) { + const subscriptions = useQuery(subscriptionsQuery); + if (subscriptions.isPending) return

Loading subscriptions…

; + if (subscriptions.error) return

{subscriptions.error.message}

; + return + (!eventId || row.eventId === eventId) && (!grantId || row.grantId === grantId))} />; +} + +export function SubscriptionsTable({ rows, showClient = true, detail = false }: { rows: EventSubscription[]; showClient?: boolean; detail?: boolean }) { + const clients = useQuery({ ...clientsQuery, enabled: showClient && rows.length > 0 }); + if (!rows.length) return

No subscriptions yet.

; + const connections = new Map(clients.data?.map(client => [client.grantId, client.clientName])); + return <> + {showClient && clients.error &&

Connection names could not be loaded.

} + + + {[...(showClient ? ["Client"] : []), "Event", "Status", "Acknowledgment mode", "Expires"].map(label => + )} + + {rows.map(row => + {showClient && } + + + + + )} +
{label}
{connections.has(row.grantId) + ? {connections.get(row.grantId)} + : clients.isPending ? "Loading…" : "Unavailable connection"} + {detail + ? {row.eventName} + : {row.eventName} subscription ending in {row.id.slice(-8)}} + {subscriptionStatus[row.status]}{row.acknowledgmentMode === "required" ? "Required" : "Off"}
+ ; +} diff --git a/packages/app/src/features/settings/authorized-clients.tsx b/packages/app/src/features/settings/authorized-clients.tsx index ba6c1107..8b63f1b0 100644 --- a/packages/app/src/features/settings/authorized-clients.tsx +++ b/packages/app/src/features/settings/authorized-clients.tsx @@ -9,6 +9,8 @@ import { import { messageOf } from "../auth/session"; import { ClientPermissions, type AuthorizedClient } from "./client-permissions"; import { clientsQuery } from "./queries"; +import { EventSubscriptions } from "../events/subscriptions-table"; +import { subscriptionsQuery } from "../events/queries"; function RenameConnection({ client }: { client: AuthorizedClient }) { const cache = useQueryClient(); @@ -55,6 +57,7 @@ function RevokeConnection({ client }: { client: AuthorizedClient }) { }, onSuccess: () => Promise.all([ cache.invalidateQueries({ queryKey: clientsQuery.queryKey }), + cache.invalidateQueries({ queryKey: subscriptionsQuery.queryKey }), ]), }); return <> @@ -112,6 +115,7 @@ export function ClientPage() {
+

Subscriptions

} {editing && client && setEditing(false)} />} ; diff --git a/packages/app/src/main.tsx b/packages/app/src/main.tsx index 0fab064c..45bc1d9b 100644 --- a/packages/app/src/main.tsx +++ b/packages/app/src/main.tsx @@ -36,7 +36,7 @@ const router = createRouter({ ), defaultNotFoundComponent: () =>

Page not found

Check the address or return to your software factory.

Go to Factorize
, - routeTree: rootRoute.addChildren([indexRoute, ...authRoutes(rootRoute), ...protocolRoutes(rootRoute), ...triggersRoutes(rootRoute), eventRoutes(rootRoute), ...workloadRoutes(rootRoute), ...appRoutes(rootRoute), ...settingsRoutes(rootRoute)]), + routeTree: rootRoute.addChildren([indexRoute, ...authRoutes(rootRoute), ...protocolRoutes(rootRoute), ...triggersRoutes(rootRoute), ...eventRoutes(rootRoute), ...workloadRoutes(rootRoute), ...appRoutes(rootRoute), ...settingsRoutes(rootRoute)]), }); declare module "@tanstack/react-router" { interface Register { router: typeof router } diff --git a/packages/app/test/functional/critical.spec.mjs b/packages/app/test/functional/critical.spec.mjs index 07d26d2b..001b2677 100644 --- a/packages/app/test/functional/critical.spec.mjs +++ b/packages/app/test/functional/critical.spec.mjs @@ -1,23 +1,87 @@ import { test, expect } from "./fixtures.mjs"; -test("select an existing Event and inspect its durable occurrence through the shared API", async ({ page, origin }) => { +test("navigates Events, subscriptions and exact client connections through accessible dashboard tables", async ({ page, origin }) => { const definitionId = "30000000-0000-4000-8000-000000000001"; const occurrenceId = "40000000-0000-4000-8000-000000000001"; const definition = { id: definitionId, name: "orders.created", description: "New orders", revision: 1, payloadSchema: { type: "object" }, createdAt: "2026-01-01T00:00:00.000Z", updatedAt: "2026-01-01T00:00:00.000Z", triggerCount: 1, occurrenceCount: 1 }; await page.route("**/api/v1/session", route => route.fulfill({ json: { authenticated: true, user: { id: "owner" }, team: { id: "tenant", name: "Team" }, capabilities: [] } })); + const otherEventId = "30000000-0000-4000-8000-000000000002"; + const timestamp = "2027-01-01T00:00:00.000Z"; + const requiredId = "sub_" + "a".repeat(64); + const expiredId = "sub_" + "b".repeat(64); + const otherId = "sub_" + "c".repeat(64); + const base = { eventId: definitionId, eventName: definition.name, expiresAt: timestamp, status: "active" }; + const required = { ...base, id: requiredId, grantId: "primary", acknowledgmentMode: "required" }; + const expired = { ...base, id: expiredId, grantId: "secondary", status: "expired", acknowledgmentMode: "off" }; + const other = { ...base, id: otherId, eventId: otherEventId, eventName: "orders.shipped", grantId: "secondary", acknowledgmentMode: "off" }; + let deleted = false; + await page.route("**/api/v1/access/authorized-clients", route => route.fulfill({ json: [ + { grantId: "primary", clientName: "Order assistant", clientId: "same-app", appName: "Registered app", expiresAt: null, authorizationDate: timestamp }, + { grantId: "secondary", clientName: "Other connection", clientId: "same-app", appName: "Registered app", expiresAt: null, authorizationDate: timestamp }, + ] })); + await page.route("**/api/v1/event-subscriptions", route => route.fulfill({ json: deleted ? [other] : [required, expired, other] })); + await page.route(`**/api/v1/event-subscriptions/${requiredId}`, route => route.fulfill({ json: required })); + await page.route(`**/api/v1/events/${definitionId}`, route => { + expect(route.request().method()).toBe("DELETE"); + deleted = true; + return route.fulfill({ json: { id: definitionId, deleted: true } }); + }); await page.route("**/api/v1/events", route => { expect(route.request().method()).toBe("GET"); - return route.fulfill({ json: [definition] }); + const remaining = { ...definition, id: otherEventId, name: "orders.shipped", description: "" }; + return route.fulfill({ json: deleted ? [remaining] : [definition, remaining] }); }); await page.route(`**/api/v1/events/${definitionId}/occurrences*`, route => route.fulfill({ json: { items: [{ id: occurrenceId, revision: 1, occurredAt: "2026-01-02T03:04:05.000Z", payload: { orderId: "order-42" }, producer: { kind: "trigger" }, createdAt: "2026-01-02T03:04:05.000Z" }], nextCursor: null } })); await page.goto(origin + "/events"); + const nav = page.getByRole("navigation", { name: "Event navigation" }); + const events = page.getByRole("table", { name: "Events", exact: true }); await expect(page.getByRole("heading", { name: "Events", exact: true })).toBeVisible(); + await expect(nav.getByRole("link", { name: "Events", exact: true })).toHaveAttribute("aria-current", "page"); + await expect(events.getByRole("columnheader")).toHaveText(["Name", "Description", "Subscribers"]); + await expect(events.getByRole("row", { name: /orders.created/ }).getByRole("cell").last()).toHaveText("1"); + await expect(page.getByRole("button", { name: "Delete", exact: true })).toHaveCount(0); await expect(page.getByRole("button", { name: "Create Event" })).toHaveCount(0); await expect(page.getByRole("main").locator("form")).toHaveCount(0); - await page.getByRole("button", { name: /^orders\.created/ }).click(); + + const created = events.getByRole("link", { name: "orders.created" }); + await created.focus(); + await page.keyboard.press("Enter"); + await expect(page).toHaveURL(origin + "/events/" + definitionId); + await expect(page.getByRole("heading", { name: "orders.created", exact: true })).toBeVisible(); + await expect(page.getByRole("navigation", { name: "Dashboard navigation" }).getByRole("link", { name: "Events" })).toBeVisible(); + await expect(page.getByRole("heading", { name: "Payload schema" })).toBeVisible(); await expect(page.getByRole("button", { name: /^Edit\b/ })).toHaveCount(0); await expect(page.getByRole("button", { name: "Delete", exact: true })).toBeVisible(); await expect(page.getByText('"orderId": "order-42"')).toBeVisible(); - await expect(page.getByText(/1 occurrences/)).toBeVisible(); + const subscriptions = page.getByRole("table", { name: "Event subscriptions" }); + await expect(subscriptions.getByRole("columnheader")).toHaveText(["Client", "Event", "Status", "Acknowledgment mode", "Expires"]); + await expect(subscriptions.getByRole("row")).toHaveCount(3); + await expect(subscriptions.getByRole("cell", { name: "Required" })).toBeVisible(); + await expect(subscriptions.getByRole("cell", { name: "Expired" })).toBeVisible(); + await subscriptions.getByRole("link", { name: /aaaaaaaa/ }).click(); + await expect(page).toHaveURL(origin + "/events/subscriptions/" + requiredId); + await expect(page.getByText(requiredId, { exact: true })).toBeVisible(); + + await nav.getByRole("link", { name: "Subscriptions" }).click(); + await expect(subscriptions.getByRole("row")).toHaveCount(4); + await subscriptions.getByRole("link", { name: "Order assistant" }).click(); + await expect(page).toHaveURL(origin + "/clients/primary"); + await expect(subscriptions.getByRole("columnheader")).toHaveText(["Event", "Status", "Acknowledgment mode", "Expires"]); + await expect(subscriptions.getByRole("row")).toHaveCount(2); + await expect(subscriptions.getByRole("cell", { name: "Required" })).toBeVisible(); + await expect(subscriptions.getByRole("cell", { name: "Expired" })).toHaveCount(0); + + await page.goto(origin + "/events"); + const description = await events.getByRole("cell", { name: "New orders" }).boundingBox(); + expect(description).not.toBeNull(); + await page.mouse.click(description.x + description.width / 2, description.y + description.height / 2); + await expect(page).toHaveURL(origin + "/events/" + definitionId); + page.once("dialog", dialog => dialog.accept()); + await page.getByRole("button", { name: "Delete", exact: true }).click(); + await expect(page).toHaveURL(origin + "/events"); + await expect(events.getByRole("link", { name: "orders.created" })).toHaveCount(0); + await nav.getByRole("link", { name: "Subscriptions" }).click(); + await expect(subscriptions.getByRole("row")).toHaveCount(2); + await expect(subscriptions.getByRole("link", { name: /orders.shipped/ })).toBeVisible(); }); diff --git a/packages/docs/integrations/events.mdx b/packages/docs/integrations/events.mdx index 9510765e..d72964c7 100644 --- a/packages/docs/integrations/events.mdx +++ b/packages/docs/integrations/events.mdx @@ -16,3 +16,10 @@ idempotent. Inspect safe outcomes with `list_trigger_webhook_activity` and MCP subscribers receive resource update notifications after an occurrence is stored. Notifications indicate that the resource changed; clients read the resource or list occurrences to obtain durable data. + +In the Factorize dashboard, open **Events** to see event definitions and their +subscriber counts. Select an event to see its payload schema, occurrence +history, and subscriptions. The **Subscriptions** sidebar shows registration +status and acknowledgment mode for your MCP connections in the current +workspace. The subscriber count includes active registrations only; an active +registration does not guarantee that the client can receive deliveries. diff --git a/packages/docs/llms-full.txt b/packages/docs/llms-full.txt index 4c3cfacb..4140c736 100644 --- a/packages/docs/llms-full.txt +++ b/packages/docs/llms-full.txt @@ -148,6 +148,13 @@ MCP subscribers receive resource update notifications after an occurrence is stored. Notifications indicate that the resource changed; clients read the resource or list occurrences to obtain durable data. +In the Factorize dashboard, open **Events** to see event definitions and their +subscriber counts. Select an event to see its payload schema, occurrence +history, and subscriptions. The **Subscriptions** sidebar shows registration +status and acknowledgment mode for your MCP connections in the current +workspace. The subscriber count includes active registrations only; an active +registration does not guarantee that the client can receive deliveries. + ## GitHub Triggers Source: https://docs.factorize.sh/integrations/github diff --git a/packages/docs/openapi.yaml b/packages/docs/openapi.yaml index 912c671b..0ebc3364 100644 --- a/packages/docs/openapi.yaml +++ b/packages/docs/openapi.yaml @@ -6837,6 +6837,164 @@ paths: - cookieAuth: [] x-required-scope: team:read x-owner-session-required: false + /api/v1/event-subscriptions: + get: + summary: List the signed-in owner's Event subscriptions in the current workspace + description: |- + Shows registration lifecycle, not current delivery capability. Does not expose webhook configuration. + + Requires the triggers:read scope. + + An interactive owner session is required; bearer tokens cannot call this operation. + responses: + "200": + description: Event subscriptions + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: string + pattern: ^sub_[a-f0-9]{64}$ + eventId: + type: string + format: uuid + pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$ + eventName: + type: string + grantId: + type: string + status: + type: string + enum: + - active + - expired + - stopped + acknowledgmentMode: + type: string + enum: + - required + - off + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$ + required: + - id + - eventId + - eventName + - grantId + - status + - acknowledgmentMode + - expiresAt + additionalProperties: false + "400": + $ref: "#/components/responses/Error400" + "401": + $ref: "#/components/responses/Error401" + "403": + $ref: "#/components/responses/Error403" + "404": + $ref: "#/components/responses/Error404" + "409": + $ref: "#/components/responses/Error409" + "429": + $ref: "#/components/responses/Error429" + "500": + $ref: "#/components/responses/Error500" + "503": + $ref: "#/components/responses/Error503" + operationId: get_api_v1_event_subscriptions + tags: + - event-subscriptions + security: + - cookieAuth: [] + x-required-scope: triggers:read + x-owner-session-required: true + /api/v1/event-subscriptions/{subscriptionId}: + get: + summary: Get a signed-in owner's Event subscription in the current workspace + responses: + "200": + description: Event subscription + content: + application/json: + schema: + type: object + properties: + id: + type: string + pattern: ^sub_[a-f0-9]{64}$ + eventId: + type: string + format: uuid + pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$ + eventName: + type: string + grantId: + type: string + status: + type: string + enum: + - active + - expired + - stopped + acknowledgmentMode: + type: string + enum: + - required + - off + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$ + required: + - id + - eventId + - eventName + - grantId + - status + - acknowledgmentMode + - expiresAt + additionalProperties: false + "400": + $ref: "#/components/responses/Error400" + "401": + $ref: "#/components/responses/Error401" + "403": + $ref: "#/components/responses/Error403" + "404": + $ref: "#/components/responses/Error404" + description: Event subscription not found + "409": + $ref: "#/components/responses/Error409" + "429": + $ref: "#/components/responses/Error429" + "500": + $ref: "#/components/responses/Error500" + "503": + $ref: "#/components/responses/Error503" + description: |- + Requires the triggers:read scope. + + An interactive owner session is required; bearer tokens cannot call this operation. + operationId: get_api_v1_event_subscriptions_subscriptionId + tags: + - event-subscriptions + security: + - cookieAuth: [] + x-required-scope: triggers:read + x-owner-session-required: true + parameters: + - name: subscriptionId + in: path + required: true + schema: + type: string + pattern: ^sub_[a-f0-9]{64}$ /api/v1/events: get: summary: List Events @@ -7197,9 +7355,9 @@ paths: - expectedRevision additionalProperties: false delete: - summary: Delete an Event and its Triggers and occurrences + summary: Delete an Event, its Triggers, subscriptions, and occurrences description: |- - Permanently deletes the Event, all attached Triggers, their input configurations, and the Event's occurrence history. + Permanently deletes the Event, all attached Triggers, their input configurations, subscriptions, and the Event's occurrence history. Requires the triggers:write scope.