migrations

package
v0.215.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{}

Functions

func Clone added in v0.63.0

func Clone(data []byte, depMapping map[uuids.UUID]uuids.UUID) ([]byte, error)

Clone clones the given flow definition by replacing all UUIDs using the provided mapping and generating new random UUIDs if they aren't in the mapping

func GetObjectUUID added in v0.204.0

func GetObjectUUID(o any) uuids.UUID

GetObjectUUID gets the UUID property of o, if o is an object, if it has "uuid" property, and if the type of that property is a string

func MigrateToLatest

func MigrateToLatest(data []byte, cfg *Config) ([]byte, error)

MigrateToLatest migrates the given flow definition to the latest version

func MigrateToVersion

func MigrateToVersion(data []byte, to *semver.Version, cfg *Config) ([]byte, error)

MigrateToVersion migrates the given flow definition to the given version

func Registered

func Registered() map[*semver.Version]MigrationFunc

Registered gets all registered migrations

func RewriteTemplates added in v0.204.0

func RewriteTemplates(f Flow, catalog *TemplateCatalog, tx func(string) string)

Types

type Action

type Action map[string]any

Action holds an action definition

func (Action) Type

func (a Action) Type() string

Type returns the type of this action

func (Action) UUID added in v0.210.0

func (a Action) UUID() uuids.UUID

UUID returns the uuid of this action

type Config

type Config struct {
	BaseMediaURL string
}

Config configures how flow migrations are handled

type Flow

type Flow map[string]any

Flow holds a flow definition

func Migrate13_1

func Migrate13_1(f Flow, cfg *Config) (Flow, error)

Migrate13_1 adds a `uuid` property to templating objects in [action:send_msg] actions.

@version 13_1 "13.1"

func Migrate13_2 added in v0.179.0

func Migrate13_2(f Flow, cfg *Config) (Flow, error)

Migrate13_2 replaces `base` as a flow language with `und` which indicates text with undetermined language in the ISO-639-3 standard.

@version 13_2 "13.2"

func Migrate13_3 added in v0.204.0

func Migrate13_3(f Flow, cfg *Config) (Flow, error)

Migrate13_3 refactors template expressions that reference @webhook to use @webhook.json

@version 13_3 "13.3"

func Migrate13_4 added in v0.206.0

func Migrate13_4(f Flow, cfg *Config) (Flow, error)

Migrate13_4 converts the `templating` object in [action:send_msg] actions to use a list of components.

@version 13_4 "13.4"

func Migrate13_5 added in v0.210.0

func Migrate13_5(f Flow, cfg *Config) (Flow, error)

Migrate13_5 converts the `templating` object in [action:send_msg] actions to use a merged list of variables.

@version 13_5 "13.5"

func ReadFlow added in v0.204.0

func ReadFlow(data []byte) (Flow, error)

ReadFlow reads a flow definition as a flow primitive

func (Flow) Localization added in v0.179.0

func (f Flow) Localization() Localization

Localization returns the localization of this flow

func (Flow) Nodes

func (f Flow) Nodes() []Node

Nodes returns the nodes in this flow

type Header13

type Header13 struct {
	UUID        assets.FlowUUID `json:"uuid" validate:"required,uuid4"`
	Name        string          `json:"name"`
	SpecVersion *semver.Version `json:"spec_version" validate:"required"`
}

Header13 is the set of fields common to all 13+ flow spec versions

type ItemTranslation added in v0.204.0

type ItemTranslation map[string]any

func (ItemTranslation) Delete added in v0.206.0

func (it ItemTranslation) Delete(property string)

func (ItemTranslation) Get added in v0.204.0

func (it ItemTranslation) Get(property string) []string

func (ItemTranslation) Set added in v0.204.0

func (it ItemTranslation) Set(property string, trans []string)

type LanguageTranslation added in v0.204.0

type LanguageTranslation map[string]any

func (LanguageTranslation) DeleteTranslation added in v0.206.0

func (lt LanguageTranslation) DeleteTranslation(uuid uuids.UUID, property string)

func (LanguageTranslation) GetTranslation added in v0.206.0

func (lt LanguageTranslation) GetTranslation(uuid uuids.UUID, property string) []string

func (LanguageTranslation) SetTranslation added in v0.206.0

func (lt LanguageTranslation) SetTranslation(uuid uuids.UUID, property string, trans []string)

type Localization added in v0.179.0

type Localization map[string]any

func (Localization) GetLanguageTranslation added in v0.204.0

func (l Localization) GetLanguageTranslation(lang i18n.Language) LanguageTranslation

func (Localization) Languages added in v0.204.0

func (l Localization) Languages() []i18n.Language

type MigrationFunc

type MigrationFunc func(Flow, *Config) (Flow, error)

MigrationFunc is a function that can migrate a flow definition from one version to another

type Node

type Node map[string]any

Node holds a node definition

func (Node) Actions

func (n Node) Actions() []Action

Actions returns the actions on this node

func (Node) Router

func (n Node) Router() Router

Router returns the router on this node

type Router

type Router map[string]any

Router holds a router definition

func (Router) Type

func (r Router) Type() string

Type returns the type of this router

type TemplateCatalog added in v0.204.0

type TemplateCatalog struct {
	Actions map[string][]string `json:"actions"`
	Routers map[string][]string `json:"routers"`
}

func GetTemplateCatalog added in v0.204.0

func GetTemplateCatalog(v *semver.Version) *TemplateCatalog

Jump to

Keyboard shortcuts

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