Skip to content

Commit

Permalink
Updated references to previous persisted operation options (#7737)
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 authored Nov 19, 2024
1 parent cb18e96 commit 2493c90
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,24 @@ Please ensure that your clients are sending date/time strings in the correct for

### Methods renamed

| Old method name | New method name |
| ----------------------------------- | -------------------------------------- |
| UsePersistedQueryPipeline | UsePersistedOperationPipeline |
| UseAutomaticPersistedQueryPipeline | UseAutomaticPersistedOperationPipeline |
| AddFileSystemQueryStorage | AddFileSystemOperationDocumentStorage |
| AddInMemoryQueryStorage | AddInMemoryOperationDocumentStorage |
| AddRedisQueryStorage | AddRedisOperationDocumentStorage |
| OnlyAllowPersistedQueries | OnlyAllowPersistedOperations |
| OnlyPersistedQueriesAreAllowedError | OnlyPersistedOperationsAreAllowedError |
| AllowNonPersistedQuery | AllowNonPersistedOperation |
| UseReadPersistedQuery | UseReadPersistedOperation |
| UseAutomaticPersistedQueryNotFound | UseAutomaticPersistedOperationNotFound |
| UseWritePersistedQuery | UseWritePersistedOperation |
| Old method name | New method name |
| ---------------------------------- | -------------------------------------- |
| UsePersistedQueryPipeline | UsePersistedOperationPipeline |
| UseAutomaticPersistedQueryPipeline | UseAutomaticPersistedOperationPipeline |
| AddFileSystemQueryStorage | AddFileSystemOperationDocumentStorage |
| AddInMemoryQueryStorage | AddInMemoryOperationDocumentStorage |
| AddRedisQueryStorage | AddRedisOperationDocumentStorage |
| AllowNonPersistedQuery | AllowNonPersistedOperation |
| UseReadPersistedQuery | UseReadPersistedOperation |
| UseAutomaticPersistedQueryNotFound | UseAutomaticPersistedOperationNotFound |
| UseWritePersistedQuery | UseWritePersistedOperation |

### Options renamed

| Old option name | New option name |
| ----------------------------------- | ----------------------------------------------- |
| OnlyAllowPersistedQueries | PersistedOperations.OnlyAllowPersistedDocuments |
| OnlyPersistedQueriesAreAllowedError | PersistedOperations.OperationNotAllowedError |

### Defaults changed

Expand Down Expand Up @@ -233,20 +238,6 @@ Accessing a keyed service that has not been registered will now throw, instead o

This change aligns the API with the regular (non-keyed) service access API.

## Change to OnlyAllowPersistedOperations option

**Before**

```csharp
ModifyRequestOptions(o => o.OnlyAllowPersistedOperations = true);
```

**After**

```csharp
ModifyRequestOptions(o => o.PersistedOperations.OnlyAllowPersistedDocuments = true);
```

# Deprecations

Things that will continue to function this release, but we encourage you to move away from.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,24 @@ Please ensure that your clients are sending date/time strings in the correct for

### Methods renamed

| Old method name | New method name |
| ----------------------------------- | -------------------------------------- |
| UsePersistedQueryPipeline | UsePersistedOperationPipeline |
| UseAutomaticPersistedQueryPipeline | UseAutomaticPersistedOperationPipeline |
| AddFileSystemQueryStorage | AddFileSystemOperationDocumentStorage |
| AddInMemoryQueryStorage | AddInMemoryOperationDocumentStorage |
| AddRedisQueryStorage | AddRedisOperationDocumentStorage |
| OnlyAllowPersistedQueries | OnlyAllowPersistedOperations |
| OnlyPersistedQueriesAreAllowedError | OnlyPersistedOperationsAreAllowedError |
| AllowNonPersistedQuery | AllowNonPersistedOperation |
| UseReadPersistedQuery | UseReadPersistedOperation |
| UseAutomaticPersistedQueryNotFound | UseAutomaticPersistedOperationNotFound |
| UseWritePersistedQuery | UseWritePersistedOperation |
| Old method name | New method name |
| ---------------------------------- | -------------------------------------- |
| UsePersistedQueryPipeline | UsePersistedOperationPipeline |
| UseAutomaticPersistedQueryPipeline | UseAutomaticPersistedOperationPipeline |
| AddFileSystemQueryStorage | AddFileSystemOperationDocumentStorage |
| AddInMemoryQueryStorage | AddInMemoryOperationDocumentStorage |
| AddRedisQueryStorage | AddRedisOperationDocumentStorage |
| AllowNonPersistedQuery | AllowNonPersistedOperation |
| UseReadPersistedQuery | UseReadPersistedOperation |
| UseAutomaticPersistedQueryNotFound | UseAutomaticPersistedOperationNotFound |
| UseWritePersistedQuery | UseWritePersistedOperation |

### Options renamed

| Old option name | New option name |
| ----------------------------------- | ----------------------------------------------- |
| OnlyAllowPersistedQueries | PersistedOperations.OnlyAllowPersistedDocuments |
| OnlyPersistedQueriesAreAllowedError | PersistedOperations.OperationNotAllowedError |

### Defaults changed

Expand Down Expand Up @@ -233,20 +238,6 @@ Accessing a keyed service that has not been registered will now throw, instead o

This change aligns the API with the regular (non-keyed) service access API.

## Change to OnlyAllowPersistedOperations option

**Before**

```csharp
ModifyRequestOptions(o => o.OnlyAllowPersistedOperations = true);
```

**After**

```csharp
ModifyRequestOptions(o => o.PersistedOperations.OnlyAllowPersistedDocuments = true);
```

# Deprecations

Things that will continue to function this release, but we encourage you to move away from.
Expand Down
8 changes: 4 additions & 4 deletions website/src/docs/nitro/apis/client-registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void ConfigureServices(IServiceCollection services)
## Block Ad-Hoc Queries
While you want to allow ad-hoc queries during development, you might want to disable them in production.
This can be done by setting the `OnlyAllowPersistedOperations` option to `true` in the `ModifyRequestOptions` method.
This can be done by setting the `PersistedOperations.OnlyAllowPersistedDocuments` option to `true` in the `ModifyRequestOptions` method.
```csharp
public void ConfigureServices(IServiceCollection services)
Expand All @@ -135,7 +135,7 @@ public void ConfigureServices(IServiceCollection services)
.AddGraphQLServer()
.AddQueryType<Query>()
.AddNitro() // Connect to the client registry
.ModifyRequestOptions(x => x.OnlyAllowPersistedOperations = true)
.ModifyRequestOptions(x => x.PersistedOperations.OnlyAllowPersistedDocuments = true)
.UsePersistedOperationPipeline(); // Enable the persisted operation pipeline
}
```
Expand All @@ -151,8 +151,8 @@ public void ConfigureServices(IServiceCollection services)
.AddNitro() // Connect to the client registry
.ModifyRequestOptions(x =>
{
x.OnlyAllowPersistedOperations = true;
x.OnlyPersistedOperationsAreAllowedError = ErrorBuilder.New()
x.PersistedOperations.OnlyAllowPersistedDocuments = true;
x.PersistedOperations.OperationNotAllowedError = ErrorBuilder.New()
.SetMessage("Only persisted operations are allowed.")
.Build();
})
Expand Down

0 comments on commit 2493c90

Please sign in to comment.