@ragestudio/scylla-odm 0.17.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/operations/findOne.js +1 -1
- package/operations/update.js +1 -1
- package/package.js +1 -1
- package/package.json +15 -3
- package/utils/isPlainObject.d.ts +4 -0
- package/utils/isPlainObject.js +1 -0
- package/utils/queryParser.js +1 -1
package/operations/findOne.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../utils/queryParser.js";async function t(t={},n){return t=e(this,t),this.client.executeWithRetry(async()=>{let e=await this.mapper.get(t,n);return e?n?.raw===!0?e
|
|
1
|
+
import e from"../utils/queryParser.js";async function t(t={},n){return t=e(this,t),this.client.executeWithRetry(async()=>{let e=await this.mapper.get(t,n);return e?n?.raw===!0?e:this._wrap(e):null},`findOne on ${this.name}`)}export{t as default};
|
package/operations/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../utils/fillDefaults.js";async function
|
|
1
|
+
import e from"../utils/fillDefaults.js";import t from"../utils/queryParser.js";async function n(n){return n=e(this.schema,n),n=t(this,n),n.__v!==void 0&&(Number.isNaN(n.__v)?n.__v=0:n.__v+=1),this.client.executeWithRetry(async()=>(await this.mapper.update(n),this._wrap(n)),`update on ${this.name}`)}export{n as default};
|
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
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ragestudio/scylla-odm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "An ODM for ScyllaDB/Cassandra",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "RageStudio",
|
|
5
7
|
"repository": {
|
|
6
8
|
"url": "https://git.ragestudio.net/ragestudio/scylla-odm"
|
|
7
9
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://git.ragestudio.net/ragestudio/scylla-odm/issues"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"scylladb",
|
|
15
|
+
"cassandra",
|
|
16
|
+
"odm",
|
|
17
|
+
"database",
|
|
18
|
+
"driver",
|
|
19
|
+
"mapper",
|
|
20
|
+
"typescript"
|
|
21
|
+
],
|
|
10
22
|
"type": "module",
|
|
11
23
|
"types": "./index.d.ts",
|
|
12
24
|
"main": "./index.js",
|
|
@@ -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};
|