()
| 180 | } |
| 181 | |
| 182 | func 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 | |
| 217 | func loadTargetPackages(patterns ...string) ([]*loadedPackage, error) { |
| 218 | targetListed, err := goList(patterns...) |
no test coverage detected