@cap-js/db-service 1.3.0 → 1.3.1

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## Version 1.3.1 - 2023-10-10
8
+
9
+ ### Fixed
10
+
11
+ - Error message for `search` with multiple arguments. #265
12
+
7
13
  ## Version 1.3.0 - 2023-10-06
8
14
 
9
15
  ### Changed
@@ -21,7 +21,7 @@ const StandardFunctions = {
21
21
  * @returns {string}
22
22
  */
23
23
  search: function (ref, arg) {
24
- if (!('val' in arg)) throw `SQLite only supports single value arguments for $search`
24
+ if (!('val' in arg)) throw `Only single value arguments are allowed for $search`
25
25
  const refs = ref.list || [ref],
26
26
  { toString } = ref
27
27
  return '(' + refs.map(ref2 => this.contains(this.tolower(toString(ref2)), this.tolower(arg))).join(' or ') + ')'
@@ -31,7 +31,7 @@ const StandardFunctions = {
31
31
  * @param {...string} args
32
32
  * @returns {string}
33
33
  */
34
- concat: (...args) => args.map(a => a.xpr ? `(${a})` : a).join(' || '),
34
+ concat: (...args) => args.map(a => (a.xpr ? `(${a})` : a)).join(' || '),
35
35
 
36
36
  /**
37
37
  * Generates SQL statement that produces a boolean value indicating whether the first string contains the second string
@@ -141,9 +141,9 @@ const StandardFunctions = {
141
141
 
142
142
  // Date and Time Functions
143
143
 
144
- current_date: p => p ? `current_date(${p})`: 'current_date',
145
- current_time: p => p ? `current_time(${p})`: 'current_time',
146
- current_timestamp: p => p ? `current_timestamp(${p})`: 'current_timestamp',
144
+ current_date: p => (p ? `current_date(${p})` : 'current_date'),
145
+ current_time: p => (p ? `current_time(${p})` : 'current_time'),
146
+ current_timestamp: p => (p ? `current_timestamp(${p})` : 'current_timestamp'),
147
147
 
148
148
  /**
149
149
  * Generates SQL statement that produces the year of a given timestamp
@@ -341,7 +341,7 @@ const HANAFunctions = {
341
341
  */
342
342
  years_between(x, y) {
343
343
  return `floor(${this.months_between(x, y)} / 12)`
344
- }
344
+ },
345
345
  }
346
346
 
347
347
  for (let each in HANAFunctions) HANAFunctions[each.toUpperCase()] = HANAFunctions[each]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/db-service",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "CDS base database service",
5
5
  "homepage": "https://github.com/cap-js/cds-dbs/tree/main/db-service#cds-base-database-service",
6
6
  "repository": {