@perses-dev/core 0.46.0 → 0.47.0

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.
Files changed (106) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/model/index.js +1 -0
  3. package/dist/cjs/model/resource.js +14 -3
  4. package/dist/cjs/model/time.js +2 -2
  5. package/dist/cjs/model/trace-data.js +29 -1
  6. package/dist/cjs/model/user.js +16 -0
  7. package/dist/cjs/schema/datasource.js +85 -0
  8. package/dist/cjs/schema/display.js +27 -0
  9. package/dist/cjs/schema/duration.js +25 -0
  10. package/dist/cjs/schema/index.js +40 -0
  11. package/dist/cjs/schema/metadata.js +41 -0
  12. package/dist/cjs/schema/panel.js +104 -0
  13. package/dist/cjs/schema/plugin.js +27 -0
  14. package/dist/cjs/schema/role.js +86 -0
  15. package/dist/cjs/schema/rolebinding.js +65 -0
  16. package/dist/cjs/schema/secret.js +174 -0
  17. package/dist/cjs/schema/user.js +57 -0
  18. package/dist/cjs/schema/variable.js +171 -0
  19. package/dist/cjs/utils/fetch.js +12 -5
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/model/calculations.d.ts +1 -1
  25. package/dist/model/calculations.d.ts.map +1 -1
  26. package/dist/model/calculations.js.map +1 -1
  27. package/dist/model/datasource.d.ts +8 -8
  28. package/dist/model/datasource.d.ts.map +1 -1
  29. package/dist/model/datasource.js.map +1 -1
  30. package/dist/model/index.d.ts +1 -0
  31. package/dist/model/index.d.ts.map +1 -1
  32. package/dist/model/index.js +1 -0
  33. package/dist/model/index.js.map +1 -1
  34. package/dist/model/panels.d.ts +9 -1
  35. package/dist/model/panels.d.ts.map +1 -1
  36. package/dist/model/panels.js +1 -1
  37. package/dist/model/panels.js.map +1 -1
  38. package/dist/model/resource.d.ts +1 -0
  39. package/dist/model/resource.d.ts.map +1 -1
  40. package/dist/model/resource.js +3 -0
  41. package/dist/model/resource.js.map +1 -1
  42. package/dist/model/time.js +2 -2
  43. package/dist/model/time.js.map +1 -1
  44. package/dist/model/trace-data.d.ts +80 -7
  45. package/dist/model/trace-data.d.ts.map +1 -1
  46. package/dist/model/trace-data.js +7 -3
  47. package/dist/model/trace-data.js.map +1 -1
  48. package/dist/model/user.d.ts +21 -0
  49. package/dist/model/user.d.ts.map +1 -0
  50. package/dist/model/user.js +15 -0
  51. package/dist/model/user.js.map +1 -0
  52. package/dist/model/variables.d.ts +9 -8
  53. package/dist/model/variables.d.ts.map +1 -1
  54. package/dist/model/variables.js.map +1 -1
  55. package/dist/schema/datasource.d.ts +60 -0
  56. package/dist/schema/datasource.d.ts.map +1 -0
  57. package/dist/schema/datasource.js +54 -0
  58. package/dist/schema/datasource.js.map +1 -0
  59. package/dist/schema/display.d.ts +12 -0
  60. package/dist/schema/display.d.ts.map +1 -0
  61. package/dist/schema/display.js +19 -0
  62. package/dist/schema/display.js.map +1 -0
  63. package/dist/schema/duration.d.ts +3 -0
  64. package/dist/schema/duration.d.ts.map +1 -0
  65. package/dist/schema/duration.js +17 -0
  66. package/dist/schema/duration.js.map +1 -0
  67. package/dist/schema/index.d.ts +12 -0
  68. package/dist/schema/index.d.ts.map +1 -0
  69. package/dist/schema/index.js +25 -0
  70. package/dist/schema/index.js.map +1 -0
  71. package/dist/schema/metadata.d.ts +20 -0
  72. package/dist/schema/metadata.d.ts.map +1 -0
  73. package/dist/schema/metadata.js +22 -0
  74. package/dist/schema/metadata.js.map +1 -0
  75. package/dist/schema/panel.d.ts +13 -0
  76. package/dist/schema/panel.d.ts.map +1 -0
  77. package/dist/schema/panel.js +67 -0
  78. package/dist/schema/panel.js.map +1 -0
  79. package/dist/schema/plugin.d.ts +14 -0
  80. package/dist/schema/plugin.d.ts.map +1 -0
  81. package/dist/schema/plugin.js +19 -0
  82. package/dist/schema/plugin.js.map +1 -0
  83. package/dist/schema/role.d.ts +57 -0
  84. package/dist/schema/role.d.ts.map +1 -0
  85. package/dist/schema/role.js +61 -0
  86. package/dist/schema/role.js.map +1 -0
  87. package/dist/schema/rolebinding.d.ts +57 -0
  88. package/dist/schema/rolebinding.d.ts.map +1 -0
  89. package/dist/schema/rolebinding.js +40 -0
  90. package/dist/schema/rolebinding.js.map +1 -0
  91. package/dist/schema/secret.d.ts +1138 -0
  92. package/dist/schema/secret.d.ts.map +1 -0
  93. package/dist/schema/secret.js +152 -0
  94. package/dist/schema/secret.js.map +1 -0
  95. package/dist/schema/user.d.ts +8 -0
  96. package/dist/schema/user.d.ts.map +1 -0
  97. package/dist/schema/user.js +36 -0
  98. package/dist/schema/user.js.map +1 -0
  99. package/dist/schema/variable.d.ts +90 -0
  100. package/dist/schema/variable.d.ts.map +1 -0
  101. package/dist/schema/variable.js +119 -0
  102. package/dist/schema/variable.js.map +1 -0
  103. package/dist/utils/fetch.d.ts.map +1 -1
  104. package/dist/utils/fetch.js +12 -5
  105. package/dist/utils/fetch.js.map +1 -1
  106. package/package.json +1 -1
