Giter Club home page Giter Club logo

jacoblincool / d1-manager Goto Github PK

View Code? Open in Web Editor NEW
361.0 7.0 159.0 5.63 MB

D1 Manager is a web UI and API for Cloudflare D1, a serverless SQL database. It provides a web interface for managing databases, tables, and records, as well as an AI assistant to help you write query in natural language.

Home Page: https://d1-manager.pages.dev

License: MIT License

Dockerfile 1.11% JavaScript 1.68% Shell 0.18% TypeScript 41.55% CSS 0.31% HTML 0.48% Svelte 54.68%
cloudflare-pages d1 database sql gpt

d1-manager's Introduction

D1 Manager

D1 Manager is a web UI and API for Cloudflare D1, a serverless SQL database. It provides a user-friendly interface for managing databases, tables, and records, as well as an API for performing operations programmatically. D1 Manager simplifies database management, enabling users to focus on their data.

semantic-query-demo

Features

  • Multiple D1 Databases
  • List all tables in a database
  • Show table schema
  • Run SQL queries
  • Run Semantic Queries (OpenAI API or Cloudflare AI Worker)
  • Edit table data through UI
  • I18n support (English, Chinese, Spanish, Japanese) add more (Online Editor)
  • API support (see routes/api for details)

Setup

  1. Fork this repo
  2. Setup a Cloudflare Pages with the forked repo
    • Select the SveltKit framework preset.
    • Build command: npm run build
    • Build output directory: .svelte-kit/cloudflare
  3. Use Cloudflare Access to protect the your site
    • The default access rules only restrict access to preview pages, so make sure to add other urls you want protected.
  4. Bind databases to DB_* environment variables

bind-d1

Note: You can bind multiple databases to the manager. In theis example, DB will be default in the UI, and DB_test will be test.

Environment Variables

Some plugins (e.g. Semantic Query) require additional environment variables to be set.

set-env-var

Also, there are some configuration options that can be set through environment variables.

  • SHOW_INTERNAL_TABLES: Show internal tables (splite_* and d1_*) in the UI.

Semantic Query

You can use OpenAI API or Cloudflare AI Worker to run Semantic Query.

OpenAI API:

  • OPENAI_API_KEY: OpenAI API key for Semantic Query.
  • OPENAI_API_URL: You may use this with Cloudflare AI Gateway to proxy requests to OpenAI API.
  • OPENAI_MODEL: OpenAI API model for Semantic Query. Default to gpt-3.5-turbo-1106.

Cloudflare AI Worker:

  • AI: Bind a Cloudflare AI Worker to this variable.
  • CFAI_MODEL: Cloudflare AI Worker model for Semantic Query. Default to @cf/mistral/mistral-7b-instruct-v0.1.

Screenshots

tables

run-query

table-browser

add-record

semantic-query

Semantic Query uses OpenAI GPT-3.5 Turbo to translate natural language queries into SQL.

d1-manager's People

Contributors

fernandodilland avatar jacoblincool avatar johtso avatar moalamri avatar nilsjacobsen avatar renovate[bot] avatar zeviance avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

d1-manager's Issues

Save query result as a http service [Feature Request]

Deploy the results of the semantic query as an API interface, which can be used as an external HTTP service.

flowchart TD
  A[Semantic Query] --> B[Generated SQL]
  B --> C[Extract Request Parameters]
  C --> D[Deployed as a HTTP Service]

Try sqlcoder-7b-2

Cloudflare Workers AI now provides sqlcoder-7b-2 as @cf/defog/sqlcoder-7b-2, which is totally built for generating SQL queries and may produces better results than GPT-4 / GPT-3.5.

no tables populated in DB

I have a DB bound to my page deployment for the manager but when I select it in the interface, I'm greeted with the DB title up top, the query field and no tables.

When I download the DB from the "download" button and open it up I get "{"success":false,"error":"Route not found"}"

Error occurs when adding data with preset function values.

I have set my data table with the following code:
create_time TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
This is to automatically fill in the date when manually adding data.

At least that's how it works on the data table operation page in Cloudflare D1. However, when I tried to do the same in the program of this repository, it automatically filled in the text of the default function strftime('%Y-%m-%dT%H:%M:%SZ', 'now') itself.
image

Typically, it should work like this: automatically filling in the date when adding.
image

`Cloudflare Pages`: Your Functions script is over the 1 MiB size limit

Am I missing something? Is it possible to use this app in Free Plan account?

Reproduction

  1. Create cloudflare pages
  2. Select forked repo
  3. Select SvelteKit preset
  4. Deploy

Logs

