@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.
Files changed (210) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/model/calculations.js +1 -1
  3. package/dist/cjs/model/index.js +3 -0
  4. package/dist/cjs/model/query.js +12 -0
  5. package/dist/cjs/model/resource.js +14 -3
  6. package/dist/cjs/model/time.js +9 -11
  7. package/dist/cjs/model/trace-data.js +29 -1
  8. package/dist/cjs/model/transforms.js +28 -0
  9. package/dist/cjs/model/units/bytes.js +0 -3
  10. package/dist/cjs/model/units/decimal.js +0 -3
  11. package/dist/cjs/model/units/percent.js +0 -5
  12. package/dist/cjs/model/units/throughput.js +18 -12
  13. package/dist/cjs/model/units/time.js +0 -10
  14. package/dist/cjs/model/units/types.js +0 -13
  15. package/dist/cjs/model/units/units.js +1 -1
  16. package/dist/cjs/model/user.js +16 -0
  17. package/dist/cjs/model/value-mapping.js +16 -0
  18. package/dist/cjs/schema/datasource.js +85 -0
  19. package/dist/cjs/schema/display.js +27 -0
  20. package/dist/cjs/schema/duration.js +25 -0
  21. package/dist/cjs/schema/index.js +40 -0
  22. package/dist/cjs/schema/metadata.js +41 -0
  23. package/dist/cjs/schema/panel.js +106 -0
  24. package/dist/cjs/schema/plugin.js +27 -0
  25. package/dist/cjs/schema/role.js +86 -0
  26. package/dist/cjs/schema/rolebinding.js +65 -0
  27. package/dist/cjs/schema/secret.js +174 -0
  28. package/dist/cjs/schema/user.js +57 -0
  29. package/dist/cjs/schema/variable.js +171 -0
  30. package/dist/cjs/utils/fetch.js +14 -20
  31. package/dist/cjs/utils/index.js +3 -0
  32. package/dist/cjs/utils/memo.js +1 -2
  33. package/dist/cjs/utils/regexp.js +54 -0
  34. package/dist/cjs/utils/text.js +21 -46
  35. package/dist/cjs/utils/transform-data.js +167 -0
  36. package/dist/cjs/utils/value-mapping.js +105 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/model/calculations.d.ts +1 -1
  42. package/dist/model/calculations.d.ts.map +1 -1
  43. package/dist/model/calculations.js +1 -1
  44. package/dist/model/calculations.js.map +1 -1
  45. package/dist/model/datasource.d.ts +8 -8
  46. package/dist/model/datasource.d.ts.map +1 -1
  47. package/dist/model/datasource.js.map +1 -1
  48. package/dist/model/http.d.ts +5 -0
  49. package/dist/model/http.d.ts.map +1 -1
  50. package/dist/model/http.js.map +1 -1
  51. package/dist/model/index.d.ts +3 -0
  52. package/dist/model/index.d.ts.map +1 -1
  53. package/dist/model/index.js +3 -0
  54. package/dist/model/index.js.map +1 -1
  55. package/dist/model/legend.d.ts +3 -3
  56. package/dist/model/legend.d.ts.map +1 -1
  57. package/dist/model/legend.js.map +1 -1
  58. package/dist/model/panels.d.ts +17 -1
  59. package/dist/model/panels.d.ts.map +1 -1
  60. package/dist/model/panels.js +1 -1
  61. package/dist/model/panels.js.map +1 -1
  62. package/dist/model/project.d.ts +5 -0
  63. package/dist/model/project.d.ts.map +1 -1
  64. package/dist/model/project.js.map +1 -1
  65. package/dist/model/query.d.ts +10 -0
  66. package/dist/model/query.d.ts.map +1 -1
  67. package/dist/model/query.js +8 -3
  68. package/dist/model/query.js.map +1 -1
  69. package/dist/model/resource.d.ts +7 -0
  70. package/dist/model/resource.d.ts.map +1 -1
  71. package/dist/model/resource.js +3 -0
  72. package/dist/model/resource.js.map +1 -1
  73. package/dist/model/time-series-data.d.ts +1 -0
  74. package/dist/model/time-series-data.d.ts.map +1 -1
  75. package/dist/model/time-series-data.js.map +1 -1
  76. package/dist/model/time.d.ts.map +1 -1
  77. package/dist/model/time.js +9 -11
  78. package/dist/model/time.js.map +1 -1
  79. package/dist/model/trace-data.d.ts +80 -7
  80. package/dist/model/trace-data.d.ts.map +1 -1
  81. package/dist/model/trace-data.js +7 -3
  82. package/dist/model/trace-data.js.map +1 -1
  83. package/dist/model/transforms.d.ts +34 -0
  84. package/dist/model/transforms.d.ts.map +1 -0
  85. package/dist/model/transforms.js +21 -0
  86. package/dist/model/transforms.js.map +1 -0
  87. package/dist/model/units/bytes.d.ts +1 -2
  88. package/dist/model/units/bytes.d.ts.map +1 -1
  89. package/dist/model/units/bytes.js +0 -3
  90. package/dist/model/units/bytes.js.map +1 -1
  91. package/dist/model/units/decimal.d.ts +1 -2
  92. package/dist/model/units/decimal.d.ts.map +1 -1
  93. package/dist/model/units/decimal.js +0 -3
  94. package/dist/model/units/decimal.js.map +1 -1
  95. package/dist/model/units/percent.d.ts +1 -2
  96. package/dist/model/units/percent.d.ts.map +1 -1
  97. package/dist/model/units/percent.js +0 -5
  98. package/dist/model/units/percent.js.map +1 -1
  99. package/dist/model/units/throughput.d.ts +1 -2
  100. package/dist/model/units/throughput.d.ts.map +1 -1
  101. package/dist/model/units/throughput.js +18 -12
  102. package/dist/model/units/throughput.js.map +1 -1
  103. package/dist/model/units/time.d.ts +1 -2
  104. package/dist/model/units/time.d.ts.map +1 -1
  105. package/dist/model/units/time.js +0 -10
  106. package/dist/model/units/time.js.map +1 -1
  107. package/dist/model/units/types.d.ts +1 -2
  108. package/dist/model/units/types.d.ts.map +1 -1
  109. package/dist/model/units/types.js +1 -7
  110. package/dist/model/units/types.js.map +1 -1
  111. package/dist/model/units/units.d.ts +2 -0
  112. package/dist/model/units/units.d.ts.map +1 -1
  113. package/dist/model/units/units.js +1 -1
  114. package/dist/model/units/units.js.map +1 -1
  115. package/dist/model/units/utils.d.ts.map +1 -1
  116. package/dist/model/units/utils.js.map +1 -1
  117. package/dist/model/user.d.ts +21 -0
  118. package/dist/model/user.d.ts.map +1 -0
  119. package/dist/model/user.js +15 -0
  120. package/dist/model/user.js.map +1 -0
  121. package/dist/model/value-mapping.d.ts +35 -0
  122. package/dist/model/value-mapping.d.ts.map +1 -0
  123. package/dist/model/value-mapping.js +15 -0
  124. package/dist/model/value-mapping.js.map +1 -0
  125. package/dist/model/variables.d.ts +9 -8
  126. package/dist/model/variables.d.ts.map +1 -1
  127. package/dist/model/variables.js.map +1 -1
  128. package/dist/schema/datasource.d.ts +61 -0
  129. package/dist/schema/datasource.d.ts.map +1 -0
  130. package/dist/schema/datasource.js +54 -0
  131. package/dist/schema/datasource.js.map +1 -0
  132. package/dist/schema/display.d.ts +12 -0
  133. package/dist/schema/display.d.ts.map +1 -0
  134. package/dist/schema/display.js +19 -0
  135. package/dist/schema/display.js.map +1 -0
  136. package/dist/schema/duration.d.ts +3 -0
  137. package/dist/schema/duration.d.ts.map +1 -0
  138. package/dist/schema/duration.js +17 -0
  139. package/dist/schema/duration.js.map +1 -0
  140. package/dist/schema/index.d.ts +12 -0
  141. package/dist/schema/index.d.ts.map +1 -0
  142. package/dist/schema/index.js +25 -0
  143. package/dist/schema/index.js.map +1 -0
  144. package/dist/schema/metadata.d.ts +21 -0
  145. package/dist/schema/metadata.d.ts.map +1 -0
  146. package/dist/schema/metadata.js +22 -0
  147. package/dist/schema/metadata.js.map +1 -0
  148. package/dist/schema/panel.d.ts +13 -0
  149. package/dist/schema/panel.d.ts.map +1 -0
  150. package/dist/schema/panel.js +69 -0
  151. package/dist/schema/panel.js.map +1 -0
  152. package/dist/schema/plugin.d.ts +14 -0
  153. package/dist/schema/plugin.d.ts.map +1 -0
  154. package/dist/schema/plugin.js +19 -0
  155. package/dist/schema/plugin.js.map +1 -0
  156. package/dist/schema/role.d.ts +58 -0
  157. package/dist/schema/role.d.ts.map +1 -0
  158. package/dist/schema/role.js +61 -0
  159. package/dist/schema/role.js.map +1 -0
  160. package/dist/schema/rolebinding.d.ts +58 -0
  161. package/dist/schema/rolebinding.d.ts.map +1 -0
  162. package/dist/schema/rolebinding.js +40 -0
  163. package/dist/schema/rolebinding.js.map +1 -0
  164. package/dist/schema/secret.d.ts +1140 -0
  165. package/dist/schema/secret.d.ts.map +1 -0
  166. package/dist/schema/secret.js +152 -0
  167. package/dist/schema/secret.js.map +1 -0
  168. package/dist/schema/user.d.ts +8 -0
  169. package/dist/schema/user.d.ts.map +1 -0
  170. package/dist/schema/user.js +36 -0
  171. package/dist/schema/user.js.map +1 -0
  172. package/dist/schema/variable.d.ts +92 -0
  173. package/dist/schema/variable.d.ts.map +1 -0
  174. package/dist/schema/variable.js +119 -0
  175. package/dist/schema/variable.js.map +1 -0
  176. package/dist/utils/fetch.d.ts +5 -2
  177. package/dist/utils/fetch.d.ts.map +1 -1
  178. package/dist/utils/fetch.js +15 -21
  179. package/dist/utils/fetch.js.map +1 -1
  180. package/dist/utils/index.d.ts +3 -0
  181. package/dist/utils/index.d.ts.map +1 -1
  182. package/dist/utils/index.js +3 -0
  183. package/dist/utils/index.js.map +1 -1
  184. package/dist/utils/is-empty-object.d.ts.map +1 -1
  185. package/dist/utils/is-empty-object.js.map +1 -1
  186. package/dist/utils/memo.d.ts.map +1 -1
  187. package/dist/utils/memo.js +1 -2
  188. package/dist/utils/memo.js.map +1 -1
  189. package/dist/utils/panel-refs.d.ts +2 -2
  190. package/dist/utils/panel-refs.d.ts.map +1 -1
  191. package/dist/utils/panel-refs.js.map +1 -1
  192. package/dist/utils/regexp.d.ts +11 -0
  193. package/dist/utils/regexp.d.ts.map +1 -0
  194. package/dist/utils/regexp.js +42 -0
  195. package/dist/utils/regexp.js.map +1 -0
  196. package/dist/utils/text.d.ts +7 -33
  197. package/dist/utils/text.d.ts.map +1 -1
  198. package/dist/utils/text.js +21 -52
  199. package/dist/utils/text.js.map +1 -1
  200. package/dist/utils/time-series-data.d.ts.map +1 -1
  201. package/dist/utils/time-series-data.js.map +1 -1
  202. package/dist/utils/transform-data.d.ts +8 -0
  203. package/dist/utils/transform-data.d.ts.map +1 -0
  204. package/dist/utils/transform-data.js +221 -0
  205. package/dist/utils/transform-data.js.map +1 -0
  206. package/dist/utils/value-mapping.d.ts +3 -0
  207. package/dist/utils/value-mapping.d.ts.map +1 -0
  208. package/dist/utils/value-mapping.js +97 -0
  209. package/dist/utils/value-mapping.js.map +1 -0
  210. package/package.json +1 -1
