create-surf-app 0.1.20 → 0.1.22

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.
@@ -30,7 +30,6 @@ const raw = await dataApi.get("newcategory/endpoint", { foo: "bar" });
30
30
  ```
31
31
  frontend/src/App.tsx - build your UI here
32
32
  frontend/src/components/ - add components
33
- frontend/src/db/schema.ts - frontend DB schema mirror
34
33
  backend/routes/*.js - add API routes (auto-mounted at /api/{name})
35
34
  backend/db/schema.js - define database tables
36
35
  ```
@@ -5,6 +5,9 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" href="/favicon.ico" />
7
7
  <title>App</title>
8
+ <script>
9
+ document.documentElement.classList.add('dark');
10
+ </script>
8
11
  </head>
9
12
  <body>
10
13
  <div id="root"><!--ssr-outlet--></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-surf-app",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Scaffold a Surf app — Vite + React + Express + @surf-ai/sdk",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,16 +0,0 @@
1
- // Database schema definition — keep in sync with actual DB tables.
2
- // This file is the single source of truth for table definitions across sessions.
3
- // After any CREATE TABLE or ALTER TABLE, update this file to match.
4
- //
5
- // Example (uncomment and modify when creating tables):
6
- //
7
- // export const schema = {
8
- // todos: {
9
- // id: 'SERIAL PRIMARY KEY',
10
- // title: 'TEXT NOT NULL',
11
- // completed: 'BOOLEAN DEFAULT false',
12
- // created_at: 'TIMESTAMPTZ DEFAULT NOW()',
13
- // },
14
- // } as const
15
- //
16
- export {}
@@ -1,31 +0,0 @@
1
- /**
2
- * Crypto API client helpers (fallback — swagger fetch failed).
3
- */
4
-
5
- export { API_BASE, normalizeProxyPath, fetchWithRetry, proxyGet, proxyPost } from './fetch'
6
-
7
- export interface ApiResponse<T> {
8
- data: T[]
9
- meta?: { total?: number; limit?: number; offset?: number }
10
- error?: { code: string; message: string }
11
- }
12
-
13
- export interface ApiObjectResponse<T> {
14
- data: T
15
- meta?: { total?: number; limit?: number; offset?: number }
16
- error?: { code: string; message: string }
17
- }
18
-
19
- export interface CursorMeta {
20
- has_more: boolean
21
- next_cursor?: string
22
- limit?: number
23
- cached?: boolean
24
- credits_used?: number
25
- }
26
-
27
- export interface ApiCursorResponse<T> {
28
- data: T[]
29
- meta: CursorMeta
30
- error?: { code: string; message: string }
31
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Core fetch utilities for proxy API access.
3
- * This file is part of the scaffold — do NOT modify manually.
4
- */
5
-
6
- export const API_BASE = import.meta.env.VITE_API_URL || import.meta.env.BASE_URL.replace(/\/$/, '')
7
-
8
- /** Normalize logical proxy paths; strips leading slashes and proxy/ prefix. */
9
- export function normalizeProxyPath(path: string): string {
10
- const trimmed = String(path || '').replace(/^\/+/, '')
11
- return trimmed.replace(/^(?:proxy\/)+/, '')
12
- }
13
-
14
- /** Fetch with retry on empty response. */
15
- export async function fetchWithRetry<T = any>(url: string, init?: RequestInit, retries = 1): Promise<T> {
16
- for (let attempt = 0; attempt <= retries; attempt++) {
17
- const res = await fetch(url, init)
18
- const text = await res.text()
19
- if (text) return JSON.parse(text)
20
- if (attempt < retries) await new Promise(r => setTimeout(r, 1000))
21
- }
22
- throw new Error(`Empty response from ${url.replace(API_BASE, '')}`)
23
- }
24
-
25
- /** Generic proxy GET \u2014 use for any /proxy/{category}/{endpoint} route. */
26
- export async function proxyGet<T = any>(path: string, params?: Record<string, string>): Promise<T> {
27
- const qs = params ? '?' + new URLSearchParams(params).toString() : ''
28
- return fetchWithRetry<T>(`${API_BASE}/proxy/${normalizeProxyPath(path)}${qs}`)
29
- }
30
-
31
- /** Generic proxy POST \u2014 use for any /proxy/{category}/{endpoint} route. */
32
- export async function proxyPost<T = any>(path: string, body?: any): Promise<T> {
33
- return fetchWithRetry<T>(`${API_BASE}/proxy/${normalizeProxyPath(path)}`, {
34
- method: 'POST',
35
- headers: { 'Content-Type': 'application/json' },
36
- body: body ? JSON.stringify(body) : undefined,
37
- })
38
- }