2023-12-14T22:02:04.341319Z	Cloning repository...
2023-12-14T22:02:05.497758Z	From https://github.com/lamualfa/d1-manager
2023-12-14T22:02:05.498469Z	 * branch            cac9355bef2ac173c55236c1af7de5c42dc724f0 -> FETCH_HEAD
2023-12-14T22:02:05.499104Z	
2023-12-14T22:02:05.593998Z	HEAD is now at cac9355 Merge pull request #21 from JacobLinCool/renovate/actions-checkout-4.x
2023-12-14T22:02:05.594821Z	
2023-12-14T22:02:05.70316Z	
2023-12-14T22:02:05.735211Z	Success: Finished cloning repository files
2023-12-14T22:02:06.627902Z	Detected the following tools from environment: [email protected], [email protected]
2023-12-14T22:02:08.423965Z	Installing project dependencies: pnpm install
2023-12-14T22:02:09.30215Z	Lockfile is up to date, resolution step is skipped
2023-12-14T22:02:09.389375Z	Progress: resolved 1, reused 0, downloaded 0, added 0
2023-12-14T22:02:09.543046Z	Packages: +657
2023-12-14T22:02:09.543406Z	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2023-12-14T22:02:10.391281Z	Progress: resolved 657, reused 0, downloaded 35, added 26
2023-12-14T22:02:11.391407Z	Progress: resolved 657, reused 0, downloaded 194, added 192
2023-12-14T22:02:12.391577Z	Progress: resolved 657, reused 0, downloaded 297, added 285
2023-12-14T22:02:13.390998Z	Progress: resolved 657, reused 0, downloaded 388, added 378
2023-12-14T22:02:14.391046Z	Progress: resolved 657, reused 0, downloaded 427, added 413
2023-12-14T22:02:15.39218Z	Progress: resolved 657, reused 0, downloaded 521, added 504
2023-12-14T22:02:16.392506Z	Progress: resolved 657, reused 0, downloaded 590, added 580
2023-12-14T22:02:17.393015Z	Progress: resolved 657, reused 0, downloaded 656, added 656
2023-12-14T22:02:17.65388Z	Progress: resolved 657, reused 0, downloaded 657, added 657, done
2023-12-14T22:02:17.982934Z	.../[email protected]/node_modules/es5-ext postinstall$  node -e "try{require('./_postinstall')}catch(e){}" || exit 0
2023-12-14T22:02:18.046584Z	.../node_modules/svelte-preprocess postinstall$ echo "[svelte-preprocess] Don't forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc..."
2023-12-14T22:02:18.069562Z	.../node_modules/svelte-preprocess postinstall: [svelte-preprocess] Don't forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc...
2023-12-14T22:02:18.072622Z	.../node_modules/svelte-preprocess postinstall: Done
2023-12-14T22:02:18.109119Z	.../[email protected]/node_modules/es5-ext postinstall: Done
2023-12-14T22:02:18.284507Z	.../[email protected]/node_modules/esbuild postinstall$ node install.js
2023-12-14T22:02:18.284895Z	.../[email protected]/node_modules/esbuild postinstall$ node install.js
2023-12-14T22:02:18.312572Z	.../node_modules/workerd postinstall$ node install.js
2023-12-14T22:02:18.328236Z	.../[email protected]/node_modules/esbuild postinstall$ node install.js
2023-12-14T22:02:18.409109Z	.../[email protected]/node_modules/esbuild postinstall: Done
2023-12-14T22:02:18.42415Z	.../[email protected]/node_modules/esbuild postinstall: Done
2023-12-14T22:02:18.738038Z	.../[email protected]/node_modules/esbuild postinstall: Done
2023-12-14T22:02:18.743521Z	.../node_modules/workerd postinstall: Done
2023-12-14T22:02:19.194211Z	.../node_modules/@sveltejs/kit postinstall$ node postinstall.js
2023-12-14T22:02:20.618698Z	.../node_modules/@sveltejs/kit postinstall: Done
2023-12-14T22:02:20.803913Z	
2023-12-14T22:02:20.804224Z	devDependencies:
2023-12-14T22:02:20.804424Z	+ @ai-d/aid 0.1.3
2023-12-14T22:02:20.804594Z	+ @changesets/changelog-github 0.5.0
2023-12-14T22:02:20.804738Z	+ @changesets/cli 2.27.1
2023-12-14T22:02:20.804872Z	+ @cloudflare/workers-types 4.20231121.0
2023-12-14T22:02:20.805001Z	+ @iconify/svelte 3.1.4
2023-12-14T22:02:20.805127Z	+ @playwright/test 1.40.1
2023-12-14T22:02:20.805255Z	+ @sveltejs/adapter-cloudflare 2.3.3
2023-12-14T22:02:20.805383Z	+ @sveltejs/kit 1.27.6
2023-12-14T22:02:20.805533Z	+ @tailwindcss/typography 0.5.10
2023-12-14T22:02:20.805668Z	+ @types/debug 4.1.12
2023-12-14T22:02:20.805794Z	+ @typescript-eslint/eslint-plugin 6.13.1
2023-12-14T22:02:20.80592Z	+ @typescript-eslint/parser 6.13.1
2023-12-14T22:02:20.806048Z	+ autoprefixer 10.4.16
2023-12-14T22:02:20.806169Z	+ csv-parse 5.5.2
2023-12-14T22:02:20.806321Z	+ csv-stringify 6.4.4
2023-12-14T22:02:20.806452Z	+ daisyui 4.4.14
2023-12-14T22:02:20.806619Z	+ debug 4.3.4
2023-12-14T22:02:20.806757Z	+ eslint 8.54.0
2023-12-14T22:02:20.806884Z	+ eslint-config-prettier 9.0.0
2023-12-14T22:02:20.807017Z	+ eslint-plugin-svelte3 4.0.0
2023-12-14T22:02:20.807143Z	+ husky 8.0.3
2023-12-14T22:02:20.807284Z	+ lint-staged 15.1.0
2023-12-14T22:02:20.807433Z	+ openai 4.20.1
2023-12-14T22:02:20.807583Z	+ postcss 8.4.31
2023-12-14T22:02:20.80771Z	+ prettier 3.1.0
2023-12-14T22:02:20.807833Z	+ prettier-plugin-organize-imports 3.2.4
2023-12-14T22:02:20.807957Z	+ prettier-plugin-svelte 3.1.2
2023-12-14T22:02:20.808098Z	+ prettier-plugin-tailwindcss 0.5.7
2023-12-14T22:02:20.808228Z	+ svelte 4.2.8
2023-12-14T22:02:20.808353Z	+ svelte-check 3.6.2
2023-12-14T22:02:20.808499Z	+ svelte-i18n 4.0.0
2023-12-14T22:02:20.808641Z	+ tailwindcss 3.3.5
2023-12-14T22:02:20.808769Z	+ theme-change 2.5.0
2023-12-14T22:02:20.808909Z	+ tslib 2.6.2
2023-12-14T22:02:20.809048Z	+ typescript 5.3.2
2023-12-14T22:02:20.809186Z	+ vite 5.0.4
2023-12-14T22:02:20.809312Z	+ vitest 0.34.6
2023-12-14T22:02:20.809437Z	+ wrangler 3.17.1
2023-12-14T22:02:20.809601Z	+ zod 3.22.4
2023-12-14T22:02:20.809745Z	
2023-12-14T22:02:20.809873Z	The dependency was already listed in devDependencies.
2023-12-14T22:02:20.809998Z	If you want to make it a prod dependency, then move it manually.
2023-12-14T22:02:20.810123Z	
2023-12-14T22:02:20.833141Z	
2023-12-14T22:02:20.833691Z	> [email protected] prepare /opt/buildhome/repo
2023-12-14T22:02:20.833881Z	> husky install
2023-12-14T22:02:20.834031Z	
2023-12-14T22:02:20.950191Z	husky - Git hooks installed
2023-12-14T22:02:20.959504Z	Done in 12.1s
2023-12-14T22:02:21.027075Z	Executing user command: npm run build
2023-12-14T22:02:21.997925Z	
2023-12-14T22:02:22.020523Z	> [email protected] build
2023-12-14T22:02:22.025909Z	> vite build
2023-12-14T22:02:22.02617Z	
2023-12-14T22:02:23.511902Z	
2023-12-14T22:02:23.512751Z	�[36mvite v5.0.4 �[32mbuilding SSR bundle for production...�[36m�[39m
2023-12-14T22:02:23.54375Z	transforming...
2023-12-14T22:02:25.137539Z	
2023-12-14T22:02:25.138314Z	🌼   �[35mdaisyUI�[39m �[2m4.4.14�[22m
2023-12-14T22:02:25.294645Z	├─ �[32m✔︎�[39m 2 themes added�[2m		https://daisyui.com/docs/themes�[22m
2023-12-14T22:02:25.29503Z	╰─ �[32m★�[39m �[0mStar daisyUI on GitHub�[0m	�[2mhttps://github.com/saadeghi/daisyui�[22m
2023-12-14T22:02:25.295243Z	
2023-12-14T22:02:26.184697Z	�[32m✓�[39m 141 modules transformed.
2023-12-14T22:02:26.291206Z	rendering chunks...
2023-12-14T22:02:27.92284Z	
2023-12-14T22:02:27.923678Z	�[36mvite v5.0.4 �[32mbuilding for production...�[36m�[39m
2023-12-14T22:02:27.928231Z	transforming...
2023-12-14T22:02:29.985957Z	�[32m✓�[39m 114 modules transformed.
2023-12-14T22:02:29.997456Z	Generated an empty chunk: "4".
2023-12-14T22:02:30.101816Z	rendering chunks...
2023-12-14T22:02:30.181772Z	computing gzip size...
2023-12-14T22:02:30.196311Z	�[2m.svelte-kit/output/client/�[22m�[32m_app/version.json                                 �[39m�[1m�[2m 0.03 kB�[22m�[1m�[22m�[2m │ gzip:  0.05 kB�[22m
2023-12-14T22:02:30.196709Z	�[2m.svelte-kit/output/client/�[22m�[32m.vite/manifest.json                               �[39m�[1m�[2m 8.82 kB�[22m�[1m�[22m�[2m │ gzip:  1.19 kB�[22m
2023-12-14T22:02:30.196899Z	�[2m.svelte-kit/output/client/�[22m�[35m_app/immutable/assets/0.HGVcbUqI.css              �[39m�[1m�[2m65.60 kB�[22m�[1m�[22m�[2m │ gzip: 10.37 kB�[22m
2023-12-14T22:02:30.19705Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/4.w40geAFS.js               �[39m�[1m�[2m 0.00 kB�[22m�[1m�[22m�[2m │ gzip:  0.02 kB�[22m
2023-12-14T22:02:30.197186Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/each.6w4Ej4nR.js            �[39m�[1m�[2m 0.09 kB�[22m�[1m�[22m�[2m │ gzip:  0.10 kB�[22m
2023-12-14T22:02:30.19733Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/navigation.IP2a5RUo.js      �[39m�[1m�[2m 0.14 kB�[22m�[1m�[22m�[2m │ gzip:  0.13 kB�[22m
2023-12-14T22:02:30.197492Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/stores.0kRi7kC7.js          �[39m�[1m�[2m 0.24 kB�[22m�[1m�[22m�[2m │ gzip:  0.17 kB�[22m
2023-12-14T22:02:30.197642Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/sql.aPao9nYC.js             �[39m�[1m�[2m 0.28 kB�[22m�[1m�[22m�[2m │ gzip:  0.19 kB�[22m
2023-12-14T22:02:30.197773Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/csv.RJwtQBx_.js             �[39m�[1m�[2m 0.61 kB�[22m�[1m�[22m�[2m │ gzip:  0.40 kB�[22m
2023-12-14T22:02:30.197902Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/nodes/1.a74FvXc4.js                �[39m�[1m�[2m 0.84 kB�[22m�[1m�[22m�[2m │ gzip:  0.52 kB�[22m
2023-12-14T22:02:30.198038Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/preload-helper.LRFSOuOa.js  �[39m�[1m�[2m 0.89 kB�[22m�[1m�[22m�[2m │ gzip:  0.55 kB�[22m
2023-12-14T22:02:30.198166Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/index.hzeRqrCp.js           �[39m�[1m�[2m 0.93 kB�[22m�[1m�[22m�[2m │ gzip:  0.58 kB�[22m
2023-12-14T22:02:30.198294Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/zh-CN.8ABRG2vZ.js           �[39m�[1m�[2m 1.98 kB�[22m�[1m�[22m�[2m │ gzip:  1.45 kB�[22m
2023-12-14T22:02:30.198423Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/zh-TW.9emzjYC_.js           �[39m�[1m�[2m 1.98 kB�[22m�[1m�[22m�[2m │ gzip:  1.49 kB�[22m
2023-12-14T22:02:30.198589Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/singletons.JTSV0eAt.js      �[39m�[1m�[2m 2.51 kB�[22m�[1m�[22m�[2m │ gzip:  1.29 kB�[22m
2023-12-14T22:02:30.198724Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/en.upktOW1j.js              �[39m�[1m�[2m 2.68 kB�[22m�[1m�[22m�[2m │ gzip:  1.19 kB�[22m
2023-12-14T22:02:30.198878Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/nodes/2.sZwpBnHi.js                �[39m�[1m�[2m 3.17 kB�[22m�[1m�[22m�[2m │ gzip:  1.43 kB�[22m
2023-12-14T22:02:30.199013Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/index.cdFJyrxh.js           �[39m�[1m�[2m 3.85 kB�[22m�[1m�[22m�[2m │ gzip:  0.94 kB�[22m
2023-12-14T22:02:30.199144Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/nodes/0.4ekFCE5b.js                �[39m�[1m�[2m 4.49 kB�[22m�[1m�[22m�[2m │ gzip:  2.17 kB�[22m
2023-12-14T22:02:30.199276Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/index.JH2cm63i.js           �[39m�[1m�[2m 4.63 kB�[22m�[1m�[22m�[2m │ gzip:  2.38 kB�[22m
2023-12-14T22:02:30.199417Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/nodes/3.jN9-_sZc.js                �[39m�[1m�[2m 5.65 kB�[22m�[1m�[22m�[2m │ gzip:  2.49 kB�[22m
2023-12-14T22:02:30.19957Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/entry/app.fiwdJAdA.js              �[39m�[1m�[2m 7.75 kB�[22m�[1m�[22m�[2m │ gzip:  2.45 kB�[22m
2023-12-14T22:02:30.199708Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/RunQuery.oOXhWTsb.js        �[39m�[1m�[2m 7.75 kB�[22m�[1m�[22m�[2m │ gzip:  3.13 kB�[22m
2023-12-14T22:02:30.199836Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/nodes/5.1L1Q7DgM.js                �[39m�[1m�[2m 8.55 kB�[22m�[1m�[22m�[2m │ gzip:  3.63 kB�[22m
2023-12-14T22:02:30.199978Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/scheduler.6qfkeAXV.js       �[39m�[1m�[2m 8.96 kB�[22m�[1m�[22m�[2m │ gzip:  3.58 kB�[22m
2023-12-14T22:02:30.200113Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/CSV.RGofGOQ2.js             �[39m�[1m�[2m 9.55 kB�[22m�[1m�[22m�[2m │ gzip:  3.87 kB�[22m
2023-12-14T22:02:30.20025Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/SemanticQuery.PkkoEVrc.js   �[39m�[1m�[2m10.26 kB�[22m�[1m�[22m�[2m │ gzip:  3.87 kB�[22m
2023-12-14T22:02:30.200394Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/nodes/6.JgNn7mZE.js                �[39m�[1m�[2m12.18 kB�[22m�[1m�[22m�[2m │ gzip:  4.92 kB�[22m
2023-12-14T22:02:30.200544Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/entry/start.1Crfvet4.js            �[39m�[1m�[2m24.95 kB�[22m�[1m�[22m�[2m │ gzip:  9.85 kB�[22m
2023-12-14T22:02:30.200695Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/sync.Lh_TsmWG.js            �[39m�[1m�[2m31.31 kB�[22m�[1m�[22m�[2m │ gzip:  9.66 kB�[22m
2023-12-14T22:02:30.200827Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/TableBrowser.714vqM29.js    �[39m�[1m�[2m34.92 kB�[22m�[1m�[22m�[2m │ gzip: 12.67 kB�[22m
2023-12-14T22:02:30.200957Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/sync.2SgfVAsK.js            �[39m�[1m�[2m49.21 kB�[22m�[1m�[22m�[2m │ gzip: 13.38 kB�[22m
2023-12-14T22:02:30.201087Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/runtime.Djt3ZxPR.js         �[39m�[1m�[2m50.02 kB�[22m�[1m�[22m�[2m │ gzip: 14.88 kB�[22m
2023-12-14T22:02:30.201232Z	�[2m.svelte-kit/output/client/�[22m�[36m_app/immutable/chunks/AddRecord.tlEiTyB9.js       �[39m�[1m�[2m61.12 kB�[22m�[1m�[22m�[2m │ gzip: 15.74 kB�[22m
2023-12-14T22:02:30.201366Z	�[32m✓ built in 2.27s�[39m
2023-12-14T22:02:31.504595Z	�[2m.svelte-kit/output/server/�[22m�[32m.vite/manifest.json                                                �[39m�[1m�[2m  8.37 kB�[22m�[1m�[22m
2023-12-14T22:02:31.505827Z	�[2m.svelte-kit/output/server/�[22m�[35m_app/immutable/assets/_layout.HGVcbUqI.css                         �[39m�[1m�[2m 65.60 kB�[22m�[1m�[22m
2023-12-14T22:02:31.506157Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/db/_page.server.ts.js                                �[39m�[1m�[2m  0.14 kB�[22m�[1m�[22m
2023-12-14T22:02:31.506605Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/_layout.server.ts.js                                 �[39m�[1m�[2m  0.14 kB�[22m�[1m�[22m
2023-12-14T22:02:31.506772Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_server.ts.js                             �[39m�[1m�[2m  0.17 kB�[22m�[1m�[22m
2023-12-14T22:02:31.507304Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/db/_database_/_layout.server.ts.js                   �[39m�[1m�[2m  0.17 kB�[22m�[1m�[22m
2023-12-14T22:02:31.508427Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/dump/_server.ts.js             �[39m�[1m�[2m  0.21 kB�[22m�[1m�[22m
2023-12-14T22:02:31.508759Z	�[2m.svelte-kit/output/server/�[22m�[36minternal.js                                                        �[39m�[1m�[2m  0.24 kB�[22m�[1m�[22m
2023-12-14T22:02:31.508978Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/sql.js                                                      �[39m�[1m�[2m  0.28 kB�[22m�[1m�[22m
2023-12-14T22:02:31.509207Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/shared-server.js                                            �[39m�[1m�[2m  0.28 kB�[22m�[1m�[22m
2023-12-14T22:02:31.509383Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/_layout.ts.js                                        �[39m�[1m�[2m  0.48 kB�[22m�[1m�[22m
2023-12-14T22:02:31.509593Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/fallbacks/error.svelte.js                                  �[39m�[1m�[2m  0.51 kB�[22m�[1m�[22m
2023-12-14T22:02:31.510048Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/stores.js                                                   �[39m�[1m�[2m  0.52 kB�[22m�[1m�[22m
2023-12-14T22:02:31.510249Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/dump/_filename_/_server.ts.js  �[39m�[1m�[2m  0.55 kB�[22m�[1m�[22m
2023-12-14T22:02:31.510454Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/exec/_server.ts.js             �[39m�[1m�[2m  0.67 kB�[22m�[1m�[22m
2023-12-14T22:02:31.510653Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/all/_server.ts.js              �[39m�[1m�[2m  0.74 kB�[22m�[1m�[22m
2023-12-14T22:02:31.510856Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/utils.js                                                    �[39m�[1m�[2m  0.76 kB�[22m�[1m�[22m
2023-12-14T22:02:31.511003Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/_table_/_server.ts.js          �[39m�[1m�[2m  1.00 kB�[22m�[1m�[22m
2023-12-14T22:02:31.511586Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/plugin/semantic-query/_server.ts.js          �[39m�[1m�[2m  1.20 kB�[22m�[1m�[22m
2023-12-14T22:02:31.511768Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/RunQuery.js                                                 �[39m�[1m�[2m  1.21 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512003Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/_layout.svelte.js                                    �[39m�[1m�[2m  1.42 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512149Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/db/_database_/_layout.svelte.js                      �[39m�[1m�[2m  1.52 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512298Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/index.js                                                    �[39m�[1m�[2m  2.20 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512428Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/CSV.js                                                      �[39m�[1m�[2m  2.29 kB�[22m�[1m�[22m
2023-12-14T22:02:31.51258Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/SemanticQuery.js                                            �[39m�[1m�[2m  2.33 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512724Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/_server.ts.js                  �[39m�[1m�[2m  2.44 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512851Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/zh-CN.js                                                    �[39m�[1m�[2m  2.49 kB�[22m�[1m�[22m
2023-12-14T22:02:31.512979Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/zh-TW.js                                                    �[39m�[1m�[2m  2.49 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513108Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/index2.js                                                   �[39m�[1m�[2m  2.58 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513233Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/_page.svelte.js                                      �[39m�[1m�[2m  2.71 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513365Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/db/_database_/_page.svelte.js                        �[39m�[1m�[2m  2.76 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513519Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/endpoints/api/db/_database_/_table_/data/_server.ts.js     �[39m�[1m�[2m  3.18 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513664Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/en.js                                                       �[39m�[1m�[2m  3.18 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513791Z	�[2m.svelte-kit/output/server/�[22m�[36mentries/pages/db/_database_/_table_/_page.svelte.js                �[39m�[1m�[2m  3.21 kB�[22m�[1m�[22m
2023-12-14T22:02:31.513917Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/AddRecord.js                                                �[39m�[1m�[2m  3.22 kB�[22m�[1m�[22m
2023-12-14T22:02:31.514053Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/hooks.server.js                                             �[39m�[1m�[2m  5.84 kB�[22m�[1m�[22m
2023-12-14T22:02:31.514189Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/internal.js                                                 �[39m�[1m�[2m  6.40 kB�[22m�[1m�[22m
2023-12-14T22:02:31.514331Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/ssr.js                                                      �[39m�[1m�[2m  7.36 kB�[22m�[1m�[22m
2023-12-14T22:02:31.514463Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/TableBrowser.js                                             �[39m�[1m�[2m 48.70 kB�[22m�[1m�[22m
2023-12-14T22:02:31.514984Z	�[2m.svelte-kit/output/server/�[22m�[36mchunks/runtime.js                                                  �[39m�[1m�[2m 99.95 kB�[22m�[1m�[22m
2023-12-14T22:02:31.515168Z	�[2m.svelte-kit/output/server/�[22m�[36mindex.js                                                           �[39m�[1m�[2m108.89 kB�[22m�[1m�[22m
2023-12-14T22:02:31.515363Z	
2023-12-14T22:02:31.51554Z	Run npm run preview to preview your production build locally.
2023-12-14T22:02:31.524912Z	
2023-12-14T22:02:31.525152Z	> Using @sveltejs/adapter-cloudflare
2023-12-14T22:02:32.82037Z	Database Bindings: 
2023-12-14T22:02:33.956491Z	  ✔ done
2023-12-14T22:02:33.956932Z	�[32m✓ built in 10.44s�[39m
2023-12-14T22:02:34.030628Z	Finished
2023-12-14T22:02:34.031226Z	Found _worker.js in output directory. Uploading.
2023-12-14T22:02:36.242731Z	✨ Compiled Worker successfully
2023-12-14T22:02:36.4288Z	Found _routes.json in output directory. Uploading.
2023-12-14T22:02:36.445228Z	Validating asset output directory
2023-12-14T22:02:37.240467Z	Deploying your site to Cloudflare's global network...
2023-12-14T22:02:41.987692Z	Parsed 2 valid header rules.
2023-12-14T22:02:43.552641Z	Uploading... (24/37)
2023-12-14T22:02:44.38585Z	Uploading... (28/37)
2023-12-14T22:02:44.566633Z	Uploading... (32/37)
2023-12-14T22:02:47.594362Z	Uploading... (37/37)
2023-12-14T22:02:47.594795Z	✨ Success! Uploaded 13 files (24 already uploaded) (4.34 sec)
2023-12-14T22:02:47.59515Z	
2023-12-14T22:02:48.100257Z	✨ Upload complete!
2023-12-14T22:02:50.228671Z	Success: Assets published!
2023-12-14T22:02:53.983157Z	Error: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large)

access control pages plugin middleware

I was actually thinking we should probably be using the access control pages plugin middleware to enforce the JWT authentication at an application level so it "defaults closed" instead of open. I think that's a more secure approach. Otherwise when you first deploy the project it is completely open to the world potentially exposing your database. With the middleware you would have to explicitly set the relevant environment variables from Zero Trust and only then will you be able to access it.

Originally posted by @johtso in #50 (comment)

D1_ERROR: not authorized

Hello! First off, thanks a lot for the repo!
It would definitely help in my use case.

I unfortunately don't really understand where I went wrong.
My DB are bound and are recognized by the application (staging and production)
image
The API Call to https://mydomain.com/db/production/__data.json?x-sveltekit-invalidated=110
returns:

{
    "type": "data",
    "nodes": [
        {
            "type": "data",
            "data": [
                {
                    "dbms": 1
                },
                [
                    2,
                    3
                ],
                "production",
                "staging"
            ],
            "uses": {}
        },
        {
            "type": "data",
            "data": [
                {
                    "db": 1
                },
                {
                    "error": 2
                },
                {
                    "message": 3,
                    "cause": 4
                },
                "D1_ERROR: not authorized",
                "not authorized"
            ],
            "uses": {
                "params": [
                    "database"
                ]
            }
        },
        {
            "type": "skip"
        }
    ]
}

D1_ERROR: near "-": syntax error at offset 30

Hi @JacobLinCool,
first of all, thanks for this cool project. I'm running into an error with one of my databases though. Here's the logs:

No deployment specified. Using latest deployment for production environment.
Connected to deployment [redacted], waiting for logs...
  (debug) d1-manager:dbms Database Bindings: +0ms DB_cf-pages-prisma-d1-test, DB_dts-prod-1, DB_prod-logs
  (debug) d1-manager:server-error Error: D1_ERROR: near "-": syntax error at offset 30
    at D1Database._sendOrThrow (cloudflare-internal:d1-api:66:19)
    at async D1PreparedStatement.all (cloudflare-internal:d1-api:181:46)
    at async GET7 (functionsWorker-0.2088450453108457.js:19004:27)
    at async render_endpoint (functionsWorker-0.2088450453108457.js:19457:20)
    at async resolve2 (functionsWorker-0.2088450453108457.js:22691:22)
    at async Object.handle (functionsWorker-0.2088450453108457.js:5071:22)
    at async respond (functionsWorker-0.2088450453108457.js:22585:22)
    at async Object.fetch (functionsWorker-0.2088450453108457.js:23051:13) +0ms

any idea what might cause this? Thanks in advance.

Deployment details

For anyone having trouble with Cloudflare deployment, the build configuration is:

Framework preset: SveltKit
Build command: npm run build
Build output directory: .svelte-kit/cloudflare

Nice tool, the Semantic Query is a great feature!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @changesets/cli to v2.27.5
  • chore(deps): update dependency autoprefixer to v10.4.19
  • chore(deps): update dependency csv-parse to v5.5.6
  • chore(deps): update dependency debug to v4.3.5
  • chore(deps): update dependency postcss to v8.4.38
  • chore(deps): update dependency sql.js to v1.10.3
  • chore(deps): update dependency svelte to v4.2.18
  • chore(deps): update dependency tailwindcss to v3.4.4
  • chore(deps): update dependency tslib to v2.6.3
  • chore(deps): update dependency @cloudflare/workers-types to v4.20240614.0
  • chore(deps): update dependency @sveltejs/adapter-cloudflare to v4.4.1
  • chore(deps): update dependency @sveltejs/kit to v2.5.16
  • chore(deps): update dependency csv-stringify to v6.5.0
  • chore(deps): update dependency daisyui to v4.12.2
  • chore(deps): update dependency eslint to v8.57.0
  • chore(deps): update dependency eslint-plugin-svelte to v2.39.4
  • chore(deps): update dependency openai to v4.51.0
  • chore(deps): update dependency prettier to v3.3.2
  • chore(deps): update dependency prettier-plugin-svelte to v3.2.4
  • chore(deps): update dependency prettier-plugin-tailwindcss to ^0.6.0
  • chore(deps): update dependency svelte-check to v3.8.0
  • chore(deps): update dependency tsup to v8.1.0
  • chore(deps): update dependency typescript to v5.4.5
  • chore(deps): update dependency vite to v5.3.1
  • chore(deps): update dependency wrangler to v3.60.3
  • chore(deps): update dependency zod to v3.23.8
  • chore(deps): update typescript-eslint monorepo to v6.21.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • chore(deps): update dependency @iconify/svelte to v4
  • chore(deps): update dependency eslint to v9
  • chore(deps): update pnpm to v9
  • chore(deps): update pnpm/action-setup action to v4
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
.devcontainer/docker-compose.yml
dockerfile
.devcontainer/Dockerfile
github-actions
.github/workflows/release.yml
  • actions/checkout v4
  • pnpm/action-setup v2.2.4
  • changesets/action v1
.github/workflows/test.yml
  • actions/checkout v4
  • pnpm/action-setup v2.2.4
npm
package.json
  • @ai-d/aid ^0.1.5
  • @changesets/changelog-github ^0.5.0
  • @changesets/cli ^2.27.1
  • @cloudflare/ai ^1.0.47
  • @cloudflare/workers-types ^4.20240117.0
  • @iconify/svelte ^3.1.6
  • @playwright/test ^1.41.1
  • @sveltejs/adapter-cloudflare ^4.1.0
  • @sveltejs/kit ^2.4.3
  • @sveltejs/vite-plugin-svelte ^3.0.1
  • @tailwindcss/typography ^0.5.10
  • @types/debug ^4.1.12
  • @types/sql.js ^1.4.9
  • @typescript-eslint/eslint-plugin ^6.19.1
  • @typescript-eslint/parser ^6.19.1
  • autoprefixer ^10.4.17
  • csv-parse ^5.5.3
  • csv-stringify ^6.4.5
  • daisyui ^4.6.0
  • debug ^4.3.4
  • eslint ^8.56.0
  • eslint-config-prettier ^9.1.0
  • eslint-plugin-svelte ^2.35.1
  • husky ^8.0.3
  • lint-staged ^15.2.0
  • openai ^4.25.0
  • postcss ^8.4.33
  • prettier ^3.2.4
  • prettier-plugin-organize-imports ^3.2.4
  • prettier-plugin-svelte ^3.1.2
  • prettier-plugin-tailwindcss ^0.5.11
  • sql.js ^1.10.2
  • svelte ^4.2.9
  • svelte-check ^3.6.3
  • svelte-i18n ^4.0.0
  • tailwindcss ^3.4.1
  • theme-change 2.5.0
  • tslib ^2.6.2
  • tsup ^8.0.1
  • typescript ^5.3.3
  • vite ^5.0.12
  • vitest ^0.34.6
  • wrangler ^3.24.0
  • zod ^3.22.4
  • pnpm 8.14.3

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.