Skip to content

Commit

Permalink
Merge branch 'dev' into reproduce-bug-5635
Browse files Browse the repository at this point in the history
  • Loading branch information
MacondoExpress authored Oct 9, 2024
2 parents 8a33784 + 59ccc39 commit 9be3a96
Show file tree
Hide file tree
Showing 39 changed files with 444 additions and 444 deletions.
5 changes: 0 additions & 5 deletions .changeset/fair-eagles-shave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/lucky-icons-marry.md

This file was deleted.

41 changes: 41 additions & 0 deletions .changeset/modern-pugs-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
"@neo4j/graphql": minor
---

Remove connection wrapper on vector queries.

_Previous:_

```graphql
query MovieVectorQuery($vector: [Float!]!) {
myVectorQuery(vector: $vector) {
moviesConnection {
edges {
cursor
score
node {
title
}
}
}
}
}
```

_Now:_

```graphql
query MovieVectorQuery($vector: [Float!]!) {
myVectorQuery(vector: $vector) {
edges {
cursor
score
node {
title
}
}
}
}
```

Vector index is now a stable feature.
5 changes: 0 additions & 5 deletions .changeset/olive-phones-speak.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/performance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
working-directory: packages/graphql

- name: Archive performance test results
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: performance
path: packages/graphql/performance/
2 changes: 1 addition & 1 deletion .github/workflows/reusable-api-library-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
run: yarn --cwd packages/graphql run test:schema --coverage
- if: ${{ !inputs.disable-coverage-archival }}
name: Archive coverage report
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: api-library-coverage-graphql
path: packages/graphql/coverage/
4 changes: 2 additions & 2 deletions .github/workflows/reusable-codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
with:
node-version: lts/*
- name: Initialize CodeQL
uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3
uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3
with:
config-file: ./.github/codeql/codeql-config.yml
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3
uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3
2 changes: 1 addition & 1 deletion .github/workflows/reusable-federation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
mkdir prnumber
echo "$PULL_REQUEST_NUMBER" > ./prnumber/prnumber
- name: Archive PR number
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: prnumber
path: prnumber/
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
NEO_URL: neo4j://localhost:7687
- if: ${{ !inputs.disable-coverage-archival && matrix.packages.package == 'graphql' }}
name: Archive coverage report
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: integration-nightly-coverage-${{ matrix.packages.package }}-${{ matrix.graphql-version.coverage_path }}-${{ matrix.packages.coverage_name }}-${{ matrix.node.coverage_name }}
path: packages/${{ matrix.packages.package }}/coverage-nightly-${{ matrix.graphql-version.coverage_path }}/
Expand All @@ -130,7 +130,7 @@ jobs:
steps:
- if: ${{ !inputs.disable-coverage-archival }}
name: Merge Artifacts
uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact/merge@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: integration-nightly-coverage
pattern: integration-nightly-coverage-*
4 changes: 2 additions & 2 deletions .github/workflows/reusable-integration-tests-on-prem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
NEO_URL: bolt://localhost:7687
- if: ${{ !inputs.disable-coverage-archival && matrix.packages.package == 'graphql' }}
name: Archive coverage report
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: integration-coverage-${{ matrix.packages.package }}-${{ matrix.neo4j-version }}-${{ matrix.graphql-version.coverage_path }}-${{ matrix.packages.coverage_name }}
path: packages/${{ matrix.packages.package }}/coverage-${{ matrix.neo4j-version }}-${{ matrix.graphql-version.coverage_path }}/
Expand All @@ -83,7 +83,7 @@ jobs:
steps:
- if: ${{ !inputs.disable-coverage-archival }}
name: Merge Artifacts
uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact/merge@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: integration-coverage
pattern: integration-coverage-*
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
- name: Archive coverage report
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: e2e-coverage-graphql-amqp-subscriptions-engine-${{ matrix.graphql-version }}-${{ matrix.neo4j-version }}
path: packages/graphql-amqp-subscriptions-engine/coverage/
Expand All @@ -66,7 +66,7 @@ jobs:
needs: e2e-tests
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact/merge@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: e2e-coverage-graphql-amqp-subscriptions-engine
pattern: e2e-coverage-graphql-amqp-subscriptions-engine-*
2 changes: 1 addition & 1 deletion .github/workflows/reusable-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
working-directory: packages/${{ matrix.package }}
- if: ${{ !inputs.disable-coverage-archival && matrix.package == 'graphql' }}
name: Archive coverage report
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4
with:
name: unit-coverage-${{ matrix.package }}
path: packages/${{ matrix.package }}/coverage/
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@apollo/server": "^4.7.0",
"@graphql-tools/wrap": "^10.0.0",
"@neo4j/graphql": "^5.7.1",
"@neo4j/graphql": "^5.8.0",
"graphql": "16.9.0",
"graphql-tag": "^2.12.6",
"neo4j-driver": "^5.8.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-amqp-subscriptions-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@types/cors": "2.8.17",
"@types/debug": "4.1.12",
"@types/jest": "29.5.13",
"@types/node": "20.16.10",
"@types/node": "20.16.11",
"camelcase": "6.3.0",
"graphql-ws": "5.16.0",
"jest": "29.7.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/graphql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @neo4j/graphql

## 5.8.0

### Minor Changes

- [#5619](https://github.com/neo4j/graphql/pull/5619) [`142bc0a`](https://github.com/neo4j/graphql/commit/142bc0af7c36e0190d42710d3d4f0f480602672f) Thanks [@mjfwebb](https://github.com/mjfwebb)! - Add cypher filtering on lists of scalars

### Patch Changes

- [#5632](https://github.com/neo4j/graphql/pull/5632) [`3c69066`](https://github.com/neo4j/graphql/commit/3c690668e6cab959b6af598c29477dd77f8807cc) Thanks [@darrellwarde](https://github.com/darrellwarde)! - The `options` argument of `assertIndexesAndConstraints` has been deprecated and the creation of indexes and constraints will no longer be support in the next major version of the library.

- [#5606](https://github.com/neo4j/graphql/pull/5606) [`e4ac1d8`](https://github.com/neo4j/graphql/commit/e4ac1d86009f520eacce26f83585e3fb57cb01ac) Thanks [@angrykoala](https://github.com/angrykoala)! - Fix delete operations inside updates for unions

- [#5616](https://github.com/neo4j/graphql/pull/5616) [`b7552f8`](https://github.com/neo4j/graphql/commit/b7552f8151d22ae3e4b4e04f4d168128600ebfa8) Thanks [@angrykoala](https://github.com/angrykoala)! - Fix cardinality validation on nested unions

## 5.7.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neo4j/graphql",
"version": "5.7.1",
"version": "5.8.0",
"description": "A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations",
"keywords": [
"neo4j",
Expand Down Expand Up @@ -47,7 +47,7 @@
"@types/is-uuid": "1.0.2",
"@types/jest": "29.5.13",
"@types/jsonwebtoken": "9.0.7",
"@types/node": "20.16.10",
"@types/node": "20.16.11",
"@types/pluralize": "0.0.33",
"@types/randomstring": "1.3.0",
"@types/semver": "7.5.8",
Expand Down
3 changes: 3 additions & 0 deletions packages/graphql/src/classes/Neo4jGraphQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ class Neo4jGraphQL {
}: {
driver?: Driver;
sessionConfig?: Neo4jGraphQLSessionConfig;
/**
* @deprecated The ability to create indexes and constraints will be removed in version 6.0.0
*/
options?: AssertIndexesAndConstraintsOptions;
} = {}): Promise<void> {
if (!(this.executableSchema || this.subgraphSchema)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type FulltextTypeNames = {
};

type VectorTypeNames = {
result: string;
connection: string;
edge: string;
where: string;
Expand Down Expand Up @@ -107,7 +106,6 @@ export class ConcreteEntityOperations extends ImplementingEntityOperations<Concr

public get vectorTypeNames(): VectorTypeNames {
return {
result: `${this.pascalCaseSingular}VectorResult`,
connection: `${this.pascalCasePlural}VectorConnection`,
edge: `${this.pascalCaseSingular}VectorEdge`,
where: `${this.pascalCaseSingular}VectorWhere`,
Expand Down
12 changes: 3 additions & 9 deletions packages/graphql/src/schema/generation/vector-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function withVectorResultTypeConnection({
composer: SchemaComposer;
concreteEntityAdapter: ConcreteEntityAdapter;
}): ObjectTypeComposer {
const typeName = concreteEntityAdapter.operations.vectorTypeNames.result;
const typeName = concreteEntityAdapter.operations.vectorTypeNames.connection;
if (composer.has(typeName)) {
return composer.getOTC(typeName);
}
Expand All @@ -91,19 +91,13 @@ export function withVectorResultTypeConnection({
});

const connection = composer.createObjectTC({
name: concreteEntityAdapter.operations.vectorTypeNames.connection,
name: typeName,
fields: {
totalCount: new GraphQLNonNull(GraphQLInt),
pageInfo: new GraphQLNonNull(PageInfo),
edges: edge.NonNull.List.NonNull,
},
});

const result = composer.createObjectTC({
name: typeName,
fields: {
[concreteEntityAdapter.operations.rootTypeFieldNames.connection]: connection.NonNull,
},
});
return result;
return connection;
}
8 changes: 3 additions & 5 deletions packages/graphql/src/schema/resolvers/query/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ export function vectorResolver({
});

return {
[entityAdapter.operations.rootTypeFieldNames.connection]: {
totalCount,
edges: connection.edges,
pageInfo: connection.pageInfo,
},
totalCount,
edges: connection.edges,
pageInfo: connection.pageInfo,
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,13 @@ export class VectorFactory {
});

let scoreField: ScoreField | undefined;
const vectorResultField = resolveTree.fieldsByTypeName[entity.operations.vectorTypeNames.result];
if (!vectorResultField) {
const vectorConnectionFields = resolveTree.fieldsByTypeName[entity.operations.vectorTypeNames.connection];

if (!vectorConnectionFields) {
throw new Error("Vector result field not found");
}

const filteredResolveTree = findFieldsByNameInFieldsByTypeNameField(
vectorResultField,
entity.operations.rootTypeFieldNames.connection
)[0]!;
// Adds the args to the nested resolve tree for vector
filteredResolveTree.args = resolveTree.args;

const connectionFields = getFieldsByTypeName(filteredResolveTree, entity.operations.vectorTypeNames.connection);
const filteredResolveTreeEdges = findFieldsByNameInFieldsByTypeNameField(connectionFields, "edges");
const filteredResolveTreeEdges = findFieldsByNameInFieldsByTypeNameField(vectorConnectionFields, "edges");
const edgeFields = getFieldsByTypeName(filteredResolveTreeEdges, entity.operations.vectorTypeNames.edge);
const scoreFields = findFieldsByNameInFieldsByTypeNameField(edgeFields, "score");

Expand Down Expand Up @@ -97,11 +90,11 @@ export class VectorFactory {
whereArgs: resolveTreeWhere,
});

this.addScoreSort(operation, filteredResolveTree, context);
this.addScoreSort(operation, resolveTree, context);

this.queryASTFactory.operationsFactory.hydrateConnectionOperation({
target: entity,
resolveTree: filteredResolveTree,
resolveTree: resolveTree,
context,
operation,
whereArgs: resolveTreeWhere,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ describe("cypher directive filtering - List Auth", () => {

expect(gqlResult.errors).toBeFalsy();
expect(gqlResult?.data).toEqual({
[Movie.plural]: [
[Movie.plural]: expect.toIncludeSameMembers([
{
custom_field: ["a", "b", "c"],
},
{
custom_field: ["bbb", "a", "bbb"],
},
],
]),
});
});

Expand Down
Loading

0 comments on commit 9be3a96

Please sign in to comment.