@backstage/plugin-catalog-backend-module-unprocessed 0.5.0 → 0.5.1-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @backstage/plugin-catalog-backend-module-unprocessed
2
2
 
3
+ ## 0.5.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/plugin-auth-node@0.5.3-next.1
9
+ - @backstage/plugin-catalog-node@1.13.1-next.1
10
+ - @backstage/backend-plugin-api@1.0.1-next.1
11
+ - @backstage/catalog-model@1.7.0
12
+ - @backstage/errors@1.2.4
13
+ - @backstage/plugin-catalog-unprocessed-entities-common@0.0.4
14
+ - @backstage/plugin-permission-common@0.8.1
15
+
16
+ ## 0.5.1-next.0
17
+
18
+ ### Patch Changes
19
+
20
+ - 094eaa3: Remove references to in-repo backend-common
21
+ - Updated dependencies
22
+ - @backstage/plugin-auth-node@0.5.3-next.0
23
+ - @backstage/backend-plugin-api@1.0.1-next.0
24
+ - @backstage/catalog-model@1.7.0
25
+ - @backstage/errors@1.2.4
26
+ - @backstage/plugin-catalog-node@1.13.1-next.0
27
+ - @backstage/plugin-catalog-unprocessed-entities-common@0.0.4
28
+ - @backstage/plugin-permission-common@0.8.1
29
+
3
30
  ## 0.5.0
4
31
 
