@backstage/plugin-catalog-common 1.0.11 → 1.0.12-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-catalog-common
2
2
 
3
+ ## 1.0.12-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 928a12a9b3: Internal refactor of `/alpha` exports.
8
+ - Updated dependencies
9
+ - @backstage/catalog-model@1.2.1-next.0
10
+ - @backstage/plugin-permission-common@0.7.3
11
+ - @backstage/plugin-search-common@1.2.1
12
+
3
13
  ## 1.0.11
4
14
 
5
15
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-common",
3
- "version": "1.0.11",
4
- "main": "../dist/index.cjs.js",
5
- "module": "../dist/index.esm.js",
6
- "types": "../dist/index.alpha.d.ts"
3
+ "version": "1.0.12-next.0",
4
+ "main": "../dist/alpha.cjs.js",
5
+ "module": "../dist/alpha.esm.js",
6
+ "types": "../dist/alpha.d.ts"
7
7
  }
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var pluginPermissionCommon = require('@backstage/plugin-permission-common');
6
+
7
+ const RESOURCE_TYPE_CATALOG_ENTITY = "catalog-entity";
8
+ const catalogEntityReadPermission = pluginPermissionCommon.createPermission({
9
+ name: "catalog.entity.read",
10
+ attributes: {
11
+ action: "read"
12
+ },
13
+ resourceType: RESOURCE_TYPE_CATALOG_ENTITY
14
+ });
15
+ const catalogEntityCreatePermission = pluginPermissionCommon.createPermission({
16
+ name: "catalog.entity.create",
17
+ attributes: {
18
+ action: "create"
19
+ }
20
+ });
21
+ const catalogEntityDeletePermission = pluginPermissionCommon.createPermission({
22
+ name: "catalog.entity.delete",
23
+ attributes: {
24
+ action: "delete"
25
+ },
26
+ resourceType: RESOURCE_TYPE_CATALOG_ENTITY
27
+ });
28
+ const catalogEntityRefreshPermission = pluginPermissionCommon.createPermission({
29
+ name: "catalog.entity.refresh",
30
+ attributes: {
31
+ action: "update"
32
+ },
33
+ resourceType: RESOURCE_TYPE_CATALOG_ENTITY
34
+ });
35
+ const catalogLocationReadPermission = pluginPermissionCommon.createPermission({
36
+ name: "catalog.location.read",
37
+ attributes: {
38
+ action: "read"
39
+ }
40
+ });
41
+ const catalogLocationCreatePermission = pluginPermissionCommon.createPermission({
42
+ name: "catalog.location.create",
43
+ attributes: {
44
+ action: "create"
45
+ }
46
+ });
47
+ const catalogLocationDeletePermission = pluginPermissionCommon.createPermission({
48
+ name: "catalog.location.delete",
49
+ attributes: {
50
+ action: "delete"
51
+ }
52
+ });
53
+ const catalogPermissions = [
54
+ catalogEntityReadPermission,
55
+ catalogEntityCreatePermission,
56
+ catalogEntityDeletePermission,
57
+ catalogEntityRefreshPermission,
58
+ catalogLocationReadPermission,
59
+ catalogLocationCreatePermission,
60
+ catalogLocationDeletePermission
61
+ ];
62
+
63
+ exports.RESOURCE_TYPE_CATALOG_ENTITY = RESOURCE_TYPE_CATALOG_ENTITY;
64
+ exports.catalogEntityCreatePermission = catalogEntityCreatePermission;
65
+ exports.catalogEntityDeletePermission = catalogEntityDeletePermission;
66
+ exports.catalogEntityReadPermission = catalogEntityReadPermission;
67
+ exports.catalogEntityRefreshPermission = catalogEntityRefreshPermission;
68
+ exports.catalogLocationCreatePermission = catalogLocationCreatePermission;
69
+ exports.catalogLocationDeletePermission = catalogLocationDeletePermission;
70
+ exports.catalogLocationReadPermission = catalogLocationReadPermission;
71
+ exports.catalogPermissions = catalogPermissions;
72
+ //# sourceMappingURL=alpha.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.cjs.js","sources":["../src/permissions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {\n createPermission,\n ResourcePermission,\n} from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to catalog entities.\n *\n * {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}\n * @alpha\n */\nexport const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';\n\n/**\n * Convenience type for catalog entity\n * {@link @backstage/plugin-permission-common#ResourcePermission}s.\n * @alpha\n */\nexport type CatalogEntityPermission = ResourcePermission<\n typeof RESOURCE_TYPE_CATALOG_ENTITY\n>;\n\n/**\n * This permission is used to authorize actions that involve reading one or more\n * entities from the catalog.\n *\n * If this permission is not authorized, it will appear that the entity does not\n * exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogEntityReadPermission = createPermission({\n name: 'catalog.entity.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to authorize actions that involve creating a new\n * catalog entity. This includes registering an existing component into the\n * catalog.\n * @alpha\n */\nexport const catalogEntityCreatePermission = createPermission({\n name: 'catalog.entity.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve removing one or\n * more entities from the catalog.\n * @alpha\n */\nexport const catalogEntityDeletePermission = createPermission({\n name: 'catalog.entity.delete',\n attributes: {\n action: 'delete',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate refreshing one or more entities from the\n * catalog.\n * @alpha\n */\nexport const catalogEntityRefreshPermission = createPermission({\n name: 'catalog.entity.refresh',\n attributes: {\n action: 'update',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate actions that involve reading one or more\n * locations from the catalog.\n *\n * If this permission is not authorized, it will appear that the location does\n * not exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogLocationReadPermission = createPermission({\n name: 'catalog.location.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * This permission is used to designate actions that involve creating catalog\n * locations.\n * @alpha\n */\nexport const catalogLocationCreatePermission = createPermission({\n name: 'catalog.location.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve deleting locations\n * from the catalog.\n * @alpha\n */\nexport const catalogLocationDeletePermission = createPermission({\n name: 'catalog.location.delete',\n attributes: {\n action: 'delete',\n },\n});\n\n/**\n * List of all catalog permissions.\n * @alpha\n */\nexport const catalogPermissions = [\n catalogEntityReadPermission,\n catalogEntityCreatePermission,\n catalogEntityDeletePermission,\n catalogEntityRefreshPermission,\n catalogLocationReadPermission,\n catalogLocationCreatePermission,\n catalogLocationDeletePermission,\n];\n"],"names":["createPermission"],"mappings":";;;;;;AA2BO,MAAM,4BAA+B,GAAA,iBAAA;AAmBrC,MAAM,8BAA8BA,uCAAiB,CAAA;AAAA,EAC1D,IAAM,EAAA,qBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAQM,MAAM,gCAAgCA,uCAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,gCAAgCA,uCAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAOM,MAAM,iCAAiCA,uCAAiB,CAAA;AAAA,EAC7D,IAAM,EAAA,wBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAUM,MAAM,gCAAgCA,uCAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkCA,uCAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkCA,uCAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAMM,MAAM,kBAAqB,GAAA;AAAA,EAChC,2BAAA;AAAA,EACA,6BAAA;AAAA,EACA,6BAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,+BAAA;AAAA,EACA,+BAAA;AACF;;;;;;;;;;;;"}
@@ -0,0 +1,72 @@
1
+ import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
2
+ import { ResourcePermission } from '@backstage/plugin-permission-common';
3
+
4
+ /**
5
+ * Permission resource type which corresponds to catalog entities.
6
+ *
7
+ * {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}
8
+ * @alpha
9
+ */
10
+ declare const RESOURCE_TYPE_CATALOG_ENTITY = "catalog-entity";
11
+ /**
12
+ * Convenience type for catalog entity
13
+ * {@link @backstage/plugin-permission-common#ResourcePermission}s.
14
+ * @alpha
15
+ */
16
+ declare type CatalogEntityPermission = ResourcePermission<typeof RESOURCE_TYPE_CATALOG_ENTITY>;
17
+ /**
18
+ * This permission is used to authorize actions that involve reading one or more
19
+ * entities from the catalog.
20
+ *
21
+ * If this permission is not authorized, it will appear that the entity does not
22
+ * exist in the catalog — both in the frontend and in API responses.
23
+ * @alpha
24
+ */
25
+ declare const catalogEntityReadPermission: ResourcePermission<"catalog-entity">;
26
+ /**
27
+ * This permission is used to authorize actions that involve creating a new
28
+ * catalog entity. This includes registering an existing component into the
29
+ * catalog.
30
+ * @alpha
31
+ */
32
+ declare const catalogEntityCreatePermission: _backstage_plugin_permission_common.BasicPermission;
33
+ /**
34
+ * This permission is used to designate actions that involve removing one or
35
+ * more entities from the catalog.
36
+ * @alpha
37
+ */
38
+ declare const catalogEntityDeletePermission: ResourcePermission<"catalog-entity">;
39
+ /**
40
+ * This permission is used to designate refreshing one or more entities from the
41
+ * catalog.
42
+ * @alpha
43
+ */
44
+ declare const catalogEntityRefreshPermission: ResourcePermission<"catalog-entity">;
45
+ /**
46
+ * This permission is used to designate actions that involve reading one or more
47
+ * locations from the catalog.
48
+ *
49
+ * If this permission is not authorized, it will appear that the location does
50
+ * not exist in the catalog — both in the frontend and in API responses.
51
+ * @alpha
52
+ */
53
+ declare const catalogLocationReadPermission: _backstage_plugin_permission_common.BasicPermission;
54
+ /**
55
+ * This permission is used to designate actions that involve creating catalog
56
+ * locations.
57
+ * @alpha
58
+ */
59
+ declare const catalogLocationCreatePermission: _backstage_plugin_permission_common.BasicPermission;
60
+ /**
61
+ * This permission is used to designate actions that involve deleting locations
62
+ * from the catalog.
63
+ * @alpha
64
+ */
65
+ declare const catalogLocationDeletePermission: _backstage_plugin_permission_common.BasicPermission;
66
+ /**
67
+ * List of all catalog permissions.
68
+ * @alpha
69
+ */
70
+ declare const catalogPermissions: (_backstage_plugin_permission_common.BasicPermission | ResourcePermission<"catalog-entity">)[];
71
+
72
+ export { CatalogEntityPermission, RESOURCE_TYPE_CATALOG_ENTITY, catalogEntityCreatePermission, catalogEntityDeletePermission, catalogEntityReadPermission, catalogEntityRefreshPermission, catalogLocationCreatePermission, catalogLocationDeletePermission, catalogLocationReadPermission, catalogPermissions };
@@ -0,0 +1,60 @@
1
+ import { createPermission } from '@backstage/plugin-permission-common';
2
+
3
+ const RESOURCE_TYPE_CATALOG_ENTITY = "catalog-entity";
4
+ const catalogEntityReadPermission = createPermission({
5
+ name: "catalog.entity.read",
6
+ attributes: {
7
+ action: "read"
8
+ },
9
+ resourceType: RESOURCE_TYPE_CATALOG_ENTITY
10
+ });
11
+ const catalogEntityCreatePermission = createPermission({
12
+ name: "catalog.entity.create",
13
+ attributes: {
14
+ action: "create"
15
+ }
16
+ });
17
+ const catalogEntityDeletePermission = createPermission({
18
+ name: "catalog.entity.delete",
19
+ attributes: {
20
+ action: "delete"
21
+ },
22
+ resourceType: RESOURCE_TYPE_CATALOG_ENTITY
23
+ });
24
+ const catalogEntityRefreshPermission = createPermission({
25
+ name: "catalog.entity.refresh",
26
+ attributes: {
27
+ action: "update"
28
+ },
29
+ resourceType: RESOURCE_TYPE_CATALOG_ENTITY
30
+ });
31
+ const catalogLocationReadPermission = createPermission({
32
+ name: "catalog.location.read",
33
+ attributes: {
34
+ action: "read"
35
+ }
36
+ });
37
+ const catalogLocationCreatePermission = createPermission({
38
+ name: "catalog.location.create",
39
+ attributes: {
40
+ action: "create"
41
+ }
42
+ });
43
+ const catalogLocationDeletePermission = createPermission({
44
+ name: "catalog.location.delete",
45
+ attributes: {
46
+ action: "delete"
47
+ }
48
+ });
49
+ const catalogPermissions = [
50
+ catalogEntityReadPermission,
51
+ catalogEntityCreatePermission,
52
+ catalogEntityDeletePermission,
53
+ catalogEntityRefreshPermission,
54
+ catalogLocationReadPermission,
55
+ catalogLocationCreatePermission,
56
+ catalogLocationDeletePermission
57
+ ];
58
+
59
+ export { RESOURCE_TYPE_CATALOG_ENTITY, catalogEntityCreatePermission, catalogEntityDeletePermission, catalogEntityReadPermission, catalogEntityRefreshPermission, catalogLocationCreatePermission, catalogLocationDeletePermission, catalogLocationReadPermission, catalogPermissions };
60
+ //# sourceMappingURL=alpha.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/permissions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {\n createPermission,\n ResourcePermission,\n} from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to catalog entities.\n *\n * {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}\n * @alpha\n */\nexport const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';\n\n/**\n * Convenience type for catalog entity\n * {@link @backstage/plugin-permission-common#ResourcePermission}s.\n * @alpha\n */\nexport type CatalogEntityPermission = ResourcePermission<\n typeof RESOURCE_TYPE_CATALOG_ENTITY\n>;\n\n/**\n * This permission is used to authorize actions that involve reading one or more\n * entities from the catalog.\n *\n * If this permission is not authorized, it will appear that the entity does not\n * exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogEntityReadPermission = createPermission({\n name: 'catalog.entity.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to authorize actions that involve creating a new\n * catalog entity. This includes registering an existing component into the\n * catalog.\n * @alpha\n */\nexport const catalogEntityCreatePermission = createPermission({\n name: 'catalog.entity.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve removing one or\n * more entities from the catalog.\n * @alpha\n */\nexport const catalogEntityDeletePermission = createPermission({\n name: 'catalog.entity.delete',\n attributes: {\n action: 'delete',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate refreshing one or more entities from the\n * catalog.\n * @alpha\n */\nexport const catalogEntityRefreshPermission = createPermission({\n name: 'catalog.entity.refresh',\n attributes: {\n action: 'update',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate actions that involve reading one or more\n * locations from the catalog.\n *\n * If this permission is not authorized, it will appear that the location does\n * not exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogLocationReadPermission = createPermission({\n name: 'catalog.location.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * This permission is used to designate actions that involve creating catalog\n * locations.\n * @alpha\n */\nexport const catalogLocationCreatePermission = createPermission({\n name: 'catalog.location.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve deleting locations\n * from the catalog.\n * @alpha\n */\nexport const catalogLocationDeletePermission = createPermission({\n name: 'catalog.location.delete',\n attributes: {\n action: 'delete',\n },\n});\n\n/**\n * List of all catalog permissions.\n * @alpha\n */\nexport const catalogPermissions = [\n catalogEntityReadPermission,\n catalogEntityCreatePermission,\n catalogEntityDeletePermission,\n catalogEntityRefreshPermission,\n catalogLocationReadPermission,\n catalogLocationCreatePermission,\n catalogLocationDeletePermission,\n];\n"],"names":[],"mappings":";;AA2BO,MAAM,4BAA+B,GAAA,iBAAA;AAmBrC,MAAM,8BAA8B,gBAAiB,CAAA;AAAA,EAC1D,IAAM,EAAA,qBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAQM,MAAM,gCAAgC,gBAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,gCAAgC,gBAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAOM,MAAM,iCAAiC,gBAAiB,CAAA;AAAA,EAC7D,IAAM,EAAA,wBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAUM,MAAM,gCAAgC,gBAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkC,gBAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkC,gBAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAMM,MAAM,kBAAqB,GAAA;AAAA,EAChC,2BAAA;AAAA,EACA,6BAAA;AAAA,EACA,6BAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,+BAAA;AAAA,EACA,+BAAA;AACF;;;;"}
package/dist/index.cjs.js CHANGED
@@ -1,72 +1,3 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var pluginPermissionCommon = require('@backstage/plugin-permission-common');
6
-
7
- const RESOURCE_TYPE_CATALOG_ENTITY = "catalog-entity";
8
- const catalogEntityReadPermission = pluginPermissionCommon.createPermission({
9
- name: "catalog.entity.read",
10
- attributes: {
11
- action: "read"
12
- },
13
- resourceType: RESOURCE_TYPE_CATALOG_ENTITY
14
- });
15
- const catalogEntityCreatePermission = pluginPermissionCommon.createPermission({
16
- name: "catalog.entity.create",
17
- attributes: {
18
- action: "create"
19
- }
20
- });
21
- const catalogEntityDeletePermission = pluginPermissionCommon.createPermission({
22
- name: "catalog.entity.delete",
23
- attributes: {
24
- action: "delete"
25
- },
26
- resourceType: RESOURCE_TYPE_CATALOG_ENTITY
27
- });
28
- const catalogEntityRefreshPermission = pluginPermissionCommon.createPermission({
29
- name: "catalog.entity.refresh",
30
- attributes: {
31
- action: "update"
32
- },
33
- resourceType: RESOURCE_TYPE_CATALOG_ENTITY
34
- });
35
- const catalogLocationReadPermission = pluginPermissionCommon.createPermission({
36
- name: "catalog.location.read",
37
- attributes: {
38
- action: "read"
39
- }
40
- });
41
- const catalogLocationCreatePermission = pluginPermissionCommon.createPermission({
42
- name: "catalog.location.create",
43
- attributes: {
44
- action: "create"
45
- }
46
- });
47
- const catalogLocationDeletePermission = pluginPermissionCommon.createPermission({
48
- name: "catalog.location.delete",
49
- attributes: {
50
- action: "delete"
51
- }
52
- });
53
- const catalogPermissions = [
54
- catalogEntityReadPermission,
55
- catalogEntityCreatePermission,
56
- catalogEntityDeletePermission,
57
- catalogEntityRefreshPermission,
58
- catalogLocationReadPermission,
59
- catalogLocationCreatePermission,
60
- catalogLocationDeletePermission
61
- ];
62
-
63
- exports.RESOURCE_TYPE_CATALOG_ENTITY = RESOURCE_TYPE_CATALOG_ENTITY;
64
- exports.catalogEntityCreatePermission = catalogEntityCreatePermission;
65
- exports.catalogEntityDeletePermission = catalogEntityDeletePermission;
66
- exports.catalogEntityReadPermission = catalogEntityReadPermission;
67
- exports.catalogEntityRefreshPermission = catalogEntityRefreshPermission;
68
- exports.catalogLocationCreatePermission = catalogLocationCreatePermission;
69
- exports.catalogLocationDeletePermission = catalogLocationDeletePermission;
70
- exports.catalogLocationReadPermission = catalogLocationReadPermission;
71
- exports.catalogPermissions = catalogPermissions;
72
3
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/permissions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {\n createPermission,\n ResourcePermission,\n} from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to catalog entities.\n *\n * {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}\n * @alpha\n */\nexport const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';\n\n/**\n * Convenience type for catalog entity\n * {@link @backstage/plugin-permission-common#ResourcePermission}s.\n * @alpha\n */\nexport type CatalogEntityPermission = ResourcePermission<\n typeof RESOURCE_TYPE_CATALOG_ENTITY\n>;\n\n/**\n * This permission is used to authorize actions that involve reading one or more\n * entities from the catalog.\n *\n * If this permission is not authorized, it will appear that the entity does not\n * exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogEntityReadPermission = createPermission({\n name: 'catalog.entity.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to authorize actions that involve creating a new\n * catalog entity. This includes registering an existing component into the\n * catalog.\n * @alpha\n */\nexport const catalogEntityCreatePermission = createPermission({\n name: 'catalog.entity.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve removing one or\n * more entities from the catalog.\n * @alpha\n */\nexport const catalogEntityDeletePermission = createPermission({\n name: 'catalog.entity.delete',\n attributes: {\n action: 'delete',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate refreshing one or more entities from the\n * catalog.\n * @alpha\n */\nexport const catalogEntityRefreshPermission = createPermission({\n name: 'catalog.entity.refresh',\n attributes: {\n action: 'update',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate actions that involve reading one or more\n * locations from the catalog.\n *\n * If this permission is not authorized, it will appear that the location does\n * not exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogLocationReadPermission = createPermission({\n name: 'catalog.location.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * This permission is used to designate actions that involve creating catalog\n * locations.\n * @alpha\n */\nexport const catalogLocationCreatePermission = createPermission({\n name: 'catalog.location.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve deleting locations\n * from the catalog.\n * @alpha\n */\nexport const catalogLocationDeletePermission = createPermission({\n name: 'catalog.location.delete',\n attributes: {\n action: 'delete',\n },\n});\n\n/**\n * List of all catalog permissions.\n * @alpha\n */\nexport const catalogPermissions = [\n catalogEntityReadPermission,\n catalogEntityCreatePermission,\n catalogEntityDeletePermission,\n catalogEntityRefreshPermission,\n catalogLocationReadPermission,\n catalogLocationCreatePermission,\n catalogLocationDeletePermission,\n];\n"],"names":["createPermission"],"mappings":";;;;;;AA2BO,MAAM,4BAA+B,GAAA,iBAAA;AAmBrC,MAAM,8BAA8BA,uCAAiB,CAAA;AAAA,EAC1D,IAAM,EAAA,qBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAQM,MAAM,gCAAgCA,uCAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,gCAAgCA,uCAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAOM,MAAM,iCAAiCA,uCAAiB,CAAA;AAAA,EAC7D,IAAM,EAAA,wBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAUM,MAAM,gCAAgCA,uCAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkCA,uCAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkCA,uCAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAMM,MAAM,kBAAqB,GAAA;AAAA,EAChC,2BAAA;AAAA,EACA,6BAAA;AAAA,EACA,6BAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,+BAAA;AAAA,EACA,+BAAA;AACF;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
package/dist/index.d.ts CHANGED
@@ -1,82 +1,12 @@
1
- /**
2
- * Provides shared objects useful for interacting with the catalog and its
3
- * entities, such as catalog permissions.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { BasicPermission } from '@backstage/plugin-permission-common';
9
- import { Entity } from '@backstage/catalog-model';
10
1
  import { IndexableDocument } from '@backstage/plugin-search-common';
11
- import { ResourcePermission } from '@backstage/plugin-permission-common';
12
-
13
- /** @public */
14
- export declare type AnalyzeLocationEntityField = {
15
- /**
16
- * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
17
- * entity again if the user wants to change it
18
- */
19
- field: string;
20
- /** The outcome of the analysis for this particular field */
21
- state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
22
- value: string | null;
23
- /**
24
- * A text to show to the user to inform about the choices made. Like, it could say
25
- * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
26
- * field empty; which would currently make it owned by X" where X is taken from the
27
- * codeowners file.
28
- */
29
- description: string;
30
- };
31
-
32
- /**
33
- * If the folder pointed to already contained catalog info yaml files, they are
34
- * read and emitted like this so that the frontend can inform the user that it
35
- * located them and can make sure to register them as well if they weren't
36
- * already
37
- * @public
38
- */
39
- export declare type AnalyzeLocationExistingEntity = {
40
- location: LocationSpec;
41
- isRegistered: boolean;
42
- entity: Entity;
43
- };
44
-
45
- /**
46
- * This is some form of representation of what the analyzer could deduce.
47
- * We should probably have a chat about how this can best be conveyed to
48
- * the frontend. It'll probably contain a (possibly incomplete) entity, plus
49
- * enough info for the frontend to know what form data to show to the user
50
- * for overriding/completing the info.
51
- * @public
52
- */
53
- export declare type AnalyzeLocationGenerateEntity = {
54
- entity: RecursivePartial<Entity>;
55
- fields: AnalyzeLocationEntityField[];
56
- };
57
-
58
- /** @public */
59
- export declare type AnalyzeLocationRequest = {
60
- location: LocationSpec;
61
- catalogFilename?: string;
62
- };
63
-
64
- /** @public */
65
- export declare type AnalyzeLocationResponse = {
66
- existingEntityFiles: AnalyzeLocationExistingEntity[];
67
- generateEntities: AnalyzeLocationGenerateEntity[];
68
- };
69
-
70
- /* Excluded from this release type: catalogEntityCreatePermission */
71
-
72
- /* Excluded from this release type: catalogEntityDeletePermission */
2
+ import { Entity } from '@backstage/catalog-model';
73
3
 
74
4
  /**
75
5
  * The Document format for an Entity in the Catalog for search
76
6
  *
77
7
  * @public
78
8
  */
79
- export declare interface CatalogEntityDocument extends IndexableDocument {
9
+ interface CatalogEntityDocument extends IndexableDocument {
80
10
  /** @deprecated `componentType` is being renamed to `type`. During the transition both of these fields should be set to the same value, in order to avoid issues with indexing. */
81
11
  componentType: string;
82
12
  type: string;
@@ -86,20 +16,6 @@ export declare interface CatalogEntityDocument extends IndexableDocument {
86
16
  owner: string;
87
17
  }
88
18
 
89
- /* Excluded from this release type: CatalogEntityPermission */
90
-
91
- /* Excluded from this release type: catalogEntityReadPermission */
92
-
93
- /* Excluded from this release type: catalogEntityRefreshPermission */
94
-
95
- /* Excluded from this release type: catalogLocationCreatePermission */
96
-
97
- /* Excluded from this release type: catalogLocationDeletePermission */
98
-
99
- /* Excluded from this release type: catalogLocationReadPermission */
100
-
101
- /* Excluded from this release type: catalogPermissions */
102
-
103
19
  /**
104
20
  * Holds the entity location information.
105
21
  *
@@ -111,7 +27,7 @@ export declare interface CatalogEntityDocument extends IndexableDocument {
111
27
  *
112
28
  * @public
113
29
  */
114
- export declare type LocationSpec = {
30
+ declare type LocationSpec = {
115
31
  type: string;
116
32
  target: string;
117
33
  presence?: 'optional' | 'required';
@@ -125,6 +41,57 @@ declare type RecursivePartial<T> = {
125
41
  [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
126
42
  };
127
43
 
128
- /* Excluded from this release type: RESOURCE_TYPE_CATALOG_ENTITY */
44
+ /** @public */
45
+ declare type AnalyzeLocationRequest = {
46
+ location: LocationSpec;
47
+ catalogFilename?: string;
48
+ };
49
+ /** @public */
50
+ declare type AnalyzeLocationResponse = {
51
+ existingEntityFiles: AnalyzeLocationExistingEntity[];
52
+ generateEntities: AnalyzeLocationGenerateEntity[];
53
+ };
54
+ /**
55
+ * If the folder pointed to already contained catalog info yaml files, they are
56
+ * read and emitted like this so that the frontend can inform the user that it
57
+ * located them and can make sure to register them as well if they weren't
58
+ * already
59
+ * @public
60
+ */
61
+ declare type AnalyzeLocationExistingEntity = {
62
+ location: LocationSpec;
63
+ isRegistered: boolean;
64
+ entity: Entity;
65
+ };
66
+ /**
67
+ * This is some form of representation of what the analyzer could deduce.
68
+ * We should probably have a chat about how this can best be conveyed to
69
+ * the frontend. It'll probably contain a (possibly incomplete) entity, plus
70
+ * enough info for the frontend to know what form data to show to the user
71
+ * for overriding/completing the info.
72
+ * @public
73
+ */
74
+ declare type AnalyzeLocationGenerateEntity = {
75
+ entity: RecursivePartial<Entity>;
76
+ fields: AnalyzeLocationEntityField[];
77
+ };
78
+ /** @public */
79
+ declare type AnalyzeLocationEntityField = {
80
+ /**
81
+ * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
82
+ * entity again if the user wants to change it
83
+ */
84
+ field: string;
85
+ /** The outcome of the analysis for this particular field */
86
+ state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
87
+ value: string | null;
88
+ /**
89
+ * A text to show to the user to inform about the choices made. Like, it could say
90
+ * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
91
+ * field empty; which would currently make it owned by X" where X is taken from the
92
+ * codeowners file.
93
+ */
94
+ description: string;
95
+ };
129
96
 
130
- export { }
97
+ export { AnalyzeLocationEntityField, AnalyzeLocationExistingEntity, AnalyzeLocationGenerateEntity, AnalyzeLocationRequest, AnalyzeLocationResponse, CatalogEntityDocument, LocationSpec };
package/dist/index.esm.js CHANGED
@@ -1,60 +1,2 @@
1
- import { createPermission } from '@backstage/plugin-permission-common';
2
1
 
3
- const RESOURCE_TYPE_CATALOG_ENTITY = "catalog-entity";
4
- const catalogEntityReadPermission = createPermission({
5
- name: "catalog.entity.read",
6
- attributes: {
7
- action: "read"
8
- },
9
- resourceType: RESOURCE_TYPE_CATALOG_ENTITY
10
- });
11
- const catalogEntityCreatePermission = createPermission({
12
- name: "catalog.entity.create",
13
- attributes: {
14
- action: "create"
15
- }
16
- });
17
- const catalogEntityDeletePermission = createPermission({
18
- name: "catalog.entity.delete",
19
- attributes: {
20
- action: "delete"
21
- },
22
- resourceType: RESOURCE_TYPE_CATALOG_ENTITY
23
- });
24
- const catalogEntityRefreshPermission = createPermission({
25
- name: "catalog.entity.refresh",
26
- attributes: {
27
- action: "update"
28
- },
29
- resourceType: RESOURCE_TYPE_CATALOG_ENTITY
30
- });
31
- const catalogLocationReadPermission = createPermission({
32
- name: "catalog.location.read",
33
- attributes: {
34
- action: "read"
35
- }
36
- });
37
- const catalogLocationCreatePermission = createPermission({
38
- name: "catalog.location.create",
39
- attributes: {
40
- action: "create"
41
- }
42
- });
43
- const catalogLocationDeletePermission = createPermission({
44
- name: "catalog.location.delete",
45
- attributes: {
46
- action: "delete"
47
- }
48
- });
49
- const catalogPermissions = [
50
- catalogEntityReadPermission,
51
- catalogEntityCreatePermission,
52
- catalogEntityDeletePermission,
53
- catalogEntityRefreshPermission,
54
- catalogLocationReadPermission,
55
- catalogLocationCreatePermission,
56
- catalogLocationDeletePermission
57
- ];
58
-
59
- export { RESOURCE_TYPE_CATALOG_ENTITY, catalogEntityCreatePermission, catalogEntityDeletePermission, catalogEntityReadPermission, catalogEntityRefreshPermission, catalogLocationCreatePermission, catalogLocationDeletePermission, catalogLocationReadPermission, catalogPermissions };
60
2
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/permissions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {\n createPermission,\n ResourcePermission,\n} from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to catalog entities.\n *\n * {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}\n * @alpha\n */\nexport const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';\n\n/**\n * Convenience type for catalog entity\n * {@link @backstage/plugin-permission-common#ResourcePermission}s.\n * @alpha\n */\nexport type CatalogEntityPermission = ResourcePermission<\n typeof RESOURCE_TYPE_CATALOG_ENTITY\n>;\n\n/**\n * This permission is used to authorize actions that involve reading one or more\n * entities from the catalog.\n *\n * If this permission is not authorized, it will appear that the entity does not\n * exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogEntityReadPermission = createPermission({\n name: 'catalog.entity.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to authorize actions that involve creating a new\n * catalog entity. This includes registering an existing component into the\n * catalog.\n * @alpha\n */\nexport const catalogEntityCreatePermission = createPermission({\n name: 'catalog.entity.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve removing one or\n * more entities from the catalog.\n * @alpha\n */\nexport const catalogEntityDeletePermission = createPermission({\n name: 'catalog.entity.delete',\n attributes: {\n action: 'delete',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate refreshing one or more entities from the\n * catalog.\n * @alpha\n */\nexport const catalogEntityRefreshPermission = createPermission({\n name: 'catalog.entity.refresh',\n attributes: {\n action: 'update',\n },\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * This permission is used to designate actions that involve reading one or more\n * locations from the catalog.\n *\n * If this permission is not authorized, it will appear that the location does\n * not exist in the catalog — both in the frontend and in API responses.\n * @alpha\n */\nexport const catalogLocationReadPermission = createPermission({\n name: 'catalog.location.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * This permission is used to designate actions that involve creating catalog\n * locations.\n * @alpha\n */\nexport const catalogLocationCreatePermission = createPermission({\n name: 'catalog.location.create',\n attributes: {\n action: 'create',\n },\n});\n\n/**\n * This permission is used to designate actions that involve deleting locations\n * from the catalog.\n * @alpha\n */\nexport const catalogLocationDeletePermission = createPermission({\n name: 'catalog.location.delete',\n attributes: {\n action: 'delete',\n },\n});\n\n/**\n * List of all catalog permissions.\n * @alpha\n */\nexport const catalogPermissions = [\n catalogEntityReadPermission,\n catalogEntityCreatePermission,\n catalogEntityDeletePermission,\n catalogEntityRefreshPermission,\n catalogLocationReadPermission,\n catalogLocationCreatePermission,\n catalogLocationDeletePermission,\n];\n"],"names":[],"mappings":";;AA2BO,MAAM,4BAA+B,GAAA,iBAAA;AAmBrC,MAAM,8BAA8B,gBAAiB,CAAA;AAAA,EAC1D,IAAM,EAAA,qBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAQM,MAAM,gCAAgC,gBAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,gCAAgC,gBAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAOM,MAAM,iCAAiC,gBAAiB,CAAA;AAAA,EAC7D,IAAM,EAAA,wBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,4BAAA;AAChB,CAAC,EAAA;AAUM,MAAM,gCAAgC,gBAAiB,CAAA;AAAA,EAC5D,IAAM,EAAA,uBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkC,gBAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAOM,MAAM,kCAAkC,gBAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,yBAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,QAAA;AAAA,GACV;AACF,CAAC,EAAA;AAMM,MAAM,kBAAqB,GAAA;AAAA,EAChC,2BAAA;AAAA,EACA,6BAAA;AAAA,EACA,6BAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,+BAAA;AAAA,EACA,+BAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,16 +1,27 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-common",
3
3
  "description": "Common functionalities for the catalog plugin",
4
- "version": "1.0.11",
5
- "main": "dist/index.cjs.js",
6
- "types": "dist/index.d.ts",
4
+ "version": "1.0.12-next.0",
5
+ "main": "./dist/index.cjs.js",
6
+ "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "publishConfig": {
9
- "access": "public",
10
- "main": "dist/index.cjs.js",
11
- "module": "dist/index.esm.js",
12
- "types": "dist/index.d.ts",
13
- "alphaTypes": "dist/index.alpha.d.ts"
9
+ "access": "public"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.esm.js",
14
+ "require": "./dist/index.cjs.js",
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs.js"
17
+ },
18
+ "./alpha": {
19
+ "import": "./dist/alpha.esm.js",
20
+ "require": "./dist/alpha.cjs.js",
21
+ "types": "./dist/alpha.d.ts",
22
+ "default": "./dist/alpha.cjs.js"
23
+ },
24
+ "./package.json": "./package.json"
14
25
  },
15
26
  "backstage": {
16
27
  "role": "common-library"
@@ -25,7 +36,7 @@
25
36
  "backstage"
26
37
  ],
27
38
  "scripts": {
28
- "build": "backstage-cli package build --experimental-type-build",
39
+ "build": "backstage-cli package build",
29
40
  "lint": "backstage-cli package lint",
30
41
  "test": "backstage-cli package test",
31
42
  "prepack": "backstage-cli package prepack",
@@ -33,16 +44,16 @@
33
44
  "clean": "backstage-cli package clean"
34
45
  },
35
46
  "dependencies": {
36
- "@backstage/catalog-model": "^1.2.0",
47
+ "@backstage/catalog-model": "^1.2.1-next.0",
37
48
  "@backstage/plugin-permission-common": "^0.7.3",
38
49
  "@backstage/plugin-search-common": "^1.2.1"
39
50
  },
40
51
  "devDependencies": {
41
- "@backstage/cli": "^0.22.2"
52
+ "@backstage/cli": "^0.22.4-next.0"
42
53
  },
43
54
  "files": [
44
55
  "dist",
45
56
  "alpha"
46
57
  ],
47
- "module": "dist/index.esm.js"
58
+ "module": "./dist/index.esm.js"
48
59
  }
@@ -1,187 +0,0 @@
1
- /**
2
- * Provides shared objects useful for interacting with the catalog and its
3
- * entities, such as catalog permissions.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { BasicPermission } from '@backstage/plugin-permission-common';
9
- import { Entity } from '@backstage/catalog-model';
10
- import { IndexableDocument } from '@backstage/plugin-search-common';
11
- import { ResourcePermission } from '@backstage/plugin-permission-common';
12
-
13
- /** @public */
14
- export declare type AnalyzeLocationEntityField = {
15
- /**
16
- * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
17
- * entity again if the user wants to change it
18
- */
19
- field: string;
20
- /** The outcome of the analysis for this particular field */
21
- state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
22
- value: string | null;
23
- /**
24
- * A text to show to the user to inform about the choices made. Like, it could say
25
- * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
26
- * field empty; which would currently make it owned by X" where X is taken from the
27
- * codeowners file.
28
- */
29
- description: string;
30
- };
31
-
32
- /**
33
- * If the folder pointed to already contained catalog info yaml files, they are
34
- * read and emitted like this so that the frontend can inform the user that it
35
- * located them and can make sure to register them as well if they weren't
36
- * already
37
- * @public
38
- */
39
- export declare type AnalyzeLocationExistingEntity = {
40
- location: LocationSpec;
41
- isRegistered: boolean;
42
- entity: Entity;
43
- };
44
-
45
- /**
46
- * This is some form of representation of what the analyzer could deduce.
47
- * We should probably have a chat about how this can best be conveyed to
48
- * the frontend. It'll probably contain a (possibly incomplete) entity, plus
49
- * enough info for the frontend to know what form data to show to the user
50
- * for overriding/completing the info.
51
- * @public
52
- */
53
- export declare type AnalyzeLocationGenerateEntity = {
54
- entity: RecursivePartial<Entity>;
55
- fields: AnalyzeLocationEntityField[];
56
- };
57
-
58
- /** @public */
59
- export declare type AnalyzeLocationRequest = {
60
- location: LocationSpec;
61
- catalogFilename?: string;
62
- };
63
-
64
- /** @public */
65
- export declare type AnalyzeLocationResponse = {
66
- existingEntityFiles: AnalyzeLocationExistingEntity[];
67
- generateEntities: AnalyzeLocationGenerateEntity[];
68
- };
69
-
70
- /**
71
- * This permission is used to authorize actions that involve creating a new
72
- * catalog entity. This includes registering an existing component into the
73
- * catalog.
74
- * @alpha
75
- */
76
- export declare const catalogEntityCreatePermission: BasicPermission;
77
-
78
- /**
79
- * This permission is used to designate actions that involve removing one or
80
- * more entities from the catalog.
81
- * @alpha
82
- */
83
- export declare const catalogEntityDeletePermission: ResourcePermission<"catalog-entity">;
84
-
85
- /**
86
- * The Document format for an Entity in the Catalog for search
87
- *
88
- * @public
89
- */
90
- export declare interface CatalogEntityDocument extends IndexableDocument {
91
- /** @deprecated `componentType` is being renamed to `type`. During the transition both of these fields should be set to the same value, in order to avoid issues with indexing. */
92
- componentType: string;
93
- type: string;
94
- namespace: string;
95
- kind: string;
96
- lifecycle: string;
97
- owner: string;
98
- }
99
-
100
- /**
101
- * Convenience type for catalog entity
102
- * {@link @backstage/plugin-permission-common#ResourcePermission}s.
103
- * @alpha
104
- */
105
- export declare type CatalogEntityPermission = ResourcePermission<typeof RESOURCE_TYPE_CATALOG_ENTITY>;
106
-
107
- /**
108
- * This permission is used to authorize actions that involve reading one or more
109
- * entities from the catalog.
110
- *
111
- * If this permission is not authorized, it will appear that the entity does not
112
- * exist in the catalog — both in the frontend and in API responses.
113
- * @alpha
114
- */
115
- export declare const catalogEntityReadPermission: ResourcePermission<"catalog-entity">;
116
-
117
- /**
118
- * This permission is used to designate refreshing one or more entities from the
119
- * catalog.
120
- * @alpha
121
- */
122
- export declare const catalogEntityRefreshPermission: ResourcePermission<"catalog-entity">;
123
-
124
- /**
125
- * This permission is used to designate actions that involve creating catalog
126
- * locations.
127
- * @alpha
128
- */
129
- export declare const catalogLocationCreatePermission: BasicPermission;
130
-
131
- /**
132
- * This permission is used to designate actions that involve deleting locations
133
- * from the catalog.
134
- * @alpha
135
- */
136
- export declare const catalogLocationDeletePermission: BasicPermission;
137
-
138
- /**
139
- * This permission is used to designate actions that involve reading one or more
140
- * locations from the catalog.
141
- *
142
- * If this permission is not authorized, it will appear that the location does
143
- * not exist in the catalog — both in the frontend and in API responses.
144
- * @alpha
145
- */
146
- export declare const catalogLocationReadPermission: BasicPermission;
147
-
148
- /**
149
- * List of all catalog permissions.
150
- * @alpha
151
- */
152
- export declare const catalogPermissions: (BasicPermission | ResourcePermission<"catalog-entity">)[];
153
-
154
- /**
155
- * Holds the entity location information.
156
- *
157
- * @remarks
158
- *
159
- * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
160
- * This flag is then set to indicate that the file can be not present.
161
- * default value: 'required'.
162
- *
163
- * @public
164
- */
165
- export declare type LocationSpec = {
166
- type: string;
167
- target: string;
168
- presence?: 'optional' | 'required';
169
- };
170
-
171
- /**
172
- * Makes all keys of an entire hierarchy optional.
173
- * @ignore
174
- */
175
- declare type RecursivePartial<T> = {
176
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
177
- };
178
-
179
- /**
180
- * Permission resource type which corresponds to catalog entities.
181
- *
182
- * {@link https://backstage.io/docs/features/software-catalog/software-catalog-overview}
183
- * @alpha
184
- */
185
- export declare const RESOURCE_TYPE_CATALOG_ENTITY = "catalog-entity";
186
-
187
- export { }
@@ -1,130 +0,0 @@
1
- /**
2
- * Provides shared objects useful for interacting with the catalog and its
3
- * entities, such as catalog permissions.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { BasicPermission } from '@backstage/plugin-permission-common';
9
- import { Entity } from '@backstage/catalog-model';
10
- import { IndexableDocument } from '@backstage/plugin-search-common';
11
- import { ResourcePermission } from '@backstage/plugin-permission-common';
12
-
13
- /** @public */
14
- export declare type AnalyzeLocationEntityField = {
15
- /**
16
- * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
17
- * entity again if the user wants to change it
18
- */
19
- field: string;
20
- /** The outcome of the analysis for this particular field */
21
- state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
22
- value: string | null;
23
- /**
24
- * A text to show to the user to inform about the choices made. Like, it could say
25
- * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
26
- * field empty; which would currently make it owned by X" where X is taken from the
27
- * codeowners file.
28
- */
29
- description: string;
30
- };
31
-
32
- /**
33
- * If the folder pointed to already contained catalog info yaml files, they are
34
- * read and emitted like this so that the frontend can inform the user that it
35
- * located them and can make sure to register them as well if they weren't
36
- * already
37
- * @public
38
- */
39
- export declare type AnalyzeLocationExistingEntity = {
40
- location: LocationSpec;
41
- isRegistered: boolean;
42
- entity: Entity;
43
- };
44
-
45
- /**
46
- * This is some form of representation of what the analyzer could deduce.
47
- * We should probably have a chat about how this can best be conveyed to
48
- * the frontend. It'll probably contain a (possibly incomplete) entity, plus
49
- * enough info for the frontend to know what form data to show to the user
50
- * for overriding/completing the info.
51
- * @public
52
- */
53
- export declare type AnalyzeLocationGenerateEntity = {
54
- entity: RecursivePartial<Entity>;
55
- fields: AnalyzeLocationEntityField[];
56
- };
57
-
58
- /** @public */
59
- export declare type AnalyzeLocationRequest = {
60
- location: LocationSpec;
61
- catalogFilename?: string;
62
- };
63
-
64
- /** @public */
65
- export declare type AnalyzeLocationResponse = {
66
- existingEntityFiles: AnalyzeLocationExistingEntity[];
67
- generateEntities: AnalyzeLocationGenerateEntity[];
68
- };
69
-
70
- /* Excluded from this release type: catalogEntityCreatePermission */
71
-
72
- /* Excluded from this release type: catalogEntityDeletePermission */
73
-
74
- /**
75
- * The Document format for an Entity in the Catalog for search
76
- *
77
- * @public
78
- */
79
- export declare interface CatalogEntityDocument extends IndexableDocument {
80
- /** @deprecated `componentType` is being renamed to `type`. During the transition both of these fields should be set to the same value, in order to avoid issues with indexing. */
81
- componentType: string;
82
- type: string;
83
- namespace: string;
84
- kind: string;
85
- lifecycle: string;
86
- owner: string;
87
- }
88
-
89
- /* Excluded from this release type: CatalogEntityPermission */
90
-
91
- /* Excluded from this release type: catalogEntityReadPermission */
92
-
93
- /* Excluded from this release type: catalogEntityRefreshPermission */
94
-
95
- /* Excluded from this release type: catalogLocationCreatePermission */
96
-
97
- /* Excluded from this release type: catalogLocationDeletePermission */
98
-
99
- /* Excluded from this release type: catalogLocationReadPermission */
100
-
101
- /* Excluded from this release type: catalogPermissions */
102
-
103
- /**
104
- * Holds the entity location information.
105
- *
106
- * @remarks
107
- *
108
- * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
109
- * This flag is then set to indicate that the file can be not present.
110
- * default value: 'required'.
111
- *
112
- * @public
113
- */
114
- export declare type LocationSpec = {
115
- type: string;
116
- target: string;
117
- presence?: 'optional' | 'required';
118
- };
119
-
120
- /**
121
- * Makes all keys of an entire hierarchy optional.
122
- * @ignore
123
- */
124
- declare type RecursivePartial<T> = {
125
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
126
- };
127
-
128
- /* Excluded from this release type: RESOURCE_TYPE_CATALOG_ENTITY */
129
-
130
- export { }