From 43ff1569b916f292f38fa69a47bd3206003b74bb Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 7 Mar 2021 00:57:51 -0800 Subject: [PATCH 1/4] translate temporal operators from equal to requested op --- src/translate/translate.js | 2 +- test/unit/cypherTest.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/translate/translate.js b/src/translate/translate.js index 6a712bc6..ffa637c9 100644 --- a/src/translate/translate.js +++ b/src/translate/translate.js @@ -2876,7 +2876,7 @@ const buildNeo4jTypeTranslation = ({ nullFieldPredicate = `${listVariable}.${filterName} IS NULL OR `; } if (isTemporalFormatted) { - return `(${nullFieldPredicate}${propertyPath} = ${cypherTypeConstructor}(${listVariable}.${filterName}))`; + return `(${nullFieldPredicate}${operatorExpression} ${cypherTypeConstructor}(${listVariable}.${filterName}))`; } else { return `(${nullFieldPredicate}${propertyPath}.${filterName} = ${listVariable}.${filterName})`; } diff --git a/test/unit/cypherTest.test.js b/test/unit/cypherTest.test.js index e702e314..637faf1c 100644 --- a/test/unit/cypherTest.test.js +++ b/test/unit/cypherTest.test.js @@ -7667,7 +7667,7 @@ test('Query node using only formatted temporal filter value nested in logical OR } } `, - expectedCypherQuery = `MATCH (\`temporalNode\`:\`TemporalNode\`) WHERE (ANY(_OR IN $filter.OR WHERE (((_OR.datetime_gte.formatted IS NULL OR \`temporalNode\`.datetime = datetime(_OR.datetime_gte.formatted)))))) RETURN \`temporalNode\` {_id: ID(\`temporalNode\`),datetime: { year: \`temporalNode\`.datetime.year , month: \`temporalNode\`.datetime.month , day: \`temporalNode\`.datetime.day , hour: \`temporalNode\`.datetime.hour , minute: \`temporalNode\`.datetime.minute , second: \`temporalNode\`.datetime.second , millisecond: \`temporalNode\`.datetime.millisecond , microsecond: \`temporalNode\`.datetime.microsecond , nanosecond: \`temporalNode\`.datetime.nanosecond , timezone: \`temporalNode\`.datetime.timezone , formatted: toString(\`temporalNode\`.datetime) }} AS \`temporalNode\``, + expectedCypherQuery = `MATCH (\`temporalNode\`:\`TemporalNode\`) WHERE (ANY(_OR IN $filter.OR WHERE (((_OR.datetime_gte.formatted IS NULL OR \`temporalNode\`.datetime >= datetime(_OR.datetime_gte.formatted)))))) RETURN \`temporalNode\` {_id: ID(\`temporalNode\`),datetime: { year: \`temporalNode\`.datetime.year , month: \`temporalNode\`.datetime.month , day: \`temporalNode\`.datetime.day , hour: \`temporalNode\`.datetime.hour , minute: \`temporalNode\`.datetime.minute , second: \`temporalNode\`.datetime.second , millisecond: \`temporalNode\`.datetime.millisecond , microsecond: \`temporalNode\`.datetime.microsecond , nanosecond: \`temporalNode\`.datetime.nanosecond , timezone: \`temporalNode\`.datetime.timezone , formatted: toString(\`temporalNode\`.datetime) }} AS \`temporalNode\``, expectedParams = { offset: 0, first: -1, From 28518ac6b130e79b3032acf5ad1e9f43fa8a2627 Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 7 Mar 2021 01:02:31 -0800 Subject: [PATCH 2/4] removed non existant filterTests.test.js from script test --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8a0940f7..0b93e41b 100755 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build-with-sourcemaps": "babel src --presets @babel/preset-env --out-dir dist --source-maps", "precommit": "lint-staged", "prepare": "npm run build", - "test": "nyc --reporter=lcov ava test/unit/augmentSchemaTest.test.js test/unit/configTest.test.js test/unit/assertSchema.test.js test/unit/searchSchema.test.js test/unit/cypherTest.test.js test/unit/filterTest.test.js test/unit/filterTests.test.js test/unit/custom/cypherTest.test.js test/unit/experimental/augmentSchemaTest.test.js test/unit/experimental/cypherTest.test.js test/unit/experimental/custom/cypherTest.test.js", + "test": "nyc --reporter=lcov ava test/unit/augmentSchemaTest.test.js test/unit/configTest.test.js test/unit/assertSchema.test.js test/unit/searchSchema.test.js test/unit/cypherTest.test.js test/unit/filterTest.test.js test/unit/custom/cypherTest.test.js test/unit/experimental/augmentSchemaTest.test.js test/unit/experimental/cypherTest.test.js test/unit/experimental/custom/cypherTest.test.js", "parse-tck": "babel-node test/helpers/tck/parseTck.js", "test-tck": "nyc ava --fail-fast test/unit/filterTests.test.js", "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", @@ -54,7 +54,7 @@ "apollo-link-http": "^1.5.16", "apollo-server": "^2.19.0", "apollo-server-express": "^2.19.0", - "ava": "^2.2.0", + "ava": "^2.4.0", "body-parser": "^1.18.3", "express": "^4.17.1", "graphql-tag": "^2.10.1", From 5bde7b3f4aa115d61a8151ddc4934d8343bcf4ea Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 7 Mar 2021 02:11:36 -0800 Subject: [PATCH 3/4] applied appropriate operator on non formatted temporal --- src/translate/translate.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/translate/translate.js b/src/translate/translate.js index ffa637c9..fa943450 100644 --- a/src/translate/translate.js +++ b/src/translate/translate.js @@ -2878,7 +2878,12 @@ const buildNeo4jTypeTranslation = ({ if (isTemporalFormatted) { return `(${nullFieldPredicate}${operatorExpression} ${cypherTypeConstructor}(${listVariable}.${filterName}))`; } else { - return `(${nullFieldPredicate}${propertyPath}.${filterName} = ${listVariable}.${filterName})`; + let filterNameOprType = buildOperatorExpression({ + filterOperationType: filterOperationType, + propertyPath: '', + isListFilterArgument: false + }); + return `(${nullFieldPredicate}${propertyPath}.${filterName} ${filterNameOprType} ${listVariable}.${filterName})`; } } ); From 79c402c157286936fd4c296380e9af61bf80a201 Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 8 Mar 2021 09:33:21 -0800 Subject: [PATCH 4/4] undo local package.json changes fpr PR --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0b93e41b..8a0940f7 100755 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build-with-sourcemaps": "babel src --presets @babel/preset-env --out-dir dist --source-maps", "precommit": "lint-staged", "prepare": "npm run build", - "test": "nyc --reporter=lcov ava test/unit/augmentSchemaTest.test.js test/unit/configTest.test.js test/unit/assertSchema.test.js test/unit/searchSchema.test.js test/unit/cypherTest.test.js test/unit/filterTest.test.js test/unit/custom/cypherTest.test.js test/unit/experimental/augmentSchemaTest.test.js test/unit/experimental/cypherTest.test.js test/unit/experimental/custom/cypherTest.test.js", + "test": "nyc --reporter=lcov ava test/unit/augmentSchemaTest.test.js test/unit/configTest.test.js test/unit/assertSchema.test.js test/unit/searchSchema.test.js test/unit/cypherTest.test.js test/unit/filterTest.test.js test/unit/filterTests.test.js test/unit/custom/cypherTest.test.js test/unit/experimental/augmentSchemaTest.test.js test/unit/experimental/cypherTest.test.js test/unit/experimental/custom/cypherTest.test.js", "parse-tck": "babel-node test/helpers/tck/parseTck.js", "test-tck": "nyc ava --fail-fast test/unit/filterTests.test.js", "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", @@ -54,7 +54,7 @@ "apollo-link-http": "^1.5.16", "apollo-server": "^2.19.0", "apollo-server-express": "^2.19.0", - "ava": "^2.4.0", + "ava": "^2.2.0", "body-parser": "^1.18.3", "express": "^4.17.1", "graphql-tag": "^2.10.1",