-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(trusted-docs): Allows useRedwoodTrustedDocuments to set more cus…
…tom UsePersistedOperationsOptions (#10894) Allows useRedwoodTrustedDocuments to set more custom UsePersistedOperationsOptions Allows the useRedwoodTrustedDocuments plugin to define: ```ts /** * Whether to allow execution of arbitrary GraphQL operations aside from persisted operations. */ allowArbitraryOperations?: boolean | AllowArbitraryOperationsHandler; /** * The path to the persisted operation id */ extractPersistedOperationId?: ExtractPersistedOperationId; /** * Whether to skip validation of the persisted operation */ skipDocumentValidation?: boolean; /** * Custom errors to be thrown */ customErrors?: CustomPersistedQueryErrors; ``` This can let you override to allow certain ops or skip validation etc: > If you validate your persisted operations while building your store, we recommend to skip the validation on the server. So this will reduce the work done by the server and the latency of the requests. The allow authenticated request is still considered, but `allowArbitraryOperations` can override. Omitted `getPersistedOperation` as this extracts hash from store.
- Loading branch information
1 parent
cf4dc76
commit 0391a30
Showing
3 changed files
with
142 additions
and
7 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,34 @@ | ||
feat(trusted-docs): Allows useRedwoodTrustedDocuments to set more custom UsePersistedOperationsOptions (#10894) by @dthyresson | ||
|
||
Allows useRedwoodTrustedDocuments to set more custom UsePersistedOperationsOptions | ||
|
||
Allows the useRedwoodTrustedDocuments plugin to define: | ||
|
||
```ts | ||
/** | ||
* Whether to allow execution of arbitrary GraphQL operations aside from persisted operations. | ||
*/ | ||
allowArbitraryOperations?: boolean | AllowArbitraryOperationsHandler; | ||
/** | ||
* The path to the persisted operation id | ||
*/ | ||
extractPersistedOperationId?: ExtractPersistedOperationId; | ||
|
||
/** | ||
* Whether to skip validation of the persisted operation | ||
*/ | ||
skipDocumentValidation?: boolean; | ||
|
||
/** | ||
* Custom errors to be thrown | ||
*/ | ||
customErrors?: CustomPersistedQueryErrors; | ||
``` | ||
|
||
This can let you override to allow certain ops or skip validation etc: | ||
|
||
> If you validate your persisted operations while building your store, we recommend to skip the validation on the server. So this will reduce the work done by the server and the latency of the requests. | ||
The allow authenticated request is still considered, but `allowArbitraryOperations` can override. | ||
|
||
Omitted `getPersistedOperation` as this extracts hash from store. |
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