@backstage/plugin-catalog-backend-module-unprocessed 0.5.7 → 0.6.0-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,22 @@
1
1
  # @backstage/plugin-catalog-backend-module-unprocessed
2
2
 
3
+ ## 0.6.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f453d5c: **BREAKING** Removed support for the legacy backend and removed references to `@backstage/backend-common`, please [migrate to the new backend system](https://backstage.io/docs/backend-system/building-plugins-and-modules/migrating)
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/plugin-catalog-node@1.17.0-next.0
13
+ - @backstage/backend-plugin-api@1.3.1-next.0
14
+ - @backstage/plugin-auth-node@0.6.3-next.0
15
+ - @backstage/catalog-model@1.7.3
16
+ - @backstage/errors@1.2.7
17
+ - @backstage/plugin-catalog-unprocessed-entities-common@0.0.7
18
+ - @backstage/plugin-permission-common@0.8.4
19
+
3
20
  ## 0.5.7
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -19,19 +19,3 @@ In `packages/backend/src/index.ts` add the module:
19
19
  ```ts title="packages/backend/src/index.ts"
20
20
  backend.add(import('@backstage/plugin-catalog-backend-module-unprocessed'));
21
21
  ```
22
-
23
- ### Legacy Backend
24
-
25
- In `packages/backend/src/plugins/catalog.ts` import the module and initialize it after invoking `CatalogBuilder.build()`:
26
-
27
- ```ts title="packages/backend/src/plugins/catalog.ts"
28
- import { UnprocessedEntitiesModule } from '@backstage/plugin-catalog-backend-module-unprocessed';
29
-
30
- //...
31
-
32
- const unprocessed = new UnprocessedEntitiesModule(
33
- await env.database.getClient(),
34
- router,
35
- );
36
- unprocessed.registerRoutes();
37
- ```
@@ -4,23 +4,19 @@ var Router = require('express-promise-router');
4
4
  var pluginPermissionCommon = require('@backstage/plugin-permission-common');
5
5
  var pluginCatalogUnprocessedEntitiesCommon = require('@backstage/plugin-catalog-unprocessed-entities-common');
6
6
  var errors = require('@backstage/errors');
7
- var backendCommon = require('@backstage/backend-common');
8
7
 
9
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
9
 
11
10
  var Router__default = /*#__PURE__*/_interopDefaultCompat(Router);
12
11
 