5
32
  ### Minor Changes
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+
3
+ var Router = require('express-promise-router');
4
+ var pluginPermissionCommon = require('@backstage/plugin-permission-common');
5
+ var pluginCatalogUnprocessedEntitiesCommon = require('@backstage/plugin-catalog-unprocessed-entities-common');
6
+ var errors = require('@backstage/errors');
7
+ var backendCommon = require('@backstage/backend-common');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
+
11
+ var Router__default = /*#__PURE__*/_interopDefaultCompat(Router);
12
+
13
+ class UnprocessedEntitiesModule {
14
+ constructor(database, router, permissions, discovery, httpAuth) {
15
+ this.database = database;
16
+ this.router = router;
17
+ this.permissions = permissions;
18
+ this.moduleRouter = Router__default.default();
19
+ this.router.use(this.moduleRouter);
20
+ this.httpAuth = backendCommon.createLegacyAuthAdapters({
21
+ discovery,
22
+ httpAuth
23
+ }).httpAuth;
24
+ }
25
+ moduleRouter;
26
+ httpAuth;
27
+ static create(options) {
28
+ return new UnprocessedEntitiesModule(
29
+ options.database,
30
+ options.router,
31
+ options.permissions,
32
+ options.discovery,
33
+ options.httpAuth
34
+ );
35
+ }
36
+ async unprocessed(request) {
37
+ if (request.reason === "pending") {
38
+ return {
39
+ type: "pending",
40
+ entities: await this.pending(request.owner)
41
+ };
42
+ }
43
+ return {
44
+ type: "failed",
45
+ entities: await this.failed(request.owner)
46
+ };
47
+ }
48
+ hydrateRefreshState(r) {
49
+ return {
50
+ ...r,
51
+ unprocessed_entity: JSON.parse(r.unprocessed_entity),
52
+ ...r.processed_entity && {
53
+ processed_entity: JSON.parse(r.processed_entity)
54
+ },
55
+ ...r.errors && { errors: JSON.parse(r.errors) },
56
+ ...r.cache && { cache: JSON.parse(r.cache) }
57
+ };
58
+ }
59
+ async pending(owner) {
60
+ const res = (await this.database("refresh_state.*").from("refresh_state").leftJoin(
61
+ "final_entities",
62
+ "final_entities.entity_id",
63
+ "refresh_state.entity_id"
64
+ ).whereNull("final_entities.entity_id")).map(this.hydrateRefreshState);
65
+ if (owner) {
66
+ return res.filter((r) => r.unprocessed_entity.spec?.owner === owner);
67
+ }
68
+ return res;
69
+ }
70
+ async failed(owner) {
71
+ const res = (await this.database("refresh_state.*").from("refresh_state").rightJoin(
72
+ "final_entities",
73
+ "final_entities.entity_id",
74
+ "refresh_state.entity_id"
75
+ ).whereNull("final_entities.final_entity")).map(this.hydrateRefreshState);
76
+ if (owner) {
77
+ return res.filter((r) => r.unprocessed_entity.spec?.owner === owner);
78
+ }
79
+ return res;
80
+ }
81
+ registerRoutes() {
82
+ const isRequestAuthorized = async (req, permission) => {
83
+ const decision = (await this.permissions.authorize([{ permission }], {
84
+ credentials: await this.httpAuth.credentials(req)
85
+ }))[0];
86
+ return decision.result !== pluginPermissionCommon.AuthorizeResult.DENY;
87
+ };
88
+ this.moduleRouter.get("/entities/unprocessed/failed", async (req, res) => {
89
+ return res.json(
90
+ await this.unprocessed({
91
+ reason: "failed",
92
+ owner: typeof req.query.owner === "string" ? req.query.owner : void 0
93
+ })
94
+ );
95
+ }).get("/entities/unprocessed/pending", async (req, res) => {
96
+ return res.json(
97
+ await this.unprocessed({
98
+ reason: "pending",
99
+ owner: typeof req.query.owner === "string" ? req.query.owner : void 0
100
+ })
101
+ );
102
+ }).delete(
103
+ "/entities/unprocessed/delete/:entity_id",
104
+ async (request, response) => {
105
+ const authorized = await isRequestAuthorized(
106
+ request,
107
+ pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesDeletePermission
108
+ );
109
+ if (!authorized) {
110
+ throw new errors.NotAllowedError("Unauthorized");
111
+ }
112
+ await this.database("refresh_state").where({ entity_id: request.params.entity_id }).delete();
113
+ response.status(204).send();
114
+ }
115
+ );
116
+ }
117
+ }
118
+
119
+ exports.UnprocessedEntitiesModule = UnprocessedEntitiesModule;
120
+ //# sourceMappingURL=UnprocessedEntitiesModule.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnprocessedEntitiesModule.cjs.js","sources":["../src/UnprocessedEntitiesModule.ts"],"sourcesContent":["/*\n * Copyright 2023 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 HydratedRefreshState,\n RefreshState,\n UnprocessedEntitiesRequest,\n UnprocessedEntitiesResponse,\n} from './types';\nimport { Knex } from 'knex';\nimport {\n DiscoveryService,\n HttpAuthService,\n HttpRouterService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\nimport type { Request } from 'express';\n\nimport {\n AuthorizeResult,\n BasicPermission,\n} from '@backstage/plugin-permission-common';\nimport { unprocessedEntitiesDeletePermission } from '@backstage/plugin-catalog-unprocessed-entities-common';\nimport { NotAllowedError } from '@backstage/errors';\nimport { createLegacyAuthAdapters } from '@backstage/backend-common';\n\n/**\n * Module providing Unprocessed Entities API endpoints\n *\n * @public\n */\nexport class UnprocessedEntitiesModule {\n private readonly moduleRouter;\n\n private readonly httpAuth: HttpAuthService;\n\n private constructor(\n private readonly database: Knex,\n private readonly router: Pick<HttpRouterService, 'use'>,\n private readonly permissions: PermissionsService,\n discovery: DiscoveryService,\n httpAuth?: HttpAuthService,\n ) {\n this.moduleRouter = Router();\n this.router.use(this.moduleRouter);\n\n this.httpAuth = createLegacyAuthAdapters({\n discovery,\n httpAuth,\n }).httpAuth;\n }\n\n static create(options: {\n router: Pick<HttpRouterService, 'use'>;\n database: Knex;\n discovery: DiscoveryService;\n permissions: PermissionsService;\n httpAuth?: HttpAuthService;\n }) {\n return new UnprocessedEntitiesModule(\n options.database,\n options.router,\n options.permissions,\n options.discovery,\n options.httpAuth,\n );\n }\n\n private async unprocessed(\n request: UnprocessedEntitiesRequest,\n ): Promise<UnprocessedEntitiesResponse> {\n if (request.reason === 'pending') {\n return {\n type: 'pending',\n entities: await this.pending(request.owner),\n };\n }\n return {\n type: 'failed',\n entities: await this.failed(request.owner),\n };\n }\n\n private hydrateRefreshState(r: RefreshState): HydratedRefreshState {\n return {\n ...r,\n unprocessed_entity: JSON.parse(r.unprocessed_entity),\n ...(r.processed_entity && {\n processed_entity: JSON.parse(r.processed_entity),\n }),\n ...(r.errors && { errors: JSON.parse(r.errors) }),\n ...(r.cache && { cache: JSON.parse(r.cache) }),\n };\n }\n\n private async pending(owner?: string): Promise<HydratedRefreshState[]> {\n const res = (\n await this.database('refresh_state.*')\n .from('refresh_state')\n .leftJoin(\n 'final_entities',\n 'final_entities.entity_id',\n 'refresh_state.entity_id',\n )\n .whereNull('final_entities.entity_id')\n ).map(this.hydrateRefreshState);\n if (owner) {\n return res.filter(r => r.unprocessed_entity.spec?.owner === owner);\n }\n\n return res;\n }\n\n private async failed(owner?: string): Promise<HydratedRefreshState[]> {\n const res = (\n await this.database('refresh_state.*')\n .from('refresh_state')\n .rightJoin(\n 'final_entities',\n 'final_entities.entity_id',\n 'refresh_state.entity_id',\n )\n .whereNull('final_entities.final_entity')\n ).map(this.hydrateRefreshState);\n if (owner) {\n return res.filter(r => r.unprocessed_entity.spec?.owner === owner);\n }\n\n return res;\n }\n\n registerRoutes() {\n const isRequestAuthorized = async (\n req: Request,\n permission: BasicPermission,\n ): Promise<boolean> => {\n const decision = (\n await this.permissions.authorize([{ permission }], {\n credentials: await this.httpAuth.credentials(req),\n })\n )[0];\n\n return decision.result !== AuthorizeResult.DENY;\n };\n\n this.moduleRouter\n .get('/entities/unprocessed/failed', async (req, res) => {\n return res.json(\n await this.unprocessed({\n reason: 'failed',\n owner:\n typeof req.query.owner === 'string' ? req.query.owner : undefined,\n }),\n );\n })\n .get('/entities/unprocessed/pending', async (req, res) => {\n return res.json(\n await this.unprocessed({\n reason: 'pending',\n owner:\n typeof req.query.owner === 'string' ? req.query.owner : undefined,\n }),\n );\n })\n .delete(\n '/entities/unprocessed/delete/:entity_id',\n async (request, response) => {\n const authorized = await isRequestAuthorized(\n request,\n unprocessedEntitiesDeletePermission,\n );\n\n if (!authorized) {\n throw new NotAllowedError('Unauthorized');\n }\n\n await this.database('refresh_state')\n .where({ entity_id: request.params.entity_id })\n .delete();\n\n response.status(204).send();\n },\n );\n }\n}\n"],"names":["Router","createLegacyAuthAdapters","AuthorizeResult","unprocessedEntitiesDeletePermission","NotAllowedError"],"mappings":";;;;;;;;;;;;AA6CO,M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CAAA;AAAA,OACH,CAAA;AAAA,KACD,CACA,CAAA,MAAA;AAAA,MACC,yCAAA;AAAA,MACA,OAAO,SAAS,QAAa,KAAA;AAC3B,QAAA,MAAM,aAAa,MAAM,mBAAA;AAAA,UACvB,OAAA;AAAA,UACAC,0EAAA;AAAA,SACF,CAAA;AAEA,QAAA,IAAI,CAAC,UAAY,EAAA;AACf,UAAM,MAAA,IAAIC,uBAAgB,cAAc,CAAA,CAAA;AAAA,SAC1C;AAEA,QAAA,MAAM,IAAK,CAAA,QAAA,CAAS,eAAe,CAAA,CAChC,KAAM,CAAA,EAAE,SAAW,EAAA,OAAA,CAAQ,MAAO,CAAA,SAAA,EAAW,CAAA,CAC7C,MAAO,EAAA,CAAA;AAEV,QAAS,QAAA,CAAA,MAAA,CAAO,GAAG,CAAA,CAAE,IAAK,EAAA,CAAA;AAAA,OAC5B;AAAA,KACF,CAAA;AAAA,GACJ;AACF;;;;"}
package/dist/index.cjs.js CHANGED
@@ -2,164 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var backendPluginApi = require('@backstage/backend-plugin-api');
6
- var Router = require('express-promise-router');
7
- var pluginPermissionCommon = require('@backstage/plugin-permission-common');
8
- var pluginCatalogUnprocessedEntitiesCommon = require('@backstage/plugin-catalog-unprocessed-entities-common');
9
- var errors = require('@backstage/errors');
10
- var backendCommon = require('@backstage/backend-common');
11
- var alpha = require('@backstage/plugin-catalog-node/alpha');
5
+ var module$1 = require('./module.cjs.js');
6
+ var UnprocessedEntitiesModule = require('./UnprocessedEntitiesModule.cjs.js');
12
7
 
