Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ name = "fastedge"
[features]
default = ["proxywasm"]
proxywasm = []
json = ["serde_json"]
json = ["serde_json", "serde"]

[dependencies]
fastedge-derive = { path = "derive", version = "0.4" }
Expand All @@ -45,6 +45,7 @@ wit-bindgen = "0.46"
thiserror = "2.0"
mime = "^0.3"
serde_json = { version = "^1.0", optional = true }
serde = { version = "1", optional = true }

[dev-dependencies]

78 changes: 78 additions & 0 deletions context/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,84 @@ This file tracks agent decisions, architectural changes, and context for future

---

## [2026-11-05] — db: dialect-neutral SQL; `Column.type_name`; example `db_sql_postgres`

### Overview
`gcore:db/sql` is documented as dialect-neutral: SQL text, placeholders and error codes are the bound
database's, and the host picks the backend from the binding's configuration. Still `0.1.0`
(unreleased).

### Decisions
- No `dialect()` call: binding a database of the wrong dialect is the developer's mistake
- The example is named after its dialect (PostgreSQL schema, `$1` placeholders), so a SQLite example
can sit beside it later

### Changes
- `wit` submodule → FastEdge-wit `feat/db-interface-all` a23194c
- `Column.type_name` (the database's type name, e.g. `int4`) replaces the PostgreSQL `type_oid`
- `src/db.rs` — module docs describe the dialect as the bound database's
- `examples/http/wasi/db_sql/` → `examples/http/wasi/db_sql_postgres/`

## [2026-10-27] — POC: `fastedge::db::kv` (gcore:db/kv-sync@0.1.0)

### Overview
Added `fastedge::db::kv`: Database KV (regional, durable, writable; Upstash Redis in the POC) bound
to the app by name; the host holds the credentials.

### Decisions
- Sync interface `kv-sync`, like `sql-sync`; the plain `kv` name is reserved for an async variant
(JS SDK).
- Re-export the generated types as is (`Database`, `Op`, `OpResult`, `SetOptions`, ...), plus
`Default for SetOptions` (always write, no expiry). No other wrapper.
- Example mirrors the JS SDK `examples/db-kv` (same keys, limits, responses).

### Changes
- `wit` submodule → FastEdge-wit `feat/db-interface-kv` ca89dc6 (`kv-types`, `kv-sync`)
- `src/lib.rs` — `with:` generates `gcore:db/kv-types@0.1.0` and `gcore:db/kv-sync@0.1.0`
- `src/db.rs` — `db::kv` module
- `examples/http/wasi/db_kv/` — new wstd example; `examples/README.md` entry

## [2026-10-27] — db: bind `gcore:db/sql-sync` (WIT split)

### Overview
FastEdge-wit split `gcore:db/sql` into `sql-types` + `sql-sync`, mirroring `cache-types` / `cache-sync`.

### Decisions
- Rust stays on the sync interface by default; the plain `sql` name is reserved for an async (pollable)
variant intended for the JS SDK. Public API `fastedge::db::sql` is unchanged.

### Changes
- `wit` submodule → FastEdge-wit `feat/db-interface` 83a7d08
- `src/lib.rs` — `with:` generates `gcore:db/sql-types@0.1.0` and `gcore:db/sql-sync@0.1.0`
- `src/db.rs` — re-exports `Database` from `sql_sync`, data types from `sql_types`

---

## [2026-10-27] — POC: `fastedge::db::sql` (gcore:db/sql@0.1.0)

### Overview
Added `fastedge::db::sql`: SQL database (PostgreSQL, Neon in the POC) bound to the app by name; the host holds the credentials.

### Decisions
- Module path `fastedge::db::sql` mirrors the WIT package `gcore:db/sql`, and keeps it apart from `fastedge::key_value` (Edge Storage). Upstash KV will follow as `fastedge::db::kv`.
- Re-export the generated types (`Database`, `Value`, `QueryResult`, `Error`, `DbError`, ...) as is, plus a thin layer: `params!` / `ToSql` for parameters, and `QueryAs::query_as::<T>` / `rows_as` decoding rows by column name via serde_json.
- `query_as` is behind the existing `json` feature (now also enables optional `serde`), so the default build gains no deps. Alternatives: sqlx/diesel (own the connection, don't fit), a custom serde Deserializer (more code, same result).
- Calls are blocking (sync WIT). Async (futures / WASI p3) is an open decision; see coordinator `db-integration/context/async-calls.md`.

### Changes
- `wit` submodule → FastEdge-wit `feat/db-interface` (`deps/db/sql.wit`, world imports `gcore:db/sql@0.1.0`)
- `src/lib.rs` — `with: { "gcore:db/sql@0.1.0": generate }` in `generate!`; `pub mod db`
- `src/db.rs` — new: `db::sql` re-exports, `ToSql`, `params!`, `QueryAs`, `rows_as`, `QueryAsError`
- `Cargo.toml` — optional `serde`, `json = ["serde_json", "serde"]`
- `examples/http/wasi/db_sql/` — new wstd example + `schema.sql`; `examples/README.md` entry

### Follow-up
- `examples/http/wasi/db_sql/Cargo.toml` uses a path dependency until `fastedge::db` is published (same as `examples/cdn/cache`).
- The `wit` submodule points at a FastEdge-wit commit that is not pushed yet (`6ddb92e`).
- Not yet: fixtures, SDK_ARCHITECTURE/PROJECT_OVERVIEW updates, plugin manifest entries, docs generation.

---

## [2026-09-14] — ProxyWasm cache module

### Overview
Expand Down
2 changes: 2 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Examples are organized into three categories:
| [headers](./http/wasi/headers/) | Echo request headers and add a custom header from an environment variable |
| [variables_and_secrets](./http/wasi/variables_and_secrets/) | Read an environment variable and a secret |
| [simple_fetch](./http/wasi/simple_fetch/) | Fetch from a configurable URL and return the response |
| [db_sql_postgres](./http/wasi/db_sql_postgres/) | Query a bound SQL database (PostgreSQL here) and decode rows into a struct (`fastedge::db::sql`) |
| [db_kv](./http/wasi/db_kv/) | Per-user rate limit and visit counter in a bound Database KV, one atomic batch (`fastedge::db::kv`) |

### cdn (proxy-wasm)

Expand Down
Loading
Loading