@rip-lang/db 0.8.3 → 0.8.5
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/db.rip +4 -9
- package/package.json +1 -1
package/db.rip
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
#
|
|
21
21
|
# ==============================================================================
|
|
22
22
|
|
|
23
|
-
import { get, post,
|
|
23
|
+
import { get, post, read, start, use } from '@rip-lang/api'
|
|
24
24
|
import { cors } from '@rip-lang/api/middleware'
|
|
25
25
|
import { open } from './lib/duckdb.mjs'
|
|
26
26
|
import { version as VERSION } from './package.json'
|
|
@@ -36,11 +36,6 @@ import {
|
|
|
36
36
|
# Enable CORS for duck-ui and other clients
|
|
37
37
|
use cors preflight: true
|
|
38
38
|
|
|
39
|
-
# Fix duck-ui's wrong content-type (sends raw SQL as form-urlencoded)
|
|
40
|
-
raw (req) ->
|
|
41
|
-
if req.headers.get('format') is 'JSONCompact'
|
|
42
|
-
req.headers.set 'content-type', 'text/plain'
|
|
43
|
-
|
|
44
39
|
# ==============================================================================
|
|
45
40
|
# Configuration
|
|
46
41
|
# ==============================================================================
|
|
@@ -246,8 +241,8 @@ get '/ui', -> new Response Bun.file(import.meta.dir + '/db.html')
|
|
|
246
241
|
# POST /ddb/run — Execute SQL and return binary result (DuckDB UI protocol)
|
|
247
242
|
post '/ddb/run', (req) ->
|
|
248
243
|
try
|
|
249
|
-
sql = req.
|
|
250
|
-
console.log "POST /ddb/run", sql?.slice(0, 100)
|
|
244
|
+
sql = req.text!
|
|
245
|
+
console.log "POST /ddb/run", sql?.slice?(0, 100) or sql
|
|
251
246
|
|
|
252
247
|
return binaryResponse serializeErrorResult 'Empty query' unless sql?.trim()
|
|
253
248
|
|
|
@@ -287,7 +282,7 @@ post '/ddb/interrupt', ->
|
|
|
287
282
|
|
|
288
283
|
# POST /ddb/tokenize — Tokenize SQL for syntax highlighting
|
|
289
284
|
post '/ddb/tokenize', (req) ->
|
|
290
|
-
sql = req.
|
|
285
|
+
sql = req.text! or ''
|
|
291
286
|
tokens = tokenizeSQL sql
|
|
292
287
|
binaryResponse serializeTokenizeResult tokens
|
|
293
288
|
|