first commit
This commit is contained in:
63
apps/suman-bosna/src/app/.well-known/ucp/route.ts
Normal file
63
apps/suman-bosna/src/app/.well-known/ucp/route.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import {
|
||||
UCP_CAPABILITIES,
|
||||
UCP_MCP_PATH,
|
||||
UCP_REST_BASE_PATH,
|
||||
UCP_VERSION,
|
||||
} from "@lib/ucp/ucp"
|
||||
import { getRequestOrigin } from "@lib/util/site"
|
||||
|
||||
export const GET = (request: Request) => {
|
||||
const origin = getRequestOrigin(request)
|
||||
const overview = `https://ucp.dev/${UCP_VERSION}/specification/overview/`
|
||||
|
||||
const capabilities = Object.fromEntries(
|
||||
Object.entries(UCP_CAPABILITIES).map(([name, { spec, schema }]) => [
|
||||
name,
|
||||
[{ version: UCP_VERSION, spec, schema }],
|
||||
])
|
||||
)
|
||||
|
||||
return Response.json(
|
||||
{
|
||||
ucp: {
|
||||
version: UCP_VERSION,
|
||||
services: {
|
||||
"dev.ucp.shopping": [
|
||||
{
|
||||
version: UCP_VERSION,
|
||||
spec: overview,
|
||||
transport: "mcp",
|
||||
endpoint: `${origin}${UCP_MCP_PATH}`,
|
||||
schema: `https://ucp.dev/${UCP_VERSION}/services/shopping/mcp.openrpc.json`,
|
||||
},
|
||||
{
|
||||
version: UCP_VERSION,
|
||||
spec: overview,
|
||||
transport: "rest",
|
||||
endpoint: `${origin}${UCP_REST_BASE_PATH}`,
|
||||
schema: `https://ucp.dev/${UCP_VERSION}/services/shopping/rest.openapi.json`,
|
||||
},
|
||||
],
|
||||
},
|
||||
capabilities: {
|
||||
...capabilities,
|
||||
"dev.ucp.shopping.permalink": [
|
||||
{
|
||||
version: UCP_VERSION,
|
||||
spec: `https://ucp.dev/${UCP_VERSION}/specification/permalink`,
|
||||
schema: `https://ucp.dev/${UCP_VERSION}/schemas/shopping/permalink.json`,
|
||||
config: { endpoint: `${origin}/buy` },
|
||||
},
|
||||
],
|
||||
},
|
||||
payment_handlers: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Cache-Control": "public, max-age=300",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user