@balena/odata-parser
Advanced tools
Comparing version 3.0.4-build-fisehara-decode-uri-before-parsing-5b7895c2c74f9294d4056e317afb7a45b453d3a9-1 to 3.0.4-build-renovate-major--balenalint-8048f717367a41233a995096edf2da6710e9e247-1
@@ -8,5 +8,5 @@ # Change Log | ||
# v3.0.4 | ||
## (2024-01-05) | ||
## (2024-04-10) | ||
* Decode escaped URI [fisehara] | ||
* Update dependency @balena/lint to v8 [Self-hosted Renovate Bot] | ||
@@ -13,0 +13,0 @@ # v3.0.3 |
{ | ||
"name": "@balena/odata-parser", | ||
"version": "3.0.4-build-fisehara-decode-uri-before-parsing-5b7895c2c74f9294d4056e317afb7a45b453d3a9-1", | ||
"version": "3.0.4-build-renovate-major--balenalint-8048f717367a41233a995096edf2da6710e9e247-1", | ||
"description": "An OData parser written in OMeta", | ||
@@ -18,3 +18,3 @@ "main": "odata-parser.js", | ||
"devDependencies": { | ||
"@balena/lint": "^7.2.4", | ||
"@balena/lint": "^8.0.0", | ||
"@types/chai": "^4.3.4", | ||
@@ -43,4 +43,4 @@ "@types/lodash": "^4.14.194", | ||
"versionist": { | ||
"publishedAt": "2024-01-05T10:22:22.105Z" | ||
"publishedAt": "2024-04-10T01:05:41.842Z" | ||
} | ||
} |
@@ -11,7 +11,2 @@ import test from './test'; | ||
test('foo=hello%2520world', (result) => | ||
it('should equal hello%20world with encoded %20 and only decoded once', () => { | ||
assert.equal(result.options.foo, 'hello%20world'); | ||
})); | ||
test.raw('/some%20thing?foo=hello%20world', (result) => | ||
@@ -22,11 +17,2 @@ it('should fail as we do not allow spaces in resource names', () => { | ||
); | ||
test(`$filter=name+eq+'s%C3%BC%C3%9F'`, ['süß'], function (result, err) { | ||
if (err) { | ||
throw err; | ||
} | ||
it('A filter should be present', () => | ||
assert.notEqual(result.options.$filter, null)); | ||
}); | ||
}); |
import test from './test'; | ||
import * as assert from 'assert'; | ||
import * as _ from 'lodash'; | ||
import * as ODataParser from '../odata-parser'; | ||
function measureExecutionTime(runs, uri) { | ||
const startTime = Date.now(); | ||
for (let i = 0; i < runs; i++) { | ||
ODataParser.parse(uri); | ||
} | ||
const endTime = Date.now(); | ||
const diff = endTime - startTime; | ||
const perRun = diff / runs; | ||
console.log( | ||
`\turi.length: ${uri.length}\truns: ${runs}\tperRun: ${JSON.stringify( | ||
perRun, | ||
null, | ||
2, | ||
)}`, | ||
); | ||
return perRun; | ||
} | ||
const selects = []; | ||
for (let selectItemCounter = 0; selectItemCounter < 100; selectItemCounter++) { | ||
selects.push(`long_field_name__field_${selectItemCounter}`); | ||
} | ||
const $select = '$select=' + selects.join(','); | ||
const $filter = `$filter=(long_field_name__field%20eq%20%27value%27)%20and%20(long_field_name__field_1%20eq%20true)`; | ||
const $nestedExpand = `$expand=resource_test(${$select})`; | ||
const $expand = `$expand=resource_test(${$select};${$nestedExpand};${$filter})`; | ||
const longTestURI = `/resource?${$select}&${$filter}&${$expand}`; | ||
const runCount = 1000; | ||
describe('Stress Testing', function () { | ||
@@ -44,13 +13,2 @@ const ids = _.range(1, 2000); | ||
}); | ||
it(`should parse long (${longTestURI.length} chars) URI ${runCount} times and record average execution time`, () => { | ||
const perRun = measureExecutionTime(runCount, longTestURI); | ||
assert.equal(perRun < 1.5, true); | ||
}); | ||
const shortTestURI = `/resource(123456789)`; | ||
it(`should parse short (${shortTestURI.length} chars) URI ${runCount} times and record average execution time`, () => { | ||
const perRun = measureExecutionTime(runCount, shortTestURI); | ||
assert.equal(perRun < 0.1, true); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
247045
6468