@lunora/hyperdrive 1.0.0-alpha.115 → 1.0.0-alpha.116

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
@@ -42,7 +42,7 @@ Part of the [Lunora](https://github.com/anolilab/lunora) framework — a type-sa
42
42
  >
43
43
  > Hyperdrive talks to a database **Lunora does not own**. That breaks two invariants the rest of Lunora relies on:
44
44
  >
45
- > 1. **Non-deterministic (action-only).** A SQL query over Hyperdrive is a network call with an external, mutable result — exactly like `fetch`. It is **forbidden in `query`/`mutation`** (which must be deterministic so the coordinator can re-run them on OCC retry / subscription re-evaluation) and allowed **only in `action`s**. The `hyperdrive_outside_action` advisor lint flags `ctx.sql` used in a query/mutation.
45
+ > 1. **Non-deterministic (action-only).** A SQL query over Hyperdrive is a network call with an external, mutable result — exactly like `fetch`. It is **forbidden in `query`/`mutation`** (which must be deterministic so the coordinator can re-run them on subscription re-evaluation; an OCC conflict surfaces as a `409` to the caller, not an internal retry) and allowed **only in `action`s**. The `hyperdrive_outside_action` advisor lint flags `ctx.sql` used in a query/mutation.
46
46
  > 2. **Non-reactive.** External writes do **not** flow through the Durable-Object / SQLite change-feed, so **Lunora live queries and subscriptions will NOT re-run** when an external Postgres/MySQL row changes. There is no honest way to make external writes reactive here.
47
47
  >
48
48
  > Use Hyperdrive to _read/write your existing DB from an action_. It is the **wrong** tool for "make my Postgres reactive". If you want external data to be reactive, write a **projection** of it into a `defineSchema` DO/D1 table from the action — that write _is_ tracked.
package/dist/index.d.mts CHANGED
@@ -14,9 +14,14 @@ import { H as HyperdriveLike, a as HyperdriveConnection, M as Mysql2Like, S as S
14
14
  * import { createHyperdrive, fromPostgresJs } from "@lunora/hyperdrive";
15
15
  * import postgres from "postgres";
16
16
  *
17
- * // inside an action (never a query/mutation):
18
- * const { connectionString } = createHyperdrive(env.HYPERDRIVE);
19
- * ctx.sql = fromPostgresJs(postgres(connectionString));
17
+ * // Wire the client once, on the app builder — called per shard construction,
18
+ * // not per request. `ctx.sql` is emitted `readonly`; it is never assigned.
19
+ * const app = defineApp<Env>()
20
+ * .shard((env) => env.SHARD)
21
+ * .hyperdrive((env) => fromPostgresJs(postgres(createHyperdrive(env.HYPERDRIVE).connectionString)))
22
+ * .build();
23
+ *
24
+ * // Then, inside an action (never a query/mutation):
20
25
  * const rows = await ctx.sql.query("select id from users where org = $1", [orgId]);
21
26
  * ```
22
27
  * @remarks
package/dist/index.d.ts CHANGED
@@ -14,9 +14,14 @@ import { H as HyperdriveLike, a as HyperdriveConnection, M as Mysql2Like, S as S
14
14
  * import { createHyperdrive, fromPostgresJs } from "@lunora/hyperdrive";
15
15
  * import postgres from "postgres";
16
16
  *
17
- * // inside an action (never a query/mutation):
18
- * const { connectionString } = createHyperdrive(env.HYPERDRIVE);
19
- * ctx.sql = fromPostgresJs(postgres(connectionString));
17
+ * // Wire the client once, on the app builder — called per shard construction,
18
+ * // not per request. `ctx.sql` is emitted `readonly`; it is never assigned.
19
+ * const app = defineApp<Env>()
20
+ * .shard((env) => env.SHARD)
21
+ * .hyperdrive((env) => fromPostgresJs(postgres(createHyperdrive(env.HYPERDRIVE).connectionString)))
22
+ * .build();
23
+ *
24
+ * // Then, inside an action (never a query/mutation):
20
25
  * const rows = await ctx.sql.query("select id from users where org = $1", [orgId]);
21
26
  * ```
22
27
  * @remarks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/hyperdrive",
3
- "version": "1.0.0-alpha.115",
3
+ "version": "1.0.0-alpha.116",
4
4
  "description": "Bring-your-own Postgres/MySQL for Lunora via Cloudflare Hyperdrive: a driver-agnostic, action-only ctx.sql",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -51,9 +51,9 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@lunora/errors": "1.0.0-alpha.36",
54
- "@lunora/platform": "1.0.0-alpha.30",
55
- "@lunora/shard-engine": "1.0.0-alpha.64",
56
- "@lunora/sql-store": "1.0.0-alpha.116",
54
+ "@lunora/platform": "1.0.0-alpha.31",
55
+ "@lunora/shard-engine": "1.0.0-alpha.66",
56
+ "@lunora/sql-store": "1.0.0-alpha.118",
57
57
  "drizzle-orm": "^0.45.2"
58
58
  },
59
59
  "peerDependencies": {