codegen

package
v0.0.38-alpha7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_GLOB = "src/**/*.ts"

Variables

This section is empty.

Functions

func FormatTS

func FormatTS(cfg *Config) error

Types

type ChangeType

type ChangeType string
const (
	// NOTE: this was a list that was in sync with change_type in auto_schema/change_type.py
	// since deprecated and we're only using one, only keeping reference to that one
	AddColumn ChangeType = "add_column"
)

type CodegenConfig

type CodegenConfig struct {
	DefaultEntPolicy      *PrivacyConfig  `yaml:"defaultEntPolicy"`
	DefaultActionPolicy   *PrivacyConfig  `yaml:"defaultActionPolicy"`
	Prettier              *PrettierConfig `yaml:"prettier"`
	RelativeImports       bool            `yaml:"relativeImports"`
	DisableGraphQLRoot    bool            `yaml:"disableGraphQLRoot"`
	GeneratedHeader       string          `yaml:"generatedHeader"`
	DisableBase64Encoding bool            `yaml:"disableBase64Encoding"`
	GenerateRootResolvers bool            `yaml:"generateRootResolvers"`
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is codegen info/config which is used to pass things down the line

func NewConfig

func NewConfig(configPath, modulePath string) (*Config, error)

func NewTestConfig

func NewTestConfig(configPath, modulePath string, codegenCfg *CodegenConfig) (*Config, error)

func (*Config) AddChangedFile added in v0.0.38

func (cfg *Config) AddChangedFile(filePath string)

func (*Config) AppendPathToModels

func (cfg *Config) AppendPathToModels(paths ...string) string

used by golang

func (*Config) Base64EncodeIDs added in v0.0.30

func (cfg *Config) Base64EncodeIDs() bool

func (*Config) ChangeMap added in v0.0.38

func (cfg *Config) ChangeMap() change.ChangeMap

func (*Config) DebugMode

func (cfg *Config) DebugMode() bool

func (*Config) DisableBase64Encoding added in v0.0.30

func (cfg *Config) DisableBase64Encoding() bool

func (*Config) DisableGraphQLRoot

func (cfg *Config) DisableGraphQLRoot() bool

func (*Config) GenerateNodeQuery added in v0.0.30

func (cfg *Config) GenerateNodeQuery() bool

func (*Config) GenerateRootResolvers added in v0.0.30

func (cfg *Config) GenerateRootResolvers() bool

func (*Config) GeneratedHeader

func (cfg *Config) GeneratedHeader() string

func (*Config) GetAbsPathToGraphQL

func (cfg *Config) GetAbsPathToGraphQL() string

used by golang

func (*Config) GetAbsPathToModels

func (cfg *Config) GetAbsPathToModels() string

used by golang

func (*Config) GetAbsPathToRoot

func (cfg *Config) GetAbsPathToRoot() string

func (*Config) GetDefaultActionPolicy

func (cfg *Config) GetDefaultActionPolicy() *PrivacyConfig

func (*Config) GetDefaultEntPolicy

func (cfg *Config) GetDefaultEntPolicy() *PrivacyConfig

func (*Config) GetImportPackage

func (cfg *Config) GetImportPackage() *ImportPackage

func (*Config) GetImportPathToGraphQL

func (cfg *Config) GetImportPathToGraphQL() string

func (*Config) GetImportPathToModels

func (cfg *Config) GetImportPathToModels() string

func (*Config) GetImportPathToRoot

func (cfg *Config) GetImportPathToRoot() string

func (*Config) GetPathToBuildFile added in v0.0.38

func (cfg *Config) GetPathToBuildFile() string

func (*Config) GetPathToCustomSchemaFile added in v0.0.38

func (cfg *Config) GetPathToCustomSchemaFile() string

func (*Config) GetPathToSchemaFile added in v0.0.38

func (cfg *Config) GetPathToSchemaFile() string

func (*Config) GetPrettierArgs

func (cfg *Config) GetPrettierArgs() []string

func (*Config) GetQuotedImportPathToConfigs

func (cfg *Config) GetQuotedImportPathToConfigs() string

func (*Config) GetQuotedImportPathToModels

func (cfg *Config) GetQuotedImportPathToModels() string

func (*Config) GetRelativePathToConfigs

func (cfg *Config) GetRelativePathToConfigs() string

func (*Config) GetRootPathToConfigs

func (cfg *Config) GetRootPathToConfigs() string

func (*Config) OverrideImportPathToModels

func (cfg *Config) OverrideImportPathToModels(importPath string)

func (*Config) SetChangeMap added in v0.0.38

func (cfg *Config) SetChangeMap(changes change.ChangeMap)

func (*Config) SetDebugMode

func (cfg *Config) SetDebugMode(debugMode bool)

func (*Config) SetUseChanges added in v0.0.38

func (cfg *Config) SetUseChanges(useChanges bool)

func (*Config) SetWriteAll added in v0.0.38

func (cfg *Config) SetWriteAll(writeAll bool)

func (*Config) ShouldUseRelativePaths

func (cfg *Config) ShouldUseRelativePaths() bool

func (*Config) UseChanges added in v0.0.38

func (cfg *Config) UseChanges() bool

func (*Config) WriteAllFiles added in v0.0.38

func (cfg *Config) WriteAllFiles() bool

type ConstructOption added in v0.0.38

type ConstructOption func(*constructOption)

func BuildInfo added in v0.0.38

func BuildInfo(bi *build_info.BuildInfo) ConstructOption

func DebugMode added in v0.0.38

func DebugMode() ConstructOption

func ProcessorConfig added in v0.0.38

func ProcessorConfig(cfg *Config) ConstructOption

func WriteAll added in v0.0.38

func WriteAll() ConstructOption

type ImportPackage

type ImportPackage struct {
	PackagePath        string
	AuthPackagePath    string
	ActionPackagePath  string
	SchemaPackagePath  string
	GraphQLPackagePath string
	InternalImportPath string
	ExternalImportPath string
}

ImportPackage refers to TypeScript paths of what needs to be generated for imports

type Option

type Option func(*option)

func DisableCustomGraphQL

func DisableCustomGraphQL() Option

func DisableFormat

func DisableFormat() Option

func DisablePrompts

func DisablePrompts() Option

func DisableSchemaGQL

func DisableSchemaGQL() Option

func FromTest

func FromTest() Option

type PrettierConfig

type PrettierConfig struct {
	Custom bool   `yaml:"custom"`
	Glob   string `yaml:"glob"`
}

type PrivacyConfig

type PrivacyConfig struct {
	Path       string `yaml:"path"`
	PolicyName string `yaml:"policyName"`
	Class      bool   `yaml:"class"`
}

type Processor

type Processor struct {
	Schema    *schema.Schema
	ChangeMap change.ChangeMap

	Config *Config
	// contains filtered or unexported fields
}

Processor stores the parsed data needed for codegen

func NewCodegenProcessor

func NewCodegenProcessor(currentSchema *schema.Schema, configPath string, options ...ConstructOption) (*Processor, error)

func NewTestCodegenProcessor

func NewTestCodegenProcessor(configPath string, s *schema.Schema, codegenCfg *CodegenConfig) (*Processor, error)

func (*Processor) DisableCustomGraphQL

func (p *Processor) DisableCustomGraphQL() bool

func (*Processor) DisableSchemaGQL

func (p *Processor) DisableSchemaGQL() bool

func (*Processor) FormatTS

func (p *Processor) FormatTS() error

func (*Processor) FromTest

func (p *Processor) FromTest() bool

func (*Processor) NoDBChanges

func (p *Processor) NoDBChanges() bool

func (*Processor) Run

func (p *Processor) Run(steps []Step, step string, options ...Option) error

func (*Processor) WriteSchema added in v0.0.38

func (p *Processor) WriteSchema() error

type Step

type Step interface {
	Name() string
	ProcessData(data *Processor) error
}

Step refers to a step in the codegen process e.g. db/ graphql/code etc

type StepWithPostProcess added in v0.0.38

type StepWithPostProcess interface {
	Step
	PostProcessData(data *Processor) error
}

TODO figure out long term thing here

type StepWithPreProcess

type StepWithPreProcess interface {
	Step
	// any pre-process steps can be done here
	// this is where things like user input and other
	PreProcessData(data *Processor) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL