shop

package
v0.0.0-...-ff5dace Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyncOptionEntity       = "entity"
	SyncOptionMailTemplate = "mail_template"
	SyncOptionSystemConfig = "system_config"
	SyncOptionTheme        = "theme"
)

Variables

View Source
var (
	ErrNoComposerFileFound        = errors.New("could not determine Shopware version as no composer.json or composer.lock file was found")
	ErrShopwareDependencyNotFound = errors.New("could not determine Shopware version as no shopware/core dependency was found")
)

Functions

func DefaultConfigFileName

func DefaultConfigFileName() string

func IsShopwareVersion

func IsShopwareVersion(projectRoot string, requiredVersion string) (bool, error)

func NewShopClient

func NewShopClient(ctx context.Context, config *Config) (*adminSdk.Client, error)

func NewUuid

func NewUuid() string

Types

type Config

type Config struct {
	AdditionalConfigs []string `yaml:"include,omitempty"`
	// The URL of the Shopware instance
	URL              string            `yaml:"url"`
	Build            *ConfigBuild      `yaml:"build,omitempty"`
	AdminApi         *ConfigAdminApi   `yaml:"admin_api,omitempty"`
	ConfigDump       *ConfigDump       `yaml:"dump,omitempty"`
	Sync             *ConfigSync       `yaml:"sync,omitempty"`
	ConfigDeployment *ConfigDeployment `yaml:"deployment,omitempty"`
	// contains filtered or unexported fields
}

func ReadConfig

func ReadConfig(fileName string, allowFallback bool) (*Config, error)

func (Config) IsFallback

func (c Config) IsFallback() bool

type ConfigAdminApi

type ConfigAdminApi struct {
	// Client ID of integration
	ClientId string `yaml:"client_id,omitempty"`
	// Client Secret of integration
	ClientSecret string `yaml:"client_secret,omitempty"`
	// Username of admin user
	Username string `yaml:"username,omitempty"`
	// Password of admin user
	Password string `yaml:"password,omitempty"`
	// Disable SSL certificate check
	DisableSSLCheck bool `yaml:"disable_ssl_check,omitempty"`
}

type ConfigBuild

type ConfigBuild struct {
	// When enabled, the assets will not be copied to the public folder
	DisableAssetCopy bool `yaml:"disable_asset_copy,omitempty"`
	// When enabled, the assets of extensions will be removed from the extension public folder. (Requires Shopware 6.5.2.0)
	RemoveExtensionAssets bool `yaml:"remove_extension_assets,omitempty"`
	// When enabled, the extensions source code will be keep in the final build
	KeepExtensionSource bool `yaml:"keep_extension_source,omitempty"`
	// When enabled, the source maps will not be removed from the final build
	KeepSourceMaps bool `yaml:"keep_source_maps,omitempty"`
	// Paths to delete for the final build
	CleanupPaths []string `yaml:"cleanup_paths,omitempty"`
	// Browserslist configuration for the Storefront build
	Browserslist string `yaml:"browserslist,omitempty"`
	// Extensions to exclude from the build
	ExcludeExtensions []string `yaml:"exclude_extensions,omitempty"`
}

type ConfigDeployment

type ConfigDeployment struct {
	Hooks struct {
		// The pre hook will be executed before the deployment
		Pre string `yaml:"pre"`
		// The post hook will be executed after the deployment
		Post string `yaml:"post"`
		// The pre-install hook will be executed before the installation
		PreInstall string `yaml:"pre-install"`
		// The post-install hook will be executed after the installation
		PostInstall string `yaml:"post-install"`
		// The pre-update hook will be executed before the update
		PreUpdate string `yaml:"pre-update"`
		// The post-update hook will be executed after the update
		PostUpdate string `yaml:"post-update"`
	} `yaml:"hooks"`

	Store struct {
		LicenseDomain string `yaml:"license-domain"`
	} `yaml:"store"`

	Cache struct {
		AlwaysClear bool `yaml:"always_clear"`
	} `yaml:"cache"`

	// The extension management of the deployment
	ExtensionManagement struct {
		// When enabled, the extensions will be installed, updated, and removed
		Enabled bool `yaml:"enabled"`
		// Which extensions should not be managed
		Exclude []string `yaml:"exclude"`

		Overrides ConfigDeploymentOverrides `yaml:"overrides"`
	} `yaml:"extension-management"`

	OneTimeTasks []struct {
		Id     string `yaml:"id" jsonschema:"required"`
		Script string `yaml:"script" jsonschema:"required"`
	} `yaml:"one-time-tasks"`
}

