Skip to content

Commit d02c82e

Browse files
authored
Release/0.8.0 (#144)
* dev: make FormFieldEnum names shorter. * dev: version bump * dev: update docs * dev: update changelog
1 parent 29a0865 commit d02c82e

12 files changed

+92
-29
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# Changelog
22

3+
## v0.8.0 - Revamped GraphQL Connections
4+
5+
** :warning: This release requires Gravity Forms v2.5.0 or higher. **
6+
7+
This release reworks all GraphQL connections, implementing data loaders, optimizing database queries, and adding support for more where args in more situations.
8+
9+
### New Features
10+
- `gravityFormsForms` can now be filtered by a list of form IDs.
11+
- `FormEntry` connections now have access to the following `where` args: `status`, `dateFilters`, `fieldFilters`, `fieldFiltersMode`.
12+
- `formField` can now be filtered by a list of field IDs, `adminLabels`, and the field type.
13+
- [Breaking] Full pagination support has been added to `Forms` and `Entries`. **Note**: cursor generation has changed, so if you are manually generating form or entry cursors, you will need to update your code.
14+
- [Breaking] `FieldFiltersOperatorInputEnum` now supports all remaining Gravity Forms entry search operators, such as `LIKE`, `IS`, `IS_NOT`. The `GREATER_THAN` and `LESS_THAN` operators have been removed, as they are not supported by Gravity Forms.
15+
16+
### Bugfixes
17+
- Correctly handle `sourceUrl` changes in `submitGravityFormsForm` and `updateGravityFormsDraftEntry` mutations.
18+
- `wp_graphql_gf_can_view_entries` filter now correctly passes `$form_ids` instead of non-existent `$entry_ids`.
19+
- `fieldFilters` now correctly search through `array` entry values.
20+
- `EntriesFieldFiltersInput.key` is now optional.
21+
22+
### Under the Hood
23+
- [Breaking] Bumped minimum GF version to v2.5.x.
24+
- [Breaking] Connections have been completely refactored. The new classes are `EntryConnections`, `FieldConnections` and `FormConnections`.
25+
- [Breaking] `RootQueryEntriesConnectionResolver` and `RootQueryFormsConnectionResolver` classes were renamed to `EntriesConnectionsResolver` and `FormConnectionResolver`. They now properly extend `AbstractConnectionResolver`.
26+
- Form connections now implement a `DataLoader`.
27+
- Added `GFUtils::get_forms()` for speedy requests from $wpdb.
28+
- Fixed various code smells.
29+
- docs: Updated information about queries to reflect pagination and new `where` args.
30+
- tests: WPUnit tests now extend `GFGraphQLTestCase`.
31+
- tests: [Breaking] `WPGraphQLGravityForms\Tests` namespace has been renamed to `Tests\WPGraphQL\GravityForms`.
32+
333
## v0.7.3 - WPGraphQL v1.6.x Compatibility
434

535
This release adds compatibility with WPGraphQL v1.6.x, [and its new lazy/eager type loading](https://github.com/wp-graphql/wp-graphql/releases/tag/v1.6.0).

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Project Status: Active.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
44
![Packagist License](https://img.shields.io/packagist/l/harness-software/wp-graphql-gravity-forms?color=green)
55
![Packagist Version](https://img.shields.io/packagist/v/harness-software/wp-graphql-gravity-forms?label=stable)
6-
![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/harness-software/wp-graphql-gravity-forms/0.7.3)
6+
![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/harness-software/wp-graphql-gravity-forms/0.8.0)
77
![GitHub forks](https://img.shields.io/github/forks/harness-software/wp-graphql-gravity-forms?style=social)
88
![GitHub Repo stars](https://img.shields.io/github/stars/harness-software/wp-graphql-gravity-forms?style=social)
99

@@ -46,12 +46,13 @@ Our hope for this open source project is that it will enable more teams to lever
4646

4747
## Future Feature Enhancements
4848

49+
[_View all Feature Requests_](https://github.com/harness-software/wp-graphql-gravity-forms/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement)
4950
- Add support for missing form fields [Github Issue](https://github.com/harness-software/wp-graphql-gravity-forms/issues/119)
50-
- Add support for backwards pagination of lists of entries.
5151
- Ability to query for lists of draft entries, or both entries and draft entries
5252
- Ability to get the total count for a list of entries.
5353
- Ability to create, update, and delete an individual Gravity Form.
5454
- Create & update integration tests. [Github Issue](https://github.com/harness-software/wp-graphql-gravity-forms/issues/116).
55+
-
5556

5657
## Documentation
5758

docs/deleting-entries.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can use the `deleteGravityFormsEntry` mutation to delete a [Gravity Forms en
88

99
```graphql
1010
mutation {
11-
deleteGravityFormsEntry(input: { clientMutationId: "123abc", entryId: 5 }) {
11+
deleteGravityFormsEntry(input: { entryId: 5 }) {
1212
entryId
1313
}
1414
}
@@ -23,10 +23,7 @@ Similarly, you can use `deleteGravityFormsDraftEntry` to delete a [Gravity Forms
2323
```graphql
2424
mutation {
2525
deleteGravityFormsDraftEntry(
26-
input: {
27-
clientMutationId: "123abc"
28-
resumeToken: "524d5f3a30c845b29a8db35c9f2aaf29"
29-
}
26+
input: { resumeToken: "524d5f3a30c845b29a8db35c9f2aaf29" }
3027
) {
3128
resumeToken
3229
}

docs/querying-entries.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,18 @@ To query a Draft Entry, simply pass the `resumeToken` to the input `id` field, a
7575

7676
## Get a List of Entries
7777

78-
The code comments in the example query below explain how you can get a filtered list of entries.
78+
The code comments in the example query below shows how you can fetch and filter data for multiple entries at once.
7979

80-
The plugin supports `first, after` and `last, before` cursor-based [pagination](https://www.wpgraphql.com/docs/connections/#solution-for-pagination-naming-conventions-and-contextual-data), but does not support `first, before` or `last, after` pagination. It also does not yet support querying for a list of draft entries.
80+
[Cursor-based pagination](https://www.wpgraphql.com/docs/connections/#solution-for-pagination-naming-conventions-and-contextual-data) is supported. You can use the `first`, `last`, `before` and `after` fields, along with the data inside of `pageInfo` and the cursors returned by the API to get each page of forms data.
8181

8282
By default, WPGraphQL sets the maximum query amount to 100. This can be overwritten using the [`graphql_connection_max_query_amount` filter](https://www.wpgraphql.com/filters/graphql_connection_max_query_amount/).
8383

84+
8485
```graphql
8586
{
8687
gravityFormsEntries(
8788
first: 20
88-
after: "eyJvZmZzZXQiOjAsImluZGV4Ijo0fQ==" # Or pass null to start from the beginning.
89+
after: "YXJyYXljb25uZWN0aW9uOjk=" # Or pass null to start from the beginning.
8990
where: {
9091
# List of all the form IDs to include.
9192
formIds: [1]
@@ -102,6 +103,8 @@ By default, WPGraphQL sets the maximum query amount to 100. This can be overwrit
102103
{ key: "created_by", intValues: [1], operator: IN }
103104
# Find entries where field 5 has a value of "somevalue".
104105
{ key: "5", stringValues: [ "somevalue" ], operator: IN }
106+
# Search all entry meta fields for a value.
107+
{ stringValues: "somevalue", operator: CONTAINS }
105108
]
106109
# Sort fields in ascending order by "date_created"
107110
sort: { direction: ASC, isNumeric: false, key: "date_created" }

docs/querying-formfields.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Querying `formFields` and their values
1+
# Querying `formFields`
22

3-
Both [forms](https://docs.gravityforms.com/form-object/) and [entries](https://docs.gravityforms.com/entry-object/) use the `formFields` GraphQL Interface to retrieve information about [Gravity Forms fields](https://docs.gravityforms.com/field-object/), and their submission values.
3+
## Getting the `formFields` from a form or entry.
44

5-
In addition to the shared fields available on the Interface, each GF Field has its own set of GraphQL fields that are accessible with query fragments.
5+
Both [forms](https://docs.gravityforms.com/form-object/) and [entries](https://docs.gravityforms.com/entry-object/) use the `formFields` GraphQL Interface to retrieve information about [Gravity Forms fields](https://docs.gravityforms.com/field-object/), and their submission values.
66

7-
You can pass `first:300` to `formFields`, where `300` is the maximum number of fields you want to query for.
7+
In addition to the shared fields available on the Interface, each Gravity Forms Field type has its own set of GraphQL fields that are accessible with query fragments.
88

9-
## Example Query
9+
### Example Query
1010

1111
```graphql
1212
{
@@ -46,6 +46,8 @@ You can pass `first:300` to `formFields`, where `300` is the maximum number of f
4646
}
4747
```
4848

49+
## Getting `formField` entry values.
50+
4951
Entry values can be accessed similarly to other Gravity Forms Field properties, by including the corresonding GraphQL field in the fragment.
5052

5153
**Note**: Due to GraphQL limitations regarding Union types, you must use the specific value type specific to that field. A full list of field value types and their corresponding field fragments are below.
@@ -61,7 +63,7 @@ Entry values can be accessed similarly to other Gravity Forms Field properties,
6163
| `value` _( string )_ | `ConsentField`<br>`DateField`<br>`EmailField`<br>`HiddenField`<br>`NumberField`<br>`PhoneField`<br>`PostContentField`<br>`PostExcerptField`<br>`PostTitleField`<br>`RadioField`<br>`SelectField`<br>`SignatureField`<br>`TextAreaField`<br>`TextField`<br>`WebsiteField` | n/a |
6264
| `values` _( [ string] )_ | `ChainedSelectField`<br>`FileUploadField`<br>`MultiSelectField`<br>`PostCategoryField`<br>`PostCustomField`<br>`PostTagsField` | n/a |
6365

64-
## Example Query
66+
### Example Query
6567

6668
```graphql
6769
{
@@ -92,3 +94,31 @@ Entry values can be accessed similarly to other Gravity Forms Field properties,
9294
}
9395
}
9496
```
97+
98+
## Filtering `formFields`.
99+
100+
The code comments in the example query below explain how you can get a filtered list of form fields.
101+
102+
```graphql
103+
{
104+
gravityFormsEntry(id: 1, idType: DATABASE_ID) {
105+
entryId
106+
formFields(
107+
first: 300
108+
after: "YXJyYXljb25uZWN0aW9uOjI=" # Or pass null to start from the beginning.
109+
where: {
110+
# Return a specific list of form fields.
111+
ids: [1,4,8]
112+
# Find form fields by their `adminLabel`.
113+
adminLabels: ['projectID', 'mylabel']
114+
# Filter form fields by field types.
115+
types: [ ADDRESS, MULTISELECT, TEXTAREA ]
116+
}
117+
) {
118+
nodes {
119+
id
120+
type
121+
}
122+
}
123+
}
124+
```

docs/querying-forms.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,25 @@ The `id` input accepts either the Gravity Forms form ID (`idType: DATABASE_ID`)
3535

3636
## Get a List of Forms.
3737

38-
The code comments in the example query below shows how you can fetch data for multiple forms at once.
38+
The code comments in the example query below shows how you can fetch and filter data for multiple forms at once.
3939

4040
[Cursor-based pagination](https://www.wpgraphql.com/docs/connections/#solution-for-pagination-naming-conventions-and-contextual-data) is supported. You can use the `first`, `last`, `before` and `after` fields, along with the data inside of `pageInfo` and the cursors returned by the API to get each page of forms data.
4141

42-
Filtering is also supported. For the `where` field, you can specify a `status` to get forms that are active, inactive, in the trash, etc.
43-
4442
#### Example Query
4543

4644
```graphql
4745
{
4846
gravityFormsForms(
4947
first: 10
50-
after: "eyJvZmZzZXQiOjAsImluZGV4Ijo0fQ==" # Or pass null to start from the beginning.
51-
where: { status: ACTIVE }
48+
after: "YXJyYXljb25uZWN0aW9uOjM=" # Or pass null to start from the beginning.
49+
where: {
50+
# List of all the form IDs to include.
51+
formIds: [1]
52+
# Sort fields in ascending order by "title
53+
sort: { direction: ASC, key: "title }
54+
# Show only active forms.
55+
status: ACTIVE
56+
}
5257
) {
5358
pageInfo {
5459
startCursor

docs/submitting-forms.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ The `fieldValues` input takes an array of objects containing the `id` of the fie
3131
submitGravityFormsForm(
3232
input: {
3333
formId: 50
34-
clientMutationId: "123abc"
3534
createdBy: 1 # The user ID.
3635
fieldValues: [
3736
{

docs/updating-entries.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ You can update a [Gravity Forms entry](https://docs.gravityforms.com/entry-objec
1010
{
1111
updateGravityFormsEntry(
1212
input: {
13-
clientMutationId: "123abc"
1413
entryId: 1
1514
isRead: false # Optional. Used to mark the entry as read.
1615
isStarred: false # Optional. Used to mark the entry as 'starred'.
@@ -47,7 +46,6 @@ Updating a [Gravity Forms draft entry](https://docs.gravityforms.com/database-st
4746
{
4847
updateGravityFormsEntry(
4948
input: {
50-
clientMutationId: "123abc"
5149
resumeToken: "f82a5d986f4d4f199893f751adee98e9"
5250
fieldValues: [
5351
{

docs/using-global-ids.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Global IDs vs Database IDs
22

3-
The `id` input for Form and Entry queries accepts either the Gravity Forms ID (`idType: DATABASE_ID`) assigned to the WordPress database, or a global (base-64 encoded) ID (`idType: ID`).
3+
The `id` input for Form and Entry queries accepts either the Gravity Forms ID ( `idType: DATABASE_ID` ) assigned to the WordPress database, or a global (base-64 encoded) ID ( `idType: ID` ).
44

55
To generate global ID for an object, you encode the name of the GraphQL type, followed by the database ID. This can be done in JavaScript using the `btoa()` function like this, where `GravityFormsForm` is the GraphQL type and `1` is the form ID:
66

@@ -13,7 +13,7 @@ You can also retrieve the global ID by returning the `id` field on the object.
1313
The example query below shows how you can use a Global ID as your input, and how you can include the global ID in the query's response:
1414

1515
```graphql
16-
{
16+
query GravityFormsForm{
1717
gravityFormsForm(id: "R3Jhdml0eUZvcm1zRm9ybTox", idType: ID) {
1818
formId # This is the (int) `DATABASE_ID`.
1919
id # This is the (string) global `ID`.

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Tested up to: 5.8
66
Requires PHP: 7.4
77
Requires Gravity Forms: 2.5.0+
88
Requires WPGraphQL: 1.0.0+
9-
Stable tag: 0.7.3
9+
Stable tag: 0.8.0
1010
Maintained at: https://github.com/harness-software/wp-graphql-gravity-forms
1111
License: GPL-3
1212
License URI: https://www.gnu.org/licenses/gpl-3.0.html

0 commit comments

Comments
 (0)