@@ -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,20 @@
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<{
11
+ name: z.ZodString;
12
+ project: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ project: string;
15
+ name: string;
16
+ }, {
17
+ project: string;
18
+ name: string;
19
+ }>;
20
+ //# 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,67 @@
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(),
17
+ description: z.string().optional()
18
+ });
19
+ export const querySpecSchema = z.object({
20
+ kind: z.string().min(1),
21
+ spec: z.object({
22
+ plugin: pluginSchema
23
+ })
24
+ });
25
+ export const linkSchema = z.object({
26
+ name: z.string().optional(),
27
+ url: z.string().min(1),
28
+ tooltip: z.string().optional(),
29
+ renderVariables: z.boolean().optional(),
30
+ targetBlank: z.boolean().optional()
31
+ });
32
+ export const panelSpecSchema = z.object({
33
+ display: panelDisplaySpec,
34
+ plugin: pluginSchema,
35
+ queries: z.array(querySpecSchema).optional(),
36
+ links: z.array(linkSchema).optional()
37
+ });
38
+ export function buildPanelSpecSchema(pluginSchema) {
39
+ return z.object({
40
+ display: panelDisplaySpec,
41
+ plugin: pluginSchema,
42
+ queries: z.array(querySpecSchema).optional(),
43
+ links: z.array(linkSchema).optional()
44
+ });
45
+ }
46
+ export const panelDefinitionSchema = z.object({
47
+ kind: z.literal('Panel'),
48
+ spec: panelSpecSchema
49
+ });
50
+ export function buildPanelDefinitionSchema(pluginSchema) {
51
+ return z.object({
52
+ kind: z.literal('Panel'),
53
+ spec: buildPanelSpecSchema(pluginSchema)
54
+ });
55
+ }
56
+ export const panelEditorSchema = z.object({
57
+ groupId: z.number(),
58
+ panelDefinition: panelDefinitionSchema
59
+ });
60
+ export function buildPanelEditorSchema(pluginSchema) {
61
+ return z.object({
62
+ groupId: z.number(),
63
+ panelDefinition: buildPanelDefinitionSchema(pluginSchema)
64
+ });
65
+ }
66
+
67
+ //# 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(),\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","description","optional","querySpecSchema","kind","min","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;IACdC,aAAaN,EAAEK,MAAM,GAAGE,QAAQ;AAClC,GAAG;AAEH,OAAO,MAAMC,kBAAgDR,EAAEG,MAAM,CAAC;IACpEM,MAAMT,EAAEK,MAAM,GAAGK,GAAG,CAAC;IACrBC,MAAMX,EAAEG,MAAM,CAAC;QACbS,QAAQX;IACV;AACF,GAAG;AAEH,OAAO,MAAMY,aAAgCb,EAAEG,MAAM,CAAC;IACpDC,MAAMJ,EAAEK,MAAM,GAAGE,QAAQ;IACzBO,KAAKd,EAAEK,MAAM,GAAGK,GAAG,CAAC;IACpBK,SAASf,EAAEK,MAAM,GAAGE,QAAQ;IAC5BS,iBAAiBhB,EAAEiB,OAAO,GAAGV,QAAQ;IACrCW,aAAalB,EAAEiB,OAAO,GAAGV,QAAQ;AACnC,GAAG;AAEH,OAAO,MAAMY,kBAA0CnB,EAAEG,MAAM,CAAC;IAC9DiB,SAASlB;IACTU,QAAQX;IACRoB,SAASrB,EAAEsB,KAAK,CAACd,iBAAiBD,QAAQ;IAC1CgB,OAAOvB,EAAEsB,KAAK,CAACT,YAAYN,QAAQ;AACrC,GAAG;AAEH,OAAO,SAASiB,qBAAqBvB,YAA0B;IAC7D,OAAOD,EAAEG,MAAM,CAAC;QACdiB,SAASlB;QACTU,QAAQX;QACRoB,SAASrB,EAAEsB,KAAK,CAACd,iBAAiBD,QAAQ;QAC1CgB,OAAOvB,EAAEsB,KAAK,CAACT,YAAYN,QAAQ;IACrC;AACF;AAEA,OAAO,MAAMkB,wBAAsDzB,EAAEG,MAAM,CAAC;IAC1EM,MAAMT,EAAE0B,OAAO,CAAC;IAChBf,MAAMQ;AACR,GAAG;AAEH,OAAO,SAASQ,2BAA2B1B,YAA0B;IACnE,OAAOD,EAAEG,MAAM,CAAC;QACdM,MAAMT,EAAE0B,OAAO,CAAC;QAChBf,MAAMa,qBAAqBvB;IAC7B;AACF;AAEA,OAAO,MAAM2B,oBAAoD5B,EAAEG,MAAM,CAAC;IACxE0B,SAAS7B,EAAE8B,MAAM;IACjBC,iBAAiBN;AACnB,GAAG;AAEH,OAAO,SAASO,uBAAuB/B,YAA0B;IAC/D,OAAOD,EAAEG,MAAM,CAAC;QACd0B,SAAS7B,EAAE8B,MAAM;QACjBC,iBAAiBJ,2BAA2B1B;IAC9C;AACF"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const pluginSchema: z.ZodObject<{
3
+ kind: z.ZodString;
4
+ spec: z.ZodRecord<z.ZodString, z.ZodAny>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ kind: string;
7
+ spec: Record<string, any>;
8
+ }, {
9
+ kind: string;
10
+ spec: Record<string, any>;
11
+ }>;
12
+ export type PluginSchemaType = z.infer<typeof pluginSchema>;
13
+ export type PluginSchema = typeof pluginSchema;
14
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/schema/plugin.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;;;;;;;;EAGvB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,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 pluginSchema = z.object({
15
+ kind: z.string().min(1, 'Required'),
16
+ spec: z.record(z.string(), z.any())
17
+ });
18
+
19
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/schema/plugin.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 pluginSchema = z.object({\n kind: z.string().min(1, 'Required'),\n spec: z.record(z.string(), z.any()),\n});\n\nexport type PluginSchemaType = z.infer<typeof pluginSchema>;\nexport type PluginSchema = typeof pluginSchema;\n"],"names":["z","pluginSchema","object","kind","string","min","spec","record","any"],"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,eAAeD,EAAEE,MAAM,CAAC;IACnCC,MAAMH,EAAEI,MAAM,GAAGC,GAAG,CAAC,GAAG;IACxBC,MAAMN,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEQ,GAAG;AAClC,GAAG"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { Permission, Role, RoleSpec } from '../model';
3
+ export declare const permissionSchema: z.ZodSchema<Permission>;
4
+ export declare const roleSpecSchema: z.ZodSchema<RoleSpec>;
5
+ export declare const roleSchema: z.ZodObject<{
6
+ kind: z.ZodLiteral<"Role">;
7
+ metadata: z.ZodObject<{
8
+ name: z.ZodString;
9
+ project: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ project: string;
12
+ name: string;
13
+ }, {
14
+ project: string;
15
+ name: string;
16
+ }>;
17
+ spec: z.ZodType<RoleSpec, z.ZodTypeDef, RoleSpec>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ kind: "Role";
20
+ spec: RoleSpec;
21
+ metadata: {
22
+ project: string;
23
+ name: string;
24
+ };
25
+ }, {
26
+ kind: "Role";
27
+ spec: RoleSpec;
28
+ metadata: {
29
+ project: string;
30
+ name: string;
31
+ };
32
+ }>;
33
+ export declare const globalRoleSchema: z.ZodObject<{
34
+ kind: z.ZodLiteral<"GlobalRole">;
35
+ metadata: z.ZodObject<{
36
+ name: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ name: string;
39
+ }, {
40
+ name: string;
41
+ }>;
42
+ spec: z.ZodType<RoleSpec, z.ZodTypeDef, RoleSpec>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ kind: "GlobalRole";
45
+ spec: RoleSpec;
46
+ metadata: {
47
+ name: string;
48
+ };
49
+ }, {
50
+ kind: "GlobalRole";
51
+ spec: RoleSpec;
52
+ metadata: {
53
+ name: string;
54
+ };
55
+ }>;
56
+ export declare const rolesEditorSchema: z.ZodSchema<Role>;
57
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/schema/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGtD,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,CAyBnD,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAE/C,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAgE,CAAC"}
@@ -0,0 +1,61 @@
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
+ export const permissionSchema = z.object({
16
+ // TODO: use SCOPE & ACTIONS constants
17
+ actions: z.array(z.enum([
18
+ '*',
19
+ 'create',
20
+ 'read',
21
+ 'update',
22
+ 'delete'
23
+ ])).nonempty('Must contains at least 1 action'),
24
+ scopes: z.array(z.enum([
25
+ '*',
26
+ 'Dashboard',
27
+ 'Datasource',
28
+ 'EphemeralDashboard',
29
+ 'Folder',
30
+ 'GlobalDatasource',
31
+ 'GlobalRole',
32
+ 'GlobalRoleBinding',
33
+ 'GlobalSecret',
34
+ 'GlobalVariable',
35
+ 'Project',
36
+ 'Role',
37
+ 'RoleBinding',
38
+ 'Secret',
39
+ 'User',
40
+ 'Variable'
41
+ ])).nonempty('Must contains at least 1 scope')
42
+ });
43
+ export const roleSpecSchema = z.object({
44
+ permissions: z.array(permissionSchema)
45
+ });
46
+ export const roleSchema = z.object({
47
+ kind: z.literal('Role'),
48
+ metadata: projectMetadataSchema,
49
+ spec: roleSpecSchema
50
+ });
51
+ export const globalRoleSchema = z.object({
52
+ kind: z.literal('GlobalRole'),
53
+ metadata: metadataSchema,
54
+ spec: roleSpecSchema
55
+ });
56
+ export const rolesEditorSchema = z.discriminatedUnion('kind', [
57
+ roleSchema,
58
+ globalRoleSchema
59
+ ]);
60
+
61
+ //# sourceMappingURL=role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/schema/role.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 { Permission, Role, RoleSpec } from '../model';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const permissionSchema: z.ZodSchema<Permission> = z.object({\n // TODO: use SCOPE & ACTIONS constants\n actions: z.array(z.enum(['*', 'create', 'read', 'update', 'delete'])).nonempty('Must contains at least 1 action'),\n scopes: z\n .array(\n z.enum([\n '*',\n 'Dashboard',\n 'Datasource',\n 'EphemeralDashboard',\n 'Folder',\n 'GlobalDatasource',\n 'GlobalRole',\n 'GlobalRoleBinding',\n 'GlobalSecret',\n 'GlobalVariable',\n 'Project',\n 'Role',\n 'RoleBinding',\n 'Secret',\n 'User',\n 'Variable',\n ])\n )\n .nonempty('Must contains at least 1 scope'), // TODO: limit project role\n});\n\nexport const roleSpecSchema: z.ZodSchema<RoleSpec> = z.object({\n permissions: z.array(permissionSchema),\n});\n\nexport const roleSchema = z.object({\n kind: z.literal('Role'),\n metadata: projectMetadataSchema,\n spec: roleSpecSchema,\n});\n\nexport const globalRoleSchema = z.object({\n kind: z.literal('GlobalRole'),\n metadata: metadataSchema,\n spec: roleSpecSchema,\n});\n\nexport const rolesEditorSchema: z.ZodSchema<Role> = z.discriminatedUnion('kind', [roleSchema, globalRoleSchema]);\n"],"names":["z","metadataSchema","projectMetadataSchema","permissionSchema","object","actions","array","enum","nonempty","scopes","roleSpecSchema","permissions","roleSchema","kind","literal","metadata","spec","globalRoleSchema","rolesEditorSchema","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;AAExB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAEnE,OAAO,MAAMC,mBAA4CH,EAAEI,MAAM,CAAC;IAChE,sCAAsC;IACtCC,SAASL,EAAEM,KAAK,CAACN,EAAEO,IAAI,CAAC;QAAC;QAAK;QAAU;QAAQ;QAAU;KAAS,GAAGC,QAAQ,CAAC;IAC/EC,QAAQT,EACLM,KAAK,CACJN,EAAEO,IAAI,CAAC;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,GAEFC,QAAQ,CAAC;AACd,GAAG;AAEH,OAAO,MAAME,iBAAwCV,EAAEI,MAAM,CAAC;IAC5DO,aAAaX,EAAEM,KAAK,CAACH;AACvB,GAAG;AAEH,OAAO,MAAMS,aAAaZ,EAAEI,MAAM,CAAC;IACjCS,MAAMb,EAAEc,OAAO,CAAC;IAChBC,UAAUb;IACVc,MAAMN;AACR,GAAG;AAEH,OAAO,MAAMO,mBAAmBjB,EAAEI,MAAM,CAAC;IACvCS,MAAMb,EAAEc,OAAO,CAAC;IAChBC,UAAUd;IACVe,MAAMN;AACR,GAAG;AAEH,OAAO,MAAMQ,oBAAuClB,EAAEmB,kBAAkB,CAAC,QAAQ;IAACP;IAAYK;CAAiB,EAAE"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { RoleBinding, RoleBindingSpec, Subject } from '../model';
3
+ export declare const subjectSchema: z.ZodSchema<Subject>;
4
+ export declare const roleBindingSpecSchema: z.ZodSchema<RoleBindingSpec>;
5
+ export declare const roleBindingSchema: z.ZodObject<{
6
+ kind: z.ZodLiteral<"RoleBinding">;
7
+ metadata: z.ZodObject<{
8
+ name: z.ZodString;
9
+ project: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ project: string;
12
+ name: string;
13
+ }, {
14
+ project: string;
15
+ name: string;
16
+ }>;
17
+ spec: z.ZodType<RoleBindingSpec, z.ZodTypeDef, RoleBindingSpec>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ kind: "RoleBinding";
20
+ spec: RoleBindingSpec;
21
+ metadata: {
22
+ project: string;
23
+ name: string;
24
+ };
25
+ }, {
26
+ kind: "RoleBinding";
27
+ spec: RoleBindingSpec;
28
+ metadata: {
29
+ project: string;
30
+ name: string;
31
+ };
32
+ }>;
33
+ export declare const globalRoleBindingSchema: z.ZodObject<{
34
+ kind: z.ZodLiteral<"GlobalRoleBinding">;
35
+ metadata: z.ZodObject<{
36
+ name: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ name: string;
39
+ }, {
40
+ name: string;
41
+ }>;
42
+ spec: z.ZodType<RoleBindingSpec, z.ZodTypeDef, RoleBindingSpec>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ kind: "GlobalRoleBinding";
45
+ spec: RoleBindingSpec;
46
+ metadata: {
47
+ name: string;
48
+ };
49
+ }, {
50
+ kind: "GlobalRoleBinding";
51
+ spec: RoleBindingSpec;
52
+ metadata: {
53
+ name: string;
54
+ };
55
+ }>;
56
+ export declare const roleBindingsEditorSchema: z.ZodSchema<RoleBinding>;
57
+ //# sourceMappingURL=rolebinding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rolebinding.d.ts","sourceRoot":"","sources":["../../src/schema/rolebinding.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGjE,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAG7C,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,SAAS,CAAC,eAAe,CAG7D,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AAEH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,CAG5D,CAAC"}
@@ -0,0 +1,40 @@
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 { nameSchema, metadataSchema, projectMetadataSchema } from './metadata';
15
+ export const subjectSchema = z.object({
16
+ kind: z.enum([
17
+ 'User'
18
+ ]),
19
+ name: nameSchema
20
+ });
21
+ export const roleBindingSpecSchema = z.object({
22
+ role: nameSchema,
23
+ subjects: z.array(subjectSchema).nonempty()
24
+ });
25
+ export const roleBindingSchema = z.object({
26
+ kind: z.literal('RoleBinding'),
27
+ metadata: projectMetadataSchema,
28
+ spec: roleBindingSpecSchema
29
+ });
30
+ export const globalRoleBindingSchema = z.object({
31
+ kind: z.literal('GlobalRoleBinding'),
32
+ metadata: metadataSchema,
33
+ spec: roleBindingSpecSchema
34
+ });
35
+ export const roleBindingsEditorSchema = z.discriminatedUnion('kind', [
36
+ roleBindingSchema,
37
+ globalRoleBindingSchema
38
+ ]);
39
+
40
+ //# sourceMappingURL=rolebinding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/schema/rolebinding.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 { RoleBinding, RoleBindingSpec, Subject } from '../model';\nimport { nameSchema, metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const subjectSchema: z.ZodSchema<Subject> = z.object({\n kind: z.enum(['User']),\n name: nameSchema,\n});\n\nexport const roleBindingSpecSchema: z.ZodSchema<RoleBindingSpec> = z.object({\n role: nameSchema,\n subjects: z.array(subjectSchema).nonempty(),\n});\n\nexport const roleBindingSchema = z.object({\n kind: z.literal('RoleBinding'),\n metadata: projectMetadataSchema,\n spec: roleBindingSpecSchema,\n});\n\nexport const globalRoleBindingSchema = z.object({\n kind: z.literal('GlobalRoleBinding'),\n metadata: metadataSchema,\n spec: roleBindingSpecSchema,\n});\n\nexport const roleBindingsEditorSchema: z.ZodSchema<RoleBinding> = z.discriminatedUnion('kind', [\n roleBindingSchema,\n globalRoleBindingSchema,\n]);\n"],"names":["z","nameSchema","metadataSchema","projectMetadataSchema","subjectSchema","object","kind","enum","name","roleBindingSpecSchema","role","subjects","array","nonempty","roleBindingSchema","literal","metadata","spec","globalRoleBindingSchema","roleBindingsEditorSchema","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;AAExB,SAASC,UAAU,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAE/E,OAAO,MAAMC,gBAAsCJ,EAAEK,MAAM,CAAC;IAC1DC,MAAMN,EAAEO,IAAI,CAAC;QAAC;KAAO;IACrBC,MAAMP;AACR,GAAG;AAEH,OAAO,MAAMQ,wBAAsDT,EAAEK,MAAM,CAAC;IAC1EK,MAAMT;IACNU,UAAUX,EAAEY,KAAK,CAACR,eAAeS,QAAQ;AAC3C,GAAG;AAEH,OAAO,MAAMC,oBAAoBd,EAAEK,MAAM,CAAC;IACxCC,MAAMN,EAAEe,OAAO,CAAC;IAChBC,UAAUb;IACVc,MAAMR;AACR,GAAG;AAEH,OAAO,MAAMS,0BAA0BlB,EAAEK,MAAM,CAAC;IAC9CC,MAAMN,EAAEe,OAAO,CAAC;IAChBC,UAAUd;IACVe,MAAMR;AACR,GAAG;AAEH,OAAO,MAAMU,2BAAqDnB,EAAEoB,kBAAkB,CAAC,QAAQ;IAC7FN;IACAI;CACD,EAAE"}