dobo 1.1.17 → 1.1.18

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.
@@ -122,6 +122,7 @@
122
122
  "errorAddingFixture%s%s": "Error adding fixture on model '%s': %s",
123
123
  "memoryDbSkipped%s": "'%s' is a memory DB, skipped",
124
124
  "db": "DB",
125
+ "invalidQuery": "Invalid Query",
125
126
  "field": {
126
127
  "id": "ID",
127
128
  "code": "Kode",
package/bajo/intl/id.json CHANGED
@@ -115,6 +115,7 @@
115
115
  "recordsAdded%s%d%d": "%s: %d of %d records added",
116
116
  "driverInstantiated%s%s": "- Driver '%s:%s' instantiated",
117
117
  "db": "DB",
118
+ "invalidQuery": "Kueri Tidak Valid",
118
119
  "field": {
119
120
  "id": "ID",
120
121
  "code": "Kode",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "Database ORM/ODM for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin/factory.js CHANGED
@@ -267,10 +267,15 @@ async function factory (pkgName) {
267
267
  buildQuery = async ({ filter, schema, options = {} } = {}) => {
268
268
  const { trim, isString, isPlainObject } = this.lib._
269
269
  let query = {}
270
+ if (schema.name === 'SeatrackVessel') this.app.dump(filter)
270
271
  if (isString(filter.query)) {
271
- filter.oquery = filter.query
272
- if (trim(filter.query).startsWith('{')) query = JSON.parse(filter.query)
273
- else query = nql(filter.query).parse()
272
+ try {
273
+ filter.oquery = filter.query
274
+ if (trim(filter.query).startsWith('{')) query = JSON.parse(filter.query)
275
+ else query = nql(filter.query).parse()
276
+ } catch (err) {
277
+ this.error('invalidQuery', { orgMessage: err.message })
278
+ }
274
279
  } else if (isPlainObject(filter.query)) query = filter.query
275
280
  return this.sanitizeQuery(query, schema)
276
281
  }