@@ -0,0 +1,106 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ buildPanelDefinitionSchema: function() {
25
+ return buildPanelDefinitionSchema;
26
+ },
27
+ buildPanelEditorSchema: function() {
28
+ return buildPanelEditorSchema;
29
+ },
30
+ buildPanelSpecSchema: function() {
31
+ return buildPanelSpecSchema;
32
+ },
33
+ linkSchema: function() {
34
+ return linkSchema;
35
+ },
36
+ panelDefinitionSchema: function() {
37
+ return panelDefinitionSchema;
38
+ },
39
+ panelDisplaySpec: function() {
40
+ return panelDisplaySpec;
41
+ },
42
+ panelEditorSchema: function() {
43
+ return panelEditorSchema;
44
+ },
45
+ panelSpecSchema: function() {
46
+ return panelSpecSchema;
47
+ },
48
+ querySpecSchema: function() {
49
+ return querySpecSchema;
50
+ }
51
+ });
52
+ const _zod = require("zod");
53
+ const _plugin = require("./plugin");
54
+ const panelDisplaySpec = _zod.z.object({
55
+ name: _zod.z.string().min(1, {
56
+ message: 'Required'
57
+ }),
58
+ description: _zod.z.string().optional()
59
+ });
60
+ const querySpecSchema = _zod.z.object({
61
+ kind: _zod.z.string().min(1),
62
+ spec: _zod.z.object({
63
+ plugin: _plugin.pluginSchema
64
+ })
65
+ });
66
+ const linkSchema = _zod.z.object({
67
+ name: _zod.z.string().optional(),
68
+ url: _zod.z.string().min(1),
69
+ tooltip: _zod.z.string().optional(),
70
+ renderVariables: _zod.z.boolean().optional(),
71
+ targetBlank: _zod.z.boolean().optional()
72
+ });
73
+ const panelSpecSchema = _zod.z.object({
74
+ display: panelDisplaySpec,
75
+ plugin: _plugin.pluginSchema,
76
+ queries: _zod.z.array(querySpecSchema).optional(),
77
+ links: _zod.z.array(linkSchema).optional()
78
+ });
79
+ function buildPanelSpecSchema(pluginSchema) {
80
+ return _zod.z.object({
81
+ display: panelDisplaySpec,
82
+ plugin: pluginSchema,
83
+ queries: _zod.z.array(querySpecSchema).optional(),
84
+ links: _zod.z.array(linkSchema).optional()
85
+ });
86
+ }
87
+ const panelDefinitionSchema = _zod.z.object({
88
+ kind: _zod.z.literal('Panel'),
89
+ spec: panelSpecSchema
90
+ });
91
+ function buildPanelDefinitionSchema(pluginSchema) {
92
+ return _zod.z.object({
93
+ kind: _zod.z.literal('Panel'),
94
+ spec: buildPanelSpecSchema(pluginSchema)
95
+ });
96
+ }
97
+ const panelEditorSchema = _zod.z.object({
98
+ groupId: _zod.z.number(),
99
+ panelDefinition: panelDefinitionSchema
100
+ });
101
+ function buildPanelEditorSchema(pluginSchema) {
102
+ return _zod.z.object({
103
+ groupId: _zod.z.number(),
104
+ panelDefinition: buildPanelDefinitionSchema(pluginSchema)
105
+ });
106
+ }
@@ -0,0 +1,27 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "pluginSchema", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return pluginSchema;
21
+ }
22
+ });
23
+ const _zod = require("zod");
24
+ const pluginSchema = _zod.z.object({
25
+ kind: _zod.z.string().min(1, 'Required'),
26
+ spec: _zod.z.record(_zod.z.string(), _zod.z.any())
27
+ });
@@ -0,0 +1,86 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ globalRoleSchema: function() {
25
+ return globalRoleSchema;
26
+ },
27
+ permissionSchema: function() {
28
+ return permissionSchema;
29
+ },
30
+ roleSchema: function() {
31
+ return roleSchema;
32
+ },
33
+ roleSpecSchema: function() {
34
+ return roleSpecSchema;
35
+ },
36
+ rolesEditorSchema: function() {
37
+ return rolesEditorSchema;
38
+ }
39
+ });
40
+ const _zod = require("zod");
41
+ const _metadata = require("./metadata");
42
+ const permissionSchema = _zod.z.object({
43
+ // TODO: use SCOPE & ACTIONS constants
44
+ actions: _zod.z.array(_zod.z.enum([
45
+ '*',
46
+ 'create',
47
+ 'read',
48
+ 'update',
49
+ 'delete'
50
+ ])).nonempty('Must contains at least 1 action'),
51
+ scopes: _zod.z.array(_zod.z.enum([
52
+ '*',
53
+ 'Dashboard',
54
+ 'Datasource',
55
+ 'EphemeralDashboard',
56
+ 'Folder',
57
+ 'GlobalDatasource',
58
+ 'GlobalRole',
59
+ 'GlobalRoleBinding',
60
+ 'GlobalSecret',
61
+ 'GlobalVariable',
62
+ 'Project',
63
+ 'Role',
64
+ 'RoleBinding',
65
+ 'Secret',
66
+ 'User',
67
+ 'Variable'
68
+ ])).nonempty('Must contains at least 1 scope')
69
+ });
70
+ const roleSpecSchema = _zod.z.object({
71
+ permissions: _zod.z.array(permissionSchema)
72
+ });
73
+ const roleSchema = _zod.z.object({
74
+ kind: _zod.z.literal('Role'),
75
+ metadata: _metadata.projectMetadataSchema,
76
+ spec: roleSpecSchema
77
+ });
78
+ const globalRoleSchema = _zod.z.object({
79
+ kind: _zod.z.literal('GlobalRole'),
80
+ metadata: _metadata.metadataSchema,
81
+ spec: roleSpecSchema
82
+ });
83
+ const rolesEditorSchema = _zod.z.discriminatedUnion('kind', [
84
+ roleSchema,
85
+ globalRoleSchema
86
+ ]);
@@ -0,0 +1,65 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ globalRoleBindingSchema: function() {
25
+ return globalRoleBindingSchema;
26
+ },
27
+ roleBindingSchema: function() {
28
+ return roleBindingSchema;
29
+ },
30
+ roleBindingSpecSchema: function() {
31
+ return roleBindingSpecSchema;
32
+ },
33
+ roleBindingsEditorSchema: function() {
34
+ return roleBindingsEditorSchema;
35
+ },
36
+ subjectSchema: function() {
37
+ return subjectSchema;
38
+ }
39
+ });
40
+ const _zod = require("zod");
41
+ const _metadata = require("./metadata");
42
+ const subjectSchema = _zod.z.object({
43
+ kind: _zod.z.enum([
44
+ 'User'
45
+ ]),
46
+ name: _metadata.nameSchema
47
+ });
48
+ const roleBindingSpecSchema = _zod.z.object({
49
+ role: _metadata.nameSchema,
50
+ subjects: _zod.z.array(subjectSchema).nonempty()
51
+ });
52
+ const roleBindingSchema = _zod.z.object({
53
+ kind: _zod.z.literal('RoleBinding'),
54
+ metadata: _metadata.projectMetadataSchema,
55
+ spec: roleBindingSpecSchema
56
+ });
57
+ const globalRoleBindingSchema = _zod.z.object({
58
+ kind: _zod.z.literal('GlobalRoleBinding'),
59
+ metadata: _metadata.metadataSchema,
60
+ spec: roleBindingSpecSchema
61
+ });
62
+ const roleBindingsEditorSchema = _zod.z.discriminatedUnion('kind', [
63
+ roleBindingSchema,
64
+ globalRoleBindingSchema
65
+ ]);
@@ -0,0 +1,174 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ globalSecretSchema: function() {
25
+ return globalSecretSchema;
26
+ },
27
+ secretSchema: function() {
28
+ return secretSchema;
29
+ },
30
+ secretSpecSchema: function() {
31
+ return secretSpecSchema;
32
+ },
33
+ secretsEditorSchema: function() {
34
+ return secretsEditorSchema;
35
+ }
36
+ });
37
+ const _zod = require("zod");
38
+ const _metadata = require("./metadata");
39
+ const secretSpecSchema = _zod.z.object({
40
+ basicAuth: _zod.z.object({
41
+ username: _zod.z.string().min(1),
42
+ password: _zod.z.string().optional(),
43
+ passwordFile: _zod.z.string().optional()
44
+ }).superRefine((val, ctx)=>{
45
+ if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {
46
+ ctx.addIssue({
47
+ code: _zod.z.ZodIssueCode.custom,
48
+ message: 'Only one of the fields must be defined',
49
+ path: [
50
+ 'password'
51
+ ]
52
+ });
53
+ ctx.addIssue({
54
+ code: _zod.z.ZodIssueCode.custom,
55
+ message: 'Only one of the fields must be defined',
56
+ path: [
57
+ 'passwordFile'
58
+ ]
59
+ });
60
+ }
61
+ }).optional(),
62
+ authorization: _zod.z.object({
63
+ type: _zod.z.string().optional(),
64
+ credentials: _zod.z.string().optional(),
65
+ credentialsFile: _zod.z.string().optional()
66
+ }).superRefine((val, ctx)=>{
67
+ if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {
68
+ ctx.addIssue({
69
+ code: _zod.z.ZodIssueCode.custom,
70
+ message: 'Only one of the fields must be defined',
71
+ path: [
72
+ 'credentials'
73
+ ]
74
+ });
75
+ ctx.addIssue({
76
+ code: _zod.z.ZodIssueCode.custom,
77
+ message: 'Only one of the fields must be defined',
78
+ path: [
79
+ 'credentialsFile'
80
+ ]
81
+ });
82
+ }
83
+ }).optional(),
84
+ tlsConfig: _zod.z.object({
85
+ ca: _zod.z.string().optional(),
86
+ cert: _zod.z.string().optional(),
87
+ key: _zod.z.string().optional(),
88
+ caFile: _zod.z.string().optional(),
89
+ certFile: _zod.z.string().optional(),
90
+ keyFile: _zod.z.string().optional(),
91
+ serverName: _zod.z.string().optional(),
92
+ insecureSkipVerify: _zod.z.boolean()
93
+ }).superRefine((val, ctx)=>{
94
+ if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
95
+ ctx.addIssue({
96
+ code: _zod.z.ZodIssueCode.custom,
97
+ message: 'Only one of the fields must be defined',
98
+ path: [
99
+ 'ca'
100
+ ]
101
+ });
102
+ ctx.addIssue({
103
+ code: _zod.z.ZodIssueCode.custom,
104
+ message: 'Only one of the fields must be defined',
105
+ path: [
106
+ 'caFile'
107
+ ]
108
+ });
109
+ }
110
+ if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {
111
+ ctx.addIssue({
112
+ code: _zod.z.ZodIssueCode.custom,
113
+ message: 'Only one of the fields must be defined',
114
+ path: [
115
+ 'cert'
116
+ ]
117
+ });
118
+ ctx.addIssue({
119
+ code: _zod.z.ZodIssueCode.custom,
120
+ message: 'Only one of the fields must be defined',
121
+ path: [
122
+ 'certFile'
123
+ ]
124
+ });
125
+ }
126
+ if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {
127
+ ctx.addIssue({
128
+ code: _zod.z.ZodIssueCode.custom,
129
+ message: 'Only one of the fields must be defined',
130
+ path: [
131
+ 'key'
132
+ ]
133
+ });
134
+ ctx.addIssue({
135
+ code: _zod.z.ZodIssueCode.custom,
136
+ message: 'Only one of the fields must be defined',
137
+ path: [
138
+ 'keyFile'
139
+ ]
140
+ });
141
+ }
142
+ }).optional()
143
+ }).superRefine((val, ctx)=>{
144
+ if (val.basicAuth && val.authorization) {
145
+ ctx.addIssue({
146
+ code: _zod.z.ZodIssueCode.custom,
147
+ message: 'Only one of the fields must be defined',
148
+ path: [
149
+ 'basicAuth'
150
+ ]
151
+ });
152
+ ctx.addIssue({
153
+ code: _zod.z.ZodIssueCode.custom,
154
+ message: 'Only one of the fields must be defined',
155
+ path: [
156
+ 'authorization'
157
+ ]
158
+ });
159
+ }
160
+ });
161
+ const secretSchema = _zod.z.object({
162
+ kind: _zod.z.literal('Secret'),
163
+ metadata: _metadata.projectMetadataSchema,
164
+ spec: secretSpecSchema
165
+ });
166
+ const globalSecretSchema = _zod.z.object({
167
+ kind: _zod.z.literal('GlobalSecret'),
168
+ metadata: _metadata.metadataSchema,
169
+ spec: secretSpecSchema
170
+ });
171
+ const secretsEditorSchema = _zod.z.discriminatedUnion('kind', [
172
+ secretSchema,
173
+ globalSecretSchema
174
+ ]);
@@ -0,0 +1,57 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ nativeProviderSchema: function() {
25
+ return nativeProviderSchema;
26
+ },
27
+ oauthProvidersSchema: function() {
28
+ return oauthProvidersSchema;
29
+ },
30
+ userSchema: function() {
31
+ return userSchema;
32
+ },
33
+ userSpecSchema: function() {
34
+ return userSpecSchema;
35
+ }
36
+ });
37
+ const _zod = require("zod");
38
+ const _metadata = require("./metadata");
39
+ const nativeProviderSchema = _zod.z.object({
40
+ password: _zod.z.string().optional()
41
+ });
42
+ const oauthProvidersSchema = _zod.z.object({
43
+ issuer: _zod.z.string().optional(),
44
+ email: _zod.z.string().optional(),
45
+ subject: _zod.z.string().optional()
46
+ });
47
+ const userSpecSchema = _zod.z.object({
48
+ firstName: _zod.z.string().optional(),
49
+ lastName: _zod.z.string().optional(),
50
+ nativeProvider: nativeProviderSchema.optional(),
51
+ oauthProviders: _zod.z.array(oauthProvidersSchema).optional()
52
+ });
53
+ const userSchema = _zod.z.object({
54
+ kind: _zod.z.literal('User'),
55
+ metadata: _metadata.metadataSchema,
56
+ spec: userSpecSchema
57
+ });
@@ -0,0 +1,171 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ buildVariableDefinitionSchema: function() {
25
+ return buildVariableDefinitionSchema;
26
+ },
27
+ buildVariableListSchema: function() {
28
+ return buildVariableListSchema;
29
+ },
30
+ buildVariableListSpecSchema: function() {
31
+ return buildVariableListSpecSchema;
32
+ },
33
+ buildVariableSpecSchema: function() {
34
+ return buildVariableSpecSchema;
35
+ },
36
+ globalVariableSchema: function() {
37
+ return globalVariableSchema;
38
+ },
39
+ variableDefinitionSchema: function() {
40
+ return variableDefinitionSchema;
41
+ },
42
+ variableDisplaySchema: function() {
43
+ return variableDisplaySchema;
44
+ },
45
+ variableListSchema: function() {
46
+ return variableListSchema;
47
+ },
48
+ variableListSpecSchema: function() {
49
+ return variableListSpecSchema;
50
+ },
51
+ variableSchema: function() {
52
+ return variableSchema;
53
+ },
54
+ variableSpecSchema: function() {
55
+ return variableSpecSchema;
56
+ },
57
+ variableTextSchema: function() {
58
+ return variableTextSchema;
59
+ },
60
+ variableTextSpecSchema: function() {
61
+ return variableTextSpecSchema;
62
+ },
63
+ variablesSchema: function() {
64
+ return variablesSchema;
65
+ }
66
+ });
67
+ const _zod = require("zod");
68
+ const _metadata = require("./metadata");
69
+ const _plugin = require("./plugin");
70
+ const variableDisplaySchema = _zod.z.object({
71
+ name: _zod.z.string().optional(),
72
+ description: _zod.z.string().optional(),
73
+ hidden: _zod.z.boolean().optional()
74
+ });
75
+ const variableListSpecSchema = _zod.z.object({
76
+ name: _zod.z.string().min(1),
77
+ display: variableDisplaySchema.optional(),
78
+ defaultValue: _zod.z.string().or(_zod.z.array(_zod.z.string())).optional(),
79
+ allowAllValue: _zod.z.boolean(),
80
+ allowMultiple: _zod.z.boolean(),
81
+ customAllValue: _zod.z.string().optional(),
82
+ capturingRegexp: _zod.z.string().optional(),
83
+ sort: _zod.z.enum([
84
+ 'none',
85
+ 'alphabetical-asc',
86
+ 'alphabetical-desc',
87
+ 'numerical-asc',
88
+ 'numerical-desc',
89
+ 'alphabetical-ci-asc',
90
+ 'alphabetical-ci-desc'
91
+ ]).optional(),
92
+ plugin: _plugin.pluginSchema
93
+ });
94
+ function buildVariableListSpecSchema(pluginSchema) {
95
+ return _zod.z.object({
96
+ name: _zod.z.string().min(1),
97
+ display: variableDisplaySchema.optional(),
98
+ defaultValue: _zod.z.string().or(_zod.z.array(_zod.z.string())).optional(),
99
+ allowAllValue: _zod.z.boolean(),
100
+ allowMultiple: _zod.z.boolean(),
101
+ customAllValue: _zod.z.string().optional(),
102
+ capturingRegexp: _zod.z.string().optional(),
103
+ sort: _zod.z.enum([
104
+ 'none',
105
+ 'alphabetical-asc',
106
+ 'alphabetical-desc',
107
+ 'numerical-asc',
108
+ 'numerical-desc',
109
+ 'alphabetical-ci-asc',
110
+ 'alphabetical-ci-desc'
111
+ ]).optional(),
112
+ plugin: pluginSchema
113
+ });
114
+ }
115
+ const variableListSchema = _zod.z.object({
116
+ kind: _zod.z.literal('ListVariable'),
117
+ spec: variableListSpecSchema
118
+ });
119
+ function buildVariableListSchema(pluginSchema) {
120
+ return _zod.z.object({
121
+ kind: _zod.z.literal('ListVariable'),
122
+ spec: buildVariableListSpecSchema(pluginSchema)
123
+ });
124
+ }
125
+ const variableTextSpecSchema = _zod.z.object({
126
+ name: _zod.z.string().min(1),
127
+ display: variableDisplaySchema.optional(),
128
+ value: _zod.z.string(),
129
+ constant: _zod.z.boolean().optional()
130
+ });
131
+ const variableTextSchema = _zod.z.object({
132
+ kind: _zod.z.literal('TextVariable'),
133
+ spec: variableTextSpecSchema
134
+ });
135
+ const variableSpecSchema = _zod.z.discriminatedUnion('kind', [
136
+ variableTextSchema,
137
+ variableListSchema
138
+ ]);
139
+ function buildVariableSpecSchema(pluginSchema) {
140
+ return _zod.z.union([
141
+ variableTextSchema,
142
+ buildVariableListSchema(pluginSchema)
143
+ ]);
144
+ }
145
+ const variableSchema = _zod.z.object({
146
+ kind: _zod.z.literal('Variable'),
147
+ metadata: _metadata.projectMetadataSchema,
148
+ spec: variableSpecSchema
149
+ });
150
+ const globalVariableSchema = _zod.z.object({
151
+ kind: _zod.z.literal('GlobalVariable'),
152
+ metadata: _metadata.projectMetadataSchema,
153
+ spec: variableSpecSchema
154
+ });
155
+ const variablesSchema = _zod.z.discriminatedUnion('kind', [
156
+ variableSchema,
157
+ globalVariableSchema
158
+ ]);
159
+ const variableDefinitionSchema = variableSpecSchema;
160
+ function buildVariableDefinitionSchema(pluginSchema) {
161
+ return _zod.z.discriminatedUnion('kind', [
162
+ _zod.z.object({
163
+ kind: _zod.z.literal('ListVariable'),
164
+ spec: buildVariableListSpecSchema(pluginSchema)
165
+ }),
166
+ _zod.z.object({
167
+ kind: _zod.z.literal('TextVariable'),
168
+ spec: variableTextSpecSchema
169
+ })
170
+ ]);
171
+ }