-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] GraphQL: Explicitly add all filters for all types for clarity
- Loading branch information
Showing
8 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
packages/@sanity/core/src/actions/graphql/filters/booleanFilters.js
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,20 @@ | ||
function createBooleanFilters() { | ||
return { | ||
name: 'BooleanFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'Boolean', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'Boolean', | ||
description: 'Checks if the value is not equal to the given input.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createBooleanFilters |
40 changes: 40 additions & 0 deletions
40
packages/@sanity/core/src/actions/graphql/filters/dateFilters.js
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,40 @@ | ||
function createDateFilters() { | ||
return { | ||
name: 'DateFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'Date', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'Date', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'gt', | ||
type: 'Date', | ||
description: 'Checks if the value is greater than the given input.' | ||
}, | ||
{ | ||
fieldName: 'gte', | ||
type: 'Date', | ||
description: 'Checks if the value is greater than or equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'lt', | ||
type: 'Date', | ||
description: 'Checks if the value is lesser than the given input.' | ||
}, | ||
{ | ||
fieldName: 'lte', | ||
type: 'Date', | ||
description: 'Checks if the value is lesser than or equal to the given input.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createDateFilters |
40 changes: 40 additions & 0 deletions
40
packages/@sanity/core/src/actions/graphql/filters/dateTimeFilters.js
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,40 @@ | ||
function createDateTimeFilters() { | ||
return { | ||
name: 'DatetimeFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'Datetime', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'Datetime', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'gt', | ||
type: 'Datetime', | ||
description: 'Checks if the value is greater than the given input.' | ||
}, | ||
{ | ||
fieldName: 'gte', | ||
type: 'Datetime', | ||
description: 'Checks if the value is greater than or equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'lt', | ||
type: 'Datetime', | ||
description: 'Checks if the value is lesser than the given input.' | ||
}, | ||
{ | ||
fieldName: 'lte', | ||
type: 'Datetime', | ||
description: 'Checks if the value is lesser than or equal to the given input.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createDateTimeFilters |
40 changes: 40 additions & 0 deletions
40
packages/@sanity/core/src/actions/graphql/filters/floatFilters.js
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,40 @@ | ||
function createFloatFilters() { | ||
return { | ||
name: 'FloatFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'Float', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'Float', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'gt', | ||
type: 'Float', | ||
description: 'Checks if the value is greater than the given input.' | ||
}, | ||
{ | ||
fieldName: 'gte', | ||
type: 'Float', | ||
description: 'Checks if the value is greater than or equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'lt', | ||
type: 'Float', | ||
description: 'Checks if the value is lesser than the given input.' | ||
}, | ||
{ | ||
fieldName: 'lte', | ||
type: 'Float', | ||
description: 'Checks if the value is lesser than or equal to the given input.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createFloatFilters |
43 changes: 43 additions & 0 deletions
43
packages/@sanity/core/src/actions/graphql/filters/idFilters.js
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,43 @@ | ||
function createIdFilters() { | ||
return { | ||
name: 'IDFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'ID', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'ID', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'matches', | ||
type: 'ID', | ||
description: 'Checks if the value matches the given word/words.' | ||
}, | ||
{ | ||
fieldName: 'in', | ||
kind: 'List', | ||
children: { | ||
type: 'ID', | ||
isNullable: false | ||
}, | ||
description: 'Checks if the value is equal to one of the given values.' | ||
}, | ||
{ | ||
fieldName: 'nin', | ||
kind: 'List', | ||
children: { | ||
type: 'ID', | ||
isNullable: false | ||
}, | ||
description: 'Checks if the value is not equal to one of the given values.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createIdFilters |
40 changes: 40 additions & 0 deletions
40
packages/@sanity/core/src/actions/graphql/filters/integerFilters.js
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,40 @@ | ||
function createIntegerFilters() { | ||
return { | ||
name: 'IntFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'Int', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'Int', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'gt', | ||
type: 'Int', | ||
description: 'Checks if the value is greater than the given input.' | ||
}, | ||
{ | ||
fieldName: 'gte', | ||
type: 'Int', | ||
description: 'Checks if the value is greater than or equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'lt', | ||
type: 'Int', | ||
description: 'Checks if the value is lesser than the given input.' | ||
}, | ||
{ | ||
fieldName: 'lte', | ||
type: 'Int', | ||
description: 'Checks if the value is lesser than or equal to the given input.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createIntegerFilters |
43 changes: 43 additions & 0 deletions
43
packages/@sanity/core/src/actions/graphql/filters/stringFilters.js
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,43 @@ | ||
function createStringFilters() { | ||
return { | ||
name: 'StringFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'String', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'String', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'matches', | ||
type: 'String', | ||
description: 'Checks if the value matches the given word/words.' | ||
}, | ||
{ | ||
fieldName: 'in', | ||
kind: 'List', | ||
children: { | ||
type: 'String', | ||
isNullable: false | ||
}, | ||
description: 'Checks if the value is equal to one of the given values.' | ||
}, | ||
{ | ||
fieldName: 'nin', | ||
kind: 'List', | ||
children: { | ||
type: 'String', | ||
isNullable: false | ||
}, | ||
description: 'Checks if the value is not equal to one of the given values.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createStringFilters |
43 changes: 43 additions & 0 deletions
43
packages/@sanity/core/src/actions/graphql/filters/urlFilters.js
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,43 @@ | ||
function createUrlFilters() { | ||
return { | ||
name: 'UrlFilter', | ||
kind: 'InputObject', | ||
fields: [ | ||
{ | ||
fieldName: 'eq', | ||
type: 'Url', | ||
description: 'Checks if the value is equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'neq', | ||
type: 'Url', | ||
description: 'Checks if the value is not equal to the given input.' | ||
}, | ||
{ | ||
fieldName: 'matches', | ||
type: 'Url', | ||
description: 'Checks if the value matches the given word/words.' | ||
}, | ||
{ | ||
fieldName: 'in', | ||
kind: 'List', | ||
children: { | ||
type: 'Url', | ||
isNullable: false | ||
}, | ||
description: 'Checks if the value is equal to one of the given values.' | ||
}, | ||
{ | ||
fieldName: 'nin', | ||
kind: 'List', | ||
children: { | ||
type: 'Url', | ||
isNullable: false | ||
}, | ||
description: 'Checks if the value is not equal to one of the given values.' | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = createUrlFilters |