@perses-dev/plugin-system 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.
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +70 -99
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -1
- package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +49 -19
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +1 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +10 -71
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +408 -376
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +2 -2
- package/dist/cjs/components/Variables/variable-model.js +24 -22
- package/dist/cjs/context/ProjectStoreProvider.js +7 -4
- package/dist/cjs/context/ValidationProvider.js +69 -0
- package/dist/cjs/context/index.js +1 -0
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/runtime/QueryCountProvider.js +83 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/cjs/runtime/builtin-variables.js +1 -1
- package/dist/cjs/runtime/datasources.js +22 -13
- package/dist/cjs/runtime/index.js +3 -2
- package/dist/cjs/runtime/plugin-registry.js +33 -22
- package/dist/cjs/runtime/time-series-queries.js +3 -3
- package/dist/cjs/runtime/trace-queries.js +5 -1
- package/dist/cjs/runtime/{template-variables.js → variables.js} +19 -19
- package/dist/cjs/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +8 -8
- package/dist/cjs/stories/shared-utils/decorators/index.js +2 -2
- package/dist/cjs/test/mock-data.js +25 -4
- package/dist/cjs/test/render.js +1 -9
- package/dist/cjs/test/test-plugins/bert/index.js +20 -19
- package/dist/cjs/utils/variables.js +23 -23
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +2 -2
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +71 -100
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -3
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +3 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +50 -20
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -0
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -70
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +411 -379
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +2 -2
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +25 -23
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
- package/dist/context/ProjectStoreProvider.js +7 -4
- package/dist/context/ProjectStoreProvider.js.map +1 -1
- package/dist/context/ValidationProvider.d.ts +19 -0
- package/dist/context/ValidationProvider.d.ts.map +1 -0
- package/dist/context/ValidationProvider.js +52 -0
- package/dist/context/ValidationProvider.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/model/panels.d.ts +2 -2
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/QueryCountProvider.d.ts +9 -0
- package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
- package/dist/{validation/duration.js → runtime/QueryCountProvider.js} +13 -4
- package/dist/runtime/QueryCountProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/builtin-variables.d.ts +1 -1
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +1 -1
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +22 -13
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +33 -22
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +2 -2
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +3 -3
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +5 -1
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/{template-variables.d.ts → variables.d.ts} +4 -4
- package/dist/runtime/variables.d.ts.map +1 -0
- package/dist/runtime/{template-variables.js → variables.js} +18 -17
- package/dist/runtime/variables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +12 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -0
- package/dist/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +9 -9
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/index.d.ts +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/index.js +2 -2
- package/dist/stories/shared-utils/decorators/index.js.map +1 -1
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +25 -4
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +1 -9
- package/dist/test/render.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +20 -19
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/utils/variables.d.ts +4 -4
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +18 -18
- package/dist/utils/variables.js.map +1 -1
- package/package.json +5 -5
- package/dist/cjs/validation/datasource.js +0 -30
- package/dist/cjs/validation/duration.js +0 -25
- package/dist/cjs/validation/index.js +0 -34
- package/dist/cjs/validation/resource.js +0 -24
- package/dist/cjs/validation/role.js +0 -86
- package/dist/cjs/validation/rolebinding.js +0 -55
- package/dist/cjs/validation/secret.js +0 -176
- package/dist/cjs/validation/user.js +0 -46
- package/dist/cjs/validation/variable.js +0 -48
- package/dist/runtime/template-variables.d.ts.map +0 -1
- package/dist/runtime/template-variables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
- package/dist/validation/datasource.d.ts +0 -19
- package/dist/validation/datasource.d.ts.map +0 -1
- package/dist/validation/datasource.js +0 -22
- package/dist/validation/datasource.js.map +0 -1
- package/dist/validation/duration.d.ts +0 -3
- package/dist/validation/duration.d.ts.map +0 -1
- package/dist/validation/duration.js.map +0 -1
- package/dist/validation/index.d.ts +0 -6
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js +0 -19
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/resource.d.ts +0 -3
- package/dist/validation/resource.d.ts.map +0 -1
- package/dist/validation/resource.js +0 -16
- package/dist/validation/resource.js.map +0 -1
- package/dist/validation/role.d.ts +0 -228
- package/dist/validation/role.d.ts.map +0 -1
- package/dist/validation/role.js +0 -67
- package/dist/validation/role.js.map +0 -1
- package/dist/validation/rolebinding.d.ts +0 -137
- package/dist/validation/rolebinding.d.ts.map +0 -1
- package/dist/validation/rolebinding.js +0 -47
- package/dist/validation/rolebinding.js.map +0 -1
- package/dist/validation/secret.d.ts +0 -964
- package/dist/validation/secret.d.ts.map +0 -1
- package/dist/validation/secret.js +0 -157
- package/dist/validation/secret.js.map +0 -1
- package/dist/validation/user.d.ts +0 -93
- package/dist/validation/user.d.ts.map +0 -1
- package/dist/validation/user.js +0 -38
- package/dist/validation/user.js.map +0 -1
- package/dist/validation/variable.d.ts +0 -96
- package/dist/validation/variable.d.ts.map +0 -1
- package/dist/validation/variable.js +0 -40
- package/dist/validation/variable.js.map +0 -1
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "variableEditorValidationSchema", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return variableEditorValidationSchema;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _zod = require("zod");
|
|
24
|
-
const variableEditorValidationSchema = _zod.z.object({
|
|
25
|
-
name: _zod.z.string().nonempty('Required').regex(/^\w+$/, 'Must only contains alphanumerical characters and underscores').refine((val)=>!val.startsWith('__'), '__ prefix is reserved to builtin variables'),
|
|
26
|
-
title: _zod.z.string().optional(),
|
|
27
|
-
description: _zod.z.string().optional(),
|
|
28
|
-
kind: _zod.z.enum([
|
|
29
|
-
'TextVariable',
|
|
30
|
-
'ListVariable',
|
|
31
|
-
'BuiltinVariable'
|
|
32
|
-
]),
|
|
33
|
-
textVariableFields: _zod.z.object({
|
|
34
|
-
value: _zod.z.string(),
|
|
35
|
-
constant: _zod.z.boolean()
|
|
36
|
-
}),
|
|
37
|
-
listVariableFields: _zod.z.object({
|
|
38
|
-
allowMultiple: _zod.z.boolean(),
|
|
39
|
-
allowAllValue: _zod.z.boolean(),
|
|
40
|
-
customAllValue: _zod.z.string().optional(),
|
|
41
|
-
capturingRegexp: _zod.z.string().optional(),
|
|
42
|
-
sort: _zod.z.string().optional(),
|
|
43
|
-
plugin: _zod.z.object({
|
|
44
|
-
kind: _zod.z.string(),
|
|
45
|
-
spec: _zod.z.object({})
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template-variables.d.ts","sourceRoot":"","sources":["../../src/runtime/template-variables.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,qBAAa,qBAAqB;IAChC;;;OAGG;IACH,CAAC,SAAS,CAAC,UAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAM;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqD;IAE5E;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,GAAG,SAAS;IAIrD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS;IAS3E;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAInC;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAiBtC,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,oBAAoB;CAG7B;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,0DAA4D,CAAC;AAUjG,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAmB5E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAOpE;AAGD,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKvF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/runtime/template-variables.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, useContext, useMemo } from 'react';\nimport { VariableValue } from '@perses-dev/core';\nimport { immerable } from 'immer';\nimport { VariableOption } from '../model';\nimport { parseTemplateVariables, replaceTemplateVariables } from '../utils';\nimport { useBuiltinVariableValues } from './builtin-variables';\n\nexport type VariableState = {\n value: VariableValue;\n options?: VariableOption[];\n loading: boolean;\n error?: Error;\n /**\n * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.\n */\n overriding?: boolean;\n /**\n * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.\n */\n overridden?: boolean;\n defaultValue?: VariableValue;\n};\n\nexport type VariableStateMap = Record<string, VariableState>;\n\n/**\n * Structure used as key in the {@link VariableStoreStateMap}.\n */\nexport type VariableStateKey = {\n /**\n * name of the variable we want to access in the state.\n */\n name: string;\n /**\n * source of the variable we want to access in the state.\n * Defined only for external variables.\n */\n source?: string;\n};\n\n/**\n * A state map with two entry keys, materialized by {@link VariableStateKey} structure.\n */\nexport class VariableStoreStateMap {\n /**\n * \"Immerable\" is mandatory to be able to use this class in an immer context.\n * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas\n */\n [immerable] = true;\n\n private readonly DEFAULT_LOCAL_SOURCE_NAME = '';\n private readonly _state: Record<string, Record<string, VariableState>> = {};\n\n /**\n * Get variable state by key.\n * @param key\n */\n get(key: VariableStateKey): VariableState | undefined {\n return this._sourceStatesOrEmpty(key.source)[key.name];\n }\n\n /**\n * Set variable state by key.\n * @param key\n * @param value\n */\n set(key: VariableStateKey, value: VariableState): VariableState | undefined {\n const sourceName = this._sourceName(key.source);\n if (!this._state[sourceName]) {\n this._state[sourceName] = {};\n }\n this._sourceStatesOrEmpty(key.source)[key.name] = value;\n return value;\n }\n\n /**\n * Check presence of variable state by key.\n * @param key\n */\n has(key: VariableStateKey): boolean {\n return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;\n }\n\n /**\n * Delete variable state by key.\n * @param key\n */\n delete(key: VariableStateKey): boolean {\n const result = this.has(key);\n const sourceName = this._sourceName(key.source);\n const sourceStates = this._state[sourceName];\n\n // Delete var from source state\n if (sourceStates) {\n delete sourceStates[key.name];\n }\n\n // Delete source state from state if empty\n if (Object.keys(sourceStates ?? {})?.length === 0) {\n delete this._state[sourceName];\n }\n return result;\n }\n\n private _sourceName(source: string | undefined): string {\n return source ?? this.DEFAULT_LOCAL_SOURCE_NAME;\n }\n\n private _sourceStatesOrEmpty(source: string | undefined): Record<string, VariableState> {\n return this._state[this._sourceName(source)] ?? {};\n }\n}\n\nexport type TemplateVariableSrv = {\n state: VariableStateMap;\n};\n\nexport const TemplateVariableContext = createContext<TemplateVariableSrv | undefined>(undefined);\n\nfunction useTemplateVariableContext() {\n const ctx = useContext(TemplateVariableContext);\n if (ctx === undefined) {\n throw new Error('No TemplateVariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useTemplateVariableValues(names?: string[]): VariableStateMap {\n const { state } = useTemplateVariableContext();\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = state[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [state, names]);\n\n if (names === undefined) {\n return state;\n }\n\n return values;\n}\n\nexport function useVariableValues(names?: string[]): VariableStateMap {\n const templateVariableValues = useTemplateVariableValues(names);\n const builtinVariableValues = useBuiltinVariableValues(names);\n\n return useMemo(() => {\n return { ...templateVariableValues, ...builtinVariableValues } as VariableStateMap;\n }, [templateVariableValues, builtinVariableValues]);\n}\n\n// Convenience hook for replacing template variables in a string\nexport function useReplaceVariablesInString(str: string | undefined): string | undefined {\n const variablesInString = str ? parseTemplateVariables(str) : [];\n const variableValues = useVariableValues(variablesInString);\n if (!str) return undefined;\n return replaceTemplateVariables(str, variableValues);\n}\n"],"names":["createContext","useContext","useMemo","immerable","parseTemplateVariables","replaceTemplateVariables","useBuiltinVariableValues","VariableStoreStateMap","get","key","_sourceStatesOrEmpty","source","name","set","value","sourceName","_sourceName","_state","has","undefined","delete","Object","result","sourceStates","keys","length","DEFAULT_LOCAL_SOURCE_NAME","TemplateVariableContext","useTemplateVariableContext","ctx","Error","useTemplateVariableValues","names","state","values","forEach","s","useVariableValues","templateVariableValues","builtinVariableValues","useReplaceVariablesInString","str","variablesInString","variableValues"],"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,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAE3D,SAASC,SAAS,QAAQ,QAAQ;AAElC,SAASC,sBAAsB,EAAEC,wBAAwB,QAAQ,WAAW;AAC5E,SAASC,wBAAwB,QAAQ,sBAAsB;IA2C5DH,aAAAA;AARH;;CAEC,GACD,OAAO,MAAMI;IAUX;;;GAGC,GACDC,IAAIC,GAAqB,EAA6B;QACpD,OAAO,IAAI,CAACC,oBAAoB,CAACD,IAAIE,MAAM,CAAC,CAACF,IAAIG,IAAI,CAAC;IACxD;IAEA;;;;GAIC,GACDC,IAAIJ,GAAqB,EAAEK,KAAoB,EAA6B;QAC1E,MAAMC,aAAa,IAAI,CAACC,WAAW,CAACP,IAAIE,MAAM;QAC9C,IAAI,CAAC,IAAI,CAACM,MAAM,CAACF,WAAW,EAAE;YAC5B,IAAI,CAACE,MAAM,CAACF,WAAW,GAAG,CAAC;QAC7B;QACA,IAAI,CAACL,oBAAoB,CAACD,IAAIE,MAAM,CAAC,CAACF,IAAIG,IAAI,CAAC,GAAGE;QAClD,OAAOA;IACT;IAEA;;;GAGC,GACDI,IAAIT,GAAqB,EAAW;QAClC,OAAO,IAAI,CAACC,oBAAoB,CAACD,IAAIE,MAAM,CAAC,CAACF,IAAIG,IAAI,CAAC,KAAKO;IAC7D;IAEA;;;GAGC,GACDC,OAAOX,GAAqB,EAAW;YAWjCY;QAVJ,MAAMC,SAAS,IAAI,CAACJ,GAAG,CAACT;QACxB,MAAMM,aAAa,IAAI,CAACC,WAAW,CAACP,IAAIE,MAAM;QAC9C,MAAMY,eAAe,IAAI,CAACN,MAAM,CAACF,WAAW;QAE5C,+BAA+B;QAC/B,IAAIQ,cAAc;YAChB,OAAOA,YAAY,CAACd,IAAIG,IAAI,CAAC;QAC/B;QAEA,0CAA0C;QAC1C,IAAIS,EAAAA,eAAAA,OAAOG,IAAI,CAACD,yBAAAA,0BAAAA,eAAgB,CAAC,gBAA7BF,mCAAAA,aAAiCI,MAAM,MAAK,GAAG;YACjD,OAAO,IAAI,CAACR,MAAM,CAACF,WAAW;QAChC;QACA,OAAOO;IACT;IAEQN,YAAYL,MAA0B,EAAU;QACtD,OAAOA,mBAAAA,oBAAAA,SAAU,IAAI,CAACe,yBAAyB;IACjD;IAEQhB,qBAAqBC,MAA0B,EAAiC;YAC/E;QAAP,OAAO,CAAA,gCAAA,IAAI,CAACM,MAAM,CAAC,IAAI,CAACD,WAAW,CAACL,QAAQ,cAArC,2CAAA,gCAAyC,CAAC;IACnD;;QAlEA;;;GAGC,GACD,uBAACR,YAAa;QAEd,uBAAiBuB,6BAA4B;QAC7C,uBAAiBT,UAAwD,CAAC;;AA4D5E;AAMA,OAAO,MAAMU,0BAA0B3B,cAA+CmB,WAAW;AAEjG,SAASS;IACP,MAAMC,MAAM5B,WAAW0B;IACvB,IAAIE,QAAQV,WAAW;QACrB,MAAM,IAAIW,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,0BAA0BC,KAAgB;IACxD,MAAM,EAAEC,KAAK,EAAE,GAAGL;IAElB,MAAMM,SAAShC,QAAQ;QACrB,MAAMgC,SAA2B,CAAC;QAClCF,kBAAAA,4BAAAA,MAAOG,OAAO,CAAC,CAACvB;YACd,MAAMwB,IAAIH,KAAK,CAACrB,KAAK;YACrB,IAAIwB,GAAG;gBACLF,MAAM,CAACtB,KAAK,GAAGwB;YACjB;QACF;QACA,OAAOF;IACT,GAAG;QAACD;QAAOD;KAAM;IAEjB,IAAIA,UAAUb,WAAW;QACvB,OAAOc;IACT;IAEA,OAAOC;AACT;AAEA,OAAO,SAASG,kBAAkBL,KAAgB;IAChD,MAAMM,yBAAyBP,0BAA0BC;IACzD,MAAMO,wBAAwBjC,yBAAyB0B;IAEvD,OAAO9B,QAAQ;QACb,OAAO;YAAE,GAAGoC,sBAAsB;YAAE,GAAGC,qBAAqB;QAAC;IAC/D,GAAG;QAACD;QAAwBC;KAAsB;AACpD;AAEA,gEAAgE;AAChE,OAAO,SAASC,4BAA4BC,GAAuB;IACjE,MAAMC,oBAAoBD,MAAMrC,uBAAuBqC,OAAO,EAAE;IAChE,MAAME,iBAAiBN,kBAAkBK;IACzC,IAAI,CAACD,KAAK,OAAOtB;IACjB,OAAOd,yBAAyBoC,KAAKE;AACvC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StoryFn, StoryContext } from '@storybook/react';
|
|
2
|
-
import { TemplateVariableSrv } from '../../../runtime';
|
|
3
|
-
declare module '@storybook/react' {
|
|
4
|
-
interface Parameters {
|
|
5
|
-
withPluginSystemTemplateVariables?: WithPluginSystemTemplateVariableParameter;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export type WithPluginSystemTemplateVariableParameter = {
|
|
9
|
-
props: TemplateVariableSrv;
|
|
10
|
-
};
|
|
11
|
-
export declare const WithPluginSystemTemplateVariables: (Story: StoryFn, context: StoryContext<unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//# sourceMappingURL=WithPluginSystemTemplateVariables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithPluginSystemTemplateVariables.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAA2B,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,iCAAiC,CAAC,EAAE,yCAAyC,CAAC;KAC/E;CACF;AAED,MAAM,MAAM,yCAAyC,GAAG;IACtD,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAcF,eAAO,MAAM,iCAAiC,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,4CAc/F,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.tsx"],"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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TemplateVariableContext, TemplateVariableSrv } from '../../../runtime';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemTemplateVariables?: WithPluginSystemTemplateVariableParameter;\n }\n}\n\nexport type WithPluginSystemTemplateVariableParameter = {\n props: TemplateVariableSrv;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTemplateVariableParameter(\n parameter: unknown | WithPluginSystemTemplateVariableParameter\n): parameter is WithPluginSystemTemplateVariableParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator is used for non-dashboards package template variable needs.\n// Use the more specific decorator in the dashboards package when working with\n// dashboards.\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemTemplateVariables = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withPluginSystemTemplateVariables;\n const defaultValue: TemplateVariableSrv = {\n state: {},\n };\n const parameter = isWithTemplateVariableParameter(initParameter) ? initParameter : { props: defaultValue };\n\n const props = parameter?.props;\n\n return (\n <TemplateVariableContext.Provider value={props}>\n <Story />\n </TemplateVariableContext.Provider>\n );\n};\n"],"names":["TemplateVariableContext","isWithTemplateVariableParameter","parameter","WithPluginSystemTemplateVariables","Story","context","initParameter","parameters","withPluginSystemTemplateVariables","defaultValue","state","props","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,uBAAuB,QAA6B,mBAAmB;AAYhF,yDAAyD;AACzD,SAASC,gCACPC,SAA8D;IAE9D,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,6EAA6E;AAC7E,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,oCAAoC,CAACC,OAAgBC;IAChE,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,iCAAiC;IAC1E,MAAMC,eAAoC;QACxCC,OAAO,CAAC;IACV;IACA,MAAMR,YAAYD,gCAAgCK,iBAAiBA,gBAAgB;QAAEK,OAAOF;IAAa;IAEzG,MAAME,QAAQT,sBAAAA,gCAAAA,UAAWS,KAAK;IAE9B,qBACE,KAACX,wBAAwBY,QAAQ;QAACC,OAAOF;kBACvC,cAAA,KAACP;;AAGP,EAAE"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const datasourceEditValidationSchema: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
title: z.ZodOptional<z.ZodString>;
|
|
5
|
-
description: z.ZodOptional<z.ZodString>;
|
|
6
|
-
default: z.ZodBoolean;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
name: string;
|
|
9
|
-
default: boolean;
|
|
10
|
-
title?: string | undefined;
|
|
11
|
-
description?: string | undefined;
|
|
12
|
-
}, {
|
|
13
|
-
name: string;
|
|
14
|
-
default: boolean;
|
|
15
|
-
title?: string | undefined;
|
|
16
|
-
description?: string | undefined;
|
|
17
|
-
}>;
|
|
18
|
-
export type DatasourceEditValidationType = z.infer<typeof datasourceEditValidationSchema>;
|
|
19
|
-
//# sourceMappingURL=datasource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/validation/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;EAKzC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
export const datasourceEditValidationSchema = z.object({
|
|
16
|
-
name: resourceIdValidationSchema,
|
|
17
|
-
title: z.string().optional(),
|
|
18
|
-
description: z.string().optional(),
|
|
19
|
-
default: z.boolean()
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=datasource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validation/datasource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport { resourceIdValidationSchema } from './resource';\n\nexport const datasourceEditValidationSchema = z.object({\n name: resourceIdValidationSchema,\n title: z.string().optional(), // display name\n description: z.string().optional(),\n default: z.boolean(),\n});\n\nexport type DatasourceEditValidationType = z.infer<typeof datasourceEditValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","datasourceEditValidationSchema","object","name","title","string","optional","description","default","boolean"],"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,OAAO,MAAMC,iCAAiCF,EAAEG,MAAM,CAAC;IACrDC,MAAMH;IACNI,OAAOL,EAAEM,MAAM,GAAGC,QAAQ;IAC1BC,aAAaR,EAAEM,MAAM,GAAGC,QAAQ;IAChCE,SAAST,EAAEU,OAAO;AACpB,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/validation/duration.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB,aAGsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validation/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 { DURATION_REGEX } from '@perses-dev/core';\nimport { z } from 'zod';\n\nexport const durationValidationSchema = z\n .string()\n .nonempty('Required')\n .regex(DURATION_REGEX, 'Must be a valid duration string');\n"],"names":["DURATION_REGEX","z","durationValidationSchema","string","nonempty","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,mBAAmB;AAClD,SAASC,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,2BAA2BD,EACrCE,MAAM,GACNC,QAAQ,CAAC,YACTC,KAAK,CAACL,gBAAgB,mCAAmC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/validation/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
export * from './datasource';
|
|
14
|
-
export * from './duration';
|
|
15
|
-
export * from './resource';
|
|
16
|
-
export * from './secret';
|
|
17
|
-
export * from './variable';
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validation/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './duration';\nexport * from './resource';\nexport * from './secret';\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,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,aAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/validation/resource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B,aAImE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
export const resourceIdValidationSchema = 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
|
-
|
|
16
|
-
//# sourceMappingURL=resource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validation/resource.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 resourceIdValidationSchema = 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"],"names":["z","resourceIdValidationSchema","string","min","max","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;AAExB,OAAO,MAAMC,6BAA6BD,EACvCE,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E"}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const roleValidationSchema: z.ZodObject<{
|
|
3
|
-
kind: z.ZodLiteral<"Role">;
|
|
4
|
-
metadata: z.ZodObject<{
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
project: z.ZodString;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
name: string;
|
|
9
|
-
project: string;
|
|
10
|
-
}, {
|
|
11
|
-
name: string;
|
|
12
|
-
project: string;
|
|
13
|
-
}>;
|
|
14
|
-
spec: z.ZodObject<{
|
|
15
|
-
permissions: z.ZodArray<z.ZodObject<{
|
|
16
|
-
actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
|
|
17
|
-
scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
20
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
21
|
-
}, {
|
|
22
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
23
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
24
|
-
}>, "many">;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
permissions: {
|
|
27
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
28
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
29
|
-
}[];
|
|
30
|
-
}, {
|
|
31
|
-
permissions: {
|
|
32
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
33
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
34
|
-
}[];
|
|
35
|
-
}>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
kind: "Role";
|
|
38
|
-
spec: {
|
|
39
|
-
permissions: {
|
|
40
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
41
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
42
|
-
}[];
|
|
43
|
-
};
|
|
44
|
-
metadata: {
|
|
45
|
-
name: string;
|
|
46
|
-
project: string;
|
|
47
|
-
};
|
|
48
|
-
}, {
|
|
49
|
-
kind: "Role";
|
|
50
|
-
spec: {
|
|
51
|
-
permissions: {
|
|
52
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
53
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
54
|
-
}[];
|
|
55
|
-
};
|
|
56
|
-
metadata: {
|
|
57
|
-
name: string;
|
|
58
|
-
project: string;
|
|
59
|
-
};
|
|
60
|
-
}>;
|
|
61
|
-
export declare const globalRoleValidationSchema: z.ZodObject<{
|
|
62
|
-
kind: z.ZodLiteral<"GlobalRole">;
|
|
63
|
-
metadata: z.ZodObject<{
|
|
64
|
-
name: z.ZodString;
|
|
65
|
-
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
name: string;
|
|
67
|
-
}, {
|
|
68
|
-
name: string;
|
|
69
|
-
}>;
|
|
70
|
-
spec: z.ZodObject<{
|
|
71
|
-
permissions: z.ZodArray<z.ZodObject<{
|
|
72
|
-
actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
|
|
73
|
-
scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
|
|
74
|
-
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
76
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
77
|
-
}, {
|
|
78
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
79
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
80
|
-
}>, "many">;
|
|
81
|
-
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
permissions: {
|
|
83
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
84
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
85
|
-
}[];
|
|
86
|
-
}, {
|
|
87
|
-
permissions: {
|
|
88
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
89
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
90
|
-
}[];
|
|
91
|
-
}>;
|
|
92
|
-
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
kind: "GlobalRole";
|
|
94
|
-
spec: {
|
|
95
|
-
permissions: {
|
|
96
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
97
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
98
|
-
}[];
|
|
99
|
-
};
|
|
100
|
-
metadata: {
|
|
101
|
-
name: string;
|
|
102
|
-
};
|
|
103
|
-
}, {
|
|
104
|
-
kind: "GlobalRole";
|
|
105
|
-
spec: {
|
|
106
|
-
permissions: {
|
|
107
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
108
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
109
|
-
}[];
|
|
110
|
-
};
|
|
111
|
-
metadata: {
|
|
112
|
-
name: string;
|
|
113
|
-
};
|
|
114
|
-
}>;
|
|
115
|
-
export declare const rolesEditorValidationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
116
|
-
kind: z.ZodLiteral<"Role">;
|
|
117
|
-
metadata: z.ZodObject<{
|
|
118
|
-
name: z.ZodString;
|
|
119
|
-
project: z.ZodString;
|
|
120
|
-
}, "strip", z.ZodTypeAny, {
|
|
121
|
-
name: string;
|
|
122
|
-
project: string;
|
|
123
|
-
}, {
|
|
124
|
-
name: string;
|
|
125
|
-
project: string;
|
|
126
|
-
}>;
|
|
127
|
-
spec: z.ZodObject<{
|
|
128
|
-
permissions: z.ZodArray<z.ZodObject<{
|
|
129
|
-
actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
|
|
130
|
-
scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
|
|
131
|
-
}, "strip", z.ZodTypeAny, {
|
|
132
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
133
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
134
|
-
}, {
|
|
135
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
136
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
137
|
-
}>, "many">;
|
|
138
|
-
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
permissions: {
|
|
140
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
141
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
142
|
-
}[];
|
|
143
|
-
}, {
|
|
144
|
-
permissions: {
|
|
145
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
146
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
147
|
-
}[];
|
|
148
|
-
}>;
|
|
149
|
-
}, "strip", z.ZodTypeAny, {
|
|
150
|
-
kind: "Role";
|
|
151
|
-
spec: {
|
|
152
|
-
permissions: {
|
|
153
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
154
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
155
|
-
}[];
|
|
156
|
-
};
|
|
157
|
-
metadata: {
|
|
158
|
-
name: string;
|
|
159
|
-
project: string;
|
|
160
|
-
};
|
|
161
|
-
}, {
|
|
162
|
-
kind: "Role";
|
|
163
|
-
spec: {
|
|
164
|
-
permissions: {
|
|
165
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
166
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
167
|
-
}[];
|
|
168
|
-
};
|
|
169
|
-
metadata: {
|
|
170
|
-
name: string;
|
|
171
|
-
project: string;
|
|
172
|
-
};
|
|
173
|
-
}>, z.ZodObject<{
|
|
174
|
-
kind: z.ZodLiteral<"GlobalRole">;
|
|
175
|
-
metadata: z.ZodObject<{
|
|
176
|
-
name: z.ZodString;
|
|
177
|
-
}, "strip", z.ZodTypeAny, {
|
|
178
|
-
name: string;
|
|
179
|
-
}, {
|
|
180
|
-
name: string;
|
|
181
|
-
}>;
|
|
182
|
-
spec: z.ZodObject<{
|
|
183
|
-
permissions: z.ZodArray<z.ZodObject<{
|
|
184
|
-
actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
|
|
185
|
-
scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
|
|
186
|
-
}, "strip", z.ZodTypeAny, {
|
|
187
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
188
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
189
|
-
}, {
|
|
190
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
191
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
192
|
-
}>, "many">;
|
|
193
|
-
}, "strip", z.ZodTypeAny, {
|
|
194
|
-
permissions: {
|
|
195
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
196
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
197
|
-
}[];
|
|
198
|
-
}, {
|
|
199
|
-
permissions: {
|
|
200
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
201
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
202
|
-
}[];
|
|
203
|
-
}>;
|
|
204
|
-
}, "strip", z.ZodTypeAny, {
|
|
205
|
-
kind: "GlobalRole";
|
|
206
|
-
spec: {
|
|
207
|
-
permissions: {
|
|
208
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
209
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
210
|
-
}[];
|
|
211
|
-
};
|
|
212
|
-
metadata: {
|
|
213
|
-
name: string;
|
|
214
|
-
};
|
|
215
|
-
}, {
|
|
216
|
-
kind: "GlobalRole";
|
|
217
|
-
spec: {
|
|
218
|
-
permissions: {
|
|
219
|
-
actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
|
|
220
|
-
scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
|
|
221
|
-
}[];
|
|
222
|
-
};
|
|
223
|
-
metadata: {
|
|
224
|
-
name: string;
|
|
225
|
-
};
|
|
226
|
-
}>]>;
|
|
227
|
-
export type RolesEditorValidationType = z.infer<typeof rolesEditorValidationSchema>;
|
|
228
|
-
//# sourceMappingURL=role.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/validation/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS/B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGtC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/validation/role.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
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 permissionValidationSchema = 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 roleValidationSchema = z.object({
|
|
44
|
-
kind: z.literal('Role'),
|
|
45
|
-
metadata: z.object({
|
|
46
|
-
name: resourceIdValidationSchema,
|
|
47
|
-
project: resourceIdValidationSchema
|
|
48
|
-
}),
|
|
49
|
-
spec: z.object({
|
|
50
|
-
permissions: z.array(permissionValidationSchema)
|
|
51
|
-
})
|
|
52
|
-
});
|
|
53
|
-
export const globalRoleValidationSchema = z.object({
|
|
54
|
-
kind: z.literal('GlobalRole'),
|
|
55
|
-
metadata: z.object({
|
|
56
|
-
name: resourceIdValidationSchema
|
|
57
|
-
}),
|
|
58
|
-
spec: z.object({
|
|
59
|
-
permissions: z.array(permissionValidationSchema)
|
|
60
|
-
})
|
|
61
|
-
});
|
|
62
|
-
export const rolesEditorValidationSchema = z.discriminatedUnion('kind', [
|
|
63
|
-
roleValidationSchema,
|
|
64
|
-
globalRoleValidationSchema
|
|
65
|
-
]);
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=role.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validation/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 { resourceIdValidationSchema } from './resource';\n\nconst permissionValidationSchema = 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 roleValidationSchema = z.object({\n kind: z.literal('Role'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n project: resourceIdValidationSchema,\n }),\n spec: z.object({\n permissions: z.array(permissionValidationSchema),\n }),\n});\n\nexport const globalRoleValidationSchema = z.object({\n kind: z.literal('GlobalRole'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n }),\n spec: z.object({\n permissions: z.array(permissionValidationSchema),\n }),\n});\n\nexport const rolesEditorValidationSchema = z.discriminatedUnion('kind', [\n roleValidationSchema,\n globalRoleValidationSchema,\n]);\n\nexport type RolesEditorValidationType = z.infer<typeof rolesEditorValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","permissionValidationSchema","object","actions","array","enum","nonempty","scopes","roleValidationSchema","kind","literal","metadata","name","project","spec","permissions","globalRoleValidationSchema","rolesEditorValidationSchema","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,6BAA6BF,EAAEG,MAAM,CAAC;IAC1C,sCAAsC;IACtCC,SAASJ,EAAEK,KAAK,CAACL,EAAEM,IAAI,CAAC;QAAC;QAAK;QAAU;QAAQ;QAAU;KAAS,GAAGC,QAAQ,CAAC;IAC/EC,QAAQR,EACLK,KAAK,CACJL,EAAEM,IAAI,CAAC;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,GAEFC,QAAQ,CAAC;AACd;AAEA,OAAO,MAAME,uBAAuBT,EAAEG,MAAM,CAAC;IAC3CO,MAAMV,EAAEW,OAAO,CAAC;IAChBC,UAAUZ,EAAEG,MAAM,CAAC;QACjBU,MAAMZ;QACNa,SAASb;IACX;IACAc,MAAMf,EAAEG,MAAM,CAAC;QACba,aAAahB,EAAEK,KAAK,CAACH;IACvB;AACF,GAAG;AAEH,OAAO,MAAMe,6BAA6BjB,EAAEG,MAAM,CAAC;IACjDO,MAAMV,EAAEW,OAAO,CAAC;IAChBC,UAAUZ,EAAEG,MAAM,CAAC;QACjBU,MAAMZ;IACR;IACAc,MAAMf,EAAEG,MAAM,CAAC;QACba,aAAahB,EAAEK,KAAK,CAACH;IACvB;AACF,GAAG;AAEH,OAAO,MAAMgB,8BAA8BlB,EAAEmB,kBAAkB,CAAC,QAAQ;IACtEV;IACAQ;CACD,EAAE"}
|