Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion services/awareness-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ subscription matching and retrying webhook delivery.
1. **Ingest** — `POST /ingest` receives every awareness packet from evault-core
(shared-secret auth) and persists it.
2. **Poll** — `GET /api/packets` lets approved consumers query packet history by
ontology, eVault and time range, with cursor pagination.
ontology, eVault and time range, with cursor pagination. A single packet can
also be fetched directly by its MetaEnvelope id with `GET /api/packets/:id`.
3. **Subscribe** — `/api/subscriptions` registers webhook subscriptions filtered
by ontology and eVault. Delivered payloads match the legacy evault-core
webhook format exactly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,15 @@ export function queryRouter(): Router {
});
});

// GET /api/packets/:id - fetch a single awareness packet (MetaEnvelope) by
// its id. Not consumer-scoped, mirroring the polling endpoint above.
router.get("/api/packets/:id", consumerAuth, async (req, res) => {
const packet = await AppDataSource.getRepository(Packet).findOne({
where: { id: req.params.id },
});
if (!packet) return res.status(404).json({ error: "not found" });
return res.json({ packet });
});

return router;
}
37 changes: 37 additions & 0 deletions services/awareness-service/api/src/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,43 @@ export const openApiDocument = {
},
},
},
"/api/packets/{id}": {
get: {
tags: ["Query"],
summary: "Get a single awareness packet (MetaEnvelope) by ID",
description: "Fetch one awareness packet by its MetaEnvelope id.",
security: [{ consumerAuth: [] }],
parameters: [
{
name: "id",
in: "path",
required: true,
schema: { type: "string" },
description: "MetaEnvelope id",
},
],
responses: {
"200": {
description: "The requested packet",
content: {
"application/json": {
schema: {
type: "object",
properties: {
packet: {
$ref: "#/components/schemas/Packet",
},
},
},
},
},
},
"401": { $ref: "#/components/responses/Unauthorized" },
"403": { $ref: "#/components/responses/Forbidden" },
"404": { $ref: "#/components/responses/NotFound" },
},
},
},
"/api/subscriptions": {
get: {
tags: ["Subscriptions"],
Expand Down
Loading