@perses-dev/plugin-system 0.42.1 → 0.43.0-rc1
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/components/DatasourceEditorForm/DatasourceEditorForm.js +7 -9
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +217 -147
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
- package/dist/cjs/validation/index.js +1 -0
- package/dist/cjs/validation/role.js +4 -4
- package/dist/cjs/validation/rolebinding.js +7 -7
- package/dist/cjs/validation/secret.js +176 -0
- package/dist/cjs/validation/variable.js +23 -4
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +7 -9
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +218 -148
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +8 -21
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/role.d.ts +24 -24
- package/dist/validation/role.js +1 -1
- package/dist/validation/role.js.map +1 -1
- package/dist/validation/rolebinding.js +1 -1
- package/dist/validation/rolebinding.js.map +1 -1
- package/dist/validation/secret.d.ts +964 -0
- package/dist/validation/secret.d.ts.map +1 -0
- package/dist/validation/secret.js +157 -0
- package/dist/validation/secret.js.map +1 -0
- package/dist/validation/variable.d.ts +82 -5
- package/dist/validation/variable.d.ts.map +1 -1
- package/dist/validation/variable.js +21 -2
- package/dist/validation/variable.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/validation/secret.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmHxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMvC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGxC,CAAC;AAEH,oBAAY,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
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 { resourceIdValidationSchema } from './resource';
|
|
15
|
+
const secretSpecSchema = z.object({
|
|
16
|
+
basicAuth: z.object({
|
|
17
|
+
username: z.string().min(1),
|
|
18
|
+
password: z.string().optional(),
|
|
19
|
+
passwordFile: z.string().optional()
|
|
20
|
+
}).superRefine((val, ctx)=>{
|
|
21
|
+
if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {
|
|
22
|
+
ctx.addIssue({
|
|
23
|
+
code: z.ZodIssueCode.custom,
|
|
24
|
+
message: 'Only one of the fields must be defined',
|
|
25
|
+
path: [
|
|
26
|
+
'password'
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
ctx.addIssue({
|
|
30
|
+
code: z.ZodIssueCode.custom,
|
|
31
|
+
message: 'Only one of the fields must be defined',
|
|
32
|
+
path: [
|
|
33
|
+
'passwordFile'
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}).optional(),
|
|
38
|
+
authorization: z.object({
|
|
39
|
+
type: z.string().optional(),
|
|
40
|
+
credentials: z.string().optional(),
|
|
41
|
+
credentialsFile: z.string().optional()
|
|
42
|
+
}).superRefine((val, ctx)=>{
|
|
43
|
+
if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {
|
|
44
|
+
ctx.addIssue({
|
|
45
|
+
code: z.ZodIssueCode.custom,
|
|
46
|
+
message: 'Only one of the fields must be defined',
|
|
47
|
+
path: [
|
|
48
|
+
'credentials'
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
ctx.addIssue({
|
|
52
|
+
code: z.ZodIssueCode.custom,
|
|
53
|
+
message: 'Only one of the fields must be defined',
|
|
54
|
+
path: [
|
|
55
|
+
'credentialsFile'
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}).optional(),
|
|
60
|
+
tlsConfig: z.object({
|
|
61
|
+
ca: z.string().optional(),
|
|
62
|
+
cert: z.string().optional(),
|
|
63
|
+
key: z.string().optional(),
|
|
64
|
+
caFile: z.string().optional(),
|
|
65
|
+
certFile: z.string().optional(),
|
|
66
|
+
keyFile: z.string().optional(),
|
|
67
|
+
serverName: z.string().optional(),
|
|
68
|
+
insecureSkipVerify: z.boolean()
|
|
69
|
+
}).superRefine((val, ctx)=>{
|
|
70
|
+
if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: z.ZodIssueCode.custom,
|
|
73
|
+
message: 'Only one of the fields must be defined',
|
|
74
|
+
path: [
|
|
75
|
+
'ca'
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: z.ZodIssueCode.custom,
|
|
80
|
+
message: 'Only one of the fields must be defined',
|
|
81
|
+
path: [
|
|
82
|
+
'caFile'
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {
|
|
87
|
+
ctx.addIssue({
|
|
88
|
+
code: z.ZodIssueCode.custom,
|
|
89
|
+
message: 'Only one of the fields must be defined',
|
|
90
|
+
path: [
|
|
91
|
+
'cert'
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
ctx.addIssue({
|
|
95
|
+
code: z.ZodIssueCode.custom,
|
|
96
|
+
message: 'Only one of the fields must be defined',
|
|
97
|
+
path: [
|
|
98
|
+
'certFile'
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {
|
|
103
|
+
ctx.addIssue({
|
|
104
|
+
code: z.ZodIssueCode.custom,
|
|
105
|
+
message: 'Only one of the fields must be defined',
|
|
106
|
+
path: [
|
|
107
|
+
'key'
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
ctx.addIssue({
|
|
111
|
+
code: z.ZodIssueCode.custom,
|
|
112
|
+
message: 'Only one of the fields must be defined',
|
|
113
|
+
path: [
|
|
114
|
+
'keyFile'
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}).optional()
|
|
119
|
+
}).superRefine((val, ctx)=>{
|
|
120
|
+
if (val.basicAuth && val.authorization) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
code: z.ZodIssueCode.custom,
|
|
123
|
+
message: 'Only one of the fields must be defined',
|
|
124
|
+
path: [
|
|
125
|
+
'basicAuth'
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
ctx.addIssue({
|
|
129
|
+
code: z.ZodIssueCode.custom,
|
|
130
|
+
message: 'Only one of the fields must be defined',
|
|
131
|
+
path: [
|
|
132
|
+
'authorization'
|
|
133
|
+
]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
export const secretValidationSchema = z.object({
|
|
138
|
+
kind: z.literal('Secret'),
|
|
139
|
+
metadata: z.object({
|
|
140
|
+
name: resourceIdValidationSchema,
|
|
141
|
+
project: resourceIdValidationSchema
|
|
142
|
+
}),
|
|
143
|
+
spec: secretSpecSchema
|
|
144
|
+
});
|
|
145
|
+
export const globalSecretValidationSchema = z.object({
|
|
146
|
+
kind: z.literal('GlobalSecret'),
|
|
147
|
+
metadata: z.object({
|
|
148
|
+
name: resourceIdValidationSchema
|
|
149
|
+
}),
|
|
150
|
+
spec: secretSpecSchema
|
|
151
|
+
});
|
|
152
|
+
export const secretsEditorValidationSchema = z.discriminatedUnion('kind', [
|
|
153
|
+
secretValidationSchema,
|
|
154
|
+
globalSecretValidationSchema
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=secret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/validation/secret.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 { resourceIdValidationSchema } from './resource';\n\nconst secretSpecSchema = z\n .object({\n basicAuth: z\n .object({\n username: z.string().min(1),\n password: z.string().optional(),\n passwordFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['password'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['passwordFile'],\n });\n }\n })\n .optional(),\n authorization: z\n .object({\n type: z.string().optional(),\n credentials: z.string().optional(),\n credentialsFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentials'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentialsFile'],\n });\n }\n })\n .optional(),\n tlsConfig: z\n .object({\n ca: z.string().optional(),\n cert: z.string().optional(),\n key: z.string().optional(),\n caFile: z.string().optional(),\n certFile: z.string().optional(),\n keyFile: z.string().optional(),\n serverName: z.string().optional(),\n insecureSkipVerify: z.boolean(),\n })\n .superRefine((val, ctx) => {\n if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['ca'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['caFile'],\n });\n }\n\n if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['cert'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['certFile'],\n });\n }\n\n if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['key'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['keyFile'],\n });\n }\n })\n .optional(),\n })\n .superRefine((val, ctx) => {\n if (val.basicAuth && val.authorization) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['basicAuth'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['authorization'],\n });\n }\n });\n\nexport const secretValidationSchema = z.object({\n kind: z.literal('Secret'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n project: resourceIdValidationSchema,\n }),\n spec: secretSpecSchema,\n});\n\nexport const globalSecretValidationSchema = z.object({\n kind: z.literal('GlobalSecret'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n }),\n spec: secretSpecSchema,\n});\n\nexport const secretsEditorValidationSchema = z.discriminatedUnion('kind', [\n secretValidationSchema,\n globalSecretValidationSchema,\n]);\n\nexport type SecretsEditorValidationType = z.infer<typeof secretsEditorValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","secretSpecSchema","object","basicAuth","username","string","min","password","optional","passwordFile","superRefine","val","ctx","length","addIssue","code","ZodIssueCode","custom","message","path","authorization","type","credentials","credentialsFile","tlsConfig","ca","cert","key","caFile","certFile","keyFile","serverName","insecureSkipVerify","boolean","secretValidationSchema","kind","literal","metadata","name","project","spec","globalSecretValidationSchema","secretsEditorValidationSchema","discriminatedUnion"],"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,0BAA0B,QAAQ,aAAa;AAExD,MAAMC,mBAAmBF,EACtBG,OAAO;IACNC,WAAWJ,EACRG,OAAO;QACNE,UAAUL,EAAEM,SAASC,IAAI;QACzBC,UAAUR,EAAEM,SAASG;QACrBC,cAAcV,EAAEM,SAASG;IAC3B,GACCE,YAAY,CAACC,K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AA+B1C,EAAEG,OAAO;IACnDiC,MAAMpC,EAAEqC,QAAQ;IAChBC,UAAUtC,EAAEG,OAAO;QACjBoC,MAAMtC;IACR;IACAwC,MAAMvC;AACR,GAAG;AAEH,OAAO,MAAMyC,gCAAgC3C,EAAE4C,mBAAmB,QAAQ;IACxET;IACAO;CACD,EAAE"}
|
|
@@ -1,19 +1,96 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const variableEditorValidationSchema: z.ZodObject<{
|
|
3
3
|
name: z.ZodEffects<z.ZodString, string, string>;
|
|
4
4
|
title: z.ZodOptional<z.ZodString>;
|
|
5
5
|
description: z.ZodOptional<z.ZodString>;
|
|
6
|
-
kind: z.
|
|
6
|
+
kind: z.ZodEnum<["TextVariable", "ListVariable", "BuiltinVariable"]>;
|
|
7
|
+
textVariableFields: z.ZodObject<{
|
|
8
|
+
value: z.ZodString;
|
|
9
|
+
constant: z.ZodBoolean;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
value: string;
|
|
12
|
+
constant: boolean;
|
|
13
|
+
}, {
|
|
14
|
+
value: string;
|
|
15
|
+
constant: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
listVariableFields: z.ZodObject<{
|
|
18
|
+
allowMultiple: z.ZodBoolean;
|
|
19
|
+
allowAllValue: z.ZodBoolean;
|
|
20
|
+
customAllValue: z.ZodOptional<z.ZodString>;
|
|
21
|
+
capturingRegexp: z.ZodOptional<z.ZodString>;
|
|
22
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
23
|
+
plugin: z.ZodObject<{
|
|
24
|
+
kind: z.ZodString;
|
|
25
|
+
spec: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
kind: string;
|
|
28
|
+
spec: {};
|
|
29
|
+
}, {
|
|
30
|
+
kind: string;
|
|
31
|
+
spec: {};
|
|
32
|
+
}>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
plugin: {
|
|
35
|
+
kind: string;
|
|
36
|
+
spec: {};
|
|
37
|
+
};
|
|
38
|
+
allowMultiple: boolean;
|
|
39
|
+
allowAllValue: boolean;
|
|
40
|
+
customAllValue?: string | undefined;
|
|
41
|
+
capturingRegexp?: string | undefined;
|
|
42
|
+
sort?: string | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
plugin: {
|
|
45
|
+
kind: string;
|
|
46
|
+
spec: {};
|
|
47
|
+
};
|
|
48
|
+
allowMultiple: boolean;
|
|
49
|
+
allowAllValue: boolean;
|
|
50
|
+
customAllValue?: string | undefined;
|
|
51
|
+
capturingRegexp?: string | undefined;
|
|
52
|
+
sort?: string | undefined;
|
|
53
|
+
}>;
|
|
7
54
|
}, "strip", z.ZodTypeAny, {
|
|
8
55
|
name: string;
|
|
9
|
-
kind:
|
|
56
|
+
kind: "TextVariable" | "ListVariable" | "BuiltinVariable";
|
|
57
|
+
textVariableFields: {
|
|
58
|
+
value: string;
|
|
59
|
+
constant: boolean;
|
|
60
|
+
};
|
|
61
|
+
listVariableFields: {
|
|
62
|
+
plugin: {
|
|
63
|
+
kind: string;
|
|
64
|
+
spec: {};
|
|
65
|
+
};
|
|
66
|
+
allowMultiple: boolean;
|
|
67
|
+
allowAllValue: boolean;
|
|
68
|
+
customAllValue?: string | undefined;
|
|
69
|
+
capturingRegexp?: string | undefined;
|
|
70
|
+
sort?: string | undefined;
|
|
71
|
+
};
|
|
10
72
|
title?: string | undefined;
|
|
11
73
|
description?: string | undefined;
|
|
12
74
|
}, {
|
|
13
75
|
name: string;
|
|
14
|
-
kind:
|
|
76
|
+
kind: "TextVariable" | "ListVariable" | "BuiltinVariable";
|
|
77
|
+
textVariableFields: {
|
|
78
|
+
value: string;
|
|
79
|
+
constant: boolean;
|
|
80
|
+
};
|
|
81
|
+
listVariableFields: {
|
|
82
|
+
plugin: {
|
|
83
|
+
kind: string;
|
|
84
|
+
spec: {};
|
|
85
|
+
};
|
|
86
|
+
allowMultiple: boolean;
|
|
87
|
+
allowAllValue: boolean;
|
|
88
|
+
customAllValue?: string | undefined;
|
|
89
|
+
capturingRegexp?: string | undefined;
|
|
90
|
+
sort?: string | undefined;
|
|
91
|
+
};
|
|
15
92
|
title?: string | undefined;
|
|
16
93
|
description?: string | undefined;
|
|
17
94
|
}>;
|
|
18
|
-
export declare type
|
|
95
|
+
export declare type VariableEditorValidationType = z.infer<typeof variableEditorValidationSchema>;
|
|
19
96
|
//# sourceMappingURL=variable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/validation/variable.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/validation/variable.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBzC,CAAC;AAEH,oBAAY,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -11,11 +11,30 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { z } from 'zod';
|
|
14
|
-
export const
|
|
14
|
+
export const variableEditorValidationSchema = z.object({
|
|
15
15
|
name: z.string().nonempty('Required').regex(/^\w+$/, 'Must only contains alphanumerical characters and underscores').refine((val)=>!val.startsWith('__'), '__ prefix is reserved to builtin variables'),
|
|
16
16
|
title: z.string().optional(),
|
|
17
17
|
description: z.string().optional(),
|
|
18
|
-
kind: z.
|
|
18
|
+
kind: z.enum([
|
|
19
|
+
'TextVariable',
|
|
20
|
+
'ListVariable',
|
|
21
|
+
'BuiltinVariable'
|
|
22
|
+
]),
|
|
23
|
+
textVariableFields: z.object({
|
|
24
|
+
value: z.string(),
|
|
25
|
+
constant: z.boolean()
|
|
26
|
+
}),
|
|
27
|
+
listVariableFields: z.object({
|
|
28
|
+
allowMultiple: z.boolean(),
|
|
29
|
+
allowAllValue: z.boolean(),
|
|
30
|
+
customAllValue: z.string().optional(),
|
|
31
|
+
capturingRegexp: z.string().optional(),
|
|
32
|
+
sort: z.string().optional(),
|
|
33
|
+
plugin: z.object({
|
|
34
|
+
kind: z.string(),
|
|
35
|
+
spec: z.object({})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
19
38
|
});
|
|
20
39
|
|
|
21
40
|
//# sourceMappingURL=variable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validation/variable.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';\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../../src/validation/variable.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';\n\nexport const variableEditorValidationSchema = z.object({\n name: z\n .string()\n .nonempty('Required')\n .regex(/^\\w+$/, 'Must only contains alphanumerical characters and underscores')\n .refine((val) => !val.startsWith('__'), '__ prefix is reserved to builtin variables'),\n title: z.string().optional(),\n description: z.string().optional(),\n kind: z.enum(['TextVariable', 'ListVariable', 'BuiltinVariable']),\n textVariableFields: z.object({\n value: z.string(),\n constant: z.boolean(),\n }),\n listVariableFields: z.object({\n allowMultiple: z.boolean(),\n allowAllValue: z.boolean(),\n customAllValue: z.string().optional(),\n capturingRegexp: z.string().optional(),\n sort: z.string().optional(),\n plugin: z.object({\n kind: z.string(),\n spec: z.object({}),\n }),\n }),\n});\n\nexport type VariableEditorValidationType = z.infer<typeof variableEditorValidationSchema>;\n"],"names":["z","variableEditorValidationSchema","object","name","string","nonempty","regex","refine","val","startsWith","title","optional","description","kind","enum","textVariableFields","value","constant","boolean","listVariableFields","allowMultiple","allowAllValue","customAllValue","capturingRegexp","sort","plugin","spec"],"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,iCAAiCD,EAAEE,OAAO;IACrDC,MAAMH,EACHI,SACAC,SAAS,YACTC,MAAM,SAAS,gEACfC,OAAO,CAACC,MAAQ,CAACA,IAAIC,WAAW,OAAO;IAC1CC,OAAOV,EAAEI,SAASO;IAClBC,aAAaZ,EAAEI,SAASO;IACxBE,MAAMb,EAAEc,KAAK;QAAC;QAAgB;QAAgB;KAAkB;IAChEC,oBAAoBf,EAAEE,OAAO;QAC3Bc,OAAOhB,EAAEI;QACTa,UAAUjB,EAAEkB;IACd;IACAC,oBAAoBnB,EAAEE,OAAO;QAC3BkB,eAAepB,EAAEkB;QACjBG,eAAerB,EAAEkB;QACjBI,gBAAgBtB,EAAEI,SAASO;QAC3BY,iBAAiBvB,EAAEI,SAASO;QAC5Ba,MAAMxB,EAAEI,SAASO;QACjBc,QAAQzB,EAAEE,OAAO;YACfW,MAAMb,EAAEI;YACRsB,MAAM1B,EAAEE,OAAO,CAAC;QAClB;IACF;AACF,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0-rc1",
|
|
4
4
|
"description": "The plugin feature in Pereses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@perses-dev/components": "0.
|
|
32
|
-
"@perses-dev/core": "0.
|
|
31
|
+
"@perses-dev/components": "0.43.0-rc1",
|
|
32
|
+
"@perses-dev/core": "0.43.0-rc1",
|
|
33
33
|
"date-fns": "^2.30.0",
|
|
34
34
|
"immer": "^9.0.15",
|
|
35
35
|
"react-hook-form": "^7.46.1",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"zod": "^3.22.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@perses-dev/storybook": "0.
|
|
41
|
+
"@perses-dev/storybook": "0.43.0-rc1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@mui/material": "^5.10.0",
|