ctipackage

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexFileName = "index.json"
	RAMLExt       = ".raml"
)
View Source
const (
	IndexLockFileName = "index-lock.json"
	IndexLockVersion  = "v1"
)
View Source
const (
	MetadataCacheFile = ".cache.json"
)
View Source
const (
	RamlxDirName = ".ramlx"
)

Variables

This section is empty.

Functions

func ValidateID

func ValidateID(id string) error

Types

type Asset

type Asset struct {
	Name  string `json:"name"`
	Value []byte `json:"value"`
}

type Dictionaries

type Dictionaries struct {
	Dictionaries Dictionary `json:"dictionaries"`
}

type Dictionary

type Dictionary map[LangCode]Entry

type Entity

type Entity struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

type Entry

type Entry map[Field]string

type Field

type Field string

type Index

type Index struct {
	PackageID            string            `json:"package_id"`
	RamlxVersion         string            `json:"ramlx_version"`
	Apis                 []string          `json:"apis,omitempty"`
	Entities             []string          `json:"entities,omitempty"`
	Assets               []string          `json:"assets,omitempty"`
	Dictionaries         []string          `json:"dictionaries,omitempty"`
	Depends              map[string]string `json:"depends,omitempty"`
	Examples             []string          `json:"examples,omitempty"`
	AdditionalProperties interface{}       `json:"additional_properties,omitempty"`
	Serialized           []string          `json:"serialized,omitempty"`
}

func DecodeIndex

func DecodeIndex(input io.Reader) (*Index, error)

func ReadIndex

func ReadIndex(dirPath string) (*Index, error)

func ReadIndexFile

func ReadIndexFile(fPath string) (*Index, error)

func (*Index) Check

func (idx *Index) Check() error

func (*Index) Clone

func (idx *Index) Clone() *Index

func (*Index) GenerateIndexRaml

func (idx *Index) GenerateIndexRaml(includeExamples bool) string

func (*Index) GetAssets

func (idx *Index) GetAssets() []string

func (*Index) GetEntities

func (idx *Index) GetEntities() ([]Entity, error)

func (*Index) PutSerialized

func (idx *Index) PutSerialized(fName string)

func (*Index) Save

func (idx *Index) Save(baseDir string) error

func (*Index) ToBytes

func (idx *Index) ToBytes() []byte

type IndexLock

type IndexLock struct {
	Version string `json:"version"`
	// Reverse map: key - package id, value - source
	DependentPackages map[string]string `json:"depends"`
	// Direct map: key - source, value - Info
	SourceInfo map[string]Info `json:"dependsInfo"`
}

func ReadIndexLock

func ReadIndexLock(pkgDir string) (*IndexLock, error)

func (*IndexLock) Save

func (idx *IndexLock) Save(baseDir string) error

type Info

type Info struct {
	PackageID       string            `json:"package_id"`
	Version         string            `json:"version"`
	Integrity       string            `json:"integrity"`
	Source          string            `json:"source"`
	SourceIntegrity string            `json:"source_integrity"`
	Depends         map[string]string `json:"depends"`
}

type InitializeOption

type InitializeOption func(*Package) error

func WithEntities

func WithEntities(entities []string) InitializeOption

func WithID

func WithID(id string) InitializeOption

func WithRamlxVersion

func WithRamlxVersion(version string) InitializeOption

type LangCode

type LangCode string

type Package

type Package struct {
	Index     *Index
	IndexLock *IndexLock

	Registry *collector.CtiRegistry

	BaseDir string
}

func New

func New(path string, options ...InitializeOption) (*Package, error)

New creates a new package from the specified path. If the path is empty, the current working directory is used.

func (*Package) DumpCache

func (b *Package) DumpCache() error

func (*Package) GetDictionaries

func (b *Package) GetDictionaries() (Dictionaries, error)

func (*Package) Initialize

func (b *Package) Initialize() error

func (*Package) Parse

func (b *Package) Parse() error

func (*Package) Read

func (b *Package) Read() error

func (*Package) SaveIndex

func (b *Package) SaveIndex() error

func (*Package) SaveIndexLock

func (b *Package) SaveIndexLock() error

func (*Package) Sync

func (b *Package) Sync() error

func (*Package) ValidateRamlxSpec

func (b *Package) ValidateRamlxSpec() error

type SourceInfo

type SourceInfo struct {
	Source string `json:"source"`
}

Jump to

Keyboard shortcuts

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