Skip to content

Commit

Permalink
version bump; changelog updated; filter parsing error message updated
Browse files Browse the repository at this point in the history
  • Loading branch information
countnazgul committed Aug 21, 2023
1 parent 79308d8 commit 34d9b94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 0.11.1 - 2023-08-21

- additional condition to the filter parsing process - check not only of double but for single quotes as well

## 0.11.0 - 2023-08-20

- **BREAKING** [#199](https://github.com/Informatiqal/qlik-saas-api/issues/199) introduction to common `getFilter` methods for majority of methods. For methods that already had `getFilter` this method is renamed to `getFilterNative`. The new `getFilter` methods is behaving similarly to the QSEoW Repository API filter endpoints where filters criteria can be passed as "readable" text eg. `name eq "something" and published ne true`. Methods that dont have the new `getFilter` will be evaluated in the next release
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qlik-saas-api",
"version": "0.11.0",
"version": "0.11.1",
"description": "Interact with Qlik Sense SaaS REST API",
"author": {
"email": "info@informatiqal.com",
Expand Down
9 changes: 5 additions & 4 deletions src/util/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export type ParsedCondition = {
*/
export function parseFilter(
filter: string,
baseObjPath: string,
baseObjPath: string
// data: {}
){
) {
// if (!filter) throw new Error("");

// split the conditions on "and" and "or" (ignore cases: AND = and = And etc.)
Expand Down Expand Up @@ -92,10 +92,11 @@ function constructFilter(

if (
isNaN(Number(c1.value)) &&
(!c1.value.startsWith(`"`) || !c1.value.endsWith(`"`))
(!c1.value.startsWith(`"`) || !c1.value.endsWith(`"`)) &&
(!c1.value.startsWith(`'`) || !c1.value.endsWith(`'`))
)
throw new Error(
`Error while parsing filter value. The value is an instance of a string but its not surrounded by double-quotes. Provided value was: ${c1.value}`
`Error while parsing filter value. The value is an instance of a string but its not surrounded by double/single-quotes. Provided value was: ${c1.value}`
);

return `${baseObjPath}.${c[c1.operation](c1.property, c1.value)} ${
Expand Down

0 comments on commit 34d9b94

Please sign in to comment.