@backstage/plugin-catalog-backend-module-unprocessed 0.6.10 → 0.6.11
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,13 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend-module-unprocessed
|
|
2
2
|
|
|
3
|
+
## 0.6.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 755d03e: Added permission authorization checks to the unprocessed entities read endpoints for pending and failed entities.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-unprocessed-entities-common@0.0.15
|
|
10
|
+
|
|
3
11
|
## 0.6.10
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -84,6 +84,13 @@ class UnprocessedEntitiesModule {
|
|
|
84
84
|
return decision.result !== pluginPermissionCommon.AuthorizeResult.DENY;
|
|
85
85
|
};
|
|
86
86
|
this.moduleRouter.get("/entities/unprocessed/failed", async (req, res) => {
|
|
87
|
+
const authorized = await isRequestAuthorized(
|
|
88
|
+
req,
|
|
89
|
+
pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesReadPermission
|
|
90
|
+
);
|
|
91
|
+
if (!authorized) {
|
|
92
|
+
throw new errors.NotAllowedError("Unauthorized");
|
|
93
|
+
}
|
|
87
94
|
return res.json(
|
|
88
95
|
await this.unprocessed({
|
|
89
96
|
reason: "failed",
|
|
@@ -91,6 +98,13 @@ class UnprocessedEntitiesModule {
|
|
|
91
98
|
})
|
|
92
99
|
);
|
|
93
100
|
}).get("/entities/unprocessed/pending", async (req, res) => {
|
|
101
|
+
const authorized = await isRequestAuthorized(
|
|
102
|
+
req,
|
|
103
|
+
pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesReadPermission
|
|
104
|
+
);
|
|
105
|
+
if (!authorized) {
|
|
106
|
+
throw new errors.NotAllowedError("Unauthorized");
|
|
107
|
+
}
|
|
94
108
|
return res.json(
|
|
95
109
|
await this.unprocessed({
|
|
96
110
|
reason: "pending",
|
|
@@ -1 +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 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';\n\n/**\n * Module providing Unprocessed Entities API endpoints\n *\n * @internal\n */\nexport class UnprocessedEntitiesModule {\n private readonly moduleRouter;\n\n private readonly httpAuth: HttpAuthService;\n\n private readonly database: Knex;\n private readonly router: Pick<HttpRouterService, 'use'>;\n private readonly permissions: PermissionsService;\n\n private constructor(\n database: Knex,\n router: Pick<HttpRouterService, 'use'>,\n permissions: PermissionsService,\n httpAuth: HttpAuthService,\n ) {\n this.database = database;\n this.router = router;\n this.permissions = permissions;\n this.moduleRouter = Router();\n this.router.use(this.moduleRouter);\n\n this.httpAuth = httpAuth;\n }\n\n static create(options: {\n router: Pick<HttpRouterService, 'use'>;\n database: Knex;\n permissions: PermissionsService;\n httpAuth: HttpAuthService;\n }) {\n return new UnprocessedEntitiesModule(\n options.database,\n options.router,\n options.permissions,\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","AuthorizeResult","unprocessedEntitiesDeletePermission","NotAllowedError"],"mappings":";;;;;;;;;;;AA2CO,MAAM,yBAAA,CAA0B;AAAA,EACpB,YAAA;AAAA,EAEA,QAAA;AAAA,EAEA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EAET,WAAA,CACN,QAAA,EACA,MAAA,EACA,WAAA,EACA,QAAA,EACA;AACA,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AACnB,IAAA,IAAA,CAAK,eAAeA,uBAAA,EAAO;AAC3B,IAAA,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,IAAA,CAAK,YAAY,CAAA;AAEjC,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAAA,EAClB;AAAA,EAEA,OAAO,OAAO,OAAA,EAKX;AACD,IAAA,OAAO,IAAI,yBAAA;AAAA,MACT,OAAA,CAAQ,QAAA;AAAA,MACR,OAAA,CAAQ,MAAA;AAAA,MACR,OAAA,CAAQ,WAAA;AAAA,MACR,OAAA,CAAQ;AAAA,KACV;AAAA,EACF;AAAA,EAEA,MAAc,YACZ,OAAA,EACsC;AACtC,IAAA,IAAI,OAAA,CAAQ,WAAW,SAAA,EAAW;AAChC,MAAA,OAAO;AAAA,QACL,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IAAA;AAAA,QACT,MAAM,KAAK,WAAA,CAAY;AAAA,UACrB,MAAA,EAAQ,SAAA;AAAA,UACR,KAAA,EACE,OAAO,GAAA,CAAI,KAAA,CAAM,UAAU,QAAA,GAAW,GAAA,CAAI,MAAM,KAAA,GAAQ;AAAA,SAC3D;AAAA,OACH;AAAA,IACF,CAAC,CAAA,CACA,MAAA;AAAA,MACC,yCAAA;AAAA,MACA,OAAO,SAAS,QAAA,KAAa;AAC3B,QAAA,MAAM,aAAa,MAAM,mBAAA;AAAA,UACvB,OAAA;AAAA,UACAC;AAAA,SACF;AAEA,QAAA,IAAI,CAAC,UAAA,EAAY;AACf,UAAA,MAAM,IAAIC,uBAAgB,cAAc,CAAA;AAAA,QAC1C;AAEA,QAAA,MAAM,IAAA,CAAK,QAAA,CAAS,eAAe,CAAA,CAChC,KAAA,CAAM,EAAE,SAAA,EAAW,OAAA,CAAQ,MAAA,CAAO,SAAA,EAAW,CAAA,CAC7C,MAAA,EAAO;AAEV,QAAA,QAAA,CAAS,MAAA,CAAO,GAAG,CAAA,CAAE,IAAA,EAAK;AAAA,MAC5B;AAAA,KACF;AAAA,EACJ;AACF;;;;"}
|
|
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 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 {\n unprocessedEntitiesDeletePermission,\n unprocessedEntitiesReadPermission,\n} from '@backstage/plugin-catalog-unprocessed-entities-common';\nimport { NotAllowedError } from '@backstage/errors';\n\n/**\n * Module providing Unprocessed Entities API endpoints\n *\n * @internal\n */\nexport class UnprocessedEntitiesModule {\n private readonly moduleRouter;\n\n private readonly httpAuth: HttpAuthService;\n\n private readonly database: Knex;\n private readonly router: Pick<HttpRouterService, 'use'>;\n private readonly permissions: PermissionsService;\n\n private constructor(\n database: Knex,\n router: Pick<HttpRouterService, 'use'>,\n permissions: PermissionsService,\n httpAuth: HttpAuthService,\n ) {\n this.database = database;\n this.router = router;\n this.permissions = permissions;\n this.moduleRouter = Router();\n this.router.use(this.moduleRouter);\n\n this.httpAuth = httpAuth;\n }\n\n static create(options: {\n router: Pick<HttpRouterService, 'use'>;\n database: Knex;\n permissions: PermissionsService;\n httpAuth: HttpAuthService;\n }) {\n return new UnprocessedEntitiesModule(\n options.database,\n options.router,\n options.permissions,\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 const authorized = await isRequestAuthorized(\n req,\n unprocessedEntitiesReadPermission,\n );\n if (!authorized) {\n throw new NotAllowedError('Unauthorized');\n }\n\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 const authorized = await isRequestAuthorized(\n req,\n unprocessedEntitiesReadPermission,\n );\n if (!authorized) {\n throw new NotAllowedError('Unauthorized');\n }\n\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","Auth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AM,KAAK,WAAA,CAAY;AAAA,UACrB,MAAA,EAAQ,SAAA;AAAA,UACR,KAAA,EACE,OAAO,GAAA,CAAI,KAAA,CAAM,UAAU,QAAA,GAAW,GAAA,CAAI,MAAM,KAAA,GAAQ;AAAA,SAC3D;AAAA,OACH;AAAA,IACF,CAAC,CAAA,CACA,MAAA;AAAA,MACC,yCAAA;AAAA,MACA,OAAO,SAAS,QAAA,KAAa;AAC3B,QAAA,MAAM,aAAa,MAAM,mBAAA;AAAA,UACvB,OAAA;AAAA,UACAC;AAAA,SACF;AAEA,QAAA,IAAI,CAAC,UAAA,EAAY;AACf,UAAA,MAAM,IAAID,uBAAgB,cAAc,CAAA;AAAA,QAC1C;AAEA,QAAA,MAAM,IAAA,CAAK,QAAA,CAAS,eAAe,CAAA,CAChC,KAAA,CAAM,EAAE,SAAA,EAAW,OAAA,CAAQ,MAAA,CAAO,SAAA,EAAW,CAAA,CAC7C,MAAA,EAAO;AAEV,QAAA,QAAA,CAAS,MAAA,CAAO,GAAG,CAAA,CAAE,IAAA,EAAK;AAAA,MAC5B;AAAA,KACF;AAAA,EACJ;AACF;;;;"}
|
package/dist/module.cjs.js
CHANGED
|
@@ -32,6 +32,7 @@ const catalogModuleUnprocessedEntities = backendPluginApi.createBackendModule({
|
|
|
32
32
|
httpAuth
|
|
33
33
|
});
|
|
34
34
|
permissionsRegistry.addPermissions([
|
|
35
|
+
pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesReadPermission,
|
|
35
36
|
pluginCatalogUnprocessedEntitiesCommon.unprocessedEntitiesDeletePermission
|
|
36
37
|
]);
|
|
37
38
|
module.registerRoutes();
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +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 {
|
|
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 {\n unprocessedEntitiesDeletePermission,\n unprocessedEntitiesReadPermission,\n} 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 permissions: coreServices.permissions,\n permissionsRegistry: coreServices.permissionsRegistry,\n },\n async init({\n database,\n router,\n logger,\n permissions,\n httpAuth,\n permissionsRegistry,\n }) {\n const module = UnprocessedEntitiesModule.create({\n database: await database.getClient(),\n router,\n permissions,\n httpAuth,\n });\n\n permissionsRegistry.addPermissions([\n unprocessedEntitiesReadPermission,\n unprocessedEntitiesDeletePermission,\n ]);\n\n module.registerRoutes();\n\n logger.info(\n 'registered additional routes for catalogModuleUnprocessedEntities',\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","UnprocessedEntitiesModule","unprocessedEntitiesReadPermission","unprocessedEntitiesDeletePermission"],"mappings":";;;;;;AA+BO,MAAM,mCAAmCA,oCAAA,CAAoB;AAAA,EAClE,QAAA,EAAU,SAAA;AAAA,EACV,QAAA,EAAU,qCAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;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,aAAaA,6BAAA,CAAa,WAAA;AAAA,QAC1B,qBAAqBA,6BAAA,CAAa;AAAA,OACpC;AAAA,MACA,MAAM,IAAA,CAAK;AAAA,QACT,QAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA,OACF,EAAG;AACD,QAAA,MAAM,MAAA,GAASC,oDAA0B,MAAA,CAAO;AAAA,UAC9C,QAAA,EAAU,MAAM,QAAA,CAAS,SAAA,EAAU;AAAA,UACnC,MAAA;AAAA,UACA,WAAA;AAAA,UACA;AAAA,SACD,CAAA;AAED,QAAA,mBAAA,CAAoB,cAAA,CAAe;AAAA,UACjCC,wEAAA;AAAA,UACAC;AAAA,SACD,CAAA;AAED,QAAA,MAAA,CAAO,cAAA,EAAe;AAEtB,QAAA,MAAA,CAAO,IAAA;AAAA,UACL;AAAA,SACF;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend-module-unprocessed",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"description": "Backstage Catalog module to view unprocessed entities",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -41,14 +41,19 @@
|
|
|
41
41
|
"@backstage/errors": "^1.3.0",
|
|
42
42
|
"@backstage/plugin-auth-node": "^0.7.0",
|
|
43
43
|
"@backstage/plugin-catalog-node": "^2.2.0",
|
|
44
|
-
"@backstage/plugin-catalog-unprocessed-entities-common": "^0.0.
|
|
44
|
+
"@backstage/plugin-catalog-unprocessed-entities-common": "^0.0.15",
|
|
45
45
|
"@backstage/plugin-permission-common": "^0.9.8",
|
|
46
46
|
"express-promise-router": "^4.1.1",
|
|
47
47
|
"knex": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
+
"@backstage/backend-test-utils": "^1.11.2",
|
|
50
51
|
"@backstage/cli": "^0.36.1",
|
|
51
|
-
"@types/express": "^4.17.6"
|
|
52
|
+
"@types/express": "^4.17.6",
|
|
53
|
+
"@types/supertest": "^2.0.8",
|
|
54
|
+
"better-sqlite3": "^12.0.0",
|
|
55
|
+
"express": "^4.22.0",
|
|
56
|
+
"supertest": "^7.0.0"
|
|
52
57
|
},
|
|
53
58
|
"typesVersions": {
|
|
54
59
|
"*": {
|