@stacksjs/query-builder 0.72.57 → 0.72.61
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.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{setConfig as
|
|
2
|
+
import{setConfig as d}from"bun-query-builder";import*as o from"bun-query-builder";import{config as c,createQueryBuilder as p}from"bun-query-builder";export*from"bun-query-builder";import{saveMigrationSnapshot as O}from"bun-query-builder";var s=new Set;function i(e,n,t){for(let r of s)try{let y=r[e];y?.(n)}catch{}try{let r=t?.[e];r?.(n)}catch{}}function g(e){return{...e,onQueryStart:(n)=>i("onQueryStart",n,e),onQueryEnd:(n)=>i("onQueryEnd",n,e),onQueryError:(n)=>i("onQueryError",n,e),onSlowQuery:(n)=>i("onSlowQuery",n,e)}}function h(e){return s.add(e),()=>s.delete(e)}function Q(e){d({...e,hooks:g(e.hooks)})}var u=["PRAGMA journal_mode = WAL","PRAGMA foreign_keys = ON","PRAGMA busy_timeout = 5000","PRAGMA wal_autocheckpoint = 1"];function w(e){for(let n of u)try{e.unsafe(n).execute().catch(()=>{})}catch{}}var a=new WeakSet;function l(){try{let e=o.getDatabase?.();if(!e||typeof e.run!=="function"||a.has(e))return;for(let n of u)try{e.run(n)}catch{}a.add(e)}catch{}}function R(e){o.configureOrm(e),l()}function v(e){let n=p(e);if(!e?.sql&&c.dialect==="sqlite")w(n),l();return n}var k=new Map;function P(e,n){let t=o.registerModel;if(typeof t==="function")return t(e,n);k.set(e,n);let r=typeof n?.getDefinition==="function"?n.getDefinition():n?.definition;if(r&&typeof r==="object")o.defineModel(r);return n}var m=/^[A-Z_][A-Z0-9_]*$/i;function b(e,n={}){if(typeof e!=="string"||e.length===0)return{valid:!1,reason:"empty"};if(e.length>64)return{valid:!1,reason:"too-long"};if(!m.test(e))return{valid:!1,reason:"invalid-shape"};if(n.allowlist&&!n.allowlist.includes(e))return{valid:!1,reason:"not-in-allowlist"};return{valid:!0}}function D(e,n={}){let t=b(e,n);if(t.valid)return;let r=n.context?` in ${n.context}`:"";throw Error(`[query-builder] Refusing to use ${JSON.stringify(e)} as a SQL identifier${r} - ${t.reason}`)}var f=new Set(["=","!=","<>","<","<=",">",">=","like","not like","ilike","not ilike","in","not in","is","is not","between","not between"]);function S(e){return typeof e==="string"&&f.has(e.toLowerCase())}function E(e,n){if(S(e))return;let t=n?` in ${n}`:"";throw Error(`[query-builder] Refusing to use ${JSON.stringify(e)} as a SQL operator${t} - not in the allowed set (${[...f].join(", ")})`)}Q({snapshotDir:"storage/framework/database"});export{v as QueryBuilder,u as SQLITE_BOOTSTRAP_PRAGMAS,w as applySqlitePragmas,D as assertSafeIdentifier,E as assertSafeOperator,l as bootstrapModelExecutorPragmas,R as configureOrm,v as createQueryBuilder,S as isSafeOperator,P as registerModel,h as registerPersistentQueryHooks,O as saveMigrationSnapshot,Q as setConfig,b 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.72.
|
|
5
|
+
"version": "0.72.61",
|
|
6
6
|
"description": "The Stacks Query Builder integration",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"prepublishOnly": "bun run build"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@stacksjs/database": "0.72.
|
|
59
|
+
"@stacksjs/database": "0.72.61",
|
|
60
60
|
"better-dx": "^0.2.24",
|
|
61
|
-
"@stacksjs/types": "0.72.
|
|
61
|
+
"@stacksjs/types": "0.72.61"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"bun-query-builder": "^0.2.53"
|