Documentation
¶
Index ¶
- Variables
- func CreateExportV2Service(srv ExportV2RPC, options []connect.HandlerOption) (*api.Service, error)
- func IsValidationError(err error) bool
- type ExportCurlRequest
- type ExportCurlResponse
- type ExportFilter
- type ExportFormat
- type ExportRequest
- type ExportResponse
- type ExportV2Deps
- type ExportV2RPC
- func (h *ExportV2RPC) Export(ctx context.Context, req *connect.Request[exportv1.ExportRequest]) (*connect.Response[exportv1.ExportResponse], error)
- func (h *ExportV2RPC) ExportCurl(ctx context.Context, req *connect.Request[exportv1.ExportCurlRequest]) (*connect.Response[exportv1.ExportCurlResponse], error)
- func (h *ExportV2RPC) ExportCurlGraphQL(ctx context.Context, req *connect.Request[exportv1.ExportCurlGraphQLRequest]) (*connect.Response[exportv1.ExportCurlGraphQLResponse], error)
- type Exporter
- type FileData
- type FlowData
- type HTTPData
- type Service
- type SimpleExporter
- func (e *SimpleExporter) ExportGraphQLToCurl(ctx context.Context, graphqlIDs []idwrap.IDWrap) (string, error)
- func (e *SimpleExporter) ExportGraphQLToYAML(ctx context.Context, graphqlIDs []idwrap.IDWrap) ([]byte, error)
- func (e *SimpleExporter) ExportToCurl(ctx context.Context, data *WorkspaceExportData, httpIDs []idwrap.IDWrap) (string, error)
- func (e *SimpleExporter) ExportToYAML(ctx context.Context, data *WorkspaceExportData, simplified bool, ...) ([]byte, error)
- func (e *SimpleExporter) ExportWebSocketToYAML(ctx context.Context, websocketIDs []idwrap.IDWrap) ([]byte, error)
- func (e *SimpleExporter) ExportWorkspaceData(ctx context.Context, workspaceID idwrap.IDWrap, filter ExportFilter) (*WorkspaceExportData, error)
- func (e *SimpleExporter) SetStorage(storage Storage)
- type SimpleStorage
- func (s *SimpleStorage) GetFiles(ctx context.Context, workspaceID idwrap.IDWrap, fileIDs []idwrap.IDWrap) ([]*FileData, error)
- func (s *SimpleStorage) GetFlows(ctx context.Context, workspaceID idwrap.IDWrap, fileIDs []idwrap.IDWrap) ([]*FlowData, error)
- func (s *SimpleStorage) GetHTTPRequests(ctx context.Context, workspaceID idwrap.IDWrap, httpIDs []idwrap.IDWrap) ([]*HTTPData, error)
- func (s *SimpleStorage) GetWorkspace(ctx context.Context, workspaceID idwrap.IDWrap) (*WorkspaceInfo, error)
- type SimpleValidator
- type Storage
- type ValidationError
- type Validator
- type WorkspaceExportData
- type WorkspaceInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrWorkspaceNotFound = fmt.Errorf("workspace not found") ErrPermissionDenied = fmt.Errorf("permission denied") ErrExportFailed = fmt.Errorf("export failed") ErrNoDataFound = fmt.Errorf("no data found") ErrUnsupportedFormat = fmt.Errorf("unsupported format") ErrTimeout = fmt.Errorf("operation timed out") )
Error definitions
Functions ¶
func CreateExportV2Service ¶
func CreateExportV2Service(srv ExportV2RPC, options []connect.HandlerOption) (*api.Service, error)
CreateExportV2Service creates the service registration for rexportv2
func IsValidationError ¶
IsValidationError checks if an error is a validation error
Types ¶
type ExportCurlRequest ¶
ExportCurlRequest represents a request to export cURL commands
type ExportCurlResponse ¶
type ExportCurlResponse struct {
Data string
}
ExportCurlResponse represents the response from a cURL export operation
type ExportFilter ¶
type ExportFilter struct {
FileIDs []idwrap.IDWrap
HTTPIDs []idwrap.IDWrap
Format ExportFormat
Simplified bool
}
ExportFilter represents filters for export operations
type ExportFormat ¶
type ExportFormat string
ExportFormat represents the supported export formats
const ( ExportFormat_YAML ExportFormat = "YAML" ExportFormat_CURL ExportFormat = "CURL" )
type ExportRequest ¶
type ExportRequest struct {
WorkspaceID idwrap.IDWrap
FileIDs []idwrap.IDWrap
Format ExportFormat
Simplified bool
}
ExportRequest represents a request to export data
type ExportResponse ¶
ExportResponse represents the response from an export operation
type ExportV2Deps ¶
type ExportV2Deps struct {
DB *sql.DB
Queries *gen.Queries
Workspace sworkspace.WorkspaceService
User suser.UserService
Http *shttp.HTTPService
Flow *sflow.FlowService
File *sfile.FileService
GraphQL *sgraphql.GraphQLService
GraphQLHeader *sgraphql.GraphQLHeaderService
GraphQLAssert *sgraphql.GraphQLAssertService
WebSocket *swebsocket.WebSocketService
WebSocketHeader *swebsocket.WebSocketHeaderService
Logger *slog.Logger
}
func (*ExportV2Deps) Validate ¶
func (d *ExportV2Deps) Validate() error
type ExportV2RPC ¶
type ExportV2RPC struct {
// contains filtered or unexported fields
}
ExportV2RPC implements the Connect RPC interface for export v2
func NewExportV2RPC ¶
func NewExportV2RPC(deps ExportV2Deps) *ExportV2RPC
NewExportV2RPC creates a new ExportV2RPC handler with modern services
func (*ExportV2RPC) Export ¶
func (h *ExportV2RPC) Export(ctx context.Context, req *connect.Request[exportv1.ExportRequest]) (*connect.Response[exportv1.ExportResponse], error)
Export implements the Export RPC method
func (*ExportV2RPC) ExportCurl ¶
func (h *ExportV2RPC) ExportCurl(ctx context.Context, req *connect.Request[exportv1.ExportCurlRequest]) (*connect.Response[exportv1.ExportCurlResponse], error)
ExportCurl implements the ExportCurl RPC method
func (*ExportV2RPC) ExportCurlGraphQL ¶
func (h *ExportV2RPC) ExportCurlGraphQL(ctx context.Context, req *connect.Request[exportv1.ExportCurlGraphQLRequest]) (*connect.Response[exportv1.ExportCurlGraphQLResponse], error)
ExportCurlGraphQL implements the ExportCurlGraphQL RPC method
type Exporter ¶
type Exporter interface {
ExportWorkspaceData(ctx context.Context, workspaceID idwrap.IDWrap, filter ExportFilter) (*WorkspaceExportData, error)
ExportToYAML(ctx context.Context, data *WorkspaceExportData, simplified bool, flowIDs []idwrap.IDWrap) ([]byte, error)
ExportToCurl(ctx context.Context, data *WorkspaceExportData, httpIDs []idwrap.IDWrap) (string, error)
}
Exporter provides export functionality for different formats
type FlowData ¶
type FlowData struct {
ID idwrap.IDWrap
Name string
Description string
Variables map[string]interface{}
Steps []interface{}
}
FlowData represents flow data for export
type HTTPData ¶
type HTTPData struct {
ID idwrap.IDWrap
Name string
Method string
Url string
Headers map[string][]string
Body string
QueryParams map[string][]string
}
HTTPData represents HTTP request/response data for export
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles the business logic for export operations
func NewService ¶
NewService creates a new export service
func (*Service) Export ¶
func (s *Service) Export(ctx context.Context, req *ExportRequest) (*ExportResponse, error)
Export performs the main export operation
func (*Service) ExportCurl ¶
func (s *Service) ExportCurl(ctx context.Context, req *ExportCurlRequest) (*ExportCurlResponse, error)
ExportCurl performs cURL export operation
type SimpleExporter ¶
type SimpleExporter struct {
// contains filtered or unexported fields
}
SimpleExporter implements the Exporter interface using modern services
func NewExporter ¶
func NewExporter( httpService *shttp.HTTPService, flowService *sflow.FlowService, fileService *sfile.FileService, ioWorkspaceService *ioworkspace.IOWorkspaceService, graphqlService *sgraphql.GraphQLService, graphqlHeaderService *sgraphql.GraphQLHeaderService, graphqlAssertService *sgraphql.GraphQLAssertService, websocketService *swebsocket.WebSocketService, websocketHeaderService *swebsocket.WebSocketHeaderService, ) *SimpleExporter
NewExporter creates a new SimpleExporter
func (*SimpleExporter) ExportGraphQLToCurl ¶
func (e *SimpleExporter) ExportGraphQLToCurl(ctx context.Context, graphqlIDs []idwrap.IDWrap) (string, error)
ExportGraphQLToCurl exports GraphQL requests as cURL commands (POST with JSON body)
func (*SimpleExporter) ExportGraphQLToYAML ¶
func (e *SimpleExporter) ExportGraphQLToYAML(ctx context.Context, graphqlIDs []idwrap.IDWrap) ([]byte, error)
ExportGraphQLToYAML exports GraphQL requests as a focused YAML
func (*SimpleExporter) ExportToCurl ¶
func (e *SimpleExporter) ExportToCurl(ctx context.Context, data *WorkspaceExportData, httpIDs []idwrap.IDWrap) (string, error)
ExportToCurl exports data to cURL format
func (*SimpleExporter) ExportToYAML ¶
func (e *SimpleExporter) ExportToYAML(ctx context.Context, data *WorkspaceExportData, simplified bool, flowIDs []idwrap.IDWrap) ([]byte, error)
ExportToYAML exports data to YAML format using ioworkspace and yamlflowsimplev2
func (*SimpleExporter) ExportWebSocketToYAML ¶
func (e *SimpleExporter) ExportWebSocketToYAML(ctx context.Context, websocketIDs []idwrap.IDWrap) ([]byte, error)
ExportWebSocketToYAML exports WebSocket items as a focused YAML
func (*SimpleExporter) ExportWorkspaceData ¶
func (e *SimpleExporter) ExportWorkspaceData(ctx context.Context, workspaceID idwrap.IDWrap, filter ExportFilter) (*WorkspaceExportData, error)
ExportWorkspaceData retrieves workspace data for export
func (*SimpleExporter) SetStorage ¶
func (e *SimpleExporter) SetStorage(storage Storage)
SetStorage sets the storage dependency (called after storage is created)
type SimpleStorage ¶
type SimpleStorage struct {
// contains filtered or unexported fields
}
SimpleStorage implements storage using modern services
func NewStorage ¶
func NewStorage( ws *sworkspace.WorkspaceService, httpService *shttp.HTTPService, flowService *sflow.FlowService, fileService *sfile.FileService, ) *SimpleStorage
NewStorage creates a new storage instance with modern services
func (*SimpleStorage) GetFiles ¶
func (s *SimpleStorage) GetFiles(ctx context.Context, workspaceID idwrap.IDWrap, fileIDs []idwrap.IDWrap) ([]*FileData, error)
GetFiles retrieves file data for the given file IDs
func (*SimpleStorage) GetFlows ¶
func (s *SimpleStorage) GetFlows(ctx context.Context, workspaceID idwrap.IDWrap, fileIDs []idwrap.IDWrap) ([]*FlowData, error)
GetFlows retrieves flow data for the given workspace and file IDs
func (*SimpleStorage) GetHTTPRequests ¶
func (s *SimpleStorage) GetHTTPRequests(ctx context.Context, workspaceID idwrap.IDWrap, httpIDs []idwrap.IDWrap) ([]*HTTPData, error)
GetHTTPRequests retrieves HTTP request data for the given HTTP IDs
func (*SimpleStorage) GetWorkspace ¶
func (s *SimpleStorage) GetWorkspace(ctx context.Context, workspaceID idwrap.IDWrap) (*WorkspaceInfo, error)
GetWorkspace retrieves workspace information
type SimpleValidator ¶
type SimpleValidator struct {
// contains filtered or unexported fields
}
SimpleValidator implements basic validation
func NewValidator ¶
func NewValidator(userService *suser.UserService) *SimpleValidator
NewValidator creates a new simple validator
func (*SimpleValidator) ValidateExportFilter ¶
func (v *SimpleValidator) ValidateExportFilter(ctx context.Context, filter ExportFilter) error
ValidateExportFilter validates an export filter
func (*SimpleValidator) ValidateExportRequest ¶
func (v *SimpleValidator) ValidateExportRequest(ctx context.Context, req *ExportRequest) error
ValidateExportRequest validates an export request
func (*SimpleValidator) ValidateWorkspaceAccess ¶
func (v *SimpleValidator) ValidateWorkspaceAccess(ctx context.Context, workspaceID idwrap.IDWrap) error
ValidateWorkspaceAccess validates that the user has access to the workspace
type Storage ¶
type Storage interface {
GetWorkspace(ctx context.Context, workspaceID idwrap.IDWrap) (*WorkspaceInfo, error)
GetFlows(ctx context.Context, workspaceID idwrap.IDWrap, fileIDs []idwrap.IDWrap) ([]*FlowData, error) // Use file IDs as flow identifiers
GetHTTPRequests(ctx context.Context, workspaceID idwrap.IDWrap, httpIDs []idwrap.IDWrap) ([]*HTTPData, error)
GetFiles(ctx context.Context, workspaceID idwrap.IDWrap, fileIDs []idwrap.IDWrap) ([]*FileData, error)
}
Storage provides data access operations using modern services
type ValidationError ¶
ValidationError represents a validation error
func NewValidationError ¶
func NewValidationError(field, message string) *ValidationError
NewValidationError creates a new validation error
func NewValidationErrorWithCause ¶
func NewValidationErrorWithCause(field string, cause error) *ValidationError
NewValidationErrorWithCause creates a new validation error with a cause
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type Validator ¶
type Validator interface {
ValidateExportRequest(ctx context.Context, req *ExportRequest) error
ValidateWorkspaceAccess(ctx context.Context, workspaceID idwrap.IDWrap) error
ValidateExportFilter(ctx context.Context, filter ExportFilter) error
}
Validator provides validation for export operations
type WorkspaceExportData ¶
type WorkspaceExportData struct {
Workspace *WorkspaceInfo
Flows []*FlowData
HTTPRequests []*HTTPData
Files []*FileData
}
WorkspaceExportData represents data exported from a workspace
type WorkspaceInfo ¶
WorkspaceInfo represents basic workspace information