@lunora/hyperdrive 1.0.0-alpha.56 → 1.0.0-alpha.58

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/dist/global.d.mts CHANGED
@@ -18,6 +18,19 @@ type Mysql2Execute = Mysql2Like;
18
18
  * `fromNodePg`) as a {@link SqlExec}. The core already renders `$N` placeholders
19
19
  * for Postgres, so `all`/`run` forward verbatim. Postgres uses `RETURNING` for
20
20
  * OCC (read via `all`), so `run` reports no affected-row count.
21
+ *
22
+ * `batch` dispatches every statement concurrently (`Promise.all`) over `client`
23
+ * rather than awaiting each `query` call in turn — `RowClient` only exposes a
24
+ * single-statement `query`, so there is no wire-level multi-statement command
25
+ * to reach for. When `client` is backed by a pool (the common production
26
+ * shape), this genuinely spreads the statements across multiple physical
27
+ * connections instead of serializing one full round trip at a time; against a
28
+ * single connection it still removes the sequential *await*, though the
29
+ * underlying driver may itself queue the sends. Either way it stays
30
+ * non-atomic, at-least-once, and unordered between elements, same as the
31
+ * sequential fallback minus the ordering — safe only for statements whose
32
+ * effects don't depend on each other, which is what every current caller
33
+ * batches (distinct-keyed companion rows).
21
34
  */
22
35
  declare const buildPgExec: (client: RowClient) => SqlExec;
23
36
  /**
@@ -30,6 +43,13 @@ declare const buildPgExec: (client: RowClient) => SqlExec;
30
43
  * (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`). Without it, `affectedRows`
31
44
  * counts *changed* rows, so an idempotent `patch`/`replace` that re-writes the
32
45
  * same values reports 0 and the OCC guard raises a spurious conflict.
46
+ *
47
+ * `batch` dispatches every statement concurrently (`Promise.all`), same
48
+ * rationale as {@link buildPgExec}'s `batch` — `Mysql2Like` only exposes a
49
+ * single-statement `execute`, so this is "spread across a pool's connections"
50
+ * rather than one wire-level multi-statement command; still non-atomic,
51
+ * at-least-once, and unordered between elements, safe only for statements
52
+ * with no cross-effect (what every current caller batches).
33
53
  */
34
54
  declare const buildMysqlExec: (connection: Mysql2Execute) => SqlExec;
35
55
  /**
package/dist/global.d.ts CHANGED
@@ -18,6 +18,19 @@ type Mysql2Execute = Mysql2Like;
18
18
  * `fromNodePg`) as a {@link SqlExec}. The core already renders `$N` placeholders
19
19
  * for Postgres, so `all`/`run` forward verbatim. Postgres uses `RETURNING` for
20
20
  * OCC (read via `all`), so `run` reports no affected-row count.
21
+ *
22
+ * `batch` dispatches every statement concurrently (`Promise.all`) over `client`
23
+ * rather than awaiting each `query` call in turn — `RowClient` only exposes a
24
+ * single-statement `query`, so there is no wire-level multi-statement command
25
+ * to reach for. When `client` is backed by a pool (the common production
26
+ * shape), this genuinely spreads the statements across multiple physical
27
+ * connections instead of serializing one full round trip at a time; against a
28
+ * single connection it still removes the sequential *await*, though the
29
+ * underlying driver may itself queue the sends. Either way it stays
30
+ * non-atomic, at-least-once, and unordered between elements, same as the
31
+ * sequential fallback minus the ordering — safe only for statements whose
32
+ * effects don't depend on each other, which is what every current caller
33
+ * batches (distinct-keyed companion rows).
21
34
  */
22
35
  declare const buildPgExec: (client: RowClient) => SqlExec;
