Skip to content

Commit 918eebc

Browse files
authored
Merge pull request #6 from linked-db/next
Next
2 parents 22a25d5 + ef971ac commit 918eebc

204 files changed

Lines changed: 44357 additions & 6262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 16 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Runs across:
7575
7676
> One SQL interface for local, remote, and live data
7777
78-
The big picture? **[SQL, reimagined for modern apps ↗](https://linked-ql.netlify.app/overview)**.
78+
**[See here ↗](https://linked-ql.netlify.app/capabilities)** for the big picture.
7979
8080
</div>
8181
@@ -119,14 +119,14 @@ The package provides clients for all supported SQL dialects — including **Flas
119119

120120
Import and use the Client for your database. LinkedQL works the same across all clients.
121121

122-
| **Dialect** | **Import Path** | **Guide** |
122+
| **Client/Model** | **Import Path** | **Guide** |
123123
| :------------------ | :----------------------------- | :--------------------------------- |
124-
| PostgreSQL | `@linked-db/linked-ql/postgres` | [PostgreSQL ↗](https://linked-ql.netlify.app/docs/setup#postgresql) |
125-
| MySQL | `@linked-db/linked-ql/mysql` | [MySQL ↗](https://linked-ql.netlify.app/docs/setup#mysql) |
126-
| MariaDB | `@linked-db/linked-ql/mariadb` | [MariaDB ↗](https://linked-ql.netlify.app/docs/setup#mariadb) |
127-
| FlashQL | `@linked-db/linked-ql/flashql` | [FlashQL ↗](https://linked-ql.netlify.app/docs/setup#flashql) |
128-
| EdgeClient | `@linked-db/linked-ql/edge` | [Edge / Browser ↗](https://linked-ql.netlify.app/docs/setup#edge) |
129-
| EdgeWorker | `@linked-db/linked-ql/edge-worker` | [Edge Worker ↗](https://linked-ql.netlify.app/docs/setup#edge) |
124+
| `PGClient` | `@linked-db/linked-ql/postgres` | [PostgreSQL ↗](https://linked-ql.netlify.app/docs/setup#postgresql) |
125+
| `MySQLClient` | `@linked-db/linked-ql/mysql` | [MySQL ↗](https://linked-ql.netlify.app/docs/setup#mysql) |
126+
| `MariaDBClient` | `@linked-db/linked-ql/mariadb` | [MariaDB ↗](https://linked-ql.netlify.app/docs/setup#mariadb) |
127+
| `FlashQL` | `@linked-db/linked-ql/flashql` | [FlashQL ↗](https://linked-ql.netlify.app/docs/setup#flashql) |
128+
| `EdgeClient` | `@linked-db/linked-ql/edge` | [Edge / Browser ↗](https://linked-ql.netlify.app/docs/setup#edgeclient) |
129+
| `EdgeWorker` | `@linked-db/linked-ql/edge-worker` | [Edge Worker ↗](https://linked-ql.netlify.app/docs/setup#edgeworker) |
130130

131131
See also:
132132

@@ -375,8 +375,7 @@ See [Changefeeds (WAL) ↗](https://linked-ql.netlify.app/capabilities/changefee
375375

376376
`db.sync.sync()` is the API for sync in FlashQL.
377377

378-
You begin by creating views and pointing them to local or remote tables. FlashQL internally uses the sync API
379-
to fulfill the contracts.
378+
You begin by defining remote data as tables (views) in your local FlashQL database. FlashQL's internal Sync Engine fulfills the contracts.
380379

381380
At the application level, `db.sync.sync()` is primarilly called on a network reconnect event:
382381

@@ -392,7 +391,7 @@ window.addEventListener('online', async () => {
392391
* Coordinates background data movement and consistency
393392
* Designed for resilience and network instabilities
394393

395-
This is covered in [FlashQL Sync ↗](https://linked-ql.netlify.app/flashql/sync).
394+
This is covered in [FlashQL Sync ↗](https://linked-ql.netlify.app/flashql/federation-and-sync).
396395

397396
---
398397

@@ -702,24 +701,6 @@ const result = await db.query(`
702701

703702
---
704703

705-
### The Big Picture: Better Mental Models
706-
707-
Traditional SQL answers:
708-
709-
> “What rows do I want?
710-
711-
LinkedQL **additionally** answers:
712-
713-
> “What shape do I want?
714-
> “How are entities connected?
715-
> “What assumptions am I making?
716-
717-
—all in the same query.
718-
719-
This allows SQL to operate directly on **application-shaped data**, not just tables.
720-
721-
---
722-
723704
## Section 3: Architecture & Orchestration
724705

725706
This section is about deploying LinkedQL as a system, not just calling it as an API.
@@ -788,44 +769,15 @@ const upstream = new PGClient({
788769
await upstream.connect();
789770
790771
// Adapter that exposes the LinkedQL protocol over HTTP
791-
const worker = new EdgeWorker({ db: upstream, type: 'http' });
772+
const httpWorkerEdge = EdgeWorker.httpWorker({ db: upstream });
792773
793774
// Now the handler (at "/api/db") that exposes the worker:
794775
export async function POST(request) {
795-
796-
// EdgeClient encodes operations as (op, args)
797-
const op = new URL(request.url).searchParams.get('op');
798-
const args = await request.json();
799-
800-
// Delegate execution to the upstream client
801-
const result = await worker.handle(op, args);
802-
803-
return Response.json(result ?? {});
776+
const event = { request };
777+
return await httpWorkerEdge.handle(event);
804778
}
805779
```
806780

807-
The above in a [Webflo](https://github.com/webqit/webflo) application would look like the following:
808-
809-
<details>
810-
<summary>Show code</summary>
811-
812-
```js
813-
export async function POST(event, next) {
814-
//await event.user.signIn();
815-
if (next.stepname) return await next();
816-
817-
const op = event.url.query.op;
818-
const args = await event.request.json();
819-
820-
821-
return await worker.handle(op, args, event.client, () => {
822-
event.waitUntil(new Promise(() => { }));
823-
}) || {}; // Always return something to prevent being a 404
824-
}
825-
```
826-
827-
</details>
828-
829781
---
830782

831783
#### Decoding the above
@@ -849,7 +801,7 @@ The difference is that execution happens across a transport boundary instead of
849801
* Preserves the `db.query()` abstraction across runtime boundaries
850802
* Avoids leaking database credentials to untrusted environments
851803

852-
For runtime setup details, see [Dialects & Clients ↗](https://linked-ql.netlify.app/docs/setup#edge).
804+
For runtime setup details, see the [Edge Setup Guide ↗](https://linked-ql.netlify.app/docs/setup#edgeclient).
853805

854806
---
855807

@@ -1142,7 +1094,7 @@ const result = await db.query(`
11421094

11431095
---
11441096

1145-
For full details, see [Federation & Sync ↗](https://linked-ql.netlify.app/flashql/foreign-io) and [FlashQL Sync ↗](https://linked-ql.netlify.app/flashql/sync).
1097+
For full details, see [Federation & Sync ↗](https://linked-ql.netlify.app/flashql/federation-and-sync).
11461098

11471099
---
11481100

@@ -1156,7 +1108,7 @@ For full details, see [Federation & Sync ↗](https://linked-ql.netlify.app/flas
11561108
| [Changefeeds (WAL) ↗](https://linked-ql.netlify.app/capabilities/changefeeds) | Read about table-level commit subscriptions. |
11571109
| [Version Binding ↗](https://linked-ql.netlify.app/capabilities/version-binding) | Bind queries to explicit relation versions. |
11581110
| [Meet FlashQL ↗](https://linked-ql.netlify.app/flashql) | Meet FlashQL — LinkedQL's embeddable SQL engine. |
1159-
| [FlashQL Sync ↗](https://linked-ql.netlify.app/flashql/sync) | Explore the sync API and local-first orchestration path. |
1111+
| [Federation & Sync ↗](https://linked-ql.netlify.app/flashql/federation-and-sync) | Explore the sync API and local-first orchestration path. |
11601112
| [Engineering Deep Dive ↗](https://linked-ql.netlify.app/engineering/realtime-engine) | Dig into LinkedQL's engineering in the engineering section. |
11611113

11621114
Visit the [LinkedQL documentation site ↗](https://linked-ql.netlify.app)

dist/flashql.js

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/flashql.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)