UNPKG

@swoft/gtd-domain

Version:

Getting Things Done (GTD) productivity system - consolidated domain implementation

215 lines (214 loc) 6.23 kB
// src/integration/contracts/zodios-api.ts import { makeApi } from "@zodios/core"; import { z } from "zod"; var InboxCaptureRequestSchema = z.object({ content: z.string().describe("The content/description of the item to capture"), capturedBy: z.string().describe("Who is capturing this item"), priority: z.enum([ "low", "medium", "high", "urgent" ]).optional().describe("Optional priority level"), tags: z.array(z.string()).optional().describe("Optional tags for categorization"), source: z.string().optional().describe("Source of the capture (for tracking)"), context: z.object({ location: z.string().optional(), project: z.string().optional(), reference: z.string().optional() }).optional().describe("Optional context information") }); var InboxItemSummarySchema = z.object({ id: z.string().describe("Unique identifier for the inbox item"), content: z.string().describe("The original content/description of the item"), text: z.string().describe("Backward compatibility field - same as content"), title: z.string().describe("User-friendly title extracted from content"), status: z.enum([ "unprocessed", "processed" ]).describe("Current processing status"), capturedAt: z.string().describe("When the item was captured (ISO date)"), createdAt: z.date().describe("Backward compatibility field - same as capturedAt"), capturedBy: z.string().describe("Who captured this item (person ID)"), capturedByPerson: z.object({ id: z.string(), displayName: z.string(), roleType: z.enum([ "Human", "AiAgent" ]) }).nullable().describe("Enriched person information"), priority: z.enum([ "low", "medium", "high", "urgent" ]).optional().describe("Priority level if assigned"), clarification: z.string().optional().describe("Clarification text if item has been clarified"), description: z.string().optional().describe("Backward compatibility field - same as clarification"), isActionable: z.boolean().optional().describe("Whether the item has been determined to be actionable"), tags: z.array(z.string()).optional().describe("Tags associated with the item") }); var InboxCaptureResultSchema = z.object({ success: z.boolean().describe("Whether the capture was successful"), itemId: z.string().describe("The ID of the created inbox item"), capturedAt: z.string().describe("When the item was captured"), message: z.string().describe("Human-readable message"), error: z.string().optional().describe("Error details if capture failed") }); var InboxQueryCriteriaSchema = z.object({ status: z.enum([ "inbox", "clarified", "processed" ]).optional(), priority: z.enum([ "low", "medium", "high", "urgent" ]).optional(), capturedBy: z.string().optional(), tags: z.array(z.string()).optional(), limit: z.number().optional(), offset: z.number().optional() }); var gtdDomainApi = makeApi([ { method: "post", path: "/api/gtd/inbox", alias: "captureInboxItem", description: "Capture a new item into GTD inbox", parameters: [ { name: "body", type: "Body", schema: InboxCaptureRequestSchema } ], response: InboxCaptureResultSchema }, { method: "get", path: "/api/gtd/inbox", alias: "getInboxItems", description: "Get inbox items with optional filtering", parameters: [ { name: "query", type: "Query", schema: InboxQueryCriteriaSchema } ], response: z.object({ items: z.array(InboxItemSummarySchema), total: z.number(), hasMore: z.boolean() }) }, { method: "get", path: "/api/gtd/inbox/:id", alias: "getInboxItem", description: "Get a specific inbox item by ID", parameters: [ { name: "id", type: "Path", schema: z.string() } ], response: InboxItemSummarySchema }, { method: "put", path: "/api/gtd/inbox/:id/clarify", alias: "clarifyInboxItem", description: "Clarify an inbox item (step 2 of GTD)", parameters: [ { name: "id", type: "Path", schema: z.string() }, { name: "body", type: "Body", schema: z.object({ isActionable: z.boolean(), outcome: z.string().optional(), nextAction: z.string().optional(), context: z.string().optional(), project: z.string().optional(), clarifiedBy: z.string() }) } ], response: InboxItemSummarySchema }, { method: "get", path: "/api/gtd/next-actions", alias: "getNextActions", description: "Get next actions organized by context", parameters: [ { name: "query", type: "Query", schema: z.object({ context: z.string().optional(), priority: z.enum([ "low", "medium", "high", "urgent" ]).optional(), limit: z.number().optional() }) } ], response: z.object({ actions: z.array(z.object({ id: z.string(), content: z.string(), context: z.string(), priority: z.enum([ "low", "medium", "high", "urgent" ]), project: z.string().optional(), dueDate: z.string().optional() })), byContext: z.record(z.string(), z.array(z.any())) }) }, { method: "get", path: "/api/gtd/weekly-review", alias: "getWeeklyReview", description: "Get data for GTD weekly review", response: z.object({ inbox: z.array(InboxItemSummarySchema), overdueTasks: z.array(z.any()), waitingForTasks: z.array(z.any()), somedayTasks: z.array(z.any()), completedThisWeek: z.array(z.any()), stats: z.object({ tasksCompleted: z.number(), tasksCreated: z.number(), averageCompletionTime: z.number(), productivityScore: z.number() }) }) } ]); export { InboxCaptureRequestSchema, InboxItemSummarySchema, InboxCaptureResultSchema, InboxQueryCriteriaSchema, gtdDomainApi }; //# sourceMappingURL=chunk-4NKUS3ME.mjs.map