Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@balena/odata-parser

Package Overview
Dependencies
Maintainers
3
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/odata-parser - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3-build-fisehara-decode-uri-before-parsing-b08feb7761d3edc066716882242ed46880a5b6f8-1

7

CHANGELOG.md

@@ -7,4 +7,9 @@ # Change Log

# v3.0.3
## (2024-01-04)
* Decode escaped URI [fisehara]
# v3.0.2
## (2024-01-03)
## (2024-01-04)

@@ -11,0 +16,0 @@ * Update dependencies [fisehara]

4

package.json
{
"name": "@balena/odata-parser",
"version": "3.0.2",
"version": "3.0.3-build-fisehara-decode-uri-before-parsing-b08feb7761d3edc066716882242ed46880a5b6f8-1",
"description": "An OData parser written in OMeta",

@@ -42,4 +42,4 @@ "main": "odata-parser.js",

"versionist": {
"publishedAt": "2024-01-03T15:23:42.361Z"
"publishedAt": "2024-01-04T10:25:30.286Z"
}
}
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 randomSelectCounter = 0;
randomSelectCounter < 100;
randomSelectCounter++
) {
selects.push(`long_field_name__field_${randomSelectCounter}`);
}
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 randomURI = `/resource?${$select}&${$filter}&${$expand}`;
const runCount = 1000;
describe('Stress Testing', function () {

@@ -13,2 +48,13 @@ const ids = _.range(1, 2000);

});
it(`should parse long (${randomURI.length} chars) URI ${runCount} times and record average execution time`, () => {
const perRun = measureExecutionTime(runCount, randomURI);
assert.equal(perRun < 1.5, true);
});
const shortRandomURI = `/resource(123456789)`;
it(`should parse short (${shortRandomURI.length} chars) URI ${runCount} times and record average execution time`, () => {
const perRun = measureExecutionTime(runCount, shortRandomURI);
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc