1// Copyright The Perses Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14package common
15
16import (
17 "strings"
18)
19
20#valueCondition: {
21 kind: "Value"
22 spec: {
23 value: strings.MinRunes(1)
24 result: #mappingResult
25 }
26}
27
28#rangeCondition: {
29 kind: "Range"
30 spec: {
31 from?: number
32 to?: number
33 result: #mappingResult
34 }
35}
36
37#regexCondition: {
38 kind: "Regex"
39 spec: {
40 pattern: strings.MinRunes(1)
41 result: #mappingResult
42 }
43}
44
45#miscCondition: {
46 kind: "Misc"
47 spec: {
48 value: "empty" | "null" | "NaN" | "true" | "false"
49 result: #mappingResult
50 }
51}
52
53#mappingResult: {
54 value: string
55 color?: =~"^#(?:[0-9a-fA-F]{3}){1,2}$"
56}
57
58#mappings: #valueCondition | #rangeCondition | #regexCondition | #miscCondition