-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/subscriptions-context-typings' of github.com:darrel…
…lwarde/graphql into fix/subscriptions-context-typings
- Loading branch information
Showing
22 changed files
with
244 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@neo4j/graphql": major | ||
--- | ||
|
||
The `limit` argument of the `@queryOptions` directive has been moved to its own directive, `@limit`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import * as neo4j from "neo4j-driver"; | ||
import { LimitDirective } from "./LimitDirective"; | ||
|
||
describe("QueryOptionsDirective", () => { | ||
describe("getLimit", () => { | ||
test("should return default limit", () => { | ||
const limit = new LimitDirective({ | ||
default: neo4j.int(5), | ||
max: neo4j.int(8), | ||
}); | ||
|
||
expect(limit.getLimit()).toEqual(neo4j.int(5)); | ||
}); | ||
|
||
test("should return max limit if default is not available", () => { | ||
const limit = new LimitDirective({ | ||
max: neo4j.int(8), | ||
}); | ||
|
||
expect(limit.getLimit()).toEqual(neo4j.int(8)); | ||
}); | ||
|
||
test("should override default limit", () => { | ||
const limit = new LimitDirective({ | ||
default: neo4j.int(5), | ||
max: neo4j.int(8), | ||
}); | ||
|
||
expect(limit.getLimit(neo4j.int(2))).toEqual(neo4j.int(2)); | ||
expect(limit.getLimit(neo4j.int(6))).toEqual(neo4j.int(6)); | ||
}); | ||
|
||
test("should return if a higher one is given max limit if a higher one is given", () => { | ||
const limit = new LimitDirective({ | ||
default: neo4j.int(5), | ||
max: neo4j.int(8), | ||
}); | ||
|
||
expect(limit.getLimit(neo4j.int(16))).toEqual(neo4j.int(8)); | ||
}); | ||
|
||
test("should return undefined if no limit is given", () => { | ||
const limit = new LimitDirective({}); | ||
|
||
expect(limit.getLimit()).toBeUndefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
packages/graphql/src/classes/QueryOptionsDirective.test.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { DirectiveLocation, GraphQLDirective, GraphQLInt } from "graphql"; | ||
|
||
export const limitDirective = new GraphQLDirective({ | ||
name: "limit", | ||
description: "Instructs @neo4j/graphql to inject limit values into a query.", | ||
args: { | ||
default: { | ||
description: "If no limit argument is supplied on query will fallback to this value.", | ||
type: GraphQLInt, | ||
}, | ||
max: { | ||
description: "Maximum limit to be used for queries.", | ||
type: GraphQLInt, | ||
}, | ||
}, | ||
locations: [DirectiveLocation.OBJECT], | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.