@mayder/devibe 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ import { createTicket, type TicketStore } from './ticket-service.ts'
2
+
3
+ export async function postTicket(request: Request, store: TicketStore): Promise<Response> {
4
+ const body: { title?: unknown } | null = await request.json().catch(() => null)
5
+ if (typeof body?.title !== 'string') {
6
+ return Response.json({ error: 'invalid_title' }, { status: 400 })
7
+ }
8
+
9
+ const ticket = await createTicket(body.title, store)
10
+ if (!ticket) {
11
+ return Response.json({ error: 'empty_title' }, { status: 422 })
12
+ }
13
+ return Response.json(ticket, { status: 201 })
14
+ }
@@ -0,0 +1,11 @@
1
+ export interface TicketStore {
2
+ insert(title: string): Promise<{ id: string; title: string }>
3
+ }
4
+
5
+ export async function createTicket(title: string, store: TicketStore) {
6
+ if (title.trim() === '') {
7
+ return null
8
+ }
9
+
10
+ return store.insert(title)
11
+ }
@@ -0,0 +1,11 @@
1
+ import { createTicket, type TicketStore } from './ticket-service.ts'
2
+
3
+ export async function postTicket(request: Request, store: TicketStore): Promise<Response> {
4
+ const body: { title?: unknown } | null = await request.json().catch(() => null)
5
+ if (typeof body?.title !== 'string') {
6
+ return Response.json({ error: 'invalid_title' }, { status: 400 })
7
+ }
8
+
9
+ const ticket = await createTicket(body.title, store)
10
+ return Response.json(ticket, { status: 201 })
11
+ }
@@ -0,0 +1,7 @@
1
+ export interface TicketStore {
2
+ insert(title: string): Promise<{ id: string; title: string }>
3
+ }
4
+
5
+ export async function createTicket(title: string, store: TicketStore) {
6
+ return store.insert(title)
7
+ }
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "@mayder/devibe",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Entiende qué escribió tu IA y revisa sus cambios en tu repo local.",
5
+ "type": "module",
6
+ "bin": {
7
+ "devibe": "./bin/devibe.mjs"
8
+ },
9
+ "engines": {
10
+ "node": ">=24"
11
+ },
12
+ "license": "UNLICENSED",
13
+ "homepage": "https://devibe-xi.vercel.app/",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/MayderC/devibe.git"
17
+ },
18
+ "files": [
19
+ "bin",
20
+ "dist",
21
+ "examples/support-desk/before",
22
+ "examples/support-desk/after"
23
+ ],
24
+ "scripts": {
25
+ "test": "node --test examples/support-desk/verify.mjs"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ }
30
+ }