@balena/odata-parser
Advanced tools
Comparing version 3.1.1 to 3.1.2-build-update-deps-e671fc822a9db4c4aa43fc5b3d46d7c9b2558700-1
@@ -7,2 +7,7 @@ # Change Log | ||
# v3.1.2 | ||
## (2024-10-04) | ||
* Update dependencies [Pagan Gazzard] | ||
# v3.1.1 | ||
@@ -9,0 +14,0 @@ ## (2024-10-04) |
{ | ||
"name": "@balena/odata-parser", | ||
"version": "3.1.1", | ||
"version": "3.1.2-build-update-deps-e671fc822a9db4c4aa43fc5b3d46d7c9b2558700-1", | ||
"description": "An OData parser written in OMeta", | ||
@@ -12,3 +12,3 @@ "main": "odata-parser.js", | ||
"prepare": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module && peggy --source-map --extra-options-file odata-parser.config.json --output odata-parser.js odata-parser.pegjs", | ||
"prettify": "balena-lint -e ts -e js --typescript --fix odata-parser.d.ts test" | ||
"lint-fix": "balena-lint -e ts -e js --typescript --fix odata-parser.d.ts test" | ||
}, | ||
@@ -19,14 +19,14 @@ "repository": "https://github.com/balena-io-modules/odata-parser.git", | ||
"devDependencies": { | ||
"@balena/lint": "^8.0.0", | ||
"@types/chai": "^4.3.4", | ||
"@types/lodash": "^4.14.194", | ||
"@types/mocha": "^10.0.1", | ||
"chai": "^4.3.7", | ||
"husky": "^9.0.0", | ||
"lint-staged": "^15.0.0", | ||
"@balena/lint": "^8.2.8", | ||
"@types/chai": "^4.3.20", | ||
"@types/lodash": "^4.17.10", | ||
"@types/mocha": "^10.0.8", | ||
"chai": "^4.5.0", | ||
"husky": "^9.1.6", | ||
"lint-staged": "^15.2.10", | ||
"lodash": "^4.17.21", | ||
"mocha": "^10.2.0", | ||
"peggy": "^4.0.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
"mocha": "^10.7.3", | ||
"peggy": "^4.1.1", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.6.2" | ||
}, | ||
@@ -44,4 +44,4 @@ "mocha": { | ||
"versionist": { | ||
"publishedAt": "2024-10-04T15:26:18.354Z" | ||
"publishedAt": "2024-10-04T15:44:58.097Z" | ||
} | ||
} |
@@ -154,7 +154,9 @@ import * as assert from 'assert'; | ||
test('$filter=Price gt 5 and Price lt 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'and'", () => | ||
assert.equal(result.options.$filter[0], 'and')); | ||
it("Filter should be an instance of 'and'", () => { | ||
assert.equal(result.options.$filter[0], 'and'); | ||
}); | ||
@@ -177,7 +179,9 @@ it('Left hand side should be Price gt $0', function () { | ||
test('$filter=Price eq 5 or Price eq 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'or'", () => | ||
assert.equal(result.options.$filter[0], 'or')); | ||
it("Filter should be an instance of 'or'", () => { | ||
assert.equal(result.options.$filter[0], 'or'); | ||
}); | ||
@@ -200,26 +204,33 @@ it('Left hand side should be Price eq $0', function () { | ||
test('$filter=Published', function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("value should be 'Published'", () => | ||
assert.equal(result.options.$filter.name, 'Published')); | ||
it("value should be 'Published'", () => { | ||
assert.equal(result.options.$filter.name, 'Published'); | ||
}); | ||
}); | ||
test('$filter=not Published', function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'not'", () => | ||
assert.equal(result.options.$filter[0], 'not')); | ||
it("Filter should be an instance of 'not'", () => { | ||
assert.equal(result.options.$filter[0], 'not'); | ||
}); | ||
it("value should be 'Published'", () => | ||
assert.equal(result.options.$filter[1].name, 'Published')); | ||
it("value should be 'Published'", () => { | ||
assert.equal(result.options.$filter[1].name, 'Published'); | ||
}); | ||
}); | ||
test('$filter=not (Price gt 5)', [5], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'not'", () => | ||
assert.equal(result.options.$filter[0], 'not')); | ||
it("Filter should be an instance of 'not'", () => { | ||
assert.equal(result.options.$filter[0], 'not'); | ||
}); | ||
@@ -235,10 +246,13 @@ it('Value should be Price gt $0', function () { | ||
test('$filter=Price in (1, 2, 3)', [1, 2, 3], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'in'", () => | ||
assert.equal(result.options.$filter[0], 'in')); | ||
it("Filter should be an instance of 'in'", () => { | ||
assert.equal(result.options.$filter[0], 'in'); | ||
}); | ||
it('lhr should be Price', () => | ||
assert.equal(result.options.$filter[1].name, 'Price')); | ||
it('lhr should be Price', () => { | ||
assert.equal(result.options.$filter[1].name, 'Price'); | ||
}); | ||
@@ -253,10 +267,13 @@ it('rhr should be [ $1, $2, $3 ]', function () { | ||
test('$filter=Price in ((1), ((2)), (((3))))', [1, 2, 3], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'in'", () => | ||
assert.equal(result.options.$filter[0], 'in')); | ||
it("Filter should be an instance of 'in'", () => { | ||
assert.equal(result.options.$filter[0], 'in'); | ||
}); | ||
it('lhr should be Price', () => | ||
assert.equal(result.options.$filter[1].name, 'Price')); | ||
it('lhr should be Price', () => { | ||
assert.equal(result.options.$filter[1].name, 'Price'); | ||
}); | ||
@@ -271,10 +288,13 @@ it('rhr should be [ $1, $2, $3 ]', function () { | ||
test("$filter=Price in ('a', 'b', 'c')", ['a', 'b', 'c'], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'in'", () => | ||
assert.equal(result.options.$filter[0], 'in')); | ||
it("Filter should be an instance of 'in'", () => { | ||
assert.equal(result.options.$filter[0], 'in'); | ||
}); | ||
it('lhr should be Price', () => | ||
assert.equal(result.options.$filter[1].name, 'Price')); | ||
it('lhr should be Price', () => { | ||
assert.equal(result.options.$filter[1].name, 'Price'); | ||
}); | ||
@@ -289,7 +309,9 @@ it('rhr should be [ $1, $2, $3 ]', function () { | ||
test('$filter=Price add 5 gt 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'gt'", () => | ||
assert.equal(result.options.$filter[0], 'gt')); | ||
it("Filter should be an instance of 'gt'", () => { | ||
assert.equal(result.options.$filter[0], 'gt'); | ||
}); | ||
@@ -303,12 +325,15 @@ it('lhr should be Price add $0', function () { | ||
it('rhr should be $1', () => | ||
assert.equal(result.options.$filter[2].bind, 1)); | ||
it('rhr should be $1', () => { | ||
assert.equal(result.options.$filter[2].bind, 1); | ||
}); | ||
}); | ||
test('$filter=Price sub 5 gt 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'gt'", () => | ||
assert.equal(result.options.$filter[0], 'gt')); | ||
it("Filter should be an instance of 'gt'", () => { | ||
assert.equal(result.options.$filter[0], 'gt'); | ||
}); | ||
@@ -322,12 +347,15 @@ it('lhr should be Price sub $0', function () { | ||
it('rhr should be $1', () => | ||
assert.equal(result.options.$filter[2].bind, 1)); | ||
it('rhr should be $1', () => { | ||
assert.equal(result.options.$filter[2].bind, 1); | ||
}); | ||
}); | ||
test('$filter=Price mul 5 gt 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'gt'", () => | ||
assert.equal(result.options.$filter[0], 'gt')); | ||
it("Filter should be an instance of 'gt'", () => { | ||
assert.equal(result.options.$filter[0], 'gt'); | ||
}); | ||
@@ -341,12 +369,15 @@ it('lhr should be Price add $0', function () { | ||
it('rhr should be $1', () => | ||
assert.equal(result.options.$filter[2].bind, 1)); | ||
it('rhr should be $1', () => { | ||
assert.equal(result.options.$filter[2].bind, 1); | ||
}); | ||
}); | ||
test('$filter=Price div Price mul 5 gt 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'gt'", () => | ||
assert.equal(result.options.$filter[0], 'gt')); | ||
it("Filter should be an instance of 'gt'", () => { | ||
assert.equal(result.options.$filter[0], 'gt'); | ||
}); | ||
@@ -366,12 +397,15 @@ const lexpr = result?.options?.$filter?.[1]; | ||
it('rhr should be $1', () => | ||
assert.equal(result.options.$filter[2].bind, 1)); | ||
it('rhr should be $1', () => { | ||
assert.equal(result.options.$filter[2].bind, 1); | ||
}); | ||
}); | ||
test('$filter=(Price div Price) mul 5 gt 10', [5, 10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'gt'", () => | ||
assert.equal(result.options.$filter[0], 'gt')); | ||
it("Filter should be an instance of 'gt'", () => { | ||
assert.equal(result.options.$filter[0], 'gt'); | ||
}); | ||
@@ -391,12 +425,15 @@ const lexpr = result?.options?.$filter?.[1]; | ||
it('rhr should be $1', () => | ||
assert.equal(result.options.$filter[2].bind, 1)); | ||
it('rhr should be $1', () => { | ||
assert.equal(result.options.$filter[2].bind, 1); | ||
}); | ||
}); | ||
test('$filter=Products/$count eq 10', [10], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'eq'", () => | ||
assert.equal(result.options.$filter[0], 'eq')); | ||
it("Filter should be an instance of 'eq'", () => { | ||
assert.equal(result.options.$filter[0], 'eq'); | ||
}); | ||
@@ -412,4 +449,5 @@ it('lhr should be Foo', function () { | ||
it('rhr should be $0', () => | ||
assert.equal(result.options.$filter[2].bind, 0)); | ||
it('rhr should be $0', () => { | ||
assert.equal(result.options.$filter[2].bind, 0); | ||
}); | ||
}); | ||
@@ -421,7 +459,9 @@ | ||
function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'ge'", () => | ||
assert.equal(result.options.$filter[0], 'ge')); | ||
it("Filter should be an instance of 'ge'", () => { | ||
assert.equal(result.options.$filter[0], 'ge'); | ||
}); | ||
@@ -441,4 +481,5 @@ it('lhr should have the Product count', function () { | ||
it('A filter should be present on the Product count lhs', () => | ||
assert.notEqual(result.options.$filter[1].options.$filter, null)); | ||
it('A filter should be present on the Product count lhs', () => { | ||
assert.notEqual(result.options.$filter[1].options.$filter, null); | ||
}); | ||
@@ -471,7 +512,9 @@ it(`has a Product count filter that is an instance of 'lt'`, () => { | ||
function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'ge'", () => | ||
assert.equal(result.options.$filter[0], 'ge')); | ||
it("Filter should be an instance of 'ge'", () => { | ||
assert.equal(result.options.$filter[0], 'ge'); | ||
}); | ||
@@ -487,7 +530,9 @@ it('lhr should have the Product count', function () { | ||
it('A filter should be present on the Product count lhs', () => | ||
assert.notEqual(result.options.$filter[1].options.$filter, null)); | ||
it('A filter should be present on the Product count lhs', () => { | ||
assert.notEqual(result.options.$filter[1].options.$filter, null); | ||
}); | ||
it(`has a Product count filter that is an instance of 'and'`, () => | ||
assert.equal(result.options.$filter[1].options.$filter[0], 'and')); | ||
it(`has a Product count filter that is an instance of 'and'`, () => { | ||
assert.equal(result.options.$filter[1].options.$filter[0], 'and'); | ||
}); | ||
@@ -515,7 +560,9 @@ it(`has an lhs on the 'and' of the Product count filter that is Price gt $0`, () => { | ||
test("$filter=note eq 'foobar'", ['foobar'], function (result) { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'eq'", () => | ||
assert.equal(result.options.$filter[0], 'eq')); | ||
it("Filter should be an instance of 'eq'", () => { | ||
assert.equal(result.options.$filter[0], 'eq'); | ||
}); | ||
@@ -527,4 +574,5 @@ it('lhr should be Foo', () => | ||
it('rhr should be $0', () => | ||
assert.equal(result.options.$filter[2].bind, 0)); | ||
it('rhr should be $0', () => { | ||
assert.equal(result.options.$filter[2].bind, 0); | ||
}); | ||
}); | ||
@@ -538,4 +586,5 @@ | ||
if (expectFailure) { | ||
it("Should fail because it's invalid", () => | ||
assert.notEqual(err, null)); | ||
it("Should fail because it's invalid", () => { | ||
assert.notEqual(err, null); | ||
}); | ||
} else if (err) { | ||
@@ -545,10 +594,13 @@ throw err; | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it("Filter should be an instance of 'eq'", () => | ||
assert.equal(result.options.$filter[0], 'eq')); | ||
it("Filter should be an instance of 'eq'", () => { | ||
assert.equal(result.options.$filter[0], 'eq'); | ||
}); | ||
it('lhs should be a call', () => | ||
assert.equal(result.options.$filter[1][0], 'call')); | ||
it('lhs should be a call', () => { | ||
assert.equal(result.options.$filter[1][0], 'call'); | ||
}); | ||
@@ -560,4 +612,5 @@ it(`lhs should be ${methodName} with correct args`, function () { | ||
it('rhs should be bound to the last arg', () => | ||
assert.equal(result.options.$filter[2].bind, binds.length)); | ||
it('rhs should be bound to the last arg', () => { | ||
assert.equal(result.options.$filter[2].bind, binds.length); | ||
}); | ||
}, | ||
@@ -588,8 +641,10 @@ ); | ||
['alfred'], | ||
(argsResult) => assert.equal(argsResult[0].bind, 0), | ||
(argsResult) => { | ||
assert.equal(argsResult[0].bind, 0); | ||
}, | ||
); | ||
const methodTestWithZeroArg = methodTest('', [], (argsResult) => | ||
assert.equal(argsResult.length, 0), | ||
); | ||
const methodTestWithZeroArg = methodTest('', [], (argsResult) => { | ||
assert.equal(argsResult.length, 0); | ||
}); | ||
@@ -641,9 +696,13 @@ methodTestWithTwoArgs('contains'); | ||
const lambdaAsserts = function (lambda, alias = 'd') { | ||
it('where it is a lambda', () => assert.notEqual(lambda, null)); | ||
it('where it is a lambda', () => { | ||
assert.notEqual(lambda, null); | ||
}); | ||
it(`of type '${methodName}'`, () => | ||
assert.equal(lambda.method, methodName)); | ||
it(`of type '${methodName}'`, () => { | ||
assert.equal(lambda.method, methodName); | ||
}); | ||
it(`with the element identified by '${alias}'`, () => | ||
assert.equal(lambda.identifier, alias)); | ||
it(`with the element identified by '${alias}'`, () => { | ||
assert.equal(lambda.identifier, alias); | ||
}); | ||
@@ -656,5 +715,9 @@ it('and an expression that is d/name', function () { | ||
it("'eq'", () => assert.equal(lambda.expression[0], 'eq')); | ||
it("'eq'", () => { | ||
assert.equal(lambda.expression[0], 'eq'); | ||
}); | ||
it('$0', () => assert.equal(lambda.expression[2].bind, 0)); | ||
it('$0', () => { | ||
assert.equal(lambda.expression[2].bind, 0); | ||
}); | ||
}; | ||
@@ -670,7 +733,9 @@ | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it('Filter should be on the child resource', () => | ||
assert.equal(result.options.$filter.name, 'child')); | ||
it('Filter should be on the child resource', () => { | ||
assert.equal(result.options.$filter.name, 'child'); | ||
}); | ||
@@ -689,7 +754,9 @@ lambdaAsserts(result?.options?.$filter?.lambda); | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it('Filter should be on the child resource', () => | ||
assert.equal(result.options.$filter.name, 'child')); | ||
it('Filter should be on the child resource', () => { | ||
assert.equal(result.options.$filter.name, 'child'); | ||
}); | ||
@@ -708,4 +775,5 @@ lambdaAsserts(result?.options?.$filter?.lambda, 'long_name'); | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
@@ -731,7 +799,9 @@ it('Filter should be on the child/grandchild resource', function () { | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
it('A filter should be present', () => { | ||
assert.notEqual(result.options.$filter, null); | ||
}); | ||
it('Filter should be on the child resource', () => | ||
assert.equal(result.options.$filter.name, 'child')); | ||
it('Filter should be on the child resource', () => { | ||
assert.equal(result.options.$filter.name, 'child'); | ||
}); | ||
@@ -738,0 +808,0 @@ it('Filter should show the canAccess method', function () { |
@@ -41,3 +41,3 @@ import * as ODataParser from '../odata-parser'; | ||
args[1] = '/resource?' + args[1]; | ||
return raw(...args); | ||
raw(...args); | ||
}; | ||
@@ -44,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
251331
6578
2