23
36
  /**
@@ -30,6 +43,13 @@ declare const buildPgExec: (client: RowClient) => SqlExec;
30
43
  * (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`). Without it, `affectedRows`
31
44
  * counts *changed* rows, so an idempotent `patch`/`replace` that re-writes the
32
45
  * same values reports 0 and the OCC guard raises a spurious conflict.
46
+ *
47
+ * `batch` dispatches every statement concurrently (`Promise.all`), same
48
+ * rationale as {@link buildPgExec}'s `batch` — `Mysql2Like` only exposes a
49
+ * single-statement `execute`, so this is "spread across a pool's connections"
50
+ * rather than one wire-level multi-statement command; still non-atomic,
51
+ * at-least-once, and unordered between elements, safe only for statements
52
+ * with no cross-effect (what every current caller batches).
33
53
  */
34
54
  declare const buildMysqlExec: (connection: Mysql2Execute) => SqlExec;
35
55
  /**
package/dist/global.mjs CHANGED
@@ -1 +1 @@
1
- import{createSqlCtxDb as o}from"@lunora/sql-store";import{postgresDialect as c,mysqlDialect as s}from"./packem_shared/mysqlDialect-CPeuWNoT.mjs";import{buildMysqlExec as i,buildPgExec as x}from"./packem_shared/buildMysqlExec-uTTy5Tv3.mjs";const r=({engine:e,exec:t,...l})=>o({...l,dialect:e==="postgres"?c:s,exec:t}),m=(e,t)=>r({...t,engine:"postgres",exec:x(e)}),p=(e,t)=>r({...t,engine:"mysql",exec:i(e)});export{i as buildMysqlExec,x as buildPgExec,r as createHyperdriveGlobalCtxDb,p as createMysqlGlobalCtxDb,m as createPostgresGlobalCtxDb,s as mysqlDialect,c as postgresDialect};
1
+ import{createSqlCtxDb as o}from"@lunora/sql-store";import{postgresDialect as c,mysqlDialect as s}from"./packem_shared/mysqlDialect-CPeuWNoT.mjs";import{buildMysqlExec as i,buildPgExec as x}from"./packem_shared/buildMysqlExec-zneG1aUr.mjs";const r=({engine:e,exec:t,...l})=>o({...l,dialect:e==="postgres"?c:s,exec:t}),m=(e,t)=>r({...t,engine:"postgres",exec:x(e)}),p=(e,t)=>r({...t,engine:"mysql",exec:i(e)});export{i as buildMysqlExec,x as buildPgExec,r as createHyperdriveGlobalCtxDb,p as createMysqlGlobalCtxDb,m as createPostgresGlobalCtxDb,s as mysqlDialect,c as postgresDialect};
@@ -0,0 +1 @@
1
+ const r=s=>({all:(e,a)=>s.query(e,a),batch:async e=>{await Promise.all(e.map(a=>s.query(a.sql,a.params)))},run:async(e,a)=>(await s.query(e,a),{rowsAffected:0})}),t=s=>({all:async(e,a)=>{const[c]=await s.execute(e,a);return c},batch:async e=>{await Promise.all(e.map(a=>s.execute(a.sql,a.params)))},run:async(e,a)=>{const[c]=await s.execute(e,a);return{rowsAffected:c.affectedRows??0}}});export{t as buildMysqlExec,r as buildPgExec};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/hyperdrive",
3
- "version": "1.0.0-alpha.56",
3
+ "version": "1.0.0-alpha.58",
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",
@@ -50,9 +50,9 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@lunora/errors": "1.0.0-alpha.10",
54
- "@lunora/shard-engine": "1.0.0-alpha.3",
55
- "@lunora/sql-store": "1.0.0-alpha.57",
53
+ "@lunora/errors": "1.0.0-alpha.12",
54
+ "@lunora/shard-engine": "1.0.0-alpha.6",
55
+ "@lunora/sql-store": "1.0.0-alpha.59",
56
56
  "drizzle-orm": "^0.45.2"
57
57
  },
58
58
  "peerDependencies": {
@@ -1 +0,0 @@
1
- const s=c=>({all:(e,t)=>c.query(e,t),run:async(e,t)=>(await c.query(e,t),{rowsAffected:0})}),n=c=>({all:async(e,t)=>{const[a]=await c.execute(e,t);return a},run:async(e,t)=>{const[a]=await c.execute(e,t);return{rowsAffected:a.affectedRows??0}}});export{n as buildMysqlExec,s as buildPgExec};