@jfvilas/plugin-kwirth-common 0.12.1

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 ADDED
@@ -0,0 +1,2 @@
1
+ # Kwirth Backstage Common
2
+ This repo contains common objects for use both at front and backend Backstage Kwirth plugins.
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const ANNOTATION_KWIRTH_LOCATION = "backstage.io/kubernetes-id";
4
+ const isKwirthAvailable = (entity) => {
5
+ if (!entity.metadata.annotations) return false;
6
+ return Boolean(entity.metadata.annotations[ANNOTATION_KWIRTH_LOCATION]);
7
+ };
8
+
9
+ exports.ANNOTATION_KWIRTH_LOCATION = ANNOTATION_KWIRTH_LOCATION;
10
+ exports.isKwirthAvailable = isKwirthAvailable;
11
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["/*\r\nCopyright 2024 Julio Fernandez\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nimport { Entity } from '@backstage/catalog-model';\r\nexport * from './Resources';\r\n\r\n/**\r\n * Kubelog annotation.\r\n */\r\nexport const ANNOTATION_KWIRTH_LOCATION = 'backstage.io/kubernetes-id';\r\n\r\n/**\r\n * Function to know if an entity has Kubelog.\r\n */\r\nexport const isKwirthAvailable = (entity: Entity) => {\r\n if (!entity.metadata.annotations) return false;\r\n return Boolean (entity.metadata.annotations[ANNOTATION_KWIRTH_LOCATION]);\r\n}\r\n"],"names":[],"mappings":";;AAqBO,MAAM,0BAA6B,GAAA;AAK7B,MAAA,iBAAA,GAAoB,CAAC,MAAmB,KAAA;AACnD,EAAA,IAAI,CAAC,MAAA,CAAO,QAAS,CAAA,WAAA,EAAoB,OAAA,KAAA;AACzC,EAAA,OAAO,OAAS,CAAA,MAAA,CAAO,QAAS,CAAA,WAAA,CAAY,0BAA0B,CAAC,CAAA;AACzE;;;;;"}
@@ -0,0 +1,39 @@
1
+ import { Entity } from '@backstage/catalog-model';
2
+ import { InstanceConfigScopeEnum, AccessKey } from '@jfvilas/kwirth-common';
3
+
4
+ /**
5
+ * @interface PodData contains data related on oaccessing one pod for doing someting
6
+ * @field name, the name of the pod (including nothing extra)
7
+ * @field namespace, the namespace of the pod
8
+ * @field accessKeys, a Map with a service scope as key (STREAM, VIEW, RESTART...) and an access key as value
9
+ */
10
+ interface PodData {
11
+ name: string;
12
+ namespace: string;
13
+ }
14
+ /**
15
+ * @interface ClusterValidPods contains data about a cluster and all the pods found in the cluster that match required access
16
+ * @field name is the name of the cluster
17
+ * @field url is the kwirth url (we will use it for asking for access keys)
18
+ * @field title is a short description of the cluster
19
+ * @field data is an array of 'PodAccess'
20
+ */
21
+ interface ClusterValidPods {
22
+ name: string;
23
+ url: string;
24
+ title?: string;
25
+ data: PodData[];
26
+ accessKeys: Map<InstanceConfigScopeEnum, AccessKey>;
27
+ }
28
+
29
+ /**
30
+ * Kubelog annotation.
31
+ */
32
+ declare const ANNOTATION_KWIRTH_LOCATION = "backstage.io/kubernetes-id";
33
+ /**
34
+ * Function to know if an entity has Kubelog.
35
+ */
36
+ declare const isKwirthAvailable: (entity: Entity) => boolean;
37
+
38
+ export { ANNOTATION_KWIRTH_LOCATION, isKwirthAvailable };
39
+ export type { ClusterValidPods, PodData };
@@ -0,0 +1,8 @@
1
+ const ANNOTATION_KWIRTH_LOCATION = "backstage.io/kubernetes-id";
2
+ const isKwirthAvailable = (entity) => {
3
+ if (!entity.metadata.annotations) return false;
4
+ return Boolean(entity.metadata.annotations[ANNOTATION_KWIRTH_LOCATION]);
5
+ };
6
+
7
+ export { ANNOTATION_KWIRTH_LOCATION, isKwirthAvailable };
8
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["/*\r\nCopyright 2024 Julio Fernandez\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nimport { Entity } from '@backstage/catalog-model';\r\nexport * from './Resources';\r\n\r\n/**\r\n * Kubelog annotation.\r\n */\r\nexport const ANNOTATION_KWIRTH_LOCATION = 'backstage.io/kubernetes-id';\r\n\r\n/**\r\n * Function to know if an entity has Kubelog.\r\n */\r\nexport const isKwirthAvailable = (entity: Entity) => {\r\n if (!entity.metadata.annotations) return false;\r\n return Boolean (entity.metadata.annotations[ANNOTATION_KWIRTH_LOCATION]);\r\n}\r\n"],"names":[],"mappings":"AAqBO,MAAM,0BAA6B,GAAA;AAK7B,MAAA,iBAAA,GAAoB,CAAC,MAAmB,KAAA;AACnD,EAAA,IAAI,CAAC,MAAA,CAAO,QAAS,CAAA,WAAA,EAAoB,OAAA,KAAA;AACzC,EAAA,OAAO,OAAS,CAAA,MAAA,CAAO,QAAS,CAAA,WAAA,CAAY,0BAA0B,CAAC,CAAA;AACzE;;;;"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@jfvilas/plugin-kwirth-common",
3
+ "version": "0.12.1",
4
+ "description": "Common functionalities for the Backstage Kwirth plugins",
5
+ "keywords": [
6
+ "Backstage",
7
+ "Kubernetes",
8
+ "observability",
9
+ "Kwirth",
10
+ "plugin"
11
+ ],
12
+ "backstage": {
13
+ "role": "common-library",
14
+ "pluginId": "kwirth",
15
+ "pluginPackages": [
16
+ "@jfvilas/plugin-kwirth-backend",
17
+ "@jfvilas/plugin-kwirth-common"
18
+ ]
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/jfvilas/plugin-kwirth-common"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "main": "dist/index.cjs.js",
27
+ "module": "dist/index.esm.js",
28
+ "types": "dist/index.d.ts"
29
+ },
30
+ "license": "Apache-2.0",
31
+ "author": {
32
+ "name": "Julio Fernandez",
33
+ "url": "https://github.com/jfvilas",
34
+ "email": "jfvilas@outlook.com"
35
+ },
36
+ "sideEffects": false,
37
+ "main": "dist/index.cjs.js",
38
+ "types": "dist/index.d.ts",
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "scripts": {
43
+ "build": "backstage-cli package build",
44
+ "clean": "backstage-cli package clean",
45
+ "lint": "backstage-cli package lint",
46
+ "prepack": "backstage-cli package prepack",
47
+ "postpack": "backstage-cli package postpack",
48
+ "test": "backstage-cli package test"
49
+ },
50
+ "dependencies": {
51
+ "@backstage/catalog-model": "^1.5.0",
52
+ "@backstage/integration": "^1.13.0"
53
+ },
54
+ "devDependencies": {
55
+ "@backstage/cli": "^0.26.11"
56
+ },
57
+ "module": "dist/index.esm.js"
58
+ }