|
| 1 | +// SPDX-License-Identifier: Apache-2.0 |
| 2 | + |
| 3 | +package backend |
| 4 | + |
| 5 | +import ( |
| 6 | + "github.com/mendixlabs/mxcli/model" |
| 7 | + "github.com/mendixlabs/mxcli/sdk/agenteditor" |
| 8 | + "github.com/mendixlabs/mxcli/sdk/mpr" |
| 9 | +) |
| 10 | + |
| 11 | +// RenameBackend provides cross-cutting rename and reference-update operations. |
| 12 | +type RenameBackend interface { |
| 13 | + UpdateQualifiedNameInAllUnits(oldName, newName string) (int, error) |
| 14 | + RenameReferences(oldName, newName string, dryRun bool) ([]mpr.RenameHit, error) |
| 15 | + RenameDocumentByName(moduleName, oldName, newName string) error |
| 16 | +} |
| 17 | + |
| 18 | +// RawUnitBackend provides low-level unit access for operations that |
| 19 | +// manipulate raw BSON (e.g. widget patching, alter page/workflow). |
| 20 | +type RawUnitBackend interface { |
| 21 | + GetRawUnit(id model.ID) (map[string]any, error) |
| 22 | + GetRawUnitBytes(id string) ([]byte, error) |
| 23 | + ListRawUnitsByType(typePrefix string) ([]*mpr.RawUnit, error) |
| 24 | + ListRawUnits(objectType string) ([]*mpr.RawUnitInfo, error) |
| 25 | + GetRawUnitByName(objectType, qualifiedName string) (*mpr.RawUnitInfo, error) |
| 26 | + GetRawMicroflowByName(qualifiedName string) ([]byte, error) |
| 27 | + UpdateRawUnit(unitID string, contents []byte) error |
| 28 | +} |
| 29 | + |
| 30 | +// MetadataBackend provides project-level metadata and introspection. |
| 31 | +type MetadataBackend interface { |
| 32 | + ListAllUnitIDs() ([]string, error) |
| 33 | + ListUnits() ([]*mpr.UnitInfo, error) |
| 34 | + GetUnitTypes() (map[string]int, error) |
| 35 | + GetProjectRootID() (string, error) |
| 36 | + ContentsDir() string |
| 37 | + ExportJSON() ([]byte, error) |
| 38 | + InvalidateCache() |
| 39 | +} |
| 40 | + |
| 41 | +// WidgetBackend provides widget introspection operations. |
| 42 | +type WidgetBackend interface { |
| 43 | + FindCustomWidgetType(widgetID string) (*mpr.RawCustomWidgetType, error) |
| 44 | + FindAllCustomWidgetTypes(widgetID string) ([]*mpr.RawCustomWidgetType, error) |
| 45 | +} |
| 46 | + |
| 47 | +// AgentEditorBackend provides agent editor document operations. |
| 48 | +type AgentEditorBackend interface { |
| 49 | + ListAgentEditorModels() ([]*agenteditor.Model, error) |
| 50 | + ListAgentEditorKnowledgeBases() ([]*agenteditor.KnowledgeBase, error) |
| 51 | + ListAgentEditorConsumedMCPServices() ([]*agenteditor.ConsumedMCPService, error) |
| 52 | + ListAgentEditorAgents() ([]*agenteditor.Agent, error) |
| 53 | +} |
0 commit comments