Reference

PersistedOperationsOptions

Package Trax.Api.GraphQL.PersistedOperationsNamespace Trax.Api.GraphQL.PersistedOperations.ConfigurationSource PersistedOperationsOptions.cs

The resolved configuration PersistedOperationsBuilder builds. UsePersistedOperations and AddPersistedOperationStore register it as a singleton. It has no public constructor and no public setters.

Signature

public sealed class PersistedOperationsOptions
{
    public bool ManagementServed { get; }
    public bool RequirePersisted { get; }
    public bool LogNonPersistedRequests { get; }
    public IReadOnlySet<string> AllowedOperationNames { get; }
    public IReadOnlyList<Func<string, bool>> AllowOperationPredicates { get; }
    public bool AllowIntrospection { get; }
    public bool CacheEnabled { get; }
    public TimeSpan CacheTtl { get; }
    public TimeSpan CacheMaxAge { get; }
    public string? RabbitMqConnectionString { get; }
    public bool SingleNode { get; }
    public string DatabaseConnectionString { get; } // obsolete
}

Properties

PropertyDefaultSet byDescription
ManagementServedfalseGateManagement, GateManagementToAuthenticatedUsersWhether documents are managed through a Trax surface, the persistedOperations fields and the dashboard's pages: true once a management gate is declared
RequirePersistedtrueRequirePersistedWhether inline documents are refused with PERSISTED_OPERATION_REQUIRED
LogNonPersistedRequestsfalseLogNonPersistedRequestsWhether inline-document requests are logged at Information
AllowedOperationNamesemptyAllowOperationsOperation names that bypass enforcement, compared ordinally
AllowOperationPredicatesemptyAllowOperationsMatchingPredicates over the operation name, or the document id when there is no name
AllowIntrospectiontrueDisableIntrospectionWhether a document selecting only __schema, __type or __typename bypasses enforcement
CacheEnabledfalseWithInMemoryCacheWhether the store's lookups are also cached in memory
CacheTtlCacheMaxAgeCacheOptions.WithTtlThe lookup cache's entry lifetime; never more than CacheMaxAge
CacheMaxAge5 minutesWithCacheMaxAgeThe longest any persisted-operation cache on a node keeps an entry, counted from when its document was read
RabbitMqConnectionStringnullUseRabbitMqInvalidationThe broker changes are broadcast on; null only when SingleNode is true
SingleNodefalseSingleNodeWhether the host declared that one process serves the endpoint and writes the store
DatabaseConnectionString""nothingObsolete and always empty

Example

public class PersistedOperationsStatus(PersistedOperationsOptions options)
{
    public string Describe() =>
        options.RequirePersisted
            ? $"enforced, cached for at most {options.CacheMaxAge}"
            : "shadow mode";
}

See also