@lunora/hyperdrive 1.0.0-alpha.79 → 1.0.0-alpha.80
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.mjs +1 -1
- package/dist/index.d.mts +49 -1
- package/dist/index.d.ts +49 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/buildMysqlExec-DriYb1l9.mjs +1 -0
- package/dist/packem_shared/createHyperdrive-DEXMfGd0.mjs +1 -0
- package/dist/packem_shared/{mysqlDialect-Cyn6N84S.mjs → mysqlDialect-DitNAlpV.mjs} +1 -1
- package/dist/packem_shared/projectSourceRow-DN8ywPRl.mjs +1 -0
- package/package.json +3 -3
- package/dist/packem_shared/buildMysqlExec-zneG1aUr.mjs +0 -1
- package/dist/packem_shared/createHyperdrive-DCe1WINF.mjs +0 -1
- package/dist/packem_shared/projectSourceRow-Dw1DLzyv.mjs +0 -1
package/dist/global.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSqlCtxDb as
|
|
1
|
+
import{createSqlCtxDb as l}from"@lunora/sql-store";import{postgresDialect as s,mysqlDialect as c}from"./packem_shared/mysqlDialect-DitNAlpV.mjs";import{buildMysqlExec as i,buildPgExec as a}from"./packem_shared/buildMysqlExec-DriYb1l9.mjs";const o=({engine:e,exec:t,...r})=>l({...r,dialect:e==="postgres"?s:c,exec:t}),p=(e,t)=>o({...t,engine:"postgres",exec:a(e)}),g=(e,t)=>o({...t,engine:"mysql",exec:i(e)});export{i as buildMysqlExec,a as buildPgExec,o as createHyperdriveGlobalCtxDb,g as createMysqlGlobalCtxDb,p as createPostgresGlobalCtxDb,c as mysqlDialect,s as postgresDialect};
|
package/dist/index.d.mts
CHANGED
|
@@ -97,4 +97,52 @@ declare const projectSourceRow: (row: Record<string, unknown>, options?: Project
|
|
|
97
97
|
* **action** (where `ctx.sql` lives); pass the result to a mutation for the write.
|
|
98
98
|
*/
|
|
99
99
|
declare const pullSourceRows: (sql: SqlClient, options: PullSourceOptions) => Promise<Record<string, unknown>[]>;
|
|
100
|
-
export { type HyperdriveConnection, type HyperdriveLike, type Mysql2Like, type NodePgLike, type PostgresJsLike, type ProjectOptions, type PullSourceOptions, type SqlClient,
|
|
100
|
+
export { type HyperdriveConnection, type HyperdriveLike, type Mysql2Like, type NodePgLike, type PostgresJsLike, type ProjectOptions, type PullSourceOptions, type SqlClient,
|
|
101
|
+
/**
|
|
102
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
103
|
+
* Hyperdrive.
|
|
104
|
+
*
|
|
105
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
106
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
107
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
108
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
109
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
110
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
111
|
+
*/
|
|
112
|
+
createHyperdrive,
|
|
113
|
+
/**
|
|
114
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
115
|
+
* Hyperdrive.
|
|
116
|
+
*
|
|
117
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
118
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
119
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
120
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
121
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
122
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
123
|
+
*/
|
|
124
|
+
fromMysql2,
|
|
125
|
+
/**
|
|
126
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
127
|
+
* Hyperdrive.
|
|
128
|
+
*
|
|
129
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
130
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
131
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
132
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
133
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
134
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
135
|
+
*/
|
|
136
|
+
fromNodePg,
|
|
137
|
+
/**
|
|
138
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
139
|
+
* Hyperdrive.
|
|
140
|
+
*
|
|
141
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
142
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
143
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
144
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
145
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
146
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
147
|
+
*/
|
|
148
|
+
fromPostgresJs, projectSourceRow, pullSourceRows };
|
package/dist/index.d.ts
CHANGED
|
@@ -97,4 +97,52 @@ declare const projectSourceRow: (row: Record<string, unknown>, options?: Project
|
|
|
97
97
|
* **action** (where `ctx.sql` lives); pass the result to a mutation for the write.
|
|
98
98
|
*/
|
|
99
99
|
declare const pullSourceRows: (sql: SqlClient, options: PullSourceOptions) => Promise<Record<string, unknown>[]>;
|
|
100
|
-
export { type HyperdriveConnection, type HyperdriveLike, type Mysql2Like, type NodePgLike, type PostgresJsLike, type ProjectOptions, type PullSourceOptions, type SqlClient,
|
|
100
|
+
export { type HyperdriveConnection, type HyperdriveLike, type Mysql2Like, type NodePgLike, type PostgresJsLike, type ProjectOptions, type PullSourceOptions, type SqlClient,
|
|
101
|
+
/**
|
|
102
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
103
|
+
* Hyperdrive.
|
|
104
|
+
*
|
|
105
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
106
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
107
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
108
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
109
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
110
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
111
|
+
*/
|
|
112
|
+
createHyperdrive,
|
|
113
|
+
/**
|
|
114
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
115
|
+
* Hyperdrive.
|
|
116
|
+
*
|
|
117
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
118
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
119
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
120
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
121
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
122
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
123
|
+
*/
|
|
124
|
+
fromMysql2,
|
|
125
|
+
/**
|
|
126
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
127
|
+
* Hyperdrive.
|
|
128
|
+
*
|
|
129
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
130
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
131
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
132
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
133
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
134
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
135
|
+
*/
|
|
136
|
+
fromNodePg,
|
|
137
|
+
/**
|
|
138
|
+
* `@lunora/hyperdrive` — bring-your-own Postgres/MySQL for Lunora via Cloudflare
|
|
139
|
+
* Hyperdrive.
|
|
140
|
+
*
|
|
141
|
+
* Surfaces a Hyperdrive binding's connection string and a driver-agnostic
|
|
142
|
+
* {@link import("./types").SqlClient | SqlClient} bound to `ctx.sql` on
|
|
143
|
+
* **`ActionCtx` only**. External SQL is non-deterministic (action-only) and
|
|
144
|
+
* non-reactive (live queries do not track external writes) — integrate an
|
|
145
|
+
* existing DB, do not replace the Lunora data layer. See the README and
|
|
146
|
+
* {@link import("./create-hyperdrive").createHyperdrive | createHyperdrive} JSDoc.
|
|
147
|
+
*/
|
|
148
|
+
fromPostgresJs, projectSourceRow, pullSourceRows };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHyperdrive as e,fromMysql2 as f,fromNodePg as m,fromPostgresJs as p}from"./packem_shared/createHyperdrive-
|
|
1
|
+
import{createHyperdrive as e,fromMysql2 as f,fromNodePg as m,fromPostgresJs as p}from"./packem_shared/createHyperdrive-DEXMfGd0.mjs";import{projectSourceRow as t,pullSourceRows as c}from"./packem_shared/projectSourceRow-DN8ywPRl.mjs";export{e as createHyperdrive,f as fromMysql2,m as fromNodePg,p as fromPostgresJs,t as projectSourceRow,c as pullSourceRows};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=e=>({all:(r,a)=>e.query(r,a),batch:async r=>{await Promise.all(r.map(a=>e.query(a.sql,a.params)))},run:async(r,a)=>(await e.query(r,a),{rowsAffected:0})}),t=e=>({all:async(r,a)=>{const[s]=await e.execute(r,a);return s},batch:async r=>{await Promise.all(r.map(a=>e.execute(a.sql,a.params)))},run:async(r,a)=>{const[s]=await e.execute(r,a);return{rowsAffected:s.affectedRows??0}}});export{t as buildMysqlExec,u as buildPgExec};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=r=>({config:{database:r.database,host:r.host,password:r.password,port:r.port,user:r.user},connectionString:r.connectionString}),a=r=>({query:async(t,s=[])=>await r.unsafe(t,s)}),c=r=>({query:async(t,s=[])=>(await r.query(t,s)).rows}),n=r=>({query:async(t,s=[])=>{const[e]=await r.execute(t,s);return Array.isArray(e)?e:[]}});export{o as createHyperdrive,n as fromMysql2,c as fromNodePg,a as fromPostgresJs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sqliteEncode as E,sqliteDecode as m}from"@lunora/sql-store";import{sql as t}from"drizzle-orm";const i="__id__",
|
|
1
|
+
import{sqliteEncode as E,sqliteDecode as m}from"@lunora/sql-store";import{sql as t}from"drizzle-orm";const i="__id__",a="__vector__",r=e=>t`${t.identifier(e)}.${t.identifier(a)}`,T=e=>t`to_tsvector('simple', ${e})`,o=e=>t`to_tsquery('simple', ${e.map((n,s)=>s===e.length-1?`${n}:*`:n).join(" & ")})`,l=/duplicate key value violates unique constraint/iu,c=e=>{switch(e){case"array":case"object":case"record":return"JSON";case"bigint":return"VARCHAR(64)";case"boolean":return"TINYINT";case"bytes":return"LONGBLOB";case"date":case"number":case"timestamp":return"DOUBLE";default:return"LONGTEXT"}},u=/TEXT|BLOB/u,_={companionTypes:{autoincrementPrimaryKey:"BIGSERIAL PRIMARY KEY",integer:"INTEGER",key:"TEXT",real:"DOUBLE PRECISION",text:"TEXT"},columnType:e=>{switch(e){case"boolean":return"INTEGER";case"bytes":return"BYTEA";case"date":case"number":case"timestamp":return"DOUBLE PRECISION";default:return"TEXT"}},decode:m,encode:E,frameworkColumns:()=>[{name:"id",type:"TEXT PRIMARY KEY"},{name:"_creationTime",type:"DOUBLE PRECISION NOT NULL"}],isUniqueViolation:e=>{const{code:n}=e;return n==="23505"||e instanceof Error&&l.test(e.message)},maxTableColumns:1600,name:"postgres",supportsFts5:!1,nativeTextSearch:{createCompanion:(e,n)=>t`CREATE TABLE IF NOT EXISTS ${t.identifier(e)} (${t.identifier(i)} ${t.raw(n)} PRIMARY KEY, ${t.identifier(a)} tsvector)`,createIndexes:e=>[t`CREATE INDEX IF NOT EXISTS ${t.identifier(`${e}__gin`)} ON ${t.identifier(e)} USING GIN (${t.identifier(a)})`],indexDocument:(e,n,s)=>t`INSERT INTO ${t.identifier(e)} (${t.identifier(i)}, ${t.identifier(a)}) VALUES (${n}, ${T(s)})`,matches:(e,n)=>t`${r(e)} @@ ${o(n)}`,rank:(e,n)=>t`ts_rank_cd(${r(e)}, ${o(n)})`},supportsReturning:!0,textPatternOperatorClass:"text_pattern_ops",tableExists:e=>t`SELECT table_name FROM information_schema.tables WHERE table_schema = ANY (current_schemas(false)) AND table_name = ${e}`},I={affectedRows:e=>e.rowsAffected,companionTypes:{autoincrementPrimaryKey:"BIGINT AUTO_INCREMENT PRIMARY KEY",integer:"INTEGER",key:"VARCHAR(768)",real:"DOUBLE",text:"LONGTEXT"},columnType:c,decode:m,encode:E,frameworkColumns:()=>[{name:"id",type:"VARCHAR(768) PRIMARY KEY"},{name:"_creationTime",type:"DOUBLE NOT NULL"}],indexKeyPrefix:e=>u.test(c(e))?191:void 0,isUniqueViolation:e=>{const n=e;return n.errno===1062||n.code==="ER_DUP_ENTRY"},maxTableColumns:4096,name:"mysql",supportsFts5:!1,supportsReturning:!1,tableExists:e=>t`SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = ${e}`};export{I as mysqlDialect,_ as postgresDialect};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{liftSourceId as a}from"@lunora/shard-engine";const n=(o,r={})=>a(o,r),w=async(o,r)=>{const{idColumn:t,map:c,params:s,query:e}=r;return(await o.query(e,s)).map(u=>n(u,{idColumn:t,map:c}))};export{n as projectSourceRow,w as pullSourceRows};
|
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.80",
|
|
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,8 +50,8 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/shard-engine": "1.0.0-alpha.
|
|
54
|
-
"@lunora/sql-store": "1.0.0-alpha.
|
|
53
|
+
"@lunora/shard-engine": "1.0.0-alpha.28",
|
|
54
|
+
"@lunora/sql-store": "1.0.0-alpha.80",
|
|
55
55
|
"drizzle-orm": "^0.45.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const o=e=>({config:{database:e.database,host:e.host,password:e.password,port:e.port,user:e.user},connectionString:e.connectionString}),t=e=>({query:async(r,s=[])=>await e.unsafe(r,s)}),n=e=>({query:async(r,s=[])=>(await e.query(r,s)).rows}),c=e=>({query:async(r,s=[])=>{const[a]=await e.execute(r,s);return Array.isArray(a)?a:[]}});export{o as createHyperdrive,c as fromMysql2,n as fromNodePg,t as fromPostgresJs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{liftSourceId as m}from"@lunora/shard-engine";const s=(o,r={})=>m(o,r),i=async(o,r)=>{const{idColumn:a,map:e,params:p,query:t}=r;return(await o.query(t,p)).map(u=>s(u,{idColumn:a,map:e}))};export{s as projectSourceRow,i as pullSourceRows};
|