13
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
8
 
15
- var Router__default = /*#__PURE__*/_interopDefaultCompat(Router);
16
9
 
17
- class UnprocessedEntitiesModule {
18
- constructor(database, router, permissions, discovery, httpAuth) {
19
- this.database = database;
20
- this.router = router;
21
- this.permissions = permissions;
22
- this.moduleRouter = Router__default.default();
23
- this.router.use(this.moduleRouter);
24
- this.httpAuth = backendCommon.createLegacyAuthAdapters({
25
- discovery,
26
- httpAuth
27
- }).httpAuth;
28
- }
29
- moduleRouter;
30
- httpAuth;
31
- static create(options) {
32
- return new UnprocessedEntitiesModule(
33
- options.database,
34
- options.router,
35
- options.permissions,
36
- options.discovery,
37
- options.httpAuth
38
- );
39
- }
40
- async unprocessed(request) {
41
- if (request.reason === "pending") {
42
- return {
43
- type: "pending",
44
- entities: await this.pending(request.owner)
45
- };
46
- }
47
- return {
48
- type: "failed",
49
- entities: await this.failed(request.owner)
50
- };
51
- }
52
- hydrateRefreshState(r) {
53
- return {
54
- ...r,
55
- unprocessed_entity: JSON.parse(r.unprocessed_entity),
56
- ...r.processed_entity && {
57
- processed_entity: JSON.parse(r.processed_entity)
58
- },
59
- ...r.errors && { errors: JSON.parse(r.errors) },
60
- ...r.cache && { cache: JSON.parse(r.cache) }
61
- };
62
- }
63
- async pending(owner) {
64
- const res = (await this.database("refresh_state.*").from("refresh_state").leftJoin(
65
- "final_entities",
66
- "final_entities.entity_id",
67
- "refresh_state.entity_id"
68
- ).whereNull("final_entities.entity_id")).map(this.hydrateRefreshState);
69
- if (owner) {
70
- return res.filter((r) => r.unprocessed_entity.spec?.owner === owner);
71
- }
72
- return res;
73
- }
74
- async failed(owner) {
75
- const res = (await this.database("refresh_state.*").from("refresh_state").rightJoin(
76
- "final_entities",
77
- "final_entities.entity_id",
78
- "refresh_state.entity_id"
79
- ).whereNull("final_entities.final_entity")).map(this.hydrateRefreshState);
80
- if (owner) {
81
- return res.filter((r) => r.unprocessed_entity.spec?.owner === owner);
82
- }
83
- return res;
84
- }
85
- registerRoutes() {
86
- const isRequestAuthorized = async (req, permission) => {
87
- const decision = (await this.permissions.authorize([{ permission }], {
88
- credentials: await this.httpAuth.credentials(req)
89
- }))[0];
90
- return decision.result !== pluginPermissionCommon.AuthorizeResult.DENY;
91
- };
92
- this.moduleRouter.get("/entities/unprocessed/failed", async (req, res) => {
93
- return res.json(
94
- await this.unprocessed({
95
- reason: "failed",
96
- owner: typeof req.query.owner === "string" ? req.query.owner : void 0
97
- })
98
- );
99
- }).get("/entities/unprocessed/pending", async (req, res) => {
100
- return res.json(
101
- await this.unprocessed({
102
- reason: "pending",
103
- owner: typeof req.query.owner === "string" ? req.query.owner : void 0
104
- })
105
- );
106
- }).delete(
107
- "/entities/unprocessed/delete/:entity_id",
108
- async (request, response) => {
109
- const authorized = await isRequestAuthorized(
110
- request,
111
- pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesDeletePermission
112
- );
113
- if (!authorized) {
114
- throw new errors.NotAllowedError("Unauthorized");
115
- }
116
- await this.database("refresh_state").where({ entity_id: request.params.entity_id }).delete();
117
- response.status(204).send();
118
- }
119
- );
120
- }
121
- }
122
-
123
- const catalogModuleUnprocessedEntities = backendPluginApi.createBackendModule({
124
- pluginId: "catalog",
125
- moduleId: "catalog-module-unprocessed-entities",
126
- register(env) {
127
- env.registerInit({
128
- deps: {
129
- database: backendPluginApi.coreServices.database,
130
- router: backendPluginApi.coreServices.httpRouter,
131
- logger: backendPluginApi.coreServices.logger,
132
- httpAuth: backendPluginApi.coreServices.httpAuth,
133
- discovery: backendPluginApi.coreServices.discovery,
134
- permissions: backendPluginApi.coreServices.permissions,
135
- catalogPermissions: alpha.catalogPermissionExtensionPoint
136
- },
137
- async init({
138
- database,
139
- router,
140
- logger,
141
- permissions,
142
- httpAuth,
143
- discovery,
144
- catalogPermissions
145
- }) {
146
- const module = UnprocessedEntitiesModule.create({
147
- database: await database.getClient(),
148
- router,
149
- permissions,
150
- discovery,
151
- httpAuth
152
- });
153
- catalogPermissions.addPermissions(pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesDeletePermission);
154
- module.registerRoutes();
155
- logger.info(
156
- "registered additional routes for catalogModuleUnprocessedEntities"
157
- );
158
- }
159
- });
160
- }
161
- });
162
-
163
- exports.UnprocessedEntitiesModule = UnprocessedEntitiesModule;
164
- exports.default = catalogModuleUnprocessedEntities;
10
+ exports.default = module$1.catalogModuleUnprocessedEntities;
11
+ exports.UnprocessedEntitiesModule = UnprocessedEntitiesModule.UnprocessedEntitiesModule;
165
12
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/UnprocessedEntitiesModule.ts","../src/module.ts"],"sourcesContent":["/*\n * Copyright 2023 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 HydratedRefreshState,\n RefreshState,\n UnprocessedEntitiesRequest,\n UnprocessedEntitiesResponse,\n} from './types';\nimport { Knex } from 'knex';\nimport {\n DiscoveryService,\n HttpAuthService,\n HttpRouterService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\nimport type { Request } from 'express';\n\nimport {\n AuthorizeResult,\n BasicPermission,\n} from '@backstage/plugin-permission-common';\nimport { unprocessedEntitiesDeletePermission } from '@backstage/plugin-catalog-unprocessed-entities-common';\nimport { NotAllowedError } from '@backstage/errors';\nimport { createLegacyAuthAdapters } from '@backstage/backend-common';\n\n/**\n * Module providing Unprocessed Entities API endpoints\n *\n * @public\n */\nexport class UnprocessedEntitiesModule {\n private readonly moduleRouter;\n\n private readonly httpAuth: HttpAuthService;\n\n private constructor(\n private readonly database: Knex,\n private readonly router: Pick<HttpRouterService, 'use'>,\n private readonly permissions: PermissionsService,\n discovery: DiscoveryService,\n httpAuth?: HttpAuthService,\n ) {\n this.moduleRouter = Router();\n this.router.use(this.moduleRouter);\n\n this.httpAuth = createLegacyAuthAdapters({\n discovery,\n httpAuth,\n }).httpAuth;\n }\n\n static create(options: {\n router: Pick<HttpRouterService, 'use'>;\n database: Knex;\n discovery: DiscoveryService;\n permissions: PermissionsService;\n httpAuth?: HttpAuthService;\n }) {\n return new UnprocessedEntitiesModule(\n options.database,\n options.router,\n options.permissions,\n options.discovery,\n options.httpAuth,\n );\n }\n\n private async unprocessed(\n request: UnprocessedEntitiesRequest,\n ): Promise<UnprocessedEntitiesResponse> {\n if (request.reason === 'pending') {\n return {\n type: 'pending',\n entities: await this.pending(request.owner),\n };\n }\n return {\n type: 'failed',\n entities: await this.failed(request.owner),\n };\n }\n\n private hydrateRefreshState(r: RefreshState): HydratedRefreshState {\n return {\n ...r,\n unprocessed_entity: JSON.parse(r.unprocessed_entity),\n ...(r.processed_entity && {\n processed_entity: JSON.parse(r.processed_entity),\n }),\n ...(r.errors && { errors: JSON.parse(r.errors) }),\n ...(r.cache && { cache: JSON.parse(r.cache) }),\n };\n }\n\n private async pending(owner?: string): Promise<HydratedRefreshState[]> {\n const res = (\n await this.database('refresh_state.*')\n .from('refresh_state')\n .leftJoin(\n 'final_entities',\n 'final_entities.entity_id',\n 'refresh_state.entity_id',\n )\n .whereNull('final_entities.entity_id')\n ).map(this.hydrateRefreshState);\n if (owner) {\n return res.filter(r => r.unprocessed_entity.spec?.owner === owner);\n }\n\n return res;\n }\n\n private async failed(owner?: string): Promise<HydratedRefreshState[]> {\n const res = (\n await this.database('refresh_state.*')\n .from('refresh_state')\n .rightJoin(\n 'final_entities',\n 'final_entities.entity_id',\n 'refresh_state.entity_id',\n )\n .whereNull('final_entities.final_entity')\n ).map(this.hydrateRefreshState);\n if (owner) {\n return res.filter(r => r.unprocessed_entity.spec?.owner === owner);\n }\n\n return res;\n }\n\n registerRoutes() {\n const isRequestAuthorized = async (\n req: Request,\n permission: BasicPermission,\n ): Promise<boolean> => {\n const decision = (\n await this.permissions.authorize([{ permission }], {\n credentials: await this.httpAuth.credentials(req),\n })\n )[0];\n\n return decision.result !== AuthorizeResult.DENY;\n };\n\n this.moduleRouter\n .get('/entities/unprocessed/failed', async (req, res) => {\n return res.json(\n await this.unprocessed({\n reason: 'failed',\n owner:\n typeof req.query.owner === 'string' ? req.query.owner : undefined,\n }),\n );\n })\n .get('/entities/unprocessed/pending', async (req, res) => {\n return res.json(\n await this.unprocessed({\n reason: 'pending',\n owner:\n typeof req.query.owner === 'string' ? req.query.owner : undefined,\n }),\n );\n })\n .delete(\n '/entities/unprocessed/delete/:entity_id',\n async (request, response) => {\n const authorized = await isRequestAuthorized(\n request,\n unprocessedEntitiesDeletePermission,\n );\n\n if (!authorized) {\n throw new NotAllowedError('Unauthorized');\n }\n\n await this.database('refresh_state')\n .where({ entity_id: request.params.entity_id })\n .delete();\n\n response.status(204).send();\n },\n );\n }\n}\n","/*\n * Copyright 2023 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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { UnprocessedEntitiesModule } from './UnprocessedEntitiesModule';\nimport { catalogPermissionExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport { unprocessedEntitiesDeletePermission } from '@backstage/plugin-catalog-unprocessed-entities-common';\n\n/**\n * Catalog Module for Unprocessed Entities\n *\n * @public\n */\nexport const catalogModuleUnprocessedEntities = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'catalog-module-unprocessed-entities',\n register(env) {\n env.registerInit({\n deps: {\n database: coreServices.database,\n router: coreServices.httpRouter,\n logger: coreServices.logger,\n httpAuth: coreServices.httpAuth,\n discovery: coreServices.discovery,\n permissions: coreServices.permissions,\n catalogPermissions: catalogPermissionExtensionPoint,\n },\n async init({\n database,\n router,\n logger,\n permissions,\n httpAuth,\n discovery,\n catalogPermissions,\n }) {\n const module = UnprocessedEntitiesModule.create({\n database: await database.getClient(),\n router,\n permissions,\n discovery,\n httpAuth,\n });\n\n catalogPermissions.addPermissions(unprocessedEntitiesDeletePermission);\n\n module.registerRoutes();\n\n logger.info(\n 'registered additional routes for catalogModuleUnprocessedEntities',\n );\n },\n });\n },\n});\n"],"names":["Router","createLegacyAuthAdapters","AuthorizeResult","unprocessedEntitiesDeletePermission","NotAllowedError","createBackendModule","coreServices","catalogPermissionExtensionPoint"],"mappings":";;;;;;;;;;;;;;;;AA6CO,MAAM,yBAA0B,CAAA;AAAA,EAK7B,WACW,CAAA,QAAA,EACA,MACA,EAAA,WAAA,EACjB,WACA,QACA,EAAA;AALiB,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA,CAAA;AAIjB,IAAA,IAAA,CAAK,eAAeA,uBAAO,EAAA,CAAA;AAC3B,IAAK,IAAA,CAAA,MAAA,CAAO,GAAI,CAAA,IAAA,CAAK,YAAY,CAAA,CAAA;AAEjC,IAAA,IAAA,CAAK,WAAWC,sCAAyB,CAAA;AAAA,MACvC,SAAA;AAAA,MACA,QAAA;AAAA,KACD,CAAE,CAAA,QAAA,CAAA;AAAA,GACL;AAAA,EAlBiB,YAAA,CAAA;AAAA,EAEA,QAAA,CAAA;AAAA,EAkBjB,OAAO,OAAO,OAMX,EAAA;AACD,IAAA,OAAO,IAAI,yBAAA;AAAA,MACT,OAAQ,CAAA,QAAA;AAAA,MACR,OAAQ,CAAA,MAAA;AAAA,MACR,OAAQ,CAAA,WAAA;AAAA,MACR,OAAQ,CAAA,SAAA;AAAA,MACR,OAAQ,CAAA,QAAA;AAAA,KACV,CAAA;AAAA,GACF;AAAA,EAEA,MAAc,YACZ,OACsC,EAAA;AACtC,I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AA;AAAA,QACrB,QAAQA,6BAAa,CAAA,MAAA;AAAA,QACrB,UAAUA,6BAAa,CAAA,QAAA;AAAA,QACvB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,aAAaA,6BAAa,CAAA,WAAA;AAAA,QAC1B,kBAAoB,EAAAC,qCAAA;AAAA,OACtB;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,QAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,QACA,SAAA;AAAA,QACA,kBAAA;AAAA,OACC,EAAA;AACD,QAAM,MAAA,MAAA,GAAS,0BAA0B,MAAO,CAAA;AAAA,UAC9C,QAAA,EAAU,MAAM,QAAA,CAAS,SAAU,EAAA;AAAA,UACnC,MAAA;AAAA,UACA,WAAA;AAAA,UACA,SAAA;AAAA,UACA,QAAA;AAAA,SACD,CAAA,CAAA;AAED,QAAA,kBAAA,CAAmB,eAAeJ,0EAAmC,CAAA,CAAA;AAErE,QAAA,MAAA,CAAO,cAAe,EAAA,CAAA;AAEtB,QAAO,MAAA,CAAA,IAAA;AAAA,UACL,mEAAA;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var backendPluginApi = require('@backstage/backend-plugin-api');
4
+ var UnprocessedEntitiesModule = require('./UnprocessedEntitiesModule.cjs.js');
5
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
6
+ var pluginCatalogUnprocessedEntitiesCommon = require('@backstage/plugin-catalog-unprocessed-entities-common');
7
+
8
+ const catalogModuleUnprocessedEntities = backendPluginApi.createBackendModule({
9
+ pluginId: "catalog",
10
+ moduleId: "catalog-module-unprocessed-entities",
11
+ register(env) {
12
+ env.registerInit({
13
+ deps: {
14
+ database: backendPluginApi.coreServices.database,
15
+ router: backendPluginApi.coreServices.httpRouter,
16
+ logger: backendPluginApi.coreServices.logger,
17
+ httpAuth: backendPluginApi.coreServices.httpAuth,
18
+ discovery: backendPluginApi.coreServices.discovery,
19
+ permissions: backendPluginApi.coreServices.permissions,
20
+ catalogPermissions: alpha.catalogPermissionExtensionPoint
21
+ },
22
+ async init({
23
+ database,
24
+ router,
25
+ logger,
26
+ permissions,
27
+ httpAuth,
28
+ discovery,
29
+ catalogPermissions
30
+ }) {
31
+ const module = UnprocessedEntitiesModule.UnprocessedEntitiesModule.create({
32
+ database: await database.getClient(),
33
+ router,
34
+ permissions,
35
+ discovery,
36
+ httpAuth
37
+ });
38
+ catalogPermissions.addPermissions(pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesDeletePermission);
39
+ module.registerRoutes();
40
+ logger.info(
41
+ "registered additional routes for catalogModuleUnprocessedEntities"
42
+ );
43
+ }
44
+ });
45
+ }
46
+ });
47
+
48
+ exports.catalogModuleUnprocessedEntities = catalogModuleUnprocessedEntities;
49
+ //# sourceMappingURL=module.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2023 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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { UnprocessedEntitiesModule } from './UnprocessedEntitiesModule';\nimport { catalogPermissionExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport { unprocessedEntitiesDeletePermission } from '@backstage/plugin-catalog-unprocessed-entities-common';\n\n/**\n * Catalog Module for Unprocessed Entities\n *\n * @public\n */\nexport const catalogModuleUnprocessedEntities = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'catalog-module-unprocessed-entities',\n register(env) {\n env.registerInit({\n deps: {\n database: coreServices.database,\n router: coreServices.httpRouter,\n logger: coreServices.logger,\n httpAuth: coreServices.httpAuth,\n discovery: coreServices.discovery,\n permissions: coreServices.permissions,\n catalogPermissions: catalogPermissionExtensionPoint,\n },\n async init({\n database,\n router,\n logger,\n permissions,\n httpAuth,\n discovery,\n catalogPermissions,\n }) {\n const module = UnprocessedEntitiesModule.create({\n database: await database.getClient(),\n router,\n permissions,\n discovery,\n httpAuth,\n });\n\n catalogPermissions.addPermissions(unprocessedEntitiesDeletePermission);\n\n module.registerRoutes();\n\n logger.info(\n 'registered additional routes for catalogModuleUnprocessedEntities',\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","catalogPermissionExtensionPoint","UnprocessedEntitiesModule","unprocessedEntitiesDeletePermission"],"mappings":";;;;;;;AA6BO,MAAM,mCAAmCA,oCAAoB,CAAA;AAAA,EAClE,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,qCAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,UAAUC,6BAAa,CAAA,QAAA;AAAA,QACvB,QAAQA,6BAAa,CAAA,UAAA;AAAA,QACrB,QAAQA,6BAAa,CAAA,MAAA;AAAA,QACrB,UAAUA,6BAAa,CAAA,QAAA;AAAA,QACvB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,aAAaA,6BAAa,CAAA,WAAA;AAAA,QAC1B,kBAAoB,EAAAC,qCAAA;AAAA,OACtB;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,QAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,QACA,SAAA;AAAA,QACA,kBAAA;AAAA,OACC,EAAA;AACD,QAAM,MAAA,MAAA,GAASC,oDAA0B,MAAO,CAAA;AAAA,UAC9C,QAAA,EAAU,MAAM,QAAA,CAAS,SAAU,EAAA;AAAA,UACnC,MAAA;AAAA,UACA,WAAA;AAAA,UACA,SAAA;AAAA,UACA,QAAA;AAAA,SACD,CAAA,CAAA;AAED,QAAA,kBAAA,CAAmB,eAAeC,0EAAmC,CAAA,CAAA;AAErE,QAAA,MAAA,CAAO,cAAe,EAAA,CAAA;AAEtB,QAAO,MAAA,CAAA,IAAA;AAAA,UACL,mEAAA;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-unprocessed",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-next.1",
4
4
  "description": "Backstage Catalog module to view unprocessed entities",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -34,18 +34,18 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@backstage/backend-common": "^0.25.0",
37
- "@backstage/backend-plugin-api": "^1.0.0",
38
- "@backstage/catalog-model": "^1.7.0",
39
- "@backstage/errors": "^1.2.4",
40
- "@backstage/plugin-auth-node": "^0.5.2",
41
- "@backstage/plugin-catalog-node": "^1.13.0",
42
- "@backstage/plugin-catalog-unprocessed-entities-common": "^0.0.4",
43
- "@backstage/plugin-permission-common": "^0.8.1",
37
+ "@backstage/backend-plugin-api": "1.0.1-next.1",
38
+ "@backstage/catalog-model": "1.7.0",
39
+ "@backstage/errors": "1.2.4",
40
+ "@backstage/plugin-auth-node": "0.5.3-next.1",
41
+ "@backstage/plugin-catalog-node": "1.13.1-next.1",
42
+ "@backstage/plugin-catalog-unprocessed-entities-common": "0.0.4",
43
+ "@backstage/plugin-permission-common": "0.8.1",
44
44
  "express-promise-router": "^4.1.1",
45
45
  "knex": "^3.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@backstage/cli": "^0.27.1",
48
+ "@backstage/cli": "0.28.0-next.2",
49
49
  "@types/express": "^4.17.6"
50
50
  }
51
51
  }