@youtyan/code-viewer 0.8.9 → 0.9.0

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/README.md CHANGED
@@ -32,9 +32,9 @@ Requires Node.js 20 or newer when installed from npm. Development uses
32
32
  - Switch the viewer UI between English and Japanese from Viewer Settings —
33
33
  the language toggle live-updates every screen including the datastore
34
34
  viewer.
35
- - Browse SQLite, PostgreSQL, MySQL, Redis, Elasticsearch, DynamoDB, and
36
- S3-compatible object storage (MinIO, LocalStack) with a built-in datastore
37
- viewer.
35
+ - Browse SQLite, PostgreSQL, MySQL, Cloudflare D1, Redis, Elasticsearch,
36
+ DynamoDB, and S3-compatible object storage (MinIO, LocalStack, Cloudflare R2)
37
+ with a built-in datastore viewer.
38
38
  Local Supabase CLI (`supabase start`) Postgres projects are auto-discovered
39
39
  too, without needing a `docker-compose.yml`.
40
40
  Table descriptions appear inside expanded table entries and in the Schema
@@ -144,7 +144,11 @@ metadata instead of dumping bytes as text.
144
144
  Markdown files use a dedicated preview tab. Relative links and images are
145
145
  resolved inside the repository, code blocks are highlighted with Shiki, and
146
146
  Mermaid diagrams are rendered lazily in the browser (click any diagram to
147
- open it in a lightbox).
147
+ open it in a lightbox). Relative links lead to the same destinations as they
148
+ do on GitHub: another Markdown file opens its file page, an `#anchor` opens
149
+ the preview and scrolls to that heading, a non-Markdown file opens in the
150
+ Code view, and a link to a directory opens that folder in the repository
151
+ tree.
148
152
 
149
153
  A file detail page lays out up to four tabs — **Preview**, **Code**,
150
154
  **Blame**, **History** — modelled after the GitHub file view. For text files
@@ -274,7 +278,23 @@ global/local secondary indexes, and non-key attribute types inferred from
274
278
  loaded items) alongside scan or query items, `LastEvaluatedKey` pagination,
275
279
  and an item detail view with a copyable key. The explorer is read-only.
276
280
 
277
- **S3-compatible object storage** (MinIO, LocalStack): browse
281
+ **Cloudflare D1** support: add a saved connection with a Cloudflare account ID,
282
+ database ID, and API token (needs the `D1:Read` permission). The database is
283
+ browsed over the D1 REST API (`POST /accounts/{account}/d1/database/{db}/raw`)
284
+ and reuses the SQL screens — table list, row grid, query editor, schema, ER
285
+ diagram, snapshots and diffs. D1 is SQLite, so the same `sqlite_master` and
286
+ `PRAGMA table_info` / `index_list` / `foreign_key_list` introspection is used.
287
+ The connection is read-only: the query editor accepts only
288
+ `SELECT` / `PRAGMA` / `EXPLAIN` / `WITH`, and the grid's row editing is
289
+ unavailable.
290
+
291
+ **Cloudflare R2**: R2 speaks the S3 API, so it is a saved connection of type
292
+ `s3` with the **Cloudflare R2** provider preset. Enter the account ID and an R2
293
+ access key pair; the endpoint (`https://<account-id>.r2.cloudflarestorage.com`)
294
+ and the required `auto` signing region are filled in for you. Everything in the
295
+ object-storage section below applies.
296
+
297
+ **S3-compatible object storage** (MinIO, LocalStack, Cloudflare R2): browse
278
298
  buckets as a folder tree, search by prefix or filename, sort scanned objects by
279
299
  update time, and preview images, video, audio, PDFs, Markdown, HTML, and text
280
300
  files. Edit text/markdown/JSON object bodies inline, upload new objects to any
@@ -291,27 +311,45 @@ table grid to insert, update, or delete rows inline. Edits queue as pending
291
311
  changes (shown with a yellow highlight on the affected row/cell) and are
292
312
  applied as a single transaction on commit. Row updates and deletes require the
293
313
  table to have a primary key. The whole batch rolls back on the first
294
- constraint violation.
314
+ constraint violation. Cloudflare D1 is browsed read-only, so Edit mode is not
315
+ offered there.
295
316
 
296
317
  ### Browser UI
297
318
 
298
319
  Open Datastores in the global navigation to access:
299
320
 
300
321
  - **Saved connections** — use the `+` action beside the datastore selector to
301
- add PostgreSQL, MySQL, Redis, Elasticsearch, S3-compatible, or DynamoDB
302
- endpoints that are not present in the repository's local discovery files.
322
+ add PostgreSQL, MySQL, Cloudflare D1, Redis, Elasticsearch, S3-compatible
323
+ (including Cloudflare R2), or DynamoDB endpoints that are not present in the
324
+ repository's local discovery files.
303
325
  Required fields are marked in the connection dialog, and **Test connection**
304
326
  verifies the current values before saving. Saved connections can be edited
305
327
  or deleted from the adjacent actions.
306
328
  PostgreSQL, MySQL, and Redis use Node.js drivers installed automatically with
307
- this package, while Elasticsearch, S3, and DynamoDB use built-in HTTP
308
- clients. No database CLI or `curl` installation is required for saved
309
- connections.
310
- Non-secret settings are stored in `.code-viewer/datastore-connections.json`.
311
- User names, access key IDs, passwords, secret keys, and session tokens remain
312
- in server memory only and are never written to that file or returned by
313
- list/edit responses, so they must be entered again after restarting
314
- code-viewer.
329
+ this package, while Cloudflare D1, Elasticsearch, S3, and DynamoDB use
330
+ built-in HTTP clients. No database CLI or `curl` installation is required for
331
+ saved connections.
332
+ Non-secret settings (host, endpoint, account/database id, region, …) are
333
+ stored in `.code-viewer/datastore-connections.json`. User names, access key
334
+ IDs, passwords, secret keys, session tokens, and API tokens are never written
335
+ to that file and are never returned by list/edit responses.
336
+
337
+ Those credentials are kept in the macOS Keychain (one generic-password item
338
+ per connection, service `code-viewer`) and reloaded on demand, so they
339
+ survive a restart without being stored anywhere in the repository. The
340
+ keychain item is written through `security -i`, which reads the command from
341
+ stdin, so the secret never appears in any process's argument list. Deleting a
342
+ connection also deletes its keychain item; if that fails (a locked keychain,
343
+ for example) the connection is still removed and the UI says the credentials
344
+ were left behind, so you can clear them from Keychain Access yourself.
345
+
346
+ Credentials are deliberately not encrypted into a file next to the data: a
347
+ file the app can decrypt unattended needs its key on the same disk, which is
348
+ no stronger than plaintext. Key protection is left to the OS.
349
+
350
+ On platforms without keychain integration (currently everything except
351
+ macOS), credentials stay in server memory only and must be entered again
352
+ after restarting code-viewer.
315
353
 
316
354
  - **Multi-DB tabs** — open multiple databases side by side, with their own
317
355
  sidebar, panes, and history. `+` adds an empty tab; `×` or middle-click