transforms input arguments for policy consumption
(inputs map[string]string)
| 762 | |
| 763 | // transforms input arguments for policy consumption |
| 764 | func getInputArguments(inputs map[string]string) map[string]any { |
| 765 | args := make(map[string]any) |
| 766 | |
| 767 | for k, v := range inputs { |
| 768 | // Normalize consistently: split on newlines first (multi-value inputs, |
| 769 | // e.g. a comma-separated contract value merged with runtime values by |
| 770 | // mergeRuntimeInputs), then split each line on commas. Doing both means a |
| 771 | // comma-separated segment is always expanded into separate values, |
| 772 | // regardless of whether it arrived as a single line or as one of several |
| 773 | // merged lines. |
| 774 | lines := strings.Split(strings.TrimRight(v, "\n"), "\n") |
| 775 | values := make([]string, 0, len(lines)) |
| 776 | for _, line := range lines { |
| 777 | values = append(values, splitArgs(line)...) |
| 778 | } |
| 779 | |
| 780 | value := getValue(values) |
| 781 | if value == nil { |
| 782 | continue |
| 783 | } |
| 784 | args[k] = value |
| 785 | } |
| 786 | |
| 787 | return args |
| 788 | } |
| 789 | |
| 790 | func getValue(values []string) any { |
| 791 | lines := make([]string, 0) |