Files
releases/refactor/refactor.go
Johan Fylling a179a24c48 v1 API
All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.

Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.

Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:27:34 +01:00

31 lines
1.0 KiB
Go

// Copyright 2021 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
// Package refactor implements different refactoring operations over Rego modules.
package refactor
import (
v1 "github.com/open-policy-agent/opa/v1/refactor"
)
// Error defines the structure of errors returned by refactor.
type Error = v1.Error
// Refactor implements different refactoring operations over Rego modules eg. renaming packages.
type Refactor = v1.Refactor
// New returns a new Refactor object.
func New() *Refactor {
return v1.New()
}
// MoveQuery holds the set of Rego modules whose package paths and other references are to be rewritten
// as per the mapping defined in SrcDstMapping.
// If validate is true, the moved modules will be compiled to ensure they are valid.
type MoveQuery = v1.MoveQuery
// MoveQueryResult defines the output of a move query and holds the rewritten modules with updated packages paths
// and references.
type MoveQueryResult = v1.MoveQueryResult