@backstage/plugin-catalog-backend 2.0.1-next.1 → 2.0.1-next.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 2.0.1-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2cac8b0: You can now specify an optional value when applying the `HAS_LABEL` permission rule, similar to the `HAS_ANNOTATION` permission rule.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-openapi-utils@0.5.4-next.1
|
|
10
|
+
- @backstage/backend-plugin-api@1.4.0-next.1
|
|
11
|
+
- @backstage/catalog-client@1.10.1-next.0
|
|
12
|
+
- @backstage/catalog-model@1.7.4
|
|
13
|
+
- @backstage/config@1.3.2
|
|
14
|
+
- @backstage/errors@1.2.7
|
|
15
|
+
- @backstage/integration@1.17.0
|
|
16
|
+
- @backstage/types@1.2.1
|
|
17
|
+
- @backstage/plugin-catalog-common@1.1.4
|
|
18
|
+
- @backstage/plugin-catalog-node@1.17.1-next.1
|
|
19
|
+
- @backstage/plugin-events-node@0.4.12-next.1
|
|
20
|
+
- @backstage/plugin-permission-common@0.9.0
|
|
21
|
+
- @backstage/plugin-permission-node@0.10.1-next.1
|
|
22
|
+
|
|
3
23
|
## 2.0.1-next.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare const catalogConditions: _backstage_plugin_permission_node.Conditions<{
|
|
|
20
20
|
}>;
|
|
21
21
|
hasLabel: _backstage_plugin_permission_node.PermissionRule<_backstage_catalog_model.Entity, _backstage_plugin_catalog_node.EntitiesSearchFilter, "catalog-entity", {
|
|
22
22
|
label: string;
|
|
23
|
+
value?: string | undefined;
|
|
23
24
|
}>;
|
|
24
25
|
hasMetadata: _backstage_plugin_permission_node.PermissionRule<_backstage_catalog_model.Entity, _backstage_plugin_catalog_node.EntitiesSearchFilter, "catalog-entity", {
|
|
25
26
|
key: string;
|
|
@@ -99,6 +100,7 @@ declare const permissionRules: {
|
|
|
99
100
|
}>;
|
|
100
101
|
hasLabel: _backstage_plugin_permission_node.PermissionRule<_backstage_catalog_model.Entity, _backstage_plugin_catalog_node.EntitiesSearchFilter, "catalog-entity", {
|
|
101
102
|
label: string;
|
|
103
|
+
value?: string | undefined;
|
|
102
104
|
}>;
|
|
103
105
|
hasMetadata: _backstage_plugin_permission_node.PermissionRule<_backstage_catalog_model.Entity, _backstage_plugin_catalog_node.EntitiesSearchFilter, "catalog-entity", {
|
|
104
106
|
key: string;
|
|
@@ -9,12 +9,16 @@ const hasLabel = pluginPermissionNode.createPermissionRule({
|
|
|
9
9
|
description: "Allow entities with the specified label",
|
|
10
10
|
resourceRef: alpha.catalogEntityPermissionResourceRef,
|
|
11
11
|
paramsSchema: zod.z.object({
|
|
12
|
-
label: zod.z.string().describe("Name of the label to match on")
|
|
12
|
+
label: zod.z.string().describe("Name of the label to match on"),
|
|
13
|
+
value: zod.z.string().optional().describe("Value of the label to match on")
|
|
13
14
|
}),
|
|
14
|
-
apply: (resource, { label }) => !!resource.metadata.labels?.hasOwnProperty(label),
|
|
15
|
-
toQuery: ({ label }) =>
|
|
15
|
+
apply: (resource, { label, value }) => !!resource.metadata.labels?.hasOwnProperty(label) && (value === void 0 ? true : resource.metadata.labels?.[label] === value),
|
|
16
|
+
toQuery: ({ label, value }) => value === void 0 ? {
|
|
16
17
|
key: `metadata.labels.${label}`
|
|
17
|
-
}
|
|
18
|
+
} : {
|
|
19
|
+
key: `metadata.labels.${label}`,
|
|
20
|
+
values: [value]
|
|
21
|
+
}
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
exports.hasLabel = hasLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasLabel.cjs.js","sources":["../../../src/permissions/rules/hasLabel.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\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 */\n\nimport { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified label in its metadata.\n * @alpha\n */\nexport const hasLabel = createPermissionRule({\n name: 'HAS_LABEL',\n description: 'Allow entities with the specified label',\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n label: z.string().describe('Name of the label to match on'),\n }),\n apply: (resource, { label }) =>\n !!resource.metadata.labels?.hasOwnProperty(label),\n toQuery: ({ label })
|
|
1
|
+
{"version":3,"file":"hasLabel.cjs.js","sources":["../../../src/permissions/rules/hasLabel.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\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 */\n\nimport { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified label in its metadata.\n * @alpha\n */\nexport const hasLabel = createPermissionRule({\n name: 'HAS_LABEL',\n description: 'Allow entities with the specified label',\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n label: z.string().describe('Name of the label to match on'),\n value: z.string().optional().describe('Value of the label to match on'),\n }),\n apply: (resource, { label, value }) =>\n !!resource.metadata.labels?.hasOwnProperty(label) &&\n (value === undefined ? true : resource.metadata.labels?.[label] === value),\n toQuery: ({ label, value }) =>\n value === undefined\n ? {\n key: `metadata.labels.${label}`,\n }\n : {\n key: `metadata.labels.${label}`,\n values: [value],\n },\n});\n"],"names":["createPermissionRule","catalogEntityPermissionResourceRef","z"],"mappings":";;;;;;AAyBO,MAAM,WAAWA,yCAAqB,CAAA;AAAA,EAC3C,IAAM,EAAA,WAAA;AAAA,EACN,WAAa,EAAA,yCAAA;AAAA,EACb,WAAa,EAAAC,wCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,KAAO,EAAAA,KAAA,CAAE,MAAO,EAAA,CAAE,SAAS,+BAA+B,CAAA;AAAA,IAC1D,OAAOA,KAAE,CAAA,MAAA,GAAS,QAAS,EAAA,CAAE,SAAS,gCAAgC;AAAA,GACvE,CAAA;AAAA,EACD,KAAA,EAAO,CAAC,QAAU,EAAA,EAAE,OAAO,KAAM,EAAA,KAC/B,CAAC,CAAC,QAAS,CAAA,QAAA,CAAS,QAAQ,cAAe,CAAA,KAAK,MAC/C,KAAU,KAAA,KAAA,CAAA,GAAY,OAAO,QAAS,CAAA,QAAA,CAAS,MAAS,GAAA,KAAK,CAAM,KAAA,KAAA,CAAA;AAAA,EACtE,SAAS,CAAC,EAAE,OAAO,KAAM,EAAA,KACvB,UAAU,KACN,CAAA,GAAA;AAAA,IACE,GAAA,EAAK,mBAAmB,KAAK,CAAA;AAAA,GAE/B,GAAA;AAAA,IACE,GAAA,EAAK,mBAAmB,KAAK,CAAA,CAAA;AAAA,IAC7B,MAAA,EAAQ,CAAC,KAAK;AAAA;AAExB,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend",
|
|
3
|
-
"version": "2.0.1-next.
|
|
3
|
+
"version": "2.0.1-next.2",
|
|
4
4
|
"description": "The Backstage backend plugin that provides the Backstage catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin",
|
|
@@ -106,11 +106,11 @@
|
|
|
106
106
|
"zod": "^3.22.4"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@backstage/backend-defaults": "0.
|
|
110
|
-
"@backstage/backend-test-utils": "1.6.0-next.
|
|
111
|
-
"@backstage/cli": "0.
|
|
109
|
+
"@backstage/backend-defaults": "0.11.0-next.2",
|
|
110
|
+
"@backstage/backend-test-utils": "1.6.0-next.2",
|
|
111
|
+
"@backstage/cli": "0.33.0-next.1",
|
|
112
112
|
"@backstage/plugin-permission-common": "0.9.0",
|
|
113
|
-
"@backstage/repo-tools": "0.14.0-next.
|
|
113
|
+
"@backstage/repo-tools": "0.14.0-next.2",
|
|
114
114
|
"@backstage/test-utils": "1.7.8",
|
|
115
115
|
"@types/core-js": "^2.5.4",
|
|
116
116
|
"@types/express": "^4.17.6",
|