@lunora/hyperdrive 1.0.0-alpha.164 → 1.0.0-alpha.165
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
|
@@ -32,20 +32,15 @@ type RowClient = SqlClient;
|
|
|
32
32
|
* probe would otherwise degrade silently to the warn branch and the OCC guard
|
|
33
33
|
* would go unchecked.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* The probe fields are typed `unknown` publicly: the paths are not in `mysql2`'s
|
|
36
|
+
* typings, so spelling them out made a real `createPool(...)` fail to type-check
|
|
37
|
+
* (TS2345, weak-type mismatch on `config`). {@link readMysqlClientFlags} reads
|
|
38
|
+
* them through the internal `FlagProbeShape` instead, and a minimal test double
|
|
39
|
+
* (only `execute`) resolves to "undeterminable" rather than a `TypeError`.
|
|
37
40
|
*/
|
|
38
41
|
type Mysql2Execute = Mysql2Like & {
|
|
39
|
-
config?:
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
pool?: {
|
|
43
|
-
config?: {
|
|
44
|
-
connectionConfig?: {
|
|
45
|
-
clientFlags?: number;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
42
|
+
config?: unknown;
|
|
43
|
+
pool?: unknown;
|
|
49
44
|
};
|
|
50
45
|
/**
|
|
51
46
|
* Wrap a Postgres row-client (from `@lunora/hyperdrive`'s `fromPostgresJs` /
|
package/dist/global.d.ts
CHANGED
|
@@ -32,20 +32,15 @@ type RowClient = SqlClient;
|
|
|
32
32
|
* probe would otherwise degrade silently to the warn branch and the OCC guard
|
|
33
33
|
* would go unchecked.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* The probe fields are typed `unknown` publicly: the paths are not in `mysql2`'s
|
|
36
|
+
* typings, so spelling them out made a real `createPool(...)` fail to type-check
|
|
37
|
+
* (TS2345, weak-type mismatch on `config`). {@link readMysqlClientFlags} reads
|
|
38
|
+
* them through the internal `FlagProbeShape` instead, and a minimal test double
|
|
39
|
+
* (only `execute`) resolves to "undeterminable" rather than a `TypeError`.
|
|
37
40
|
*/
|
|
38
41
|
type Mysql2Execute = Mysql2Like & {
|
|
39
|
-
config?:
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
pool?: {
|
|
43
|
-
config?: {
|
|
44
|
-
connectionConfig?: {
|
|
45
|
-
clientFlags?: number;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
42
|
+
config?: unknown;
|
|
43
|
+
pool?: unknown;
|
|
49
44
|
};
|
|
50
45
|
/**
|
|
51
46
|
* Wrap a Postgres row-client (from `@lunora/hyperdrive`'s `fromPostgresJs` /
|
package/dist/global.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSqlCtxDb as c}from"@lunora/sql-store";import{postgresDialect as l,mysqlDialect as s}from"./packem_shared/mysqlDialect-WuCGPd2_.mjs";import{buildMysqlExec as a,buildPgExec as i}from"./packem_shared/buildMysqlExec-
|
|
1
|
+
import{createSqlCtxDb as c}from"@lunora/sql-store";import{postgresDialect as l,mysqlDialect as s}from"./packem_shared/mysqlDialect-WuCGPd2_.mjs";import{buildMysqlExec as a,buildPgExec as i}from"./packem_shared/buildMysqlExec-CjkrA5JG.mjs";import{createPgVectorIndex as d}from"./packem_shared/createPgVectorIndex-CSNnG065.mjs";const r=({engine:e,exec:t,...o})=>c({...o,dialect:e==="postgres"?l:s,exec:t}),p=(e,t)=>r({...t,engine:"postgres",exec:i(e)}),g=(e,t)=>r({...t,engine:"mysql",exec:a(e)});export{a as buildMysqlExec,i as buildPgExec,r as createHyperdriveGlobalCtxDb,g as createMysqlGlobalCtxDb,d as createPgVectorIndex,p as createPostgresGlobalCtxDb,s as mysqlDialect,l as postgresDialect};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as s}from"@lunora/errors";const n=2,o=new WeakSet,i=t=>{const e=t,r=e.config?.clientFlags;if(typeof r=="number")return r;const a=e.pool?.config?.connectionConfig?.clientFlags;return typeof a=="number"?a:void 0},c=t=>{const e=i(t);if(e===void 0){if(o.has(t))return;o.add(t),console.warn('@lunora/hyperdrive: could not determine whether this MySQL connection negotiated CLIENT_FOUND_ROWS (the driver exposes no flag introspection). If it was NOT created with the `CLIENT_FOUND_ROWS` flag (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`), an idempotent patch/replace that rewrites identical values may report 0 affectedRows and raise a spurious OCC ConflictError.');return}if((e&n)===0)throw new s("INTERNAL",'@lunora/hyperdrive: this MySQL connection was not created with the `CLIENT_FOUND_ROWS` flag (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`). Without it, `affectedRows` counts changed (not matched) rows, so an idempotent patch/replace that rewrites identical values reports 0 and the OCC guard raises a spurious conflict.')},u=t=>({all:(e,r)=>t.query(e,r),batch:async e=>{await Promise.all(e.map(r=>t.query(r.sql,r.params)))},run:async(e,r)=>(await t.query(e,r),{rowsAffected:0})}),d=t=>(c(t),{all:async(e,r)=>{const[a]=await t.execute(e,r);return Array.isArray(a)?a:[]},batch:async e=>{await Promise.all(e.map(r=>t.execute(r.sql,r.params)))},run:async(e,r)=>{const[a]=await t.execute(e,r);return{rowsAffected:a.affectedRows??0}}});export{d as buildMysqlExec,u as buildPgExec};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/hyperdrive",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.165",
|
|
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,10 +50,10 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
53
|
+
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
54
54
|
"@lunora/platform": "1.0.0-alpha.57",
|
|
55
|
-
"@lunora/shard-engine": "1.0.0-alpha.
|
|
56
|
-
"@lunora/sql-store": "1.0.0-alpha.
|
|
55
|
+
"@lunora/shard-engine": "1.0.0-alpha.118",
|
|
56
|
+
"@lunora/sql-store": "1.0.0-alpha.169",
|
|
57
57
|
"drizzle-orm": "^0.45.3"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as o}from"@lunora/errors";const n=2,s=new WeakSet,i=t=>{const e=t.config?.clientFlags;if(typeof e=="number")return e;const r=t.pool?.config?.connectionConfig?.clientFlags;return typeof r=="number"?r:void 0},c=t=>{const e=i(t);if(e===void 0){if(s.has(t))return;s.add(t),console.warn('@lunora/hyperdrive: could not determine whether this MySQL connection negotiated CLIENT_FOUND_ROWS (the driver exposes no flag introspection). If it was NOT created with the `CLIENT_FOUND_ROWS` flag (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`), an idempotent patch/replace that rewrites identical values may report 0 affectedRows and raise a spurious OCC ConflictError.');return}if((e&n)===0)throw new o("INTERNAL",'@lunora/hyperdrive: this MySQL connection was not created with the `CLIENT_FOUND_ROWS` flag (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`). Without it, `affectedRows` counts changed (not matched) rows, so an idempotent patch/replace that rewrites identical values reports 0 and the OCC guard raises a spurious conflict.')},u=t=>({all:(e,r)=>t.query(e,r),batch:async e=>{await Promise.all(e.map(r=>t.query(r.sql,r.params)))},run:async(e,r)=>(await t.query(e,r),{rowsAffected:0})}),d=t=>(c(t),{all:async(e,r)=>{const[a]=await t.execute(e,r);return Array.isArray(a)?a:[]},batch:async e=>{await Promise.all(e.map(r=>t.execute(r.sql,r.params)))},run:async(e,r)=>{const[a]=await t.execute(e,r);return{rowsAffected:a.affectedRows??0}}});export{d as buildMysqlExec,u as buildPgExec};
|