@stacksjs/query-builder 0.74.23 → 0.74.25
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/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export declare function applySqlitePragmas(instance: SqlitePragmaExecutor): void
|
|
|
26
26
|
* `getDatabase()` returns the executor's live handle for the sqlite dialect
|
|
27
27
|
* (creating the executor if needed) and throws for mysql/postgres — where
|
|
28
28
|
* there is nothing to bootstrap, hence the silent catch. Safe to call
|
|
29
|
-
* repeatedly: the
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* repeatedly: the WeakMap makes it a no-op while the connection and pragma
|
|
30
|
+
* list remain unchanged. A new handle or changed list is bootstrapped on
|
|
31
|
+
* the next call.
|
|
32
32
|
*/
|
|
33
33
|
export declare function bootstrapModelExecutorPragmas(): void;
|
|
34
34
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{setConfig as d}from"bun-query-builder";import*as o from"bun-query-builder";import{config as
|
|
2
|
+
import{setConfig as d}from"bun-query-builder";import*as o from"bun-query-builder";import{config as u,createQueryBuilder as p}from"bun-query-builder";export*from"bun-query-builder";import{saveMigrationSnapshot as _}from"bun-query-builder";var s=new Set;function i(e,t,n){for(let r of s)try{let c=r[e];c?.(t)}catch{}try{let r=n?.[e];r?.(t)}catch{}}function g(e){return{...e,onQueryStart:(t)=>i("onQueryStart",t,e),onQueryEnd:(t)=>i("onQueryEnd",t,e),onQueryError:(t)=>i("onQueryError",t,e),onSlowQuery:(t)=>i("onSlowQuery",t,e)}}function R(e){return s.add(e),()=>s.delete(e)}function Q(e){d({...e,hooks:g(e.hooks)})}var w=["PRAGMA journal_mode = WAL","PRAGMA foreign_keys = ON","PRAGMA busy_timeout = 5000","PRAGMA wal_autocheckpoint = 1"];function l(){return[...w,...u.sqlite?.pragmas??[]]}function m(e){for(let t of l())try{e.unsafe(t).execute().catch(()=>{})}catch{}}var a=new WeakMap;function f(){try{let e=o.getDatabase?.();if(!e||typeof e.run!=="function")return;let t=l(),n=JSON.stringify(t);if(a.get(e)===n)return;for(let r of t)try{e.run(r)}catch{}a.set(e,n)}catch{}}function P(e){o.configureOrm(e),f()}function v(e){let t=p(e);if(!e?.sql&&u.dialect==="sqlite")m(t),f();return t}var k=new Map;function D(e,t){let n=o.registerModel;if(typeof n==="function")return n(e,t);k.set(e,t);let r=typeof t?.getDefinition==="function"?t.getDefinition():t?.definition;if(r&&typeof r==="object")o.defineModel(r);return t}var b=/^[A-Z_][A-Z0-9_]*$/i;function S(e,t={}){if(typeof e!=="string"||e.length===0)return{valid:!1,reason:"empty"};if(e.length>64)return{valid:!1,reason:"too-long"};if(!b.test(e))return{valid:!1,reason:"invalid-shape"};if(t.allowlist&&!t.allowlist.includes(e))return{valid:!1,reason:"not-in-allowlist"};return{valid:!0}}function E(e,t={}){let n=S(e,t);if(n.valid)return;let r=t.context?` in ${t.context}`:"";throw Error(`[query-builder] Refusing to use ${JSON.stringify(e)} as a SQL identifier${r} - ${n.reason}`)}var y=new Set(["=","!=","<>","<","<=",">",">=","like","not like","ilike","not ilike","in","not in","is","is not","between","not between"]);function x(e){return typeof e==="string"&&y.has(e.toLowerCase())}function A(e,t){if(x(e))return;let n=t?` in ${t}`:"";throw Error(`[query-builder] Refusing to use ${JSON.stringify(e)} as a SQL operator${n} - not in the allowed set (${[...y].join(", ")})`)}Q({snapshotDir:"storage/framework/database"});export{v as QueryBuilder,w as SQLITE_BOOTSTRAP_PRAGMAS,m as applySqlitePragmas,E as assertSafeIdentifier,A as assertSafeOperator,f as bootstrapModelExecutorPragmas,P as configureOrm,v as createQueryBuilder,x as isSafeOperator,D as registerModel,R as registerPersistentQueryHooks,_ as saveMigrationSnapshot,Q as setConfig,S as validateIdentifier};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/query-builder",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.25",
|
|
6
6
|
"description": "The Stacks Query Builder integration",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"prepublishOnly": "bun run build"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"bun-query-builder": "^0.2.
|
|
59
|
+
"bun-query-builder": "^0.2.67"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@stacksjs/database": "0.74.
|
|
62
|
+
"@stacksjs/database": "0.74.25",
|
|
63
63
|
"better-dx": "^0.2.24",
|
|
64
|
-
"@stacksjs/types": "0.74.
|
|
64
|
+
"@stacksjs/types": "0.74.25"
|
|
65
65
|
}
|
|
66
66
|
}
|