@perses-dev/client 0.54.0-beta.10
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/README.md +3 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/model/dashboard.js +16 -0
- package/dist/cjs/model/datasource-api.js +16 -0
- package/dist/cjs/model/datasource.js +16 -0
- package/dist/cjs/model/ephemeralDashboard.js +16 -0
- package/dist/cjs/model/folder.js +16 -0
- package/dist/cjs/model/http.js +16 -0
- package/dist/cjs/model/index.js +42 -0
- package/dist/cjs/model/kind.js +39 -0
- package/dist/cjs/model/resource.js +36 -0
- package/dist/cjs/model/role.js +60 -0
- package/dist/cjs/model/roleBindings.js +16 -0
- package/dist/cjs/model/secret.js +16 -0
- package/dist/cjs/model/user.js +16 -0
- package/dist/cjs/model/variable.js +34 -0
- package/dist/cjs/schema/datasource.js +66 -0
- package/dist/cjs/schema/index.js +35 -0
- package/dist/cjs/schema/metadata.js +41 -0
- package/dist/cjs/schema/role.js +86 -0
- package/dist/cjs/schema/rolebinding.js +65 -0
- package/dist/cjs/schema/secret.js +211 -0
- package/dist/cjs/schema/user.js +57 -0
- package/dist/cjs/test/index.js +30 -0
- package/dist/cjs/test/render.js +38 -0
- package/dist/cjs/test/setup-tests.js +18 -0
- package/dist/cjs/util/fetch.js +82 -0
- package/dist/cjs/util/index.js +30 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/model/dashboard.d.ts +9 -0
- package/dist/model/dashboard.d.ts.map +1 -0
- package/dist/model/dashboard.js +15 -0
- package/dist/model/dashboard.js.map +1 -0
- package/dist/model/datasource-api.d.ts +41 -0
- package/dist/model/datasource-api.d.ts.map +1 -0
- package/dist/model/datasource-api.js +19 -0
- package/dist/model/datasource-api.js.map +1 -0
- package/dist/model/datasource.d.ts +28 -0
- package/dist/model/datasource.d.ts.map +1 -0
- package/dist/model/datasource.js +15 -0
- package/dist/model/datasource.js.map +1 -0
- package/dist/model/ephemeralDashboard.d.ts +14 -0
- package/dist/model/ephemeralDashboard.d.ts.map +1 -0
- package/dist/model/ephemeralDashboard.js +15 -0
- package/dist/model/ephemeralDashboard.js.map +1 -0
- package/dist/model/folder.d.ts +19 -0
- package/dist/model/folder.d.ts.map +1 -0
- package/dist/model/folder.js +15 -0
- package/dist/model/folder.js.map +1 -0
- package/dist/model/http.d.ts +2 -0
- package/dist/model/http.d.ts.map +1 -0
- package/dist/model/http.js +15 -0
- package/dist/model/http.js.map +1 -0
- package/dist/model/index.d.ts +14 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +27 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/kind.d.ts +3 -0
- package/dist/model/kind.d.ts.map +1 -0
- package/dist/model/kind.js +31 -0
- package/dist/model/kind.js.map +1 -0
- package/dist/model/resource.d.ts +28 -0
- package/dist/model/resource.d.ts.map +1 -0
- package/dist/model/resource.js +20 -0
- package/dist/model/resource.js.map +1 -0
- package/dist/model/role.d.ts +31 -0
- package/dist/model/role.d.ts.map +1 -0
- package/dist/model/role.js +41 -0
- package/dist/model/role.js.map +1 -0
- package/dist/model/roleBindings.d.ts +27 -0
- package/dist/model/roleBindings.d.ts.map +1 -0
- package/dist/model/roleBindings.js +15 -0
- package/dist/model/roleBindings.js.map +1 -0
- package/dist/model/secret.d.ts +54 -0
- package/dist/model/secret.d.ts.map +1 -0
- package/dist/model/secret.js +15 -0
- package/dist/model/secret.js.map +1 -0
- package/dist/model/user.d.ts +21 -0
- package/dist/model/user.d.ts.map +1 -0
- package/dist/model/user.js +15 -0
- package/dist/model/user.js.map +1 -0
- package/dist/model/variable.d.ts +58 -0
- package/dist/model/variable.d.ts.map +1 -0
- package/dist/model/variable.js +18 -0
- package/dist/model/variable.js.map +1 -0
- package/dist/schema/datasource.d.ts +59 -0
- package/dist/schema/datasource.d.ts.map +1 -0
- package/dist/schema/datasource.js +41 -0
- package/dist/schema/datasource.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +20 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/metadata.d.ts +21 -0
- package/dist/schema/metadata.d.ts.map +1 -0
- package/dist/schema/metadata.js +22 -0
- package/dist/schema/metadata.js.map +1 -0
- package/dist/schema/role.d.ts +58 -0
- package/dist/schema/role.d.ts.map +1 -0
- package/dist/schema/role.js +61 -0
- package/dist/schema/role.js.map +1 -0
- package/dist/schema/rolebinding.d.ts +58 -0
- package/dist/schema/rolebinding.d.ts.map +1 -0
- package/dist/schema/rolebinding.js +40 -0
- package/dist/schema/rolebinding.js.map +1 -0
- package/dist/schema/secret.d.ts +1597 -0
- package/dist/schema/secret.d.ts.map +1 -0
- package/dist/schema/secret.js +189 -0
- package/dist/schema/secret.js.map +1 -0
- package/dist/schema/user.d.ts +8 -0
- package/dist/schema/user.d.ts.map +1 -0
- package/dist/schema/user.js +36 -0
- package/dist/schema/user.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.d.ts +7 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +32 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +16 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/util/fetch.d.ts +28 -0
- package/dist/util/fetch.d.ts.map +1 -0
- package/dist/util/fetch.js +68 -0
- package/dist/util/fetch.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +15 -0
- package/dist/util/index.js.map +1 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Perses Client Package
|
|
2
|
+
|
|
3
|
+
This [package](https://www.npmjs.com/package/@perses-dev/client) Functions as an API Client or Data Fetching Layer for interacting with a backend service. For more info about corresponding packages see the [general UI README here](https://github.com/perses/perses/blob/main/ui/README.md) and markdown files in each component folder.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 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
|
+
_export_star(require("./util"), exports);
|
|
18
|
+
_export_star(require("./model"), exports);
|
|
19
|
+
_export_star(require("./schema"), exports);
|
|
20
|
+
function _export_star(from, to) {
|
|
21
|
+
Object.keys(from).forEach(function(k) {
|
|
22
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
23
|
+
Object.defineProperty(to, k, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return from[k];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return from;
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 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
|
+
_export_star(require("./datasource"), exports);
|
|
18
|
+
_export_star(require("./folder"), exports);
|
|
19
|
+
_export_star(require("./kind"), exports);
|
|
20
|
+
_export_star(require("./resource"), exports);
|
|
21
|
+
_export_star(require("./datasource-api"), exports);
|
|
22
|
+
_export_star(require("./http"), exports);
|
|
23
|
+
_export_star(require("./secret"), exports);
|
|
24
|
+
_export_star(require("./role"), exports);
|
|
25
|
+
_export_star(require("./roleBindings"), exports);
|
|
26
|
+
_export_star(require("./user"), exports);
|
|
27
|
+
_export_star(require("./ephemeralDashboard"), exports);
|
|
28
|
+
_export_star(require("./variable"), exports);
|
|
29
|
+
_export_star(require("./dashboard"), exports);
|
|
30
|
+
function _export_star(from, to) {
|
|
31
|
+
Object.keys(from).forEach(function(k) {
|
|
32
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
33
|
+
Object.defineProperty(to, k, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return from[k];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return from;
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 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, "KINDS", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return KINDS;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const KINDS = [
|
|
24
|
+
'Dashboard',
|
|
25
|
+
'Datasource',
|
|
26
|
+
'EphemeralDashboard',
|
|
27
|
+
'Folder',
|
|
28
|
+
'GlobalDatasource',
|
|
29
|
+
'GlobalRole',
|
|
30
|
+
'GlobalRoleBinding',
|
|
31
|
+
'GlobalSecret',
|
|
32
|
+
'GlobalVariable',
|
|
33
|
+
'Project',
|
|
34
|
+
'Role',
|
|
35
|
+
'RoleBinding',
|
|
36
|
+
'Secret',
|
|
37
|
+
'User',
|
|
38
|
+
'Variable'
|
|
39
|
+
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get getMetadataProject () {
|
|
25
|
+
return getMetadataProject;
|
|
26
|
+
},
|
|
27
|
+
get isProjectMetadata () {
|
|
28
|
+
return isProjectMetadata;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function isProjectMetadata(metadata) {
|
|
32
|
+
return 'project' in metadata;
|
|
33
|
+
}
|
|
34
|
+
function getMetadataProject(metadata) {
|
|
35
|
+
return 'project' in metadata ? metadata.project : undefined;
|
|
36
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get ACTIONS () {
|
|
25
|
+
return ACTIONS;
|
|
26
|
+
},
|
|
27
|
+
get GLOBAL_SCOPES () {
|
|
28
|
+
return GLOBAL_SCOPES;
|
|
29
|
+
},
|
|
30
|
+
get PROJECT_SCOPES () {
|
|
31
|
+
return PROJECT_SCOPES;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const ACTIONS = [
|
|
35
|
+
'*',
|
|
36
|
+
'create',
|
|
37
|
+
'read',
|
|
38
|
+
'update',
|
|
39
|
+
'delete'
|
|
40
|
+
];
|
|
41
|
+
const PROJECT_SCOPES = [
|
|
42
|
+
'*',
|
|
43
|
+
'Dashboard',
|
|
44
|
+
'Datasource',
|
|
45
|
+
'EphemeralDashboard',
|
|
46
|
+
'Folder',
|
|
47
|
+
'Project',
|
|
48
|
+
'Role',
|
|
49
|
+
'RoleBinding',
|
|
50
|
+
'Secret',
|
|
51
|
+
'Variable'
|
|
52
|
+
];
|
|
53
|
+
const GLOBAL_SCOPES = [
|
|
54
|
+
'GlobalDatasource',
|
|
55
|
+
'GlobalRole',
|
|
56
|
+
'GlobalRoleBinding',
|
|
57
|
+
'GlobalSecret',
|
|
58
|
+
'GlobalVariable',
|
|
59
|
+
'User'
|
|
60
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get DEFAULT_ALL_VALUE () {
|
|
25
|
+
return DEFAULT_ALL_VALUE;
|
|
26
|
+
},
|
|
27
|
+
get getVariableProject () {
|
|
28
|
+
return getVariableProject;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function getVariableProject(variable) {
|
|
32
|
+
return 'project' in variable.metadata ? variable.metadata.project : undefined;
|
|
33
|
+
}
|
|
34
|
+
const DEFAULT_ALL_VALUE = '$__all';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get buildDatasourceDefinitionSchema () {
|
|
25
|
+
return buildDatasourceDefinitionSchema;
|
|
26
|
+
},
|
|
27
|
+
get datasourceDefinitionSchema () {
|
|
28
|
+
return datasourceDefinitionSchema;
|
|
29
|
+
},
|
|
30
|
+
get datasourceSchema () {
|
|
31
|
+
return datasourceSchema;
|
|
32
|
+
},
|
|
33
|
+
get datasourcesSchema () {
|
|
34
|
+
return datasourcesSchema;
|
|
35
|
+
},
|
|
36
|
+
get globalDatasourceSchema () {
|
|
37
|
+
return globalDatasourceSchema;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const _spec = require("@perses-dev/spec");
|
|
41
|
+
const _zod = require("zod");
|
|
42
|
+
const _metadata = require("./metadata");
|
|
43
|
+
const datasourceSchema = _zod.z.object({
|
|
44
|
+
kind: _zod.z.literal('Datasource'),
|
|
45
|
+
metadata: _metadata.projectMetadataSchema,
|
|
46
|
+
spec: _spec.datasourceSpecSchema
|
|
47
|
+
});
|
|
48
|
+
const globalDatasourceSchema = _zod.z.object({
|
|
49
|
+
kind: _zod.z.literal('GlobalDatasource'),
|
|
50
|
+
metadata: _metadata.metadataSchema,
|
|
51
|
+
spec: _spec.datasourceSpecSchema
|
|
52
|
+
});
|
|
53
|
+
const datasourcesSchema = _zod.z.discriminatedUnion('kind', [
|
|
54
|
+
datasourceSchema,
|
|
55
|
+
globalDatasourceSchema
|
|
56
|
+
]);
|
|
57
|
+
const datasourceDefinitionSchema = _zod.z.object({
|
|
58
|
+
name: _zod.z.string().min(1),
|
|
59
|
+
spec: _spec.datasourceSpecSchema
|
|
60
|
+
});
|
|
61
|
+
function buildDatasourceDefinitionSchema(pluginSchema) {
|
|
62
|
+
return _zod.z.object({
|
|
63
|
+
name: _zod.z.string().min(1),
|
|
64
|
+
spec: (0, _spec.buildDatasourceSpecSchema)(pluginSchema)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright 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
|
+
_export_star(require("./datasource"), exports);
|
|
18
|
+
_export_star(require("./metadata"), exports);
|
|
19
|
+
_export_star(require("./user"), exports);
|
|
20
|
+
_export_star(require("./secret"), exports);
|
|
21
|
+
_export_star(require("./role"), exports);
|
|
22
|
+
_export_star(require("./rolebinding"), exports);
|
|
23
|
+
function _export_star(from, to) {
|
|
24
|
+
Object.keys(from).forEach(function(k) {
|
|
25
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
26
|
+
Object.defineProperty(to, k, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return from[k];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return from;
|
|
35
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get metadataSchema () {
|
|
25
|
+
return metadataSchema;
|
|
26
|
+
},
|
|
27
|
+
get nameSchema () {
|
|
28
|
+
return nameSchema;
|
|
29
|
+
},
|
|
30
|
+
get projectMetadataSchema () {
|
|
31
|
+
return projectMetadataSchema;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _zod = require("zod");
|
|
35
|
+
const nameSchema = _zod.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 _ . -');
|
|
36
|
+
const metadataSchema = _zod.z.object({
|
|
37
|
+
name: nameSchema
|
|
38
|
+
});
|
|
39
|
+
const projectMetadataSchema = metadataSchema.extend({
|
|
40
|
+
project: nameSchema
|
|
41
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get globalRoleSchema () {
|
|
25
|
+
return globalRoleSchema;
|
|
26
|
+
},
|
|
27
|
+
get permissionSchema () {
|
|
28
|
+
return permissionSchema;
|
|
29
|
+
},
|
|
30
|
+
get roleSchema () {
|
|
31
|
+
return roleSchema;
|
|
32
|
+
},
|
|
33
|
+
get roleSpecSchema () {
|
|
34
|
+
return roleSpecSchema;
|
|
35
|
+
},
|
|
36
|
+
get rolesEditorSchema () {
|
|
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
|
+
]);
|