Documentation ¶
Overview ¶
* Copyright (c) 2023 WunderGraph Inc. * All rights reserved. * * This file is licensed under the WunderGraph Enterprise License. * @see https://github.com/wundergraph/wundergraph/blob/main/LICENSE.ENTERPRISE.md
Index ¶
- func EncodeData(r *http.Request, buf *bytes.Buffer, variables []byte, response []byte) ([]byte, error)
- func HeaderCSVToSlice(headers map[string]string) map[string][]string
- func HeaderSliceToCSV(headers map[string][]string) map[string]string
- func HttpRequestToWunderGraphRequestJSON(r *http.Request, withBody bool) ([]byte, error)
- type AuthenticationConfig
- type AuthenticationDeniedError
- type AuthenticationHooks
- func (h *AuthenticationHooks) MutatingPostAuthentication(ctx context.Context, user *authentication.User) (*authentication.User, error)
- func (h *AuthenticationHooks) PostAuthentication(ctx context.Context, user *authentication.User) error
- func (h *AuthenticationHooks) PostLogout(ctx context.Context, user *authentication.User) error
- func (h *AuthenticationHooks) RevalidateAuthentication(ctx context.Context, user *authentication.User) (*authentication.User, error)
- type Client
- func (c *Client) DoAuthenticationRequest(ctx context.Context, hook MiddlewareHook, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
- func (c *Client) DoFunctionRequest(ctx context.Context, operationName string, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
- func (c *Client) DoFunctionSubscriptionRequest(ctx context.Context, operationName string, jsonData []byte, subscribeOnce bool, ...) error
- func (c *Client) DoGlobalRequest(ctx context.Context, hook MiddlewareHook, hookID string, jsonData []byte, ...) (*MiddlewareHookResponse, error)
- func (c *Client) DoHealthCheckRequest(ctx context.Context) (status bool)
- func (c *Client) DoOperationRequest(ctx context.Context, operationName string, hook MiddlewareHook, ...) (*MiddlewareHookResponse, error)
- func (c *Client) DoUploadRequest(ctx context.Context, providerName string, profileName string, hook UploadHook, ...) (*UploadHookResponse, error)
- func (c *Client) DoWsTransportRequest(ctx context.Context, hook MiddlewareHook, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
- type ClientOptions
- type Executor
- type Hook
- type HookCheck
- type HookMatcher
- type HookResponse
- type HookResponseError
- type MiddlewareHook
- type MiddlewareHookResponse
- type OnRequestHookPayload
- type OnRequestHookResponse
- type OnResponseHookPayload
- type OnResponseHookResponse
- type OnWsConnectionInitHookPayload
- type PipelineConfig
- type PostResolveConfiguration
- type QueryResolver
- type ResolveConfiguration
- type Response
- type SubscriptionOperationPipeline
- func (p *SubscriptionOperationPipeline) PostResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request, ...) (*Response, error)
- func (p *SubscriptionOperationPipeline) PreResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request) (*Response, error)
- func (p *SubscriptionOperationPipeline) RunSubscription(ctx *resolve.Context, w SubscriptionWriter, r *http.Request) (*Response, error)
- type SubscriptionOperationPipelineConfig
- type SubscriptionResolver
- type SubscriptionWriter
- type SynchronousOperationPipeline
- func (p *SynchronousOperationPipeline) PostResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request, ...) (*Response, error)
- func (p *SynchronousOperationPipeline) PreResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request) (*Response, error)
- func (p *SynchronousOperationPipeline) Run(ctx *resolve.Context, w http.ResponseWriter, r *http.Request, ...) (*Response, error)
- type SynchronousOperationPipelineConfig
- type UploadHook
- type UploadHookResponse
- type WunderGraphRequest
- type WunderGraphResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthenticationConfig ¶ added in v0.134.0
type AuthenticationDeniedError ¶ added in v0.134.0
type AuthenticationDeniedError string
func (AuthenticationDeniedError) Error ¶ added in v0.134.0
func (e AuthenticationDeniedError) Error() string
type AuthenticationHooks ¶ added in v0.134.0
type AuthenticationHooks struct {
// contains filtered or unexported fields
}
func NewAuthenticationHooks ¶ added in v0.134.0
func NewAuthenticationHooks(config AuthenticationConfig) *AuthenticationHooks
func (*AuthenticationHooks) MutatingPostAuthentication ¶ added in v0.134.0
func (h *AuthenticationHooks) MutatingPostAuthentication(ctx context.Context, user *authentication.User) (*authentication.User, error)
func (*AuthenticationHooks) PostAuthentication ¶ added in v0.134.0
func (h *AuthenticationHooks) PostAuthentication(ctx context.Context, user *authentication.User) error
func (*AuthenticationHooks) PostLogout ¶ added in v0.134.0
func (h *AuthenticationHooks) PostLogout(ctx context.Context, user *authentication.User) error
func (*AuthenticationHooks) RevalidateAuthentication ¶ added in v0.134.0
func (h *AuthenticationHooks) RevalidateAuthentication(ctx context.Context, user *authentication.User) (*authentication.User, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts *ClientOptions) *Client
func (*Client) DoAuthenticationRequest ¶
func (c *Client) DoAuthenticationRequest(ctx context.Context, hook MiddlewareHook, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
func (*Client) DoFunctionRequest ¶ added in v0.126.0
func (*Client) DoFunctionSubscriptionRequest ¶ added in v0.126.0
func (*Client) DoGlobalRequest ¶
func (c *Client) DoGlobalRequest(ctx context.Context, hook MiddlewareHook, hookID string, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
func (*Client) DoHealthCheckRequest ¶ added in v0.114.0
func (*Client) DoOperationRequest ¶
func (c *Client) DoOperationRequest(ctx context.Context, operationName string, hook MiddlewareHook, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
func (*Client) DoUploadRequest ¶ added in v0.127.0
func (*Client) DoWsTransportRequest ¶ added in v0.112.0
func (c *Client) DoWsTransportRequest(ctx context.Context, hook MiddlewareHook, jsonData []byte, buf *bytes.Buffer) (*MiddlewareHookResponse, error)
type ClientOptions ¶ added in v0.157.0
type Hook ¶ added in v0.166.0
type Hook struct { ID string Type wgpb.HookType Matcher HookMatcher }
Hook contains a new-style hook that can match on arbitrary events. To use the hook create an Executor by calling Hook.Executor()
type HookMatcher ¶ added in v0.166.0
type HookResponse ¶ added in v0.127.0
type HookResponseError ¶ added in v0.173.0
type HookResponseError struct { Code string `json:"code"` Message string `json:"message"` StatusCode int `json:"statusCode"` Stack string `json:"stack"` }
func (*HookResponseError) Error ¶ added in v0.173.0
func (e *HookResponseError) Error() string
type MiddlewareHook ¶
type MiddlewareHook string
const ( MockResolve MiddlewareHook = "mockResolve" PreResolve MiddlewareHook = "preResolve" PostResolve MiddlewareHook = "postResolve" CustomResolve MiddlewareHook = "customResolve" MutatingPreResolve MiddlewareHook = "mutatingPreResolve" MutatingPostResolve MiddlewareHook = "mutatingPostResolve" PostAuthentication MiddlewareHook = "postAuthentication" PostLogout MiddlewareHook = "postLogout" MutatingPostAuthentication MiddlewareHook = "mutatingPostAuthentication" RevalidateAuthentication MiddlewareHook = "revalidateAuthentication" // HttpTransportOnRequest to the origin HttpTransportOnRequest MiddlewareHook = "onOriginRequest" // HttpTransportOnResponse from the origin HttpTransportOnResponse MiddlewareHook = "onOriginResponse" HttpTransportOnTransport MiddlewareHook = "onOriginTransport" WsTransportOnConnectionInit MiddlewareHook = "onConnectionInit" )
type MiddlewareHookResponse ¶
type MiddlewareHookResponse struct { Error *HookResponseError `json:"error,omitempty"` Op string `json:"op"` Hook string `json:"hook"` Response json.RawMessage `json:"response"` Input json.RawMessage `json:"input"` SetClientRequestHeaders map[string]string `json:"setClientRequestHeaders"` // ClientResponseStatusCode is the status code that should be returned to the client ClientResponseStatusCode int }
func (*MiddlewareHookResponse) HookName ¶ added in v0.173.0
func (r *MiddlewareHookResponse) HookName() string
func (*MiddlewareHookResponse) OperationName ¶ added in v0.173.0
func (r *MiddlewareHookResponse) OperationName() string
func (*MiddlewareHookResponse) ResponseError ¶ added in v0.127.0
func (r *MiddlewareHookResponse) ResponseError() error
type OnRequestHookPayload ¶
type OnRequestHookPayload struct { Request WunderGraphRequest `json:"request"` OperationName string `json:"operationName"` OperationType string `json:"operationType"` }
type OnRequestHookResponse ¶
type OnRequestHookResponse struct { Skip bool `json:"skip"` Cancel bool `json:"cancel"` Request *WunderGraphRequest `json:"request"` }
type OnResponseHookPayload ¶
type OnResponseHookPayload struct { Response WunderGraphResponse `json:"response"` OperationName string `json:"operationName"` OperationType string `json:"operationType"` }
type OnResponseHookResponse ¶
type OnResponseHookResponse struct { Skip bool `json:"skip"` Cancel bool `json:"cancel"` Response *WunderGraphResponse `json:"response"` }
type OnWsConnectionInitHookPayload ¶ added in v0.112.0
type OnWsConnectionInitHookPayload struct { DataSourceID string `json:"dataSourceId"` Request WunderGraphRequest `json:"request"` }
type PipelineConfig ¶ added in v0.131.1
type PipelineConfig struct { Client *Client Operation *wgpb.Operation Transformer *postresolvetransform.Transformer Logger *zap.Logger }
type PostResolveConfiguration ¶ added in v0.131.1
type QueryResolver ¶ added in v0.131.1
type ResolveConfiguration ¶ added in v0.131.1
type ResolveConfiguration struct { // Pre indicates whether the PreResolve hook should be run Pre bool // MutatingPre indicates whether the MutatingPreResolve hook should be run MutatingPre bool // Custom indicates whether the CustomResolve hook should be run Custom bool // Mock indicates whether the MockResolve hook should be run Mock bool }
type SubscriptionOperationPipeline ¶ added in v0.131.1
type SubscriptionOperationPipeline struct {
// contains filtered or unexported fields
}
func NewSubscriptionOperationPipeline ¶ added in v0.131.1
func NewSubscriptionOperationPipeline(config SubscriptionOperationPipelineConfig) *SubscriptionOperationPipeline
func (*SubscriptionOperationPipeline) PostResolve ¶ added in v0.131.1
func (p *SubscriptionOperationPipeline) PostResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request, responseData []byte) (*Response, error)
PostResolve runs the post-resolution hooks
func (*SubscriptionOperationPipeline) PreResolve ¶ added in v0.131.1
func (p *SubscriptionOperationPipeline) PreResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request) (*Response, error)
PreResolve runs the pre-resolution hooks
func (*SubscriptionOperationPipeline) RunSubscription ¶ added in v0.131.1
func (p *SubscriptionOperationPipeline) RunSubscription(ctx *resolve.Context, w SubscriptionWriter, r *http.Request) (*Response, error)
RunSubscription runs the pre-resolution hooks and resolves the subscription if needed. The writer is responsible for calling the post-resolution hooks (usually via Pipeline.PostResolve()). The pipeline Resolver must implement ResolveSubscription.
type SubscriptionOperationPipelineConfig ¶ added in v0.131.1
type SubscriptionOperationPipelineConfig struct { PipelineConfig Resolver SubscriptionResolver Plan *plan.SubscriptionResponsePlan }
type SubscriptionResolver ¶ added in v0.131.1
type SubscriptionResolver interface {
ResolveGraphQLSubscription(ctx *resolve.Context, subscription *resolve.GraphQLSubscription, writer resolve.FlushWriter) (err error)
}
type SubscriptionWriter ¶ added in v0.131.1
type SubscriptionWriter interface { http.ResponseWriter resolve.FlushWriter }
type SynchronousOperationPipeline ¶ added in v0.131.1
type SynchronousOperationPipeline struct {
// contains filtered or unexported fields
}
func NewSynchronousOperationPipeline ¶ added in v0.173.0
func NewSynchronousOperationPipeline(config SynchronousOperationPipelineConfig) *SynchronousOperationPipeline
func (*SynchronousOperationPipeline) PostResolve ¶ added in v0.131.1
func (p *SynchronousOperationPipeline) PostResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request, responseData []byte) (*Response, error)
PostResolve runs the post-resolution hooks
func (*SynchronousOperationPipeline) PreResolve ¶ added in v0.131.1
func (p *SynchronousOperationPipeline) PreResolve(ctx *resolve.Context, w http.ResponseWriter, r *http.Request) (*Response, error)
PreResolve runs the pre-resolution hooks
func (*SynchronousOperationPipeline) Run ¶ added in v0.131.1
func (p *SynchronousOperationPipeline) Run(ctx *resolve.Context, w http.ResponseWriter, r *http.Request, buf *bytes.Buffer) (*Response, error)
Run runs the pre-resolution hooks, resolves the operation if needed and then runs the post-resolution hooks. The pipeline Resolver must implement ResolveOperation.
type SynchronousOperationPipelineConfig ¶ added in v0.131.1
type SynchronousOperationPipelineConfig struct { PipelineConfig Resolver QueryResolver Plan *plan.SynchronousResponsePlan }
type UploadHook ¶ added in v0.127.0
type UploadHook string
const ( PreUpload UploadHook = "preUpload" PostUpload UploadHook = "postUpload" )
type UploadHookResponse ¶ added in v0.127.0
type UploadHookResponse struct { Hook string `json:"hook"` Error *HookResponseError `json:"error"` FileKey string `json:"fileKey"` }
func (*UploadHookResponse) HookName ¶ added in v0.173.0
func (r *UploadHookResponse) HookName() string
func (*UploadHookResponse) OperationName ¶ added in v0.173.0
func (r *UploadHookResponse) OperationName() string
func (*UploadHookResponse) ResponseError ¶ added in v0.127.0
func (r *UploadHookResponse) ResponseError() error