@balena/odata-parser 4.2.2 → 4.2.3

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.
@@ -1,3 +1,14 @@
1
+ - commits:
2
+ - subject: Avoid setting $count `options` for $orderby when not provided
3
+ hash: 4e1f9750aed95dba4731d1fe9e7a46a000ea4ab6
4
+ body: ""
5
+ footer:
6
+ Change-type: patch
7
+ change-type: patch
8
+ author: Thodoris Greasidis
9
+ version: 4.2.3
10
+ title: ""
11
+ date: 2025-04-01T07:49:35.337Z
1
12
  - commits:
2
13
  - subject: Update dependency mocha to v11
3
14
  hash: 118d83467fc89b977ad89f7b9444897739399693
@@ -9,7 +20,7 @@
9
20
  author: balena-renovate[bot]
10
21
  version: 4.2.2
11
22
  title: ""
12
- date: 2025-03-18T11:47:06.799Z
23
+ date: 2025-03-25T16:34:08.496Z
13
24
  - commits:
14
25
  - subject: Add the missing MethodCall type
15
26
  hash: 78efcd852c6ff653da7eb17c9d15cdfaf18f177e
package/CHANGELOG.md CHANGED
@@ -4,8 +4,13 @@ All notable changes to this project will be documented in this file
4
4
  automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
5
5
  This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ # v4.2.3
8
+ ## (2025-04-01)
9
+
10
+ * Avoid setting $count `options` for $orderby when not provided [Thodoris Greasidis]
11
+
7
12
  # v4.2.2
8
- ## (2025-03-18)
13
+ ## (2025-03-25)
9
14
 
10
15
  * Update dependency mocha to v11 [balena-renovate[bot]]
11
16
 
package/odata-parser.js CHANGED
@@ -568,8 +568,8 @@ function peg$parse(input, options) {
568
568
  var peg$f42 = function(methodName, args) { return [ 'call', { args, method: methodName } ] };
569
569
  var peg$f43 = function(name) { return { name } };
570
570
  var peg$f44 = function(result, property) { result.property = property };
571
- var peg$f45 = function(result, option) { return CollapseObjectArray([option]) };
572
- var peg$f46 = function(result, optionsObj) { result.count = true; result.options = optionsObj };
571
+ var peg$f45 = function(result, option) { result.options = CollapseObjectArray([option]) };
572
+ var peg$f46 = function(result) { result.count = true };
573
573
  var peg$f47 = function(result, key) { result.key = key };
574
574
  var peg$f48 = function(result, property) { result.property = property };
575
575
  var peg$f49 = function(result) { return result };
@@ -3381,7 +3381,8 @@ function peg$parse(input, options) {
3381
3381
  if (peg$silentFails === 0) { peg$fail(peg$e35); }
3382
3382
  }
3383
3383
  if (s7 !== peg$FAILED) {
3384
- s4 = s6;
3384
+ s5 = [s5, s6, s7];
3385
+ s4 = s5;
3385
3386
  } else {
3386
3387
  peg$currPos = s4;
3387
3388
  s4 = peg$FAILED;
@@ -3398,7 +3399,7 @@ function peg$parse(input, options) {
3398
3399
  s4 = null;
3399
3400
  }
3400
3401
  peg$savedPos = s2;
3401
- s2 = peg$f46(s1, s4);
3402
+ s2 = peg$f46(s1);
3402
3403
  } else {
3403
3404
  peg$currPos = s2;
3404
3405
  s2 = peg$FAILED;
@@ -450,15 +450,15 @@ PropertyPath =
450
450
  / ( // collectionNavigationExpr
451
451
  ( // collectionPathExpr
452
452
  '/$count'
453
- optionsObj:(
453
+ (
454
454
  '('
455
- @( Dollar
455
+ ( Dollar
456
456
  option:FilterByOption
457
- { return CollapseObjectArray([option]) }
457
+ { result.options = CollapseObjectArray([option]) }
458
458
  )
459
459
  ')'
460
460
  )?
461
- { result.count = true; result.options = optionsObj }
461
+ { result.count = true }
462
462
  )
463
463
  / ( // keyPredicate [ singleNavigationExpr ]
464
464
  (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/odata-parser",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "description": "An OData parser written in OMeta",
5
5
  "main": "odata-parser.js",
6
6
  "scripts": {
@@ -39,6 +39,6 @@
39
39
  "npm": ">=8.1.0"
40
40
  },
41
41
  "versionist": {
42
- "publishedAt": "2025-03-18T11:47:06.942Z"
42
+ "publishedAt": "2025-04-01T07:49:35.456Z"
43
43
  }
44
44
  }
package/test/orderby.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as assert from 'assert';
2
+ import { expect } from 'chai';
2
3
  import filterby from './filterby';
3
4
 
4
5
  export default (test) => {
@@ -103,6 +104,20 @@ export default (test) => {
103
104
  it('has count defined', () => {
104
105
  assert.equal(result.options.$orderby.properties[0].count, true);
105
106
  });
107
+ it('has no count options defined', () => {
108
+ expect(result.options.$orderby.properties[0]).to.not.have.property(
109
+ 'options',
110
+ );
111
+ });
112
+ it('sort options property should be as expected', () => {
113
+ assert.deepStrictEqual(result.options.$orderby.properties, [
114
+ {
115
+ name: 'PropertyOne',
116
+ count: true,
117
+ order: 'desc',
118
+ },
119
+ ]);
120
+ });
106
121
  });
107
122
 
108
123
  const testFilterOption = function (nestedTest, input, ...optArgs) {
@@ -231,7 +246,7 @@ export default (test) => {
231
246
  {
232
247
  name: 'Products',
233
248
  key: { bind: 0 },
234
- property: { name: 'Orders', count: true, options: null },
249
+ property: { name: 'Orders', count: true },
235
250
  order: 'asc',
236
251
  },
237
252
  ]);
@@ -255,7 +270,7 @@ export default (test) => {
255
270
  key: {
256
271
  partialkey: { bind: 0 },
257
272
  },
258
- property: { name: 'Orders', count: true, options: null },
273
+ property: { name: 'Orders', count: true },
259
274
  order: 'asc',
260
275
  },
261
276
  ]);