bundle_entities

package
v0.0.0-...-e06565c Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GITHUB_VERSION_PATTERN = fmt.Sprintf(
		`([~^]?%s|%s(\.%s){2}|%s-%s)`,
		manifest_entities.VERSION_PATTERN,
		manifest_entities.VERSION_X_PATTERN,
		manifest_entities.VERSION_X_PATTERN,
		manifest_entities.VERSION_PATTERN,
		manifest_entities.VERSION_PATTERN,
	)
	GITHUB_DEPENDENCY_PATTERN = fmt.Sprintf(`^[a-z0-9_-]{1,64}/[a-z0-9_-]{1,128}:%s/[^/]+$`, GITHUB_VERSION_PATTERN)

	MARKETPLACE_VERSION_PATTERN = fmt.Sprintf(
		`([~^]?%s|%s(\.%s){2}|%s-%s)`,
		manifest_entities.VERSION_PATTERN,
		manifest_entities.VERSION_X_PATTERN,
		manifest_entities.VERSION_X_PATTERN,
		manifest_entities.VERSION_PATTERN,
		manifest_entities.VERSION_PATTERN,
	)
	MARKETPLACE_DEPENDENCY_PATTERN = fmt.Sprintf(`^[a-z0-9_-]{1,64}/[a-z0-9_-]{1,128}:%s$`, MARKETPLACE_VERSION_PATTERN)
)
View Source
var (
	GITHUB_DEPENDENCY_PATTERN_REGEX_COMPILED = regexp.MustCompile(GITHUB_DEPENDENCY_PATTERN)
	MARKETPLACE_PATTERN_REGEX_COMPILED       = regexp.MustCompile(MARKETPLACE_DEPENDENCY_PATTERN)
)

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	Name         string                             `json:"name" yaml:"name" validate:"required"`
	Labels       plugin_entities.I18nObject         `json:"labels" yaml:"labels" validate:"required"`
	Description  plugin_entities.I18nObject         `json:"description" yaml:"description" validate:"required"`
	Icon         string                             `json:"icon" yaml:"icon" validate:"required"`
	Version      manifest_entities.Version          `json:"version" yaml:"version" validate:"required,version"`
	Author       string                             `json:"author" yaml:"author" validate:"required"`
	Type         manifest_entities.DifyManifestType `json:"type" yaml:"type" validate:"required,eq=bundle"`
	Dependencies []Dependency                       `json:"dependencies" yaml:"dependencies" validate:"required"`
	Tags         []manifest_entities.PluginTag      `json:"tags" yaml:"tags" validate:"omitempty,dive,plugin_tag,max=128"`
}

func (*Bundle) MarshalJSON

func (b *Bundle) MarshalJSON() ([]byte, error)

for api, avoid pydantic validation error

func (*Bundle) UnmarshalYAML

func (b *Bundle) UnmarshalYAML(node *yaml.Node) error

for unmarshal yaml

type Dependency

type Dependency struct {
	Type  DependencyType `json:"type" yaml:"type" validate:"required,oneof=github marketplace package"`
	Value any            `json:"value" yaml:"value" validate:"required"`
}

func (*Dependency) UnmarshalYAML

func (d *Dependency) UnmarshalYAML(node *yaml.Node) error

type DependencyType

type DependencyType string
const (
	DEPENDENCY_TYPE_GITHUB      DependencyType = "github"
	DEPENDENCY_TYPE_MARKETPLACE DependencyType = "marketplace"
	DEPENDENCY_TYPE_PACKAGE     DependencyType = "package"
)

type GithubDependency

type GithubDependency struct {
	// RepoPattern is the pattern of the repo, as for its content, at least one of the following patterns:
	// 1. owner/repo/1.0.0/aaa.difypkg
	// 2. owner/repo/1.0.0/*.difypkg
	// 3. owner/repo/1.x.x/aaa.difypkg
	// 4. owner/repo/^1.0.0/aaa.difypkg
	// 5. owner/repo/~1.0.0/aaa.difypkg
	// 6. owner/repo/1.0.0-2.0.0/aaa.difypkg
	// 7. owner/repo/1.0.0-beta/aaa.difypkg
	RepoPattern GithubRepoPattern `json:"repo_pattern" yaml:"repo_pattern" validate:"required,github_dependency_pattern"`
}

type GithubRepoPattern

type GithubRepoPattern string

func NewGithubRepoPattern

func NewGithubRepoPattern(pattern string) (GithubRepoPattern, error)

func (GithubRepoPattern) Asset

func (p GithubRepoPattern) Asset() string

func (GithubRepoPattern) GithubRepo

func (p GithubRepoPattern) GithubRepo() string

func (GithubRepoPattern) Release

func (p GithubRepoPattern) Release() string

func (GithubRepoPattern) Repo

func (p GithubRepoPattern) Repo() string

func (GithubRepoPattern) Split

func (p GithubRepoPattern) Split() []string

type MarketplaceDependency

type MarketplaceDependency struct {
	// MarketplacePattern is the pattern of the marketplace, as for its content, at least one of the following patterns:
	// 1. org/plugin/1.0.0
	// 2. org/plugin/1.x.x
	// 3. org/plugin/^1.0.0
	// 4. org/plugin/~1.0.0
	// 5. org/plugin/1.0.0-2.0.0
	// 6. org/plugin/1.0.0-beta
	MarketplacePattern MarketplacePattern `json:"marketplace_pattern" yaml:"marketplace_pattern" validate:"required,marketplace_pattern"`
}

type MarketplacePattern

type MarketplacePattern string

func NewMarketplacePattern

func NewMarketplacePattern(pattern string) (MarketplacePattern, error)

func (MarketplacePattern) Organization

func (p MarketplacePattern) Organization() string

func (MarketplacePattern) Plugin

func (p MarketplacePattern) Plugin() string

func (MarketplacePattern) Split

func (p MarketplacePattern) Split() []string

func (MarketplacePattern) Version

func (p MarketplacePattern) Version() string

type PackageDependency

type PackageDependency struct {
	// refers to the path of difypkg file in assets
	Path string `json:"path" yaml:"path" validate:"required"`
}

Jump to

Keyboard shortcuts

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