@perses-dev/core 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/model/calculations.js +1 -1
- package/dist/cjs/model/index.js +3 -0
- package/dist/cjs/model/query.js +12 -0
- package/dist/cjs/model/resource.js +14 -3
- package/dist/cjs/model/time.js +9 -11
- package/dist/cjs/model/trace-data.js +29 -1
- package/dist/cjs/model/transforms.js +28 -0
- package/dist/cjs/model/units/bytes.js +0 -3
- package/dist/cjs/model/units/decimal.js +0 -3
- package/dist/cjs/model/units/percent.js +0 -5
- package/dist/cjs/model/units/throughput.js +18 -12
- package/dist/cjs/model/units/time.js +0 -10
- package/dist/cjs/model/units/types.js +0 -13
- package/dist/cjs/model/units/units.js +1 -1
- package/dist/cjs/model/user.js +16 -0
- package/dist/cjs/model/value-mapping.js +16 -0
- package/dist/cjs/schema/datasource.js +85 -0
- package/dist/cjs/schema/display.js +27 -0
- package/dist/cjs/schema/duration.js +25 -0
- package/dist/cjs/schema/index.js +40 -0
- package/dist/cjs/schema/metadata.js +41 -0
- package/dist/cjs/schema/panel.js +106 -0
- package/dist/cjs/schema/plugin.js +27 -0
- package/dist/cjs/schema/role.js +86 -0
- package/dist/cjs/schema/rolebinding.js +65 -0
- package/dist/cjs/schema/secret.js +174 -0
- package/dist/cjs/schema/user.js +57 -0
- package/dist/cjs/schema/variable.js +171 -0
- package/dist/cjs/utils/fetch.js +14 -20
- package/dist/cjs/utils/index.js +3 -0
- package/dist/cjs/utils/memo.js +1 -2
- package/dist/cjs/utils/regexp.js +54 -0
- package/dist/cjs/utils/text.js +21 -46
- package/dist/cjs/utils/transform-data.js +167 -0
- package/dist/cjs/utils/value-mapping.js +105 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model/calculations.d.ts +1 -1
- package/dist/model/calculations.d.ts.map +1 -1
- package/dist/model/calculations.js +1 -1
- package/dist/model/calculations.js.map +1 -1
- package/dist/model/datasource.d.ts +8 -8
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/http.d.ts +5 -0
- package/dist/model/http.d.ts.map +1 -1
- package/dist/model/http.js.map +1 -1
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +3 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +3 -3
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +17 -1
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/project.d.ts +5 -0
- package/dist/model/project.d.ts.map +1 -1
- package/dist/model/project.js.map +1 -1
- package/dist/model/query.d.ts +10 -0
- package/dist/model/query.d.ts.map +1 -1
- package/dist/model/query.js +8 -3
- package/dist/model/query.js.map +1 -1
- package/dist/model/resource.d.ts +7 -0
- package/dist/model/resource.d.ts.map +1 -1
- package/dist/model/resource.js +3 -0
- package/dist/model/resource.js.map +1 -1
- package/dist/model/time-series-data.d.ts +1 -0
- package/dist/model/time-series-data.d.ts.map +1 -1
- package/dist/model/time-series-data.js.map +1 -1
- package/dist/model/time.d.ts.map +1 -1
- package/dist/model/time.js +9 -11
- package/dist/model/time.js.map +1 -1
- package/dist/model/trace-data.d.ts +80 -7
- package/dist/model/trace-data.d.ts.map +1 -1
- package/dist/model/trace-data.js +7 -3
- package/dist/model/trace-data.js.map +1 -1
- package/dist/model/transforms.d.ts +34 -0
- package/dist/model/transforms.d.ts.map +1 -0
- package/dist/model/transforms.js +21 -0
- package/dist/model/transforms.js.map +1 -0
- package/dist/model/units/bytes.d.ts +1 -2
- package/dist/model/units/bytes.d.ts.map +1 -1
- package/dist/model/units/bytes.js +0 -3
- package/dist/model/units/bytes.js.map +1 -1
- package/dist/model/units/decimal.d.ts +1 -2
- package/dist/model/units/decimal.d.ts.map +1 -1
- package/dist/model/units/decimal.js +0 -3
- package/dist/model/units/decimal.js.map +1 -1
- package/dist/model/units/percent.d.ts +1 -2
- package/dist/model/units/percent.d.ts.map +1 -1
- package/dist/model/units/percent.js +0 -5
- package/dist/model/units/percent.js.map +1 -1
- package/dist/model/units/throughput.d.ts +1 -2
- package/dist/model/units/throughput.d.ts.map +1 -1
- package/dist/model/units/throughput.js +18 -12
- package/dist/model/units/throughput.js.map +1 -1
- package/dist/model/units/time.d.ts +1 -2
- package/dist/model/units/time.d.ts.map +1 -1
- package/dist/model/units/time.js +0 -10
- package/dist/model/units/time.js.map +1 -1
- package/dist/model/units/types.d.ts +1 -2
- package/dist/model/units/types.d.ts.map +1 -1
- package/dist/model/units/types.js +1 -7
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.d.ts +2 -0
- package/dist/model/units/units.d.ts.map +1 -1
- package/dist/model/units/units.js +1 -1
- package/dist/model/units/units.js.map +1 -1
- package/dist/model/units/utils.d.ts.map +1 -1
- package/dist/model/units/utils.js.map +1 -1
- package/dist/model/user.d.ts +21 -0
- package/dist/model/user.d.ts.map +1 -0
- package/dist/model/user.js +15 -0
- package/dist/model/user.js.map +1 -0
- package/dist/model/value-mapping.d.ts +35 -0
- package/dist/model/value-mapping.d.ts.map +1 -0
- package/dist/model/value-mapping.js +15 -0
- package/dist/model/value-mapping.js.map +1 -0
- package/dist/model/variables.d.ts +9 -8
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/schema/datasource.d.ts +61 -0
- package/dist/schema/datasource.d.ts.map +1 -0
- package/dist/schema/datasource.js +54 -0
- package/dist/schema/datasource.js.map +1 -0
- package/dist/schema/display.d.ts +12 -0
- package/dist/schema/display.d.ts.map +1 -0
- package/dist/schema/display.js +19 -0
- package/dist/schema/display.js.map +1 -0
- package/dist/schema/duration.d.ts +3 -0
- package/dist/schema/duration.d.ts.map +1 -0
- package/dist/schema/duration.js +17 -0
- package/dist/schema/duration.js.map +1 -0
- package/dist/schema/index.d.ts +12 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +25 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/metadata.d.ts +21 -0
- package/dist/schema/metadata.d.ts.map +1 -0
- package/dist/schema/metadata.js +22 -0
- package/dist/schema/metadata.js.map +1 -0
- package/dist/schema/panel.d.ts +13 -0
- package/dist/schema/panel.d.ts.map +1 -0
- package/dist/schema/panel.js +69 -0
- package/dist/schema/panel.js.map +1 -0
- package/dist/schema/plugin.d.ts +14 -0
- package/dist/schema/plugin.d.ts.map +1 -0
- package/dist/schema/plugin.js +19 -0
- package/dist/schema/plugin.js.map +1 -0
- package/dist/schema/role.d.ts +58 -0
- package/dist/schema/role.d.ts.map +1 -0
- package/dist/schema/role.js +61 -0
- package/dist/schema/role.js.map +1 -0
- package/dist/schema/rolebinding.d.ts +58 -0
- package/dist/schema/rolebinding.d.ts.map +1 -0
- package/dist/schema/rolebinding.js +40 -0
- package/dist/schema/rolebinding.js.map +1 -0
- package/dist/schema/secret.d.ts +1140 -0
- package/dist/schema/secret.d.ts.map +1 -0
- package/dist/schema/secret.js +152 -0
- package/dist/schema/secret.js.map +1 -0
- package/dist/schema/user.d.ts +8 -0
- package/dist/schema/user.d.ts.map +1 -0
- package/dist/schema/user.js +36 -0
- package/dist/schema/user.js.map +1 -0
- package/dist/schema/variable.d.ts +92 -0
- package/dist/schema/variable.d.ts.map +1 -0
- package/dist/schema/variable.js +119 -0
- package/dist/schema/variable.js.map +1 -0
- package/dist/utils/fetch.d.ts +5 -2
- package/dist/utils/fetch.d.ts.map +1 -1
- package/dist/utils/fetch.js +15 -21
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/is-empty-object.d.ts.map +1 -1
- package/dist/utils/is-empty-object.js.map +1 -1
- package/dist/utils/memo.d.ts.map +1 -1
- package/dist/utils/memo.js +1 -2
- package/dist/utils/memo.js.map +1 -1
- package/dist/utils/panel-refs.d.ts +2 -2
- package/dist/utils/panel-refs.d.ts.map +1 -1
- package/dist/utils/panel-refs.js.map +1 -1
- package/dist/utils/regexp.d.ts +11 -0
- package/dist/utils/regexp.d.ts.map +1 -0
- package/dist/utils/regexp.js +42 -0
- package/dist/utils/regexp.js.map +1 -0
- package/dist/utils/text.d.ts +7 -33
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +21 -52
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/time-series-data.d.ts.map +1 -1
- package/dist/utils/time-series-data.js.map +1 -1
- package/dist/utils/transform-data.d.ts +8 -0
- package/dist/utils/transform-data.d.ts.map +1 -0
- package/dist/utils/transform-data.js +221 -0
- package/dist/utils/transform-data.js.map +1 -0
- package/dist/utils/value-mapping.d.ts +3 -0
- package/dist/utils/value-mapping.d.ts.map +1 -0
- package/dist/utils/value-mapping.js +97 -0
- package/dist/utils/value-mapping.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/utils.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport function shouldShortenValues(shortValues?: boolean) {\n return shortValues !== false;\n}\n\nexport function hasDecimalPlaces(decimalPlaces?: number) {\n return typeof decimalPlaces === 'number';\n}\n\n// Avoids maximumFractionDigits out-of-range error.\n// Allowed values are 0 to 20.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits\nexport function limitDecimalPlaces(num?: number) {\n if (!num) return num;\n\n if (num < 0) {\n num = 0;\n } else if (num > 20) {\n num = 20;\n }\n\n return num;\n}\n"],"names":["shouldShortenValues","shortValues","hasDecimalPlaces","decimalPlaces","limitDecimalPlaces","num"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,SAASA,oBAAoBC,WAAqB;IACvD,OAAOA,gBAAgB;AACzB;AAEA,OAAO,SAASC,iBAAiBC,aAAsB;IACrD,OAAO,OAAOA,kBAAkB;AAClC;AAEA,mDAAmD;AACnD,8BAA8B;AAC9B,wIAAwI;AACxI,OAAO,SAASC,mBAAmBC,GAAY;IAC7C,IAAI,CAACA,KAAK,OAAOA;IAEjB,IAAIA,MAAM,GAAG;QACXA,MAAM;IACR,OAAO,IAAIA,MAAM,IAAI;QACnBA,MAAM;IACR;IAEA,OAAOA;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/utils.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport function shouldShortenValues(shortValues?: boolean): boolean {\n return shortValues !== false;\n}\n\nexport function hasDecimalPlaces(decimalPlaces?: number): boolean {\n return typeof decimalPlaces === 'number';\n}\n\n// Avoids maximumFractionDigits out-of-range error.\n// Allowed values are 0 to 20.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits\nexport function limitDecimalPlaces(num?: number): number | undefined {\n if (!num) return num;\n\n if (num < 0) {\n num = 0;\n } else if (num > 20) {\n num = 20;\n }\n\n return num;\n}\n"],"names":["shouldShortenValues","shortValues","hasDecimalPlaces","decimalPlaces","limitDecimalPlaces","num"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,SAASA,oBAAoBC,WAAqB;IACvD,OAAOA,gBAAgB;AACzB;AAEA,OAAO,SAASC,iBAAiBC,aAAsB;IACrD,OAAO,OAAOA,kBAAkB;AAClC;AAEA,mDAAmD;AACnD,8BAA8B;AAC9B,wIAAwI;AACxI,OAAO,SAASC,mBAAmBC,GAAY;IAC7C,IAAI,CAACA,KAAK,OAAOA;IAEjB,IAAIA,MAAM,GAAG;QACXA,MAAM;IACR,OAAO,IAAIA,MAAM,IAAI;QACnBA,MAAM;IACR;IAEA,OAAOA;AACT"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Metadata } from './resource';
|
|
2
|
+
export interface NativeProvider {
|
|
3
|
+
password?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface OAuthProvider {
|
|
6
|
+
issuer?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
subject?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UserSpec {
|
|
11
|
+
firstName?: string;
|
|
12
|
+
lastName?: string;
|
|
13
|
+
nativeProvider?: NativeProvider;
|
|
14
|
+
oauthProviders?: OAuthProvider[];
|
|
15
|
+
}
|
|
16
|
+
export interface UserResource {
|
|
17
|
+
kind: 'User';
|
|
18
|
+
metadata: Metadata;
|
|
19
|
+
spec: UserSpec;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/model/user.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;CAChB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/user.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Metadata } from './resource';\n\nexport interface NativeProvider {\n password?: string;\n}\n\nexport interface OAuthProvider {\n issuer?: string;\n email?: string;\n subject?: string;\n}\n\nexport interface UserSpec {\n firstName?: string;\n lastName?: string;\n nativeProvider?: NativeProvider;\n oauthProviders?: OAuthProvider[];\n}\n\nexport interface UserResource {\n kind: 'User';\n metadata: Metadata;\n spec: UserSpec;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAqBjC,WAIC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type ValueMapping = ValueMappingOptions | ValueMappingOptionsRange | ValueMappingOptionsRegex | ValueMappingOptionsMisc;
|
|
2
|
+
export interface ValueMappingOptions {
|
|
3
|
+
kind: 'Value';
|
|
4
|
+
spec: {
|
|
5
|
+
value: string | number;
|
|
6
|
+
result: MappedValue;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface ValueMappingOptionsRange {
|
|
10
|
+
kind: 'Range';
|
|
11
|
+
spec: {
|
|
12
|
+
from?: number;
|
|
13
|
+
to?: number;
|
|
14
|
+
result: MappedValue;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ValueMappingOptionsRegex {
|
|
18
|
+
kind: 'Regex';
|
|
19
|
+
spec: {
|
|
20
|
+
pattern: string;
|
|
21
|
+
result: MappedValue;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface ValueMappingOptionsMisc {
|
|
25
|
+
kind: 'Misc';
|
|
26
|
+
spec: {
|
|
27
|
+
value: 'empty' | 'null' | 'NaN' | 'true' | 'false';
|
|
28
|
+
result: MappedValue;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface MappedValue {
|
|
32
|
+
value: number | string;
|
|
33
|
+
color?: string;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=value-mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-mapping.d.ts","sourceRoot":"","sources":["../../src/model/value-mapping.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GACpB,mBAAmB,GACnB,wBAAwB,GACxB,wBAAwB,GACxB,uBAAuB,CAAC;AAE5B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;QACnD,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=value-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/value-mapping.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport type ValueMapping =\n | ValueMappingOptions\n | ValueMappingOptionsRange\n | ValueMappingOptionsRegex\n | ValueMappingOptionsMisc;\n\nexport interface ValueMappingOptions {\n kind: 'Value';\n spec: {\n value: string | number;\n result: MappedValue;\n };\n}\n\nexport interface ValueMappingOptionsRange {\n kind: 'Range';\n spec: {\n from?: number;\n to?: number;\n result: MappedValue;\n };\n}\n\nexport interface ValueMappingOptionsRegex {\n kind: 'Regex';\n spec: {\n pattern: string;\n result: MappedValue;\n };\n}\n\nexport interface ValueMappingOptionsMisc {\n kind: 'Misc';\n spec: {\n value: 'empty' | 'null' | 'NaN' | 'true' | 'false';\n result: MappedValue;\n };\n}\n\nexport interface MappedValue {\n value: number | string;\n color?: string;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAyCjC,WAGC"}
|
|
@@ -3,11 +3,12 @@ import { Display } from './display';
|
|
|
3
3
|
import { Metadata, ProjectMetadata } from './resource';
|
|
4
4
|
export type VariableName = string;
|
|
5
5
|
export type VariableValue = string | string[] | null;
|
|
6
|
+
export interface VariableDisplay extends Display {
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
}
|
|
6
9
|
export interface VariableSpec {
|
|
7
10
|
name: VariableName;
|
|
8
|
-
display?:
|
|
9
|
-
hidden?: boolean;
|
|
10
|
-
};
|
|
11
|
+
display?: VariableDisplay;
|
|
11
12
|
}
|
|
12
13
|
export interface TextVariableDefinition extends Definition<TextVariableSpec> {
|
|
13
14
|
kind: 'TextVariable';
|
|
@@ -16,13 +17,13 @@ export interface TextVariableSpec extends VariableSpec {
|
|
|
16
17
|
value: string;
|
|
17
18
|
constant?: boolean;
|
|
18
19
|
}
|
|
19
|
-
export interface ListVariableDefinition
|
|
20
|
+
export interface ListVariableDefinition extends Definition<ListVariableSpec> {
|
|
20
21
|
kind: 'ListVariable';
|
|
21
22
|
}
|
|
22
|
-
export interface ListVariableSpec<PluginSpec> extends VariableSpec {
|
|
23
|
+
export interface ListVariableSpec<PluginSpec = UnknownSpec> extends VariableSpec {
|
|
23
24
|
defaultValue?: VariableValue;
|
|
24
|
-
allowMultiple
|
|
25
|
-
allowAllValue
|
|
25
|
+
allowMultiple: boolean;
|
|
26
|
+
allowAllValue: boolean;
|
|
26
27
|
customAllValue?: string;
|
|
27
28
|
capturingRegexp?: string;
|
|
28
29
|
sort?: string;
|
|
@@ -35,7 +36,7 @@ export interface BuiltinVariableSpec extends VariableSpec {
|
|
|
35
36
|
value: () => string;
|
|
36
37
|
source: string;
|
|
37
38
|
}
|
|
38
|
-
export type VariableDefinition = TextVariableDefinition | ListVariableDefinition
|
|
39
|
+
export type VariableDefinition = TextVariableDefinition | ListVariableDefinition;
|
|
39
40
|
/**
|
|
40
41
|
* A variable that belongs to a project.
|
|
41
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC1E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC1E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB,CAAC,UAAU,GAAG,WAAW,CAAE,SAAQ,YAAY;IAC9E,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,yBAA0B,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IAChF,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,sBAAsB,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,sBAAsB,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED,eAAO,MAAM,iBAAiB,UAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/variables.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Definition, UnknownSpec } from './definitions';\nimport { Display } from './display';\nimport { Metadata, ProjectMetadata } from './resource';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\nexport interface
|
|
1
|
+
{"version":3,"sources":["../../src/model/variables.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Definition, UnknownSpec } from './definitions';\nimport { Display } from './display';\nimport { Metadata, ProjectMetadata } from './resource';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\nexport interface VariableDisplay extends Display {\n hidden?: boolean;\n}\n\nexport interface VariableSpec {\n name: VariableName;\n display?: VariableDisplay;\n}\n\nexport interface TextVariableDefinition extends Definition<TextVariableSpec> {\n kind: 'TextVariable';\n}\n\nexport interface TextVariableSpec extends VariableSpec {\n value: string;\n constant?: boolean;\n}\n\nexport interface ListVariableDefinition extends Definition<ListVariableSpec> {\n kind: 'ListVariable';\n}\n\nexport interface ListVariableSpec<PluginSpec = UnknownSpec> extends VariableSpec {\n defaultValue?: VariableValue;\n allowMultiple: boolean;\n allowAllValue: boolean;\n customAllValue?: string;\n capturingRegexp?: string;\n sort?: string;\n plugin: Definition<PluginSpec>;\n}\n\nexport interface BuiltinVariableDefinition extends Definition<BuiltinVariableSpec> {\n kind: 'BuiltinVariable';\n}\n\nexport interface BuiltinVariableSpec extends VariableSpec {\n value: () => string;\n source: string;\n}\n\nexport type VariableDefinition = TextVariableDefinition | ListVariableDefinition;\n\n/**\n * A variable that belongs to a project.\n */\nexport interface VariableResource {\n kind: 'Variable';\n metadata: ProjectMetadata;\n spec: VariableDefinition;\n}\n\n/**\n * A global variable that doesn´t belong to a project.\n */\nexport interface GlobalVariableResource {\n kind: 'GlobalVariable';\n metadata: Metadata;\n spec: VariableDefinition;\n}\n\nexport type Variable = VariableResource | GlobalVariableResource;\n\nexport function getVariableProject(variable: Variable): string | undefined {\n return 'project' in variable.metadata ? variable.metadata.project : undefined;\n}\n\nexport const DEFAULT_ALL_VALUE = '$__all' as const;\n"],"names":["getVariableProject","variable","metadata","project","undefined","DEFAULT_ALL_VALUE"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAyEjC,OAAO,SAASA,mBAAmBC,QAAkB;IACnD,OAAO,aAAaA,SAASC,QAAQ,GAAGD,SAASC,QAAQ,CAACC,OAAO,GAAGC;AACtE;AAEA,OAAO,MAAMC,oBAAoB,SAAkB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Datasource, DatasourceDefinition, DatasourceSpec } from '../model';
|
|
3
|
+
import { PluginSchema } from './plugin';
|
|
4
|
+
export declare const datasourceSpecSchema: z.ZodSchema<DatasourceSpec>;
|
|
5
|
+
export declare function buildDatasourceSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<DatasourceSpec>;
|
|
6
|
+
export declare const datasourceSchema: z.ZodObject<{
|
|
7
|
+
kind: z.ZodLiteral<"Datasource">;
|
|
8
|
+
metadata: z.ZodObject<z.objectUtil.extendShape<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
}, {
|
|
11
|
+
project: z.ZodString;
|
|
12
|
+
}>, "strip", z.ZodTypeAny, {
|
|
13
|
+
project: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}, {
|
|
16
|
+
project: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}>;
|
|
19
|
+
spec: z.ZodType<DatasourceSpec<import("../model").UnknownSpec>, z.ZodTypeDef, DatasourceSpec<import("../model").UnknownSpec>>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
kind: "Datasource";
|
|
22
|
+
spec: DatasourceSpec<import("../model").UnknownSpec>;
|
|
23
|
+
metadata: {
|
|
24
|
+
project: string;
|
|
25
|
+
name: string;
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
kind: "Datasource";
|
|
29
|
+
spec: DatasourceSpec<import("../model").UnknownSpec>;
|
|
30
|
+
metadata: {
|
|
31
|
+
project: string;
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
export declare const globalDatasourceSchema: z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"GlobalDatasource">;
|
|
37
|
+
metadata: z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name: string;
|
|
41
|
+
}, {
|
|
42
|
+
name: string;
|
|
43
|
+
}>;
|
|
44
|
+
spec: z.ZodType<DatasourceSpec<import("../model").UnknownSpec>, z.ZodTypeDef, DatasourceSpec<import("../model").UnknownSpec>>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
kind: "GlobalDatasource";
|
|
47
|
+
spec: DatasourceSpec<import("../model").UnknownSpec>;
|
|
48
|
+
metadata: {
|
|
49
|
+
name: string;
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
kind: "GlobalDatasource";
|
|
53
|
+
spec: DatasourceSpec<import("../model").UnknownSpec>;
|
|
54
|
+
metadata: {
|
|
55
|
+
name: string;
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
export declare const datasourcesSchema: z.Schema<Datasource>;
|
|
59
|
+
export declare const datasourceDefinitionSchema: z.Schema<DatasourceDefinition>;
|
|
60
|
+
export declare function buildDatasourceDefinitionSchema(pluginSchema: PluginSchema): z.Schema<DatasourceDefinition>;
|
|
61
|
+
//# sourceMappingURL=datasource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/schema/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AAGtD,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,SAAS,CAAC,cAAc,CAI3D,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAMjG;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAGjD,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAGpE,CAAC;AAEH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAK1G"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright 2023 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
|
+
import { z } from 'zod';
|
|
14
|
+
import { metadataSchema, projectMetadataSchema } from './metadata';
|
|
15
|
+
import { pluginSchema } from './plugin';
|
|
16
|
+
import { displaySchema } from './display';
|
|
17
|
+
export const datasourceSpecSchema = z.object({
|
|
18
|
+
display: displaySchema.optional(),
|
|
19
|
+
default: z.boolean(),
|
|
20
|
+
plugin: pluginSchema
|
|
21
|
+
});
|
|
22
|
+
export function buildDatasourceSpecSchema(pluginSchema) {
|
|
23
|
+
return z.object({
|
|
24
|
+
display: displaySchema.optional(),
|
|
25
|
+
default: z.boolean(),
|
|
26
|
+
plugin: pluginSchema
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export const datasourceSchema = z.object({
|
|
30
|
+
kind: z.literal('Datasource'),
|
|
31
|
+
metadata: projectMetadataSchema,
|
|
32
|
+
spec: datasourceSpecSchema
|
|
33
|
+
});
|
|
34
|
+
export const globalDatasourceSchema = z.object({
|
|
35
|
+
kind: z.literal('GlobalDatasource'),
|
|
36
|
+
metadata: metadataSchema,
|
|
37
|
+
spec: datasourceSpecSchema
|
|
38
|
+
});
|
|
39
|
+
export const datasourcesSchema = z.discriminatedUnion('kind', [
|
|
40
|
+
datasourceSchema,
|
|
41
|
+
globalDatasourceSchema
|
|
42
|
+
]);
|
|
43
|
+
export const datasourceDefinitionSchema = z.object({
|
|
44
|
+
name: z.string().min(1),
|
|
45
|
+
spec: datasourceSpecSchema
|
|
46
|
+
});
|
|
47
|
+
export function buildDatasourceDefinitionSchema(pluginSchema) {
|
|
48
|
+
return z.object({
|
|
49
|
+
name: z.string().min(1),
|
|
50
|
+
spec: buildDatasourceSpecSchema(pluginSchema)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=datasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/datasource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport { Datasource, DatasourceDefinition, DatasourceSpec } from '../model';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\nimport { PluginSchema, pluginSchema } from './plugin';\nimport { displaySchema } from './display';\n\nexport const datasourceSpecSchema: z.ZodSchema<DatasourceSpec> = z.object({\n display: displaySchema.optional(),\n default: z.boolean(),\n plugin: pluginSchema,\n});\n\nexport function buildDatasourceSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<DatasourceSpec> {\n return z.object({\n display: displaySchema.optional(),\n default: z.boolean(),\n plugin: pluginSchema,\n });\n}\n\nexport const datasourceSchema = z.object({\n kind: z.literal('Datasource'),\n metadata: projectMetadataSchema,\n spec: datasourceSpecSchema,\n});\n\nexport const globalDatasourceSchema = z.object({\n kind: z.literal('GlobalDatasource'),\n metadata: metadataSchema,\n spec: datasourceSpecSchema,\n});\n\nexport const datasourcesSchema: z.Schema<Datasource> = z.discriminatedUnion('kind', [\n datasourceSchema,\n globalDatasourceSchema,\n]);\n\nexport const datasourceDefinitionSchema: z.Schema<DatasourceDefinition> = z.object({\n name: z.string().min(1),\n spec: datasourceSpecSchema,\n});\n\nexport function buildDatasourceDefinitionSchema(pluginSchema: PluginSchema): z.Schema<DatasourceDefinition> {\n return z.object({\n name: z.string().min(1),\n spec: buildDatasourceSpecSchema(pluginSchema),\n });\n}\n"],"names":["z","metadataSchema","projectMetadataSchema","pluginSchema","displaySchema","datasourceSpecSchema","object","display","optional","default","boolean","plugin","buildDatasourceSpecSchema","datasourceSchema","kind","literal","metadata","spec","globalDatasourceSchema","datasourcesSchema","discriminatedUnion","datasourceDefinitionSchema","name","string","min","buildDatasourceDefinitionSchema"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AACnE,SAAuBC,YAAY,QAAQ,WAAW;AACtD,SAASC,aAAa,QAAQ,YAAY;AAE1C,OAAO,MAAMC,uBAAoDL,EAAEM,MAAM,CAAC;IACxEC,SAASH,cAAcI,QAAQ;IAC/BC,SAAST,EAAEU,OAAO;IAClBC,QAAQR;AACV,GAAG;AAEH,OAAO,SAASS,0BAA0BT,YAA0B;IAClE,OAAOH,EAAEM,MAAM,CAAC;QACdC,SAASH,cAAcI,QAAQ;QAC/BC,SAAST,EAAEU,OAAO;QAClBC,QAAQR;IACV;AACF;AAEA,OAAO,MAAMU,mBAAmBb,EAAEM,MAAM,CAAC;IACvCQ,MAAMd,EAAEe,OAAO,CAAC;IAChBC,UAAUd;IACVe,MAAMZ;AACR,GAAG;AAEH,OAAO,MAAMa,yBAAyBlB,EAAEM,MAAM,CAAC;IAC7CQ,MAAMd,EAAEe,OAAO,CAAC;IAChBC,UAAUf;IACVgB,MAAMZ;AACR,GAAG;AAEH,OAAO,MAAMc,oBAA0CnB,EAAEoB,kBAAkB,CAAC,QAAQ;IAClFP;IACAK;CACD,EAAE;AAEH,OAAO,MAAMG,6BAA6DrB,EAAEM,MAAM,CAAC;IACjFgB,MAAMtB,EAAEuB,MAAM,GAAGC,GAAG,CAAC;IACrBP,MAAMZ;AACR,GAAG;AAEH,OAAO,SAASoB,gCAAgCtB,YAA0B;IACxE,OAAOH,EAAEM,MAAM,CAAC;QACdgB,MAAMtB,EAAEuB,MAAM,GAAGC,GAAG,CAAC;QACrBP,MAAML,0BAA0BT;IAClC;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const displaySchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodOptional<z.ZodString>;
|
|
4
|
+
description: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
description?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/schema/display.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;EAGxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { z } from 'zod';
|
|
14
|
+
export const displaySchema = z.object({
|
|
15
|
+
name: z.string().optional(),
|
|
16
|
+
description: z.string().optional()
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/display.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\n\nexport const displaySchema = z.object({\n name: z.string().optional(),\n description: z.string().optional(),\n});\n"],"names":["z","displaySchema","object","name","string","optional","description"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,gBAAgBD,EAAEE,MAAM,CAAC;IACpCC,MAAMH,EAAEI,MAAM,GAAGC,QAAQ;IACzBC,aAAaN,EAAEI,MAAM,GAAGC,QAAQ;AAClC,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/schema/duration.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,wBAAwB,aAGsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { z } from 'zod';
|
|
14
|
+
import { DURATION_REGEX } from '../model';
|
|
15
|
+
export const durationValidationSchema = z.string().min(1, 'Required').regex(DURATION_REGEX, 'Must be a valid duration string');
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/duration.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport { DURATION_REGEX } from '../model';\n\nexport const durationValidationSchema = z\n .string()\n .min(1, 'Required')\n .regex(DURATION_REGEX, 'Must be a valid duration string');\n"],"names":["z","DURATION_REGEX","durationValidationSchema","string","min","regex"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AACxB,SAASC,cAAc,QAAQ,WAAW;AAE1C,OAAO,MAAMC,2BAA2BF,EACrCG,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,KAAK,CAACJ,gBAAgB,mCAAmC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './datasource';
|
|
2
|
+
export * from './display';
|
|
3
|
+
export * from './duration';
|
|
4
|
+
export * from './metadata';
|
|
5
|
+
export * from './panel';
|
|
6
|
+
export * from './plugin';
|
|
7
|
+
export * from './role';
|
|
8
|
+
export * from './rolebinding';
|
|
9
|
+
export * from './secret';
|
|
10
|
+
export * from './user';
|
|
11
|
+
export * from './variable';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
export * from './datasource';
|
|
14
|
+
export * from './display';
|
|
15
|
+
export * from './duration';
|
|
16
|
+
export * from './metadata';
|
|
17
|
+
export * from './panel';
|
|
18
|
+
export * from './plugin';
|
|
19
|
+
export * from './role';
|
|
20
|
+
export * from './rolebinding';
|
|
21
|
+
export * from './secret';
|
|
22
|
+
export * from './user';
|
|
23
|
+
export * from './variable';
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './display';\nexport * from './duration';\nexport * from './metadata';\nexport * from './panel';\nexport * from './plugin';\nexport * from './role';\nexport * from './rolebinding';\nexport * from './secret';\nexport * from './user';\nexport * from './variable';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const nameSchema: z.ZodString;
|
|
3
|
+
export declare const metadataSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
name: string;
|
|
7
|
+
}, {
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const projectMetadataSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
}, {
|
|
13
|
+
project: z.ZodString;
|
|
14
|
+
}>, "strip", z.ZodTypeAny, {
|
|
15
|
+
project: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}, {
|
|
18
|
+
project: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/schema/metadata.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU,aAImF,CAAC;AAE3G,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;EAEhC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { z } from 'zod';
|
|
14
|
+
export const nameSchema = z.string().min(1, 'Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
|
|
15
|
+
export const metadataSchema = z.object({
|
|
16
|
+
name: nameSchema
|
|
17
|
+
});
|
|
18
|
+
export const projectMetadataSchema = metadataSchema.extend({
|
|
19
|
+
project: nameSchema
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/metadata.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\n\nexport const nameSchema = z\n .string()\n .min(1, 'Required')\n .max(75, 'Must be 75 or fewer characters long')\n .regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');\n\nexport const metadataSchema = z.object({\n name: nameSchema,\n});\n\nexport const projectMetadataSchema = metadataSchema.extend({\n project: nameSchema,\n});\n"],"names":["z","nameSchema","string","min","max","regex","metadataSchema","object","name","projectMetadataSchema","extend","project"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,aAAaD,EACvBE,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E;AAE3G,OAAO,MAAMC,iBAAiBN,EAAEO,MAAM,CAAC;IACrCC,MAAMP;AACR,GAAG;AAEH,OAAO,MAAMQ,wBAAwBH,eAAeI,MAAM,CAAC;IACzDC,SAASV;AACX,GAAG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Link, PanelDefinition, PanelDisplay, PanelEditorValues, PanelSpec, QueryDefinition } from '../model';
|
|
3
|
+
import { PluginSchema } from './plugin';
|
|
4
|
+
export declare const panelDisplaySpec: z.ZodSchema<PanelDisplay>;
|
|
5
|
+
export declare const querySpecSchema: z.ZodSchema<QueryDefinition>;
|
|
6
|
+
export declare const linkSchema: z.ZodSchema<Link>;
|
|
7
|
+
export declare const panelSpecSchema: z.ZodSchema<PanelSpec>;
|
|
8
|
+
export declare function buildPanelSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelSpec>;
|
|
9
|
+
export declare const panelDefinitionSchema: z.ZodSchema<PanelDefinition>;
|
|
10
|
+
export declare function buildPanelDefinitionSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelDefinition>;
|
|
11
|
+
export declare const panelEditorSchema: z.ZodSchema<PanelEditorValues>;
|
|
12
|
+
export declare function buildPanelEditorSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelEditorValues>;
|
|
13
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/schema/panel.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AAEtD,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY,CAGrD,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC,eAAe,CAKvD,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAMvC,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,CAKjD,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAOvF;AAED,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,SAAS,CAAC,eAAe,CAG7D,CAAC;AAEH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAKnG;AAED,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAG3D,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAKjG"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { z } from 'zod';
|
|
14
|
+
import { pluginSchema } from './plugin';
|
|
15
|
+
export const panelDisplaySpec = z.object({
|
|
16
|
+
name: z.string().min(1, {
|
|
17
|
+
message: 'Required'
|
|
18
|
+
}),
|
|
19
|
+
description: z.string().optional()
|
|
20
|
+
});
|
|
21
|
+
export const querySpecSchema = z.object({
|
|
22
|
+
kind: z.string().min(1),
|
|
23
|
+
spec: z.object({
|
|
24
|
+
plugin: pluginSchema
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
export const linkSchema = z.object({
|
|
28
|
+
name: z.string().optional(),
|
|
29
|
+
url: z.string().min(1),
|
|
30
|
+
tooltip: z.string().optional(),
|
|
31
|
+
renderVariables: z.boolean().optional(),
|
|
32
|
+
targetBlank: z.boolean().optional()
|
|
33
|
+
});
|
|
34
|
+
export const panelSpecSchema = z.object({
|
|
35
|
+
display: panelDisplaySpec,
|
|
36
|
+
plugin: pluginSchema,
|
|
37
|
+
queries: z.array(querySpecSchema).optional(),
|
|
38
|
+
links: z.array(linkSchema).optional()
|
|
39
|
+
});
|
|
40
|
+
export function buildPanelSpecSchema(pluginSchema) {
|
|
41
|
+
return z.object({
|
|
42
|
+
display: panelDisplaySpec,
|
|
43
|
+
plugin: pluginSchema,
|
|
44
|
+
queries: z.array(querySpecSchema).optional(),
|
|
45
|
+
links: z.array(linkSchema).optional()
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export const panelDefinitionSchema = z.object({
|
|
49
|
+
kind: z.literal('Panel'),
|
|
50
|
+
spec: panelSpecSchema
|
|
51
|
+
});
|
|
52
|
+
export function buildPanelDefinitionSchema(pluginSchema) {
|
|
53
|
+
return z.object({
|
|
54
|
+
kind: z.literal('Panel'),
|
|
55
|
+
spec: buildPanelSpecSchema(pluginSchema)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export const panelEditorSchema = z.object({
|
|
59
|
+
groupId: z.number(),
|
|
60
|
+
panelDefinition: panelDefinitionSchema
|
|
61
|
+
});
|
|
62
|
+
export function buildPanelEditorSchema(pluginSchema) {
|
|
63
|
+
return z.object({
|
|
64
|
+
groupId: z.number(),
|
|
65
|
+
panelDefinition: buildPanelDefinitionSchema(pluginSchema)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/panel.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport { Link, PanelDefinition, PanelDisplay, PanelEditorValues, PanelSpec, QueryDefinition } from '../model';\nimport { PluginSchema, pluginSchema } from './plugin';\n\nexport const panelDisplaySpec: z.ZodSchema<PanelDisplay> = z.object({\n name: z.string().min(1, { message: 'Required' }),\n description: z.string().optional(),\n});\n\nexport const querySpecSchema: z.ZodSchema<QueryDefinition> = z.object({\n kind: z.string().min(1),\n spec: z.object({\n plugin: pluginSchema,\n }),\n});\n\nexport const linkSchema: z.ZodSchema<Link> = z.object({\n name: z.string().optional(),\n url: z.string().min(1),\n tooltip: z.string().optional(),\n renderVariables: z.boolean().optional(),\n targetBlank: z.boolean().optional(),\n});\n\nexport const panelSpecSchema: z.ZodSchema<PanelSpec> = z.object({\n display: panelDisplaySpec,\n plugin: pluginSchema,\n queries: z.array(querySpecSchema).optional(),\n links: z.array(linkSchema).optional(),\n});\n\nexport function buildPanelSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelSpec> {\n return z.object({\n display: panelDisplaySpec,\n plugin: pluginSchema,\n queries: z.array(querySpecSchema).optional(),\n links: z.array(linkSchema).optional(),\n });\n}\n\nexport const panelDefinitionSchema: z.ZodSchema<PanelDefinition> = z.object({\n kind: z.literal('Panel'),\n spec: panelSpecSchema,\n});\n\nexport function buildPanelDefinitionSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelDefinition> {\n return z.object({\n kind: z.literal('Panel'),\n spec: buildPanelSpecSchema(pluginSchema),\n });\n}\n\nexport const panelEditorSchema: z.ZodSchema<PanelEditorValues> = z.object({\n groupId: z.number(),\n panelDefinition: panelDefinitionSchema,\n});\n\nexport function buildPanelEditorSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelEditorValues> {\n return z.object({\n groupId: z.number(),\n panelDefinition: buildPanelDefinitionSchema(pluginSchema),\n });\n}\n"],"names":["z","pluginSchema","panelDisplaySpec","object","name","string","min","message","description","optional","querySpecSchema","kind","spec","plugin","linkSchema","url","tooltip","renderVariables","boolean","targetBlank","panelSpecSchema","display","queries","array","links","buildPanelSpecSchema","panelDefinitionSchema","literal","buildPanelDefinitionSchema","panelEditorSchema","groupId","number","panelDefinition","buildPanelEditorSchema"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AAExB,SAAuBC,YAAY,QAAQ,WAAW;AAEtD,OAAO,MAAMC,mBAA8CF,EAAEG,MAAM,CAAC;IAClEC,MAAMJ,EAAEK,MAAM,GAAGC,GAAG,CAAC,GAAG;QAAEC,SAAS;IAAW;IAC9CC,aAAaR,EAAEK,MAAM,GAAGI,QAAQ;AAClC,GAAG;AAEH,OAAO,MAAMC,kBAAgDV,EAAEG,MAAM,CAAC;IACpEQ,MAAMX,EAAEK,MAAM,GAAGC,GAAG,CAAC;IACrBM,MAAMZ,EAAEG,MAAM,CAAC;QACbU,QAAQZ;IACV;AACF,GAAG;AAEH,OAAO,MAAMa,aAAgCd,EAAEG,MAAM,CAAC;IACpDC,MAAMJ,EAAEK,MAAM,GAAGI,QAAQ;IACzBM,KAAKf,EAAEK,MAAM,GAAGC,GAAG,CAAC;IACpBU,SAAShB,EAAEK,MAAM,GAAGI,QAAQ;IAC5BQ,iBAAiBjB,EAAEkB,OAAO,GAAGT,QAAQ;IACrCU,aAAanB,EAAEkB,OAAO,GAAGT,QAAQ;AACnC,GAAG;AAEH,OAAO,MAAMW,kBAA0CpB,EAAEG,MAAM,CAAC;IAC9DkB,SAASnB;IACTW,QAAQZ;IACRqB,SAAStB,EAAEuB,KAAK,CAACb,iBAAiBD,QAAQ;IAC1Ce,OAAOxB,EAAEuB,KAAK,CAACT,YAAYL,QAAQ;AACrC,GAAG;AAEH,OAAO,SAASgB,qBAAqBxB,YAA0B;IAC7D,OAAOD,EAAEG,MAAM,CAAC;QACdkB,SAASnB;QACTW,QAAQZ;QACRqB,SAAStB,EAAEuB,KAAK,CAACb,iBAAiBD,QAAQ;QAC1Ce,OAAOxB,EAAEuB,KAAK,CAACT,YAAYL,QAAQ;IACrC;AACF;AAEA,OAAO,MAAMiB,wBAAsD1B,EAAEG,MAAM,CAAC;IAC1EQ,MAAMX,EAAE2B,OAAO,CAAC;IAChBf,MAAMQ;AACR,GAAG;AAEH,OAAO,SAASQ,2BAA2B3B,YAA0B;IACnE,OAAOD,EAAEG,MAAM,CAAC;QACdQ,MAAMX,EAAE2B,OAAO,CAAC;QAChBf,MAAMa,qBAAqBxB;IAC7B;AACF;AAEA,OAAO,MAAM4B,oBAAoD7B,EAAEG,MAAM,CAAC;IACxE2B,SAAS9B,EAAE+B,MAAM;IACjBC,iBAAiBN;AACnB,GAAG;AAEH,OAAO,SAASO,uBAAuBhC,YAA0B;IAC/D,OAAOD,EAAEG,MAAM,CAAC;QACd2B,SAAS9B,EAAE+B,MAAM;QACjBC,iBAAiBJ,2BAA2B3B;IAC9C;AACF"}
|