Documentation
¶
Index ¶
- Constants
- Variables
- func AddDaysWithCurrentDhakaTime(days int) string
- func AddDaysWithCurrentTime(days int) string
- func ArrayContains(arr []string, str string) bool
- func ArrayContainsInterface(arr []interface{}, val interface{}) bool
- func BuildAsyncContext(ctx context.Context) (context.Context, context.CancelFunc)
- func BuildCRUDPermissions(modelName string, role *models.Role) (*models.APIPermission, error)
- func CaptureInternalServerError(err error, scopes map[string]interface{}) error
- func ConnectDisconnectParamBuilder(project *models.Project, uid string, connectionIds map[string]interface{}, ...) ([]*models.ConnectDisconnectParam, error)
- func ExtractActionName(name string) string
- func ExtractGraphQLOperationName(query string, schema *models.ProjectSchema, isSystemQuery bool) ([]*models.IncomingRequest, error)
- func ExtractModelNames(schema *models.ProjectSchema, queryDoc *ast.QueryDocument) ([]*models.IncomingRequest, bool, error)
- func ExtractRelationName(name string) string
- func ExtractResourceName(name string) string
- func FilterNumber(num string) (string, error)
- func FilterProjectArray(arr *[]*models.Project, key string) *models.Project
- func FilterUserArray(arr *[]*models.SystemUser, key string) *models.SystemUser
- func GenerateCombinedQuery(doc *ast.QueryDocument, fragments map[string]*ast.FragmentDefinition) string
- func GetCurrentDhakaTime() string
- func GetCurrentDhakaTimeDateOnly() string
- func GetCurrentDhakaTimeObject() time.Time
- func GetCurrentTime() string
- func GetCurrentTimeObject() time.Time
- func GetDhakaLocation() *time.Location
- func GetEnv(key, defaults string) string
- func GetGraphQLObject(object interface{}) (*graphql.Object, error)
- func HTMLToMarkdown(html string) string
- func HandlePayload(model *models.ModelType, data map[string]interface{})
- func HandleSubPayload(field *models.FieldInfo, data map[string]interface{})
- func HasMetaQuery(name string) bool
- func IntFormat(v interface{}) (int, error)
- func IsInActionNameMap(key string) bool
- func IsValidIdentifier(identifier string) (*models.ValidIdentifier, error)
- func MarkdownToHTML(markdown string) string
- func MarkdownToText(markdown string) string
- func ModelSchemaBuilder(modelType *models.ModelType, update bool) *oas.Schema
- func MultiLineTextFormat(v interface{}) (map[string]interface{}, error)
- func MultipleResourceName(name string) string
- func NewRefreshTokenAuthenticator(cfg *models.Config, token string) (*models.JWTTokens, error)
- func OpenApiSpecGenerator(env string, loader *models.ApplicationCache) (interface{}, error)
- func ProcessMultilineField(input map[string]interface{}) map[string]interface{}
- func RandomNumberGenerator(min, max int) string
- func RandomStringGenerator(n int) string
- func RandomVariableGenerator(n int) string
- func SanitizeMarkdown(markdown string) string
- func SetTokenClaimsToRouter(ctx echo.Context, tokenClaims *models.TokenClaims) error
- func SetTokenCookie(cfg *models.Config, name, token string, httpOnly bool, expire bool) *http.Cookie
- func SingularResourceName(name string) string
- func ValidatePermissions(vv map[string]interface{}) (*models.APIPermission, error)
- func ValidateScope(p string) (*string, bool)
- type Authenticator
- type CRUDPermissions
- type GoroutineMonitor
- type MarkdownProcessor
- func (mp *MarkdownProcessor) HTMLToMarkdown(html string) string
- func (mp *MarkdownProcessor) MarkdownToHTML(markdown string) string
- func (mp *MarkdownProcessor) MarkdownToText(markdown string) string
- func (mp *MarkdownProcessor) ProcessMultilineField(input map[string]interface{}) map[string]interface{}
- func (mp *MarkdownProcessor) SanitizeMarkdown(markdown string) string
- func (mp *MarkdownProcessor) TextToMarkdown(text string) string
- type RESTtoGraphResponse
Constants ¶
const ( GOROUTINE_WARNING_THRESHOLD = 500 GOROUTINE_CRITICAL_THRESHOLD = 1000 GOROUTINE_CHECK_INTERVAL = 30 * time.Second )
Variables ¶
var DefaultMarkdownProcessor = NewMarkdownProcessor()
Global instance for easy access
var MapActionName = map[string]string{
"UpdateProfileResolverFn": "update user profile",
"UpsertPluginResolverFn": "plugin modification",
"GenerateApiTokenResolverFn": "generated api token",
"DeleteApiTokenResolverFn": "deleted api token",
"CreateWebHookResolverFn": "created a webhook",
"DeleteWebHookResolverFn": "deleted a webhook",
"UpdateProjectResolverFn": "updated a project information",
"AddModelToProjectResolverFn": "added a model to a project",
"UpdateModelResolverFn": "updated a model",
"UpsertRoleToProjectResolverFn": "added or modified a role to a project",
"DeleteRoleResolverFn": "deleted a role",
"UpsertFieldToModelResolverFn": "added or modified a field to a model",
"DeleteFieldTypeResolverFn": "deleted a field",
"ModelFieldOperationResolverFn": "modified a field of a model",
"CreateConnectionTypeResolverFn": "created a connection between models",
"UpsertModelDataFnFn": "added or modified data of a model",
"DeleteModelDataFnFn": "deleted data of a model",
}
var SupportedLocals = []string{}/* 609 elements not displayed */
Functions ¶
func AddDaysWithCurrentTime ¶
func ArrayContains ¶
func ArrayContainsInterface ¶
func ArrayContainsInterface(arr []interface{}, val interface{}) bool
func BuildAsyncContext ¶
func BuildCRUDPermissions ¶
func ExtractActionName ¶
func ExtractGraphQLOperationName ¶
func ExtractGraphQLOperationName(query string, schema *models.ProjectSchema, isSystemQuery bool) ([]*models.IncomingRequest, error)
func ExtractModelNames ¶
func ExtractModelNames(schema *models.ProjectSchema, queryDoc *ast.QueryDocument) ([]*models.IncomingRequest, bool, error)
func ExtractRelationName ¶
func ExtractResourceName ¶
separate update,delete,create from model name
func FilterNumber ¶
func FilterProjectArray ¶
FilterProjectArray filters the array by a key and removes the found item from the array
func FilterUserArray ¶
func FilterUserArray(arr *[]*models.SystemUser, key string) *models.SystemUser
FilterUserArray filters the array by a key and removes the found item from the array
func GenerateCombinedQuery ¶
func GenerateCombinedQuery(doc *ast.QueryDocument, fragments map[string]*ast.FragmentDefinition) string
New function to generate the combined output as a single string
func GetCurrentDhakaTime ¶
func GetCurrentDhakaTime() string
func GetCurrentDhakaTimeDateOnly ¶
func GetCurrentDhakaTimeDateOnly() string
func GetCurrentTimeObject ¶
func GetGraphQLObject ¶
GetGraphQLObject Converts struct into graphql object
func HTMLToMarkdown ¶ added in v1.1.3
func HandlePayload ¶
func HandleSubPayload ¶
func HasMetaQuery ¶
func IsInActionNameMap ¶
func IsValidIdentifier ¶ added in v1.1.4
func IsValidIdentifier(identifier string) (*models.ValidIdentifier, error)
func MarkdownToHTML ¶ added in v1.1.3
func MarkdownToText ¶ added in v1.1.3
func ModelSchemaBuilder ¶
func MultiLineTextFormat ¶
func MultipleResourceName ¶
func OpenApiSpecGenerator ¶
func OpenApiSpecGenerator(env string, loader *models.ApplicationCache) (interface{}, error)
func ProcessMultilineField ¶ added in v1.1.3
Convenience functions using the default processor
func RandomNumberGenerator ¶
func RandomStringGenerator ¶
func RandomVariableGenerator ¶
func SanitizeMarkdown ¶ added in v1.1.3
func SetTokenClaimsToRouter ¶
func SetTokenClaimsToRouter(ctx echo.Context, tokenClaims *models.TokenClaims) error
func SetTokenCookie ¶
func SingularResourceName ¶
func ValidatePermissions ¶
func ValidatePermissions(vv map[string]interface{}) (*models.APIPermission, error)
func ValidateScope ¶
Types ¶
type Authenticator ¶
func NewAuthenticator ¶
func NewAuthenticator(cfg *models.Config) (*Authenticator, error)
type CRUDPermissions ¶
type GoroutineMonitor ¶ added in v1.1.0
type GoroutineMonitor struct {
// contains filtered or unexported fields
}
func NewGoroutineMonitor ¶ added in v1.1.0
func NewGoroutineMonitor() *GoroutineMonitor
func (*GoroutineMonitor) GetCurrentCount ¶ added in v1.1.0
func (gm *GoroutineMonitor) GetCurrentCount() int
func (*GoroutineMonitor) StartMonitoring ¶ added in v1.1.0
func (gm *GoroutineMonitor) StartMonitoring(ctx context.Context)
func (*GoroutineMonitor) StopMonitoring ¶ added in v1.1.0
func (gm *GoroutineMonitor) StopMonitoring()
type MarkdownProcessor ¶ added in v1.1.3
type MarkdownProcessor struct {
// contains filtered or unexported fields
}
MarkdownProcessor handles markdown sanitization and conversion
func NewMarkdownProcessor ¶ added in v1.1.3
func NewMarkdownProcessor() *MarkdownProcessor
NewMarkdownProcessor creates a new markdown processor with proper sanitization
func (*MarkdownProcessor) HTMLToMarkdown ¶ added in v1.1.3
func (mp *MarkdownProcessor) HTMLToMarkdown(html string) string
HTMLToMarkdown converts HTML to markdown
func (*MarkdownProcessor) MarkdownToHTML ¶ added in v1.1.3
func (mp *MarkdownProcessor) MarkdownToHTML(markdown string) string
MarkdownToHTML converts markdown to sanitized HTML
func (*MarkdownProcessor) MarkdownToText ¶ added in v1.1.3
func (mp *MarkdownProcessor) MarkdownToText(markdown string) string
MarkdownToText converts markdown to plain text (removes all formatting)
func (*MarkdownProcessor) ProcessMultilineField ¶ added in v1.1.3
func (mp *MarkdownProcessor) ProcessMultilineField(input map[string]interface{}) map[string]interface{}
ProcessMultilineField processes a multiline field with markdown as the source of truth
func (*MarkdownProcessor) SanitizeMarkdown ¶ added in v1.1.3
func (mp *MarkdownProcessor) SanitizeMarkdown(markdown string) string
SanitizeMarkdown removes potentially dangerous content from markdown
func (*MarkdownProcessor) TextToMarkdown ¶ added in v1.1.3
func (mp *MarkdownProcessor) TextToMarkdown(text string) string
TextToMarkdown converts plain text to basic markdown
type RESTtoGraphResponse ¶
type RESTtoGraphResponse struct { Query string `json:"query"` QueryName string `json:"query_name"` OperationName string `json:"operation_name"` }
func HandleFunctionGraphqlBase ¶
func HandleFunctionGraphqlBase(c echo.Context, schema *models.ProjectSchema, functionName string) (*RESTtoGraphResponse, error)
func RESTtoGraphQL ¶
func RESTtoGraphQL(c echo.Context, schema *models.ProjectSchema, rootModel string, rest url.Values, skipQueryDef bool) (*RESTtoGraphResponse, error)
Source Files
¶
- array.go
- claims_set.go
- connect_disconnect_builder.go
- context.go
- date.go
- env.go
- fragment_query_merger.go
- generator.go
- goroutine_monitor.go
- html_to_markdown.go
- id_check.go
- locals.go
- map_action_name.go
- map_validation.go
- markdown_utility.go
- model_extractor_from_query.go
- name_extractor.go
- oauth.go
- open_api_spec_generator.go
- permission_builder.go
- query_parser.go
- rest_to_graphql.go
- sentry.go
- set_token_cookie.go
- struct_to_graphql.go