@stacksjs/query-builder 0.74.26 → 0.74.27
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export declare function assertSafeOperator(op: unknown, context?: string): asser
|
|
|
116
116
|
* confirmed on a live deploy via lsof (two connections) and WAL frames
|
|
117
117
|
* from ORM inserts never auto-checkpointing.
|
|
118
118
|
*/
|
|
119
|
-
export declare const SQLITE_BOOTSTRAP_PRAGMAS: readonly [unknown
|
|
119
|
+
export declare const SQLITE_BOOTSTRAP_PRAGMAS: readonly [unknown];
|
|
120
120
|
/**
|
|
121
121
|
* Return value of `validateIdentifier` / `assertSafeIdentifier`.
|
|
122
122
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{setConfig as
|
|
2
|
+
import{setConfig as f}from"bun-query-builder";import*as o from"bun-query-builder";import{config as y,createQueryBuilder as k}from"bun-query-builder";export*from"bun-query-builder";import{saveMigrationSnapshot as T}from"bun-query-builder";var s=new Set,i;function d(e){return Boolean(e&&Object.values(e).some((n)=>n!==void 0))}function u(e,n,t){for(let r of s)try{let w=r[e];w?.(n)}catch{}try{let r=t?.[e];r?.(n)}catch{}}function c(e){return{...e,onQueryStart:(n)=>u("onQueryStart",n,e),onQueryEnd:(n)=>u("onQueryEnd",n,e),onQueryError:(n)=>u("onQueryError",n,e),onSlowQuery:(n)=>u("onSlowQuery",n,e)}}function a(){let e=s.size>0||d(i)?c(i):void 0;f({hooks:e})}function D(e){return s.add(e),a(),()=>{if(s.delete(e))a()}}function m(e){if(Object.prototype.hasOwnProperty.call(e,"hooks"))i=e.hooks;f({...e,hooks:s.size>0||d(i)?c(i):void 0})}var b=["PRAGMA journal_mode = WAL","PRAGMA foreign_keys = ON","PRAGMA busy_timeout = 5000","PRAGMA wal_autocheckpoint = 100"];function p(){return[...b,...y.sqlite?.pragmas??[]]}function S(e){for(let n of p())try{e.unsafe(n).execute().catch(()=>{})}catch{}}var l=new WeakMap;function g(){try{let e=o.getDatabase?.();if(!e||typeof e.run!=="function")return;let n=p(),t=JSON.stringify(n);if(l.get(e)===t)return;for(let r of n)try{e.run(r)}catch{}l.set(e,t)}catch{}}function E(e){o.configureOrm(e),g()}function A(e){let n=k(e);if(!e?.sql&&y.dialect==="sqlite")S(n),g();return n}var x=new Map;function q(e,n){let t=o.registerModel;if(typeof t==="function")return t(e,n);x.set(e,n);let r=typeof n?.getDefinition==="function"?n.getDefinition():n?.definition;if(r&&typeof r==="object")o.defineModel(r);return n}var B=/^[A-Z_][A-Z0-9_]*$/i;function h(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(!B.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 M(e,n={}){let t=h(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 Q=new Set(["=","!=","<>","<","<=",">",">=","like","not like","ilike","not ilike","in","not in","is","is not","between","not between"]);function v(e){return typeof e==="string"&&Q.has(e.toLowerCase())}function O(e,n){if(v(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 (${[...Q].join(", ")})`)}m({snapshotDir:"storage/framework/database"});export{A as QueryBuilder,b as SQLITE_BOOTSTRAP_PRAGMAS,S as applySqlitePragmas,M as assertSafeIdentifier,O as assertSafeOperator,g as bootstrapModelExecutorPragmas,E as configureOrm,A as createQueryBuilder,v as isSafeOperator,q as registerModel,D as registerPersistentQueryHooks,T as saveMigrationSnapshot,m as setConfig,h 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.27",
|
|
6
6
|
"description": "The Stacks Query Builder integration",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"bun-query-builder": "^0.2.68"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@stacksjs/database": "0.74.
|
|
62
|
+
"@stacksjs/database": "0.74.27",
|
|
63
63
|
"better-dx": "^0.2.24",
|
|
64
|
-
"@stacksjs/types": "0.74.
|
|
64
|
+
"@stacksjs/types": "0.74.27"
|
|
65
65
|
}
|
|
66
66
|
}
|