Retain authoritative pipeline and campaign load results
This commit is contained in:
@@ -17,6 +17,15 @@ type documentResolution struct {
|
||||
sources map[string]string
|
||||
}
|
||||
|
||||
// ConfigKitResult returns the campaign's actual completed native load result.
|
||||
// Constructed campaign values have no result.
|
||||
func (cfg *CampaignConfig) ConfigKitResult() *configkit.Result[CampaignConfig] {
|
||||
if cfg == nil || cfg.resolution == nil {
|
||||
return nil
|
||||
}
|
||||
return cfg.resolution.campaign
|
||||
}
|
||||
|
||||
func documentResource(resolution *configkit.Resolution, path configkit.Path, value *string, invocationDir string, sources map[string]string) {
|
||||
if info, ok := resolution.EntryInfo(path); ok && len(info.Origin.Locations) == 1 {
|
||||
if source, ok := resolution.Source(info.Origin.Locations[0].SourceID); ok {
|
||||
@@ -45,7 +54,7 @@ func campaignDefinition(invocationDir string, sources map[string]string) configk
|
||||
documentResource(resolution, inputs.Key(field.name), field.value, invocationDir, sources)
|
||||
}
|
||||
return nil
|
||||
}}
|
||||
}, Validate: validateCampaignConfigKit}
|
||||
}
|
||||
|
||||
func sessionDefinition(invocationDir string, sources map[string]string) configkit.Definition[SessionConfig] {
|
||||
@@ -78,9 +87,9 @@ func loadCampaignWithConfigKit(path string) (*CampaignConfig, error) {
|
||||
if err != nil {
|
||||
return nil, describeConfigKitLoadError("campaign", err)
|
||||
}
|
||||
cfg := result.Config
|
||||
cfg := &result.Config
|
||||
cfg.resolution = &documentResolution{campaign: result, sources: sources}
|
||||
return &cfg, nil
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func loadSessionSource(source configkit.Source, label string, opts SessionLoadOptions, imports bool) (*SessionConfig, string, error) {
|
||||
|
||||
Reference in New Issue
Block a user