13
12
  class UnprocessedEntitiesModule {
14
- constructor(database, router, permissions, discovery, httpAuth) {
13
+ constructor(database, router, permissions, httpAuth) {
15
14
  this.database = database;
16
15
  this.router = router;
17
16
  this.permissions = permissions;
18
17
  this.moduleRouter = Router__default.default();
19
18
  this.router.use(this.moduleRouter);
20
- this.httpAuth = backendCommon.createLegacyAuthAdapters({
21
- discovery,
22
- httpAuth
23
- }).httpAuth;
19
+ this.httpAuth = httpAuth;
24
20
  }
25
21
  moduleRouter;
26
22
  httpAuth;
@@ -29,7 +25,6 @@ class UnprocessedEntitiesModule {
29
25
  options.database,
30
26
  options.router,
31
27
  options.permissions,
32
- options.discovery,
33
28
  options.httpAuth
34
29
  );
35
30
  }
@@ -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 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,MAAM,yBAA0B,CAAA;AAAA,EAK7B,WACW,CAAA,QAAA,EACA,MACA,EAAA,WAAA,EACjB,WACA,QACA,EAAA;AALiB,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,MAAA,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AS,QAAA,CAAA,MAAA,CAAO,GAAG,CAAA,CAAE,IAAK,EAAA;AAAA;AAC5B,KACF;AAAA;AAEN;;;;"}
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 constructor(\n private readonly database: Knex,\n private readonly router: Pick<HttpRouterService, 'use'>,\n private readonly permissions: PermissionsService,\n httpAuth: HttpAuthService,\n ) {\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,yBAA0B,CAAA;AAAA,EAK7B,WACW,CAAA,QAAA,EACA,MACA,EAAA,WAAA,EACjB,QACA,EAAA;AAJiB,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAGjB,IAAA,IAAA,CAAK,eAAeA,uBAAO,EAAA;AAC3B,IAAK,IAAA,CAAA,MAAA,CAAO,GAAI,CAAA,IAAA,CAAK,YAAY,CAAA;AAEjC,IAAA,IAAA,CAAK,QAAW,GAAA,QAAA;AAAA;AAClB,EAdiB,YAAA;AAAA,EAEA,QAAA;AAAA,EAcjB,OAAO,OAAO,OAKX,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;AAAA,KACV;AAAA;AACF,EAEA,MAAc,YACZ,OACsC,EAAA;AACtC,IAAI,IAAA,OAAA,CAAQ,WAAW,SAAW,EAAA;AAChC,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,SAAA;AAAA,QACN,QAAU,EAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,QAAQ,KAAK;AAAA,OAC5C;AAAA;AAEF,IAAO,OAAA;AAAA,MACL,IAAM,EAA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AC3D;AAAA,OACH;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;AAAA,SACF;AAEA,QAAA,IAAI,CAAC,UAAY,EAAA;AACf,UAAM,MAAA,IAAIC,uBAAgB,cAAc,CAAA;AAAA;AAG1C,QAAA,MAAM,IAAK,CAAA,QAAA,CAAS,eAAe,CAAA,CAChC,KAAM,CAAA,EAAE,SAAW,EAAA,OAAA,CAAQ,MAAO,CAAA,SAAA,EAAW,CAAA,CAC7C,MAAO,EAAA;AAEV,QAAS,QAAA,CAAA,MAAA,CAAO,GAAG,CAAA,CAAE,IAAK,EAAA;AAAA;AAC5B,KACF;AAAA;AAEN;;;;"}
package/dist/index.cjs.js CHANGED
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var module$1 = require('./module.cjs.js');
6
- var UnprocessedEntitiesModule = require('./UnprocessedEntitiesModule.cjs.js');
7
6
 
8
7
 
9
8
 
10
9
  exports.default = module$1.catalogModuleUnprocessedEntities;
11
- exports.UnprocessedEntitiesModule = UnprocessedEntitiesModule.UnprocessedEntitiesModule;
12
10
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
2
- import { HttpRouterService, DiscoveryService, PermissionsService, HttpAuthService } from '@backstage/backend-plugin-api';
3
- import { Knex } from 'knex';
4
2
 
5
3
  /**
6
4
  * Catalog Module for Unprocessed Entities
@@ -9,30 +7,4 @@ import { Knex } from 'knex';
9
7
  */
10
8
  declare const catalogModuleUnprocessedEntities: _backstage_backend_plugin_api.BackendFeature;
11
9
 
12
- /**
13
- * Module providing Unprocessed Entities API endpoints
14
- *
15
- * @public
16
- */
17
- declare class UnprocessedEntitiesModule {
18
- private readonly database;
19
- private readonly router;
20
- private readonly permissions;
21
- private readonly moduleRouter;
22
- private readonly httpAuth;
23
- private constructor();
24
- static create(options: {
25
- router: Pick<HttpRouterService, 'use'>;
26
- database: Knex;
27
- discovery: DiscoveryService;
28
- permissions: PermissionsService;
29
- httpAuth?: HttpAuthService;
30
- }): UnprocessedEntitiesModule;
31
- private unprocessed;
32
- private hydrateRefreshState;
33
- private pending;
34
- private failed;
35
- registerRoutes(): void;
36
- }
37
-
38
- export { UnprocessedEntitiesModule, catalogModuleUnprocessedEntities as default };
10
+ export { catalogModuleUnprocessedEntities as default };
@@ -14,7 +14,6 @@ const catalogModuleUnprocessedEntities = backendPluginApi.createBackendModule({
14
14
  router: backendPluginApi.coreServices.httpRouter,
15
15
  logger: backendPluginApi.coreServices.logger,
16
16
  httpAuth: backendPluginApi.coreServices.httpAuth,
17
- discovery: backendPluginApi.coreServices.discovery,
18
17
  permissions: backendPluginApi.coreServices.permissions,
19
18
  permissionsRegistry: backendPluginApi.coreServices.permissionsRegistry
20
19
  },
@@ -24,14 +23,12 @@ const catalogModuleUnprocessedEntities = backendPluginApi.createBackendModule({
24
23
  logger,
25
24
  permissions,
26
25
  httpAuth,
27
- discovery,
28
26
  permissionsRegistry
29
27
  }) {
30
28
  const module = UnprocessedEntitiesModule.UnprocessedEntitiesModule.create({
31
29
  database: await database.getClient(),
32
30
  router,
33
31
  permissions,
34
- discovery,
35
32
  httpAuth
36
33
  });
37
34
  permissionsRegistry.addPermissions([
@@ -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 { 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 permissionsRegistry: coreServices.permissionsRegistry,\n },\n async init({\n database,\n router,\n logger,\n permissions,\n httpAuth,\n discovery,\n permissionsRegistry,\n }) {\n const module = UnprocessedEntitiesModule.create({\n database: await database.getClient(),\n router,\n permissions,\n discovery,\n httpAuth,\n });\n\n permissionsRegistry.addPermissions([\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","unprocessedEntitiesDeletePermission"],"mappings":";;;;;;AA4BO,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,qBAAqBA,6BAAa,CAAA;AAAA,OACpC;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;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;AAAA,SACD,CAAA;AAED,QAAA,mBAAA,CAAoB,cAAe,CAAA;AAAA,UACjCC;AAAA,SACD,CAAA;AAED,QAAA,MAAA,CAAO,cAAe,EAAA;AAEtB,QAAO,MAAA,CAAA,IAAA;AAAA,UACL;AAAA,SACF;AAAA;AACF,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
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 { 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 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 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","unprocessedEntitiesDeletePermission"],"mappings":";;;;;;AA4BO,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,aAAaA,6BAAa,CAAA,WAAA;AAAA,QAC1B,qBAAqBA,6BAAa,CAAA;AAAA,OACpC;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,QAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,QACA;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;AAAA,SACD,CAAA;AAED,QAAA,mBAAA,CAAoB,cAAe,CAAA;AAAA,UACjCC;AAAA,SACD,CAAA;AAED,QAAA,MAAA,CAAO,cAAe,EAAA;AAEtB,QAAO,MAAA,CAAA,IAAA;AAAA,UACL;AAAA,SACF;AAAA;AACF,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-unprocessed",
3
- "version": "0.5.7",
3
+ "version": "0.6.0-next.0",
4
4
  "description": "Backstage Catalog module to view unprocessed entities",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -36,19 +36,18 @@
36
36
  "test": "backstage-cli package test"
37
37
  },
38
38
  "dependencies": {
39
- "@backstage/backend-common": "^0.25.0",
40
- "@backstage/backend-plugin-api": "^1.3.0",
41
- "@backstage/catalog-model": "^1.7.3",
42
- "@backstage/errors": "^1.2.7",
43
- "@backstage/plugin-auth-node": "^0.6.2",
44
- "@backstage/plugin-catalog-node": "^1.16.3",
45
- "@backstage/plugin-catalog-unprocessed-entities-common": "^0.0.7",
46
- "@backstage/plugin-permission-common": "^0.8.4",
39
+ "@backstage/backend-plugin-api": "1.3.1-next.0",
40
+ "@backstage/catalog-model": "1.7.3",
41
+ "@backstage/errors": "1.2.7",
42
+ "@backstage/plugin-auth-node": "0.6.3-next.0",
43
+ "@backstage/plugin-catalog-node": "1.17.0-next.0",
44
+ "@backstage/plugin-catalog-unprocessed-entities-common": "0.0.7",
45
+ "@backstage/plugin-permission-common": "0.8.4",
47
46
  "express-promise-router": "^4.1.1",
48
47
  "knex": "^3.0.0"
49
48
  },
50
49
  "devDependencies": {
51
- "@backstage/cli": "^0.32.0",
50
+ "@backstage/cli": "0.32.1-next.0",
52
51
  "@types/express": "^4.17.6"
53
52
  },
54
53
  "typesVersions": {