@ragestudio/scylla-odm 0.18.0 → 0.19.0
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/package.js +1 -1
- package/package.json +1 -1
- package/utils/isPlainObject.d.ts +4 -0
- package/utils/isPlainObject.js +1 -0
- package/utils/queryParser.js +1 -1
package/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.
|
|
1
|
+
var e=`0.19.0`,t=`An ODM for ScyllaDB/Cassandra`;export{t as description,e as version};
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>{if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype};export{e as default};
|
package/utils/queryParser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../driver/index.js";const{q:
|
|
1
|
+
import e from"../driver/index.js";import t from"./isPlainObject.js";const{q:n}=e.mapping,r=1e3,i=new Set([`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`]);function a(e,t){if(e==null)throw Error(`${t} operator cannot compare with null or undefined`)}function o(e,t){if(!i.has(e))throw Error(`Invalid operator: ${e}`);switch(e){case`$eq`:return t;case`$ne`:return a(t,`$ne`),n.notEq(t);case`$in`:if(!Array.isArray(t))throw Error(`$in operator requires an array`);if(t.length>r)throw Error(`$in operator exceeds maximum of ${r} elements`);for(let e=0;e<t.length;e++)if(t[e]===null||t[e]===void 0)throw Error(`$in array element at index ${e} cannot be null or undefined`);return n.in_(t);case`$gt`:return a(t,`$gt`),n.gt(t);case`$gte`:return a(t,`$gte`),n.gte(t);case`$lt`:return a(t,`$lt`),n.lt(t);case`$lte`:return a(t,`$lte`),n.lte(t)}}function s(e,n,r=0){if(r>3)throw Error(`Query depth exceeds maximum of 3`);if(!n||typeof n!=`object`)return n;let i={};for(let r of Object.keys(n)){let a=n[r];if(!l(e.schema.fields,r))throw Error(`Invalid field name: [${r}] or it does not exist in schema`);t(a)?i[r]=c(a):i[r]=a}return i}function c(e){let t=Object.keys(e).map(t=>o(t,e[t]));return t.length===1?t[0]:n.and(...t)}function l(e,t){for(let e of[/^[0-9]/,/[^a-zA-Z0-9_]/,/^(select|insert|update|delete|drop|create|alter|truncate)$/i])if(e.test(t))return!1;return t in e}function u(e){return i.has(e)}export{s as default,l as isValidFieldName,u as isValidOperator};
|