bundle_packager.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package bundle_packager
  2. import (
  3. "github.com/langgenius/dify-plugin-daemon/internal/types/entities/bundle_entities"
  4. "github.com/langgenius/dify-plugin-daemon/internal/types/entities/manifest_entities"
  5. )
  6. type BundlePackager interface {
  7. // Export exports the bundle to a zip byte array
  8. Export() ([]byte, error)
  9. // Save saves the bundle to the original source
  10. Save() error
  11. // Manifest returns the manifest of the bundle
  12. Manifest() (*bundle_entities.Bundle, error)
  13. // Remove removes a dependency from the bundle
  14. Remove(index int) error
  15. // Append Github Dependency appends a github dependency to the bundle
  16. AppendGithubDependency(repoPattern bundle_entities.GithubRepoPattern)
  17. // Append Marketplace Dependency appends a marketplace dependency to the bundle
  18. AppendMarketplaceDependency(marketplacePattern bundle_entities.MarketplacePattern)
  19. // Append Package Dependency appends a local package dependency to the bundle
  20. AppendPackageDependency(packagePath string) error
  21. // ListDependencies lists all the dependencies of the bundle
  22. ListDependencies() ([]bundle_entities.Dependency, error)
  23. // Regenerate regenerates the bundle, replace the basic information of the bundle like name, labels, description, icon, etc.
  24. Regenerate(bundle bundle_entities.Bundle) error
  25. // BumpVersion bumps the version of the bundle
  26. BumpVersion(targetVersion manifest_entities.Version)
  27. // FetchAsset fetches the asset of the bundle
  28. // NOTE: path is the relative path to _assets folder
  29. FetchAsset(path string) ([]byte, error)
  30. // ReadFile reads the file from the bundle
  31. // NOTE: path is the relative path to the root of the bundle
  32. ReadFile(path string) ([]byte, error)
  33. }