dbxlite-ui 0.3.2 → 0.3.4
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/assets/assets/{main-CyH5V7SF.js → main-DBSgQ0Bs.js} +2490 -2454
- package/assets/index.html +1 -1
- package/dist/cli.js +21 -0
- package/package.json +1 -1
package/assets/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
<!-- Favicon - database icon in gradient rounded square -->
|
|
16
16
|
<link rel="icon" type="image/svg+xml" href="./logo/favicon.svg">
|
|
17
|
-
<script type="module" crossorigin src="./assets/main-
|
|
17
|
+
<script type="module" crossorigin src="./assets/main-DBSgQ0Bs.js"></script>
|
|
18
18
|
<link rel="modulepreload" crossorigin href="./assets/oauth-constants-m7PlKcMR.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="./assets/react-vendor-B2Ij4Vfr.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="./assets/monaco-editor-CbzSR0rd.js">
|
package/dist/cli.js
CHANGED
|
@@ -165,16 +165,37 @@ console.log(`Assets directory: ${ASSETS_DIR}`);
|
|
|
165
165
|
// index.html so the React router can handle it (mirrors the Vercel rewrite).
|
|
166
166
|
const ASSET_PREFIXES = ['/assets/', '/duckdb/', '/sql-templates/', '/logo/', '/screenshots/'];
|
|
167
167
|
const ASSET_FILES = ['/robots.txt', '/sitemap.xml', '/favicon.ico'];
|
|
168
|
+
// API prefixes never fall back to index.html — they're CORS-proxy paths
|
|
169
|
+
// (Snowflake, BigQuery) that exist in the Vercel deployment but not here.
|
|
170
|
+
// Returning index.html for these breaks the connector with "Unexpected
|
|
171
|
+
// token '<'" when it tries to JSON.parse the HTML response.
|
|
172
|
+
const API_PREFIXES = ['/api/'];
|
|
168
173
|
|
|
169
174
|
function isAssetPath(urlPath) {
|
|
170
175
|
return ASSET_PREFIXES.some(p => urlPath.startsWith(p)) || ASSET_FILES.includes(urlPath);
|
|
171
176
|
}
|
|
172
177
|
|
|
178
|
+
function isApiPath(urlPath) {
|
|
179
|
+
return API_PREFIXES.some(p => urlPath.startsWith(p));
|
|
180
|
+
}
|
|
181
|
+
|
|
173
182
|
// Create asset server
|
|
174
183
|
const server = createServer((req, res) => {
|
|
175
184
|
let urlPath = req.url.split('?')[0];
|
|
176
185
|
if (urlPath === '/') urlPath = '/index.html';
|
|
177
186
|
|
|
187
|
+
// Cloud API proxy paths (Snowflake / BigQuery CORS proxies) only exist in
|
|
188
|
+
// the Vercel deployment. Locally we 501 with a JSON body so the connector
|
|
189
|
+
// can show a clear error instead of choking on HTML.
|
|
190
|
+
if (isApiPath(urlPath)) {
|
|
191
|
+
res.writeHead(501, { 'Content-Type': 'application/json' });
|
|
192
|
+
res.end(JSON.stringify({
|
|
193
|
+
error: 'cloud_proxy_unavailable',
|
|
194
|
+
message: `${urlPath} requires the dbxlite-cloud proxy. Use sql.dbxlite.com for Snowflake/BigQuery, or run dbxlite locally only for DuckDB.`,
|
|
195
|
+
}));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
178
199
|
let filePath = join(ASSETS_DIR, urlPath);
|
|
179
200
|
|
|
180
201
|
// Security: prevent directory traversal
|
package/package.json
CHANGED