@tanstack/cta-framework-react-cra 0.22.1 → 0.22.2
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.
- package/add-ons/mcp/assets/src/mcp-todos.ts +5 -1
- package/add-ons/mcp/assets/src/routes/api.mcp-todos.ts +7 -3
- package/add-ons/mcp/assets/src/utils/mcp-handler.ts +0 -2
- package/add-ons/neon/assets/_dot_env.example.append +3 -2
- package/add-ons/neon/assets/src/db.ts +2 -2
- package/add-ons/start/assets/vite.config.ts.ejs +2 -1
- package/package.json +2 -2
|
@@ -43,5 +43,9 @@ export function subscribeToTodos(callback: (todos: Todo[]) => void) {
|
|
|
43
43
|
|
|
44
44
|
// Notify all subscribers of a user's cart
|
|
45
45
|
function notifySubscribers() {
|
|
46
|
-
|
|
46
|
+
for (const cb of subscribers) {
|
|
47
|
+
try {
|
|
48
|
+
cb(todos)
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
47
51
|
}
|
|
@@ -8,9 +8,13 @@ export const Route = createFileRoute('/api/mcp-todos')({
|
|
|
8
8
|
GET: () => {
|
|
9
9
|
const stream = new ReadableStream({
|
|
10
10
|
start(controller) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
function ping() {
|
|
12
|
+
try {
|
|
13
|
+
controller.enqueue(`event: ping\n\n`)
|
|
14
|
+
setTimeout(ping, 1000)
|
|
15
|
+
} catch {}
|
|
16
|
+
}
|
|
17
|
+
ping()
|
|
14
18
|
const unsubscribe = subscribeToTodos((todos) => {
|
|
15
19
|
controller.enqueue(`data: ${JSON.stringify(todos)}\n\n`)
|
|
16
20
|
})
|
|
@@ -31,8 +31,6 @@ export async function handleMcpRequest(
|
|
|
31
31
|
await clientTransport.close()
|
|
32
32
|
await serverTransport.close()
|
|
33
33
|
|
|
34
|
-
console.log('responseData', JSON.stringify(responseData, null, 2))
|
|
35
|
-
|
|
36
34
|
return Response.json(responseData, {
|
|
37
35
|
headers: {
|
|
38
36
|
'Content-Type': 'application/json',
|
|
@@ -3,11 +3,11 @@ import { neon } from '@neondatabase/serverless'
|
|
|
3
3
|
let client: ReturnType<typeof neon>
|
|
4
4
|
|
|
5
5
|
export async function getClient() {
|
|
6
|
-
if (!process.env.
|
|
6
|
+
if (!process.env.VITE_DATABASE_URL) {
|
|
7
7
|
return undefined
|
|
8
8
|
}
|
|
9
9
|
if (!client) {
|
|
10
|
-
client = await neon(process.env.
|
|
10
|
+
client = await neon(process.env.VITE_DATABASE_URL!)
|
|
11
11
|
}
|
|
12
12
|
return client
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/cta-framework-react-cra",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"description": "CTA Framework for React (Create React App)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"author": "Jack Herrington <jherr@pobox.com>",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tanstack/cta-engine": "0.22.
|
|
26
|
+
"@tanstack/cta-engine": "0.22.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.13.4",
|