MCPcopy
hub / github.com/superplanehq/superplane / loadExamples

Function loadExamples

pkg/lint/examplepayloads/checker.go:182–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180}
181
182func loadExamples() (map[string]exampleRecord, error) {
183 reg, err := registry.NewRegistry(crypto.NewNoOpEncryptor(), registry.HTTPOptions{})
184 if err != nil {
185 return nil, fmt.Errorf("create registry: %w", err)
186 }
187
188 examples := map[string]exampleRecord{}
189 add := func(kind nodeKind, name string, payload map[string]any) {
190 examples[exampleKey(kind, name)] = exampleRecord{
191 Name: name,
192 Kind: kind,
193 Payload: payload,
194 }
195 }
196
197 for _, action := range reg.ListActions() {
198 add(nodeKindAction, action.Name(), cloneMap(action.ExampleOutput()))
199 }
200
201 for _, trigger := range reg.ListTriggers() {
202 add(nodeKindTrigger, trigger.Name(), cloneMap(trigger.ExampleData()))
203 }
204
205 for _, integration := range reg.ListIntegrations() {
206 for _, action := range integration.Actions() {
207 add(nodeKindAction, action.Name(), cloneMap(action.ExampleOutput()))
208 }
209 for _, trigger := range integration.Triggers() {
210 add(nodeKindTrigger, trigger.Name(), cloneMap(trigger.ExampleData()))
211 }
212 }
213
214 return examples, nil
215}
216
217func loadTargetPackages(patterns ...string) ([]*loadedPackage, error) {
218 targetListed, err := goList(patterns...)

Callers 1

RunFunction · 0.85

Calls 13

ListActionsMethod · 0.95
ListTriggersMethod · 0.95
ListIntegrationsMethod · 0.95
NewRegistryFunction · 0.92
NewNoOpEncryptorFunction · 0.92
exampleKeyFunction · 0.85
cloneMapFunction · 0.85
ErrorfMethod · 0.80
NameMethod · 0.65
ExampleOutputMethod · 0.65
ExampleDataMethod · 0.65
ActionsMethod · 0.65

Tested by

no test coverage detected