-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/Count queries #329
Feat/Count queries #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, and will be very well received by many! Just one comment about naming really!
@@ -1148,6 +1155,10 @@ function makeAugmentedSchema( | |||
composer.Query.addFields({ | |||
[pluralize(camelCase(node.name))]: findResolver({ node }), | |||
}); | |||
|
|||
composer.Query.addFields({ | |||
[`count${pluralize(node.name)}`]: countResolver({ node }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count${pluralize(node.name)}
or ${pluralize(camelCase(node.name))}Count
?
i.e. "countMovies" as it is now, or "moviesCount"? I'm not sure what I prefer really!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this for a while, I settled on countMovies
to be consistent with createMovies
, deleteMovies
, and updateMovies
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I think we discussed this before! However, just as a counter to that point, when executing a Query you're asking for what you want back, whilst when executing a Mutation you're specifying the action you want to happen.
So the Mutation naming makes sense, you're asking to "create movies" or "update movies", etc.
For the current queries, you ask for "movies" and get movies back... But with this you're asking for "count movies" and getting an integer back. The naming would make more sense if you were asking for a "movies count" based on a predicate.
Thanks, I just realized. I forgot about the OGM so will add a method onto that sometime soon and bump this when it's ready again. |
@darrellwarde I've made the changes we discussed and added a method for the OGM. Ill hold of merging just so you can have a last look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, looks good to me! 😄
* Relationship properties - connection fields with filtering and sorting (#205) * Schema generation and Cypher translation for basic relationship property queries using GraphQL cursor connections Somewhat TCK tested, but still requires integration tests * Connection fields now returned for both queries and mutations An array of new TCK tests validating the new filtering code and projections of connections * Relationship Properties Union Support (#215) * Schema generation and Cypher translation for basic relationship property queries using GraphQL cursor connections Somewhat TCK tested, but still requires integration tests * Connection fields now returned for both queries and mutations An array of new TCK tests validating the new filtering code and projections of connections * Union support * Few loose ends for unions with relationship properties (#218) * Feat/relationship-properties-create (#219) * test: add inital for creating rel properties * feat: add inital for creating rel properties * feat: get unions working with nested create * test: fix ogm tests to include nested create changes * Relationship property update operations (#222) * Schema generation and Cypher translation for basic relationship property queries using GraphQL cursor connections Somewhat TCK tested, but still requires integration tests * Connection fields now returned for both queries and mutations An array of new TCK tests validating the new filtering code and projections of connections * Union support * A couple of loose ends for unions - __resolveType and filtering * Merging 2.0.0 branch is for some reason reverting some of my changes, trying to fix * Make breaking schema changes and fix tests * Update relationship properties, validated by TCK tests * Integration tests for update operations * Feat/relationship-properties-connect (#224) * test: add cases for connecting with rel properties * feat: add logic for connecting with rel properties * fix: change properties set to use the new appointed name * refactor: only add update with when needed * test: update all breaking tests due to changes in rel properties connect * feat: add union connect support * test: union connect support * Feat/composite-where-on-delete-and-disconnect (#239) * test: add composite where without unions and auth Co-authored-by: Darrell Warde <[email protected]> * feat: added union support for composite where Co-authored-by: Darrell Warde <[email protected]> * config: add husky back Co-authored-by: Darrell Warde <[email protected]> * Fix bug in code merged in from master * Update version and mark prerelease * Bring 2.0.0 in line with master (#250) * Update neo-push-server to enforce nodemon uses local ts-node install (force rerun cla check) * Fix typos * refactor: add more debug logs for get jwt Co-authored-by: Evan Reed <[email protected]> Co-authored-by: Matt Murphy <[email protected]> Co-authored-by: Daniel Starns <[email protected]> * Documentation for 2.0.0 (#242) * Beginning of documentation for relationship properties * Basic migration guide (navigation a little broken) * Continued work on 2.0.0 docs * Fixed headers not working for new pages (page keys cannot begin with a number) * Remove node from where clause of connect * A couple of outstanding documentation tasks * Highlight that req must be passed into context, add lambda edge case * Clarify Point and CartesianPoint usage in docs * Relationship propery enum support * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * General 2.0.0 housekeeping (#255) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Bring 2.0.0 in line with master (#264) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Fixed nullability of Query return type * Update code comment * refactor: remove neoSchema from OGM properties (#256) * feat: add cypherParams (#254) * Use upperFirst from graphql-compose in all cases (#262) * Remove upper-case-first and our own util function from @neo4j/graphql - use upperFirst from graphql-compose * Re-export graphql-compose upperFirst from @neo4j/graphql for use in @neo4j/graphql-ogm, remove upper-case-first dependency * Fix TCK tests broken from merge Co-authored-by: Daniel Starns <[email protected]> * Version update * Update index.adoc Fix broken link * Update relationships.adoc Fix typo, relationship properties type should be interface * Update filtering.adoc Add missing word, and change phrasing * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Add scalars earlier to fix DateTime relationship properties, and merge changes from master (#272) * Potential fix for the problem serializing Int/Float values * Fix bug in previous bugfix code related to this fix * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Fixed nullability of Query return type * Update code comment * refactor: remove neoSchema from OGM properties (#256) * feat: add cypherParams (#254) * Quick fix for custom type resolvers on unions. Prevents generated resolvers from being overwritten with __resolveType. * Use upperFirst from graphql-compose in all cases (#262) * Remove upper-case-first and our own util function from @neo4j/graphql - use upperFirst from graphql-compose * Re-export graphql-compose upperFirst from @neo4j/graphql for use in @neo4j/graphql-ogm, remove upper-case-first dependency * Fix TCK tests broken from merge * update: documentation * Update filtering.adoc Add missing word and change phrasing * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Dan Gerard <[email protected]> Co-authored-by: dmoree <[email protected]> * Version update * Fix exact match when checking for existing scalars “Date” would otherwise match “scalar DateTime”. * Add Date type and map it to Neo4j Date * Fix for projecting connection fields from relationship fields (#284) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Fix projecting connection field from a relationship field * Feat/Connection Auth (#286) * test: add coverage for connections auth * feat: add connections auth * test: add coverage for auth where and user where * Pagination Cursors on Connections (Relay Specification) (#282) * skip and limit on connections * add pageinfo and pagecursor definitions * add totalCount, return connections * add skip, limit on unions, make all tests pass * add global node resolution, green on tests * add copyright header to connection.ts * minor cleanup * cleanup * remove before/last arguments; move pagination arguments into options * use one consistent node interface definition * remove cursor Scalar * use isInt on totalCount check in make-augmented-schema connection resolver * remove redundant arraySlice check in createConnectionWithEdge properties * remove Node global resolution from this pr * remove erroneous yalc stuff, formatting cleanup * hoist connection args to field level, fix tests from merge, simplify connection cursor function * integration test for pagination, fix skipLimitStr * add pagination helper tests, fix off-by-one error in cursor calculation * remove erroneous console * move pagination tests * Add union relationship where (#291) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Add top-level where for union relationship fields * Add "node" level to connect where (#290) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Remove seemingly redundant input type * Add "node level" to connect where * Update other tests, and documentation * Only return union members which have fragments in the selection set (#289) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Only return union members of which a fragment is present in the selection set * Fix test broken from merge * Refactor/rename skip to offset (#294) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Rename skip to offset * Nested update argument change (#295) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * Update structure of nested updates * Update documentation with new update structure * Merge most recent changes from master into 2.0.0 (#306) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * fix(jwt): req.cookies might be undefined this fix prevents the app from crashing id req.cookies is undefined * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * fix: use package json for useragent name and version (#271) * fix: use package json for useragent name and version * fix: add userAgent support for <=4.2 and >=4.3 drivers * config: remove codeowners (#277) * Version update * fix(login): avoid confusion caused by secondary button (#265) * fix: losing params while creating Auth Predicate (#281) * fix: loosing params while creating Auth Predicate * fix: typos * fix: typo * feat: add projection to top level cypher directive (#251) * feat: add projection to top level queries and mutations using cypher directive * fix: add missing cypherParams * Fix for loss of scalar and field level resolvers (#297) * wrapCustomResolvers removed in favour of schema level resolver auth injection * Add test cases for this fix * Mention double escaping for @cypher directive * Version update Co-authored-by: gaspard <[email protected]> Co-authored-by: Oskar Hane <[email protected]> Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]> Co-authored-by: Arnaud Gissinger <[email protected]> * Refactor/union arguments (#304) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * fix(jwt): req.cookies might be undefined this fix prevents the app from crashing id req.cookies is undefined * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * fix: use package json for useragent name and version (#271) * fix: use package json for useragent name and version * fix: add userAgent support for <=4.2 and >=4.3 drivers * config: remove codeowners (#277) * Version update * fix(login): avoid confusion caused by secondary button (#265) * fix: losing params while creating Auth Predicate (#281) * fix: loosing params while creating Auth Predicate * fix: typos * fix: typo * feat: add projection to top level cypher directive (#251) * feat: add projection to top level queries and mutations using cypher directive * fix: add missing cypherParams * Fix for loss of scalar and field level resolvers (#297) * wrapCustomResolvers removed in favour of schema level resolver auth injection * Add test cases for this fix * Mention double escaping for @cypher directive * Version update * checkpoint: commit all changes to date - NOT WORKING * Committing before merging in 2.0.0 changes * Union connect and test needs fixing * Add .huskyrc back * Reformat schema TCK tests for better diff * Reorganise schema TCK for better diff * Create union input types in a map * Various work, including nested connects and disconnects for unions, fixing a variety of bugs * Documentation changes * Fix structure of nested creates for unions, and add tests for nested union mutations * Fix where input for nested update * Add integration tests for multiple union create/update Co-authored-by: gaspard <[email protected]> Co-authored-by: Oskar Hane <[email protected]> Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]> Co-authored-by: Arnaud Gissinger <[email protected]> * Merge changes from master into 2.0.0 (#309) * Missing copyright headers * Point to prerelease documentation for 2.0.0 branch * General housekeeping before release * Update code comment * Fix TCK tests broken from merge * fix(jwt): req.cookies might be undefined this fix prevents the app from crashing id req.cookies is undefined * Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) * Changes to accomodate merge from master * fix: use package json for useragent name and version (#271) * fix: use package json for useragent name and version * fix: add userAgent support for <=4.2 and >=4.3 drivers * config: remove codeowners (#277) * Version update * fix(login): avoid confusion caused by secondary button (#265) * fix: losing params while creating Auth Predicate (#281) * fix: loosing params while creating Auth Predicate * fix: typos * fix: typo * feat: add projection to top level cypher directive (#251) * feat: add projection to top level queries and mutations using cypher directive * fix: add missing cypherParams * Fix for loss of scalar and field level resolvers (#297) * wrapCustomResolvers removed in favour of schema level resolver auth injection * Add test cases for this fix * Mention double escaping for @cypher directive * Version update * Allows users to pass in decoded JWT (#303) * Allows users to pass in decoded JWT - needs more testing * More tests for decoded JWTs * Updates to auth documentation * Fix relationships documentation examples (#296) * Version update Co-authored-by: gaspard <[email protected]> Co-authored-by: Oskar Hane <[email protected]> Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]> Co-authored-by: Arnaud Gissinger <[email protected]> * Selectively project union members * Replace instances of "properties" with "relationship" * Fix errors when no sorting available on related nodes * Add tests for #288 which previously didn't work due to this bug * Fixed tests broken after merge * Merge 1.2.1 changes from master into 2.0.0 (#319) * Fix for bug, caused by returning a union * Docs media (#310) * config: remove codeowners * docs: add some media links * docs: change links to list * Update README.md Capitalise NODES * docs: add wills talk to list Co-authored-by: Darrell Warde <[email protected]> * Version update * Fixed tests broken after merge Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]> * refactor: change union where on connections (#317) * refactor: change union where on connections * Merge changes from 2.0.0 into union-where * test: add coverage for using relationship on union where * refactor: remove temp file * test: format and add relationship and node coverage * Jwt type (#321) * config: remove codeowners * refactor: type change to boolean * Refactor/tck test formatting (#323) * Fix for bug, caused by returning a union * Docs media (#310) * config: remove codeowners * docs: add some media links * docs: change links to list * Update README.md Capitalise NODES * docs: add wills talk to list Co-authored-by: Darrell Warde <[email protected]> * Version update * Fixed tests broken after merge * Refactor headings and add markdownlint config to allow nested heading re-use * Use code block tags which allow formatting * Replace ```schema with ```graphql * Slight markdownlint config tweak * Merge branch '2.0.0' into refactor/tck-test-formatting Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]> * Version update * Add Connection where field to node where types Co-authored-by: Daniel Starns <[email protected]> * Added more test cases * Ensure that all combinations of connection projections work without error * Remove commented code * Make startCursor and endCursor nullable * fix: relationship cypher params added for create * update: integration test for update -> create * fix: use correct property for proper translation * update: integration test for update -> update * fix: formatting * Feat/Count queries (#329) * test: add init coverage for count * feat: add count queries * test: changes to existing for count queries * docs: add count queries * docs: remove misleading comment on count * refactor: change to xCount over countX * feat: add count to ogm * Align naming of "issue tests" * Version update * Manually add schemaDirectives after resolvers * Add missing copyright header * Remove leftover comment, add some explanation to order * A new approach for deciding which union members to return! * Validation of Type Definitions (#300) * docs: add aura flag apoc * fix: temporarily disable validateTypeDefs Co-authored-by: Darrell Warde <[email protected]> * docs: duplicate doc text * docs: remove auth aura flag * docs: add license to docs and readmes * docs: wrong licence link * fix: validate document * refactor: remove compose from validate document * test: add the correct issue test cases * refactor: remove checkNodeImplementsInterfaces * test: add case for github issue * Working solution for type definition validation * Allow for skipping of validation for some edge cases such as using our internally generated types * Add tests that demonstrate errors will be thrown if using "protected" types * Filter out internel input type names during validation so that they can be used without error * Add test to demonstrate that directives cannot be redefined * Make suggested changes from PR Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Darrell Warde <[email protected]> * Remove redundant comments * Rename points.md to point.md * Add missing types to where for relationship properties * Add missing Date filters * Test that Date and Boolean relationship property filters added to schema * Added Cypher TCK test for filtering by relationship property temporal values * Allow OGM selectionSet to be SelectionSetNode * Dependency patch upgrades * Upgrade graphql-compose to 8.1.0 * graphql-compose to 9.x and fix results of breaking changes * Fix/issue 369 (#370) * fix: issue #369 connections using cypher * test: coverage for issue #369 * Alias connections (#368) * fix: alias connections * test: alias connections * refactor: change to source and info * test: add a case with many alias * 2.0.0 documentation updates (#366) * Docs changes * Add unions page back to migration guide * Document union where changes in migration guide * Move custom resolvers page down * Ensure contents in type definitions map to underlying pages * Documentation changes from editorial comments, aligning frontpage with other products * Missing summaries in contents * Restructure following editorial comments * Split out each Mutation operation into separate chapters * Rewrite of getting started guide, with more examples and screenshots * Add type definitions basics page * Add documentation for all GraphQL types * Fix order of type definitions pages * Rewrite introduction page with features, interacting and deployment section * Change documentation for interfaces, highlighting that they are used for relationship properties * Fix references to pagination * Continued rewriting and restructuring * Rework auth content * Overhaul API references for both Neo4jGraphQL and OGM * Changes reflecting @danstarns comments * Version update * Remove duplicate sentence * Fix OGM contents * Remove ; and & * Filter out nested input types during validation * Change minimum database version to 4.1.5 * Fix validation of database versions using semver package * Don't list temporal and spatial types on filtering page - could fall out of date * Error auth relationship properties (#379) * feat: throw error when auth directive is used on relationship props * test: when auth directive is used on relationship props * Add a simple util file which can be called with ts-node to clear down database before/after running integration tests * Add comment explaining teardown file * Error relationship on relationship properties (#381) * feat: throw error when relationship directive is used on relationship props * test: when relationship directive is used on relationship props * Coerce Aura database version numbers * Refactor/unify relationship fields (#383) * feat: throw error when relationship directive is used on relationship props * test: when relationship directive is used on relationship props * refactor: unify relationship properties fields and reuse existing functions * test: add for cypher on interface * Rough find/replace attempt at passing last bookmark into GraphQL execution * Treat custom scalars, enums and primitives the same for custom Cypher fields * Also fix custom scalars for Query-level custom Cypher * Style guidance - remove instances of "whilst" * Remove "Step x" from Getting Started, change to second person * Attempt to change all wording to second person * refactor: change schema references from relationship to edge (#389) * refactor: change schema references from relationship to edge * docs: add note about relationship and edges * Update relationships.adoc Rephrase sentence to be passive * feat: export auth errors from index (#394) * Reserved properties (#396) * feat: throw error when using reserved names * test: error when using reserved names * docs: remove useage of Node type * refactor: changes from PR comments * Version update * Fix multiple connections being returned from custom Cypher * Remove _IN and _NOT_IN filters for relationships * Remove translation for surplus _IN and _NOT_IN * Remove prerelease marker * refactor: use alias for params and name for fields * add: int test for nested connections and aliasing * add: tck test for multiple aliasing on connections Co-authored-by: Daniel Starns <[email protected]> Co-authored-by: Darrell Warde <[email protected]> Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Evan Reed <[email protected]> Co-authored-by: Matt Murphy <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]> Co-authored-by: Dan Gerard <[email protected]> Co-authored-by: dmoree <[email protected]> Co-authored-by: Oskar Hane <[email protected]> Co-authored-by: nsethi <[email protected]> Co-authored-by: gaspard <[email protected]> Co-authored-by: Arnaud Gissinger <[email protected]> Co-authored-by: dmoree <[email protected]> Co-authored-by: Neo Technology Build Agent <[email protected]>
Description
Adds top-level queries to count nodes.
Checklist
The following requirements should have been met (depending on the changes in the branch):