type ConfigDeploymentOverrides

type ConfigDeploymentOverrides map[string]struct {
	State string `yaml:"state"`
}

func (ConfigDeploymentOverrides) JSONSchema

type ConfigDump

type ConfigDump struct {
	// Allows to rewrite single columns, perfect for GDPR compliance
	Rewrite map[string]core.Rewrite `yaml:"rewrite,omitempty"`
	// Only export the schema of these tables
	NoData []string `yaml:"nodata,omitempty"`
	// Ignore these tables from export
	Ignore []string `yaml:"ignore,omitempty"`
	// Add an where condition to that table, schema is table name as key, and where statement as value
	Where map[string]string `yaml:"where,omitempty"`
}

type ConfigSync

type ConfigSync struct {
	Enabled      *[]string          `yaml:"enabled,omitempty" jsonschema:"enum=system_config,enum=mail_template,enum=theme,enum=entity"`
	Config       []ConfigSyncConfig `yaml:"config,omitempty"`
	Theme        []ThemeConfig      `yaml:"theme,omitempty"`
	MailTemplate []MailTemplate     `yaml:"mail_template,omitempty"`
	Entity       []EntitySync       `yaml:"entity,omitempty"`
}

type ConfigSyncConfig

type ConfigSyncConfig struct {
	// Sales Channel ID to apply
	SalesChannel *string `yaml:"sales_channel,omitempty"`
	// Configurations of that Sales Channel
	Settings map[string]interface{} `yaml:"settings"`
}

type ConsoleResponse

type ConsoleResponse struct {
	Commands []struct {
		Name       string `json:"name"`
		Hidden     bool   `json:"hidden"`
		Definition struct {
			Arguments interface{} `json:"arguments"`
			Options   map[string]struct {
				Shortcut string `json:"shortcut"`
			} `json:"options"`
		} `json:"definition"`
	} `json:"commands"`
}

func GetConsoleCompletion

func GetConsoleCompletion(ctx context.Context, projectRoot string) (*ConsoleResponse, error)

func (ConsoleResponse) GetCommandOptions

func (c ConsoleResponse) GetCommandOptions(name string) []string

type EntitySync

type EntitySync struct {
	Entity  string                 `yaml:"entity"`
	Exists  *[]EntitySyncFilter    `yaml:"exists,omitempty"`
	Payload map[string]interface{} `yaml:"payload"`
}

type EntitySyncFilter

type EntitySyncFilter struct {
	// The type of filter
	Type string `` /* 155-byte string literal not displayed */
	// The field to filter on
	Field string `yaml:"field" jsonschema:"required"`
	// The actual filter value
	Value interface{} `yaml:"value"`
	// The operator to use for multiple filters
	Operator *string `yaml:"operator,omitempty" jsonschema:"enum=AND,enum=OR,enum=XOR"`
	// The filters to apply, when type set to multi
	Queries *[]EntitySyncFilter `yaml:"queries,omitempty"`
}

func (EntitySyncFilter) JSONSchema

func (s EntitySyncFilter) JSONSchema() *jsonschema.Schema

type MailTemplate

type MailTemplate struct {
	Id           string                    `yaml:"id"`
	Translations []MailTemplateTranslation `yaml:"translations"`
}

type MailTemplateTranslation

type MailTemplateTranslation struct {
	Language     string      `yaml:"language"`
	SenderName   string      `yaml:"sender_name"`
	Subject      string      `yaml:"subject"`
	HTML         string      `yaml:"html"`
	Plain        string      `yaml:"plain"`
	CustomFields interface{} `yaml:"custom_fields"`
}

type ThemeConfig

type ThemeConfig struct {
	Name     string                               `yaml:"name"`
	Settings map[string]adminSdk.ThemeConfigValue `yaml:"settings"`
}

Jump to

Keyboard shortcuts

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