@backstage/plugin-catalog-node 0.0.0-nightly-20260918023200 → 0.0.0-nightly-20260920023043

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,19 +1,19 @@
1
1
  # @backstage/plugin-catalog-node
2
2
 
3
- ## 0.0.0-nightly-20260918023200
3
+ ## 0.0.0-nightly-20260920023043
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Updated dependencies
8
- - @backstage/backend-test-utils@0.0.0-nightly-20260918023200
9
- - @backstage/plugin-permission-node@0.11.4
10
- - @backstage/backend-plugin-api@1.10.1
11
- - @backstage/catalog-client@1.16.2
12
- - @backstage/catalog-model@1.10.1
13
- - @backstage/errors@1.3.1
8
+ - @backstage/errors@0.0.0-nightly-20260920023043
9
+ - @backstage/backend-test-utils@0.0.0-nightly-20260920023043
10
+ - @backstage/backend-plugin-api@0.0.0-nightly-20260920023043
11
+ - @backstage/plugin-permission-common@0.0.0-nightly-20260920023043
12
+ - @backstage/plugin-permission-node@0.0.0-nightly-20260920023043
13
+ - @backstage/catalog-client@0.0.0-nightly-20260920023043
14
+ - @backstage/catalog-model@0.0.0-nightly-20260920023043
14
15
  - @backstage/types@1.2.2
15
- - @backstage/plugin-catalog-common@1.2.0
16
- - @backstage/plugin-permission-common@0.9.11
16
+ - @backstage/plugin-catalog-common@0.0.0-nightly-20260920023043
17
17
 
18
18
  ## 2.2.5
19
19
 
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.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 { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { createPermissionResourceRef } from '@backstage/plugin-permission-node';\nimport { Entity } from '@backstage/catalog-model';\nimport { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';\n\n/** @alpha */\nexport const catalogEntityPermissionResourceRef = createPermissionResourceRef<\n Entity,\n EntitiesSearchFilter\n>().with({\n pluginId: 'catalog',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\nexport type { CatalogModelExtensionPoint } from './extensions';\nexport { catalogModelExtensionPoint } from './extensions';\n\nexport * from './scmEvents';\nexport { provideStaticCatalogModel } from './provideStaticCatalogModel';\n"],"names":["createPermissionResourceRef","RESOURCE_TYPE_CATALOG_ENTITY"],"mappings":";;;;;;;;AAsBO,MAAM,kCAAA,GAAqCA,gDAAA,EAGhD,CAAE,IAAA,CAAK;AAAA,EACP,QAAA,EAAU,SAAA;AAAA,EACV,YAAA,EAAcC;AAChB,CAAC;;;;;;;"}
1
+ {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.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 { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { createPermissionResourceRef } from '@backstage/plugin-permission-node';\nimport { Entity } from '@backstage/catalog-model';\nimport { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';\n\n/** @alpha */\nexport const catalogEntityPermissionResourceRef = createPermissionResourceRef<\n Entity,\n EntitiesSearchFilter\n>().with({\n pluginId: 'catalog',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\nexport type { CatalogModelExtensionPoint } from './extensions';\nexport { catalogModelExtensionPoint } from './extensions';\n\nexport * from './scmEvents';\nexport { provideStaticCatalogModel } from './provideStaticCatalogModel';\n"],"names":["createPermissionResourceRef","RESOURCE_TYPE_CATALOG_ENTITY"],"mappings":";;;;;;;;AAsBO,MAAM,kCAAA,GAAqCA,gDAAA,EAGhD,CAAE,IAAA,CAAK;AAAA,EACP,QAAA,EAAU,SAAA;AAAA,EACV,YAAA,EAAcC;AAChB,CAAC;;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _backstage_plugin_permission_node from '@backstage/plugin-permission-node';
2
2
  import { Entity } from '@backstage/catalog-model';
3
3
  import { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
4
- export { b as CatalogModelExtensionPoint, f as catalogModelExtensionPoint } from './types/extensions.d-B2z19h7d.js';
4
+ export { C as CatalogModelExtensionPoint, c as catalogModelExtensionPoint } from './types/extensions.d-DwAgFule.js';
5
5
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
6
6
  import { CatalogModelLayer } from '@backstage/catalog-model/alpha';
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"processingResult.cjs.js","sources":["../../src/api/processingResult.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { InputError, NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { CatalogProcessorResult } from './processor';\nimport { EntityRelationSpec } from './common';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * Factory functions for the standard processing result types.\n *\n * @public\n */\nexport const processingResult = Object.freeze({\n /**\n * Associates a NotFoundError with the processing state of the current entity.\n */\n notFoundError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new NotFoundError(message),\n };\n },\n\n /**\n * Associates an InputError with the processing state of the current entity.\n */\n inputError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new InputError(message),\n };\n },\n\n /**\n * Associates a general Error with the processing state of the current entity.\n */\n generalError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return { type: 'error', location: atLocation, error: new Error(message) };\n },\n\n /**\n * Emits a location. In effect, this is analogous to emitting a Location kind\n * child entity. This is commonly used in discovery processors. Do not use\n * this while processing Location entities.\n */\n location(newLocation: LocationSpec): CatalogProcessorResult {\n return { type: 'location', location: newLocation };\n },\n\n /**\n * Emits a child of the current entity, associated with a certain location.\n */\n entity(\n atLocation: LocationSpec,\n newEntity: Entity,\n options?: {\n /**\n * Sets the location key of the emitted entity, overriding the default one derived from the location.\n *\n * To set a `null` location key the value `null` must be used.\n */\n locationKey?: string | null;\n },\n ): CatalogProcessorResult {\n return {\n type: 'entity',\n location: atLocation,\n entity: newEntity,\n locationKey: options?.locationKey,\n };\n },\n\n /**\n * Emits a relation owned by the current entity. The relation does not have to\n * start or end at the current entity. The relation only lives for as long as\n * the current entity lives.\n */\n relation(spec: EntityRelationSpec): CatalogProcessorResult {\n return { type: 'relation', relation: spec };\n },\n\n /**\n * Associates the given refresh key with the current entity. The effect of\n * this is that the entity will be marked for refresh when such requests are\n * made.\n */\n refresh(key: string): CatalogProcessorResult {\n return { type: 'refresh', key };\n },\n} as const);\n"],"names":["NotFoundError","InputError"],"mappings":";;;;AA2BO,MAAM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QAAQ,GAAA,EAAqC;AAC3C,IAAA,OAAO,EAAE,IAAA,EAAM,SAAA,EAAW,GAAA,EAAI;AAAA,EAChC;AACF,CAAU;;;;"}
1
+ {"version":3,"file":"processingResult.cjs.js","sources":["../../src/api/processingResult.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { InputError, NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { CatalogProcessorResult } from './processor';\nimport { EntityRelationSpec } from './common';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * Factory functions for the standard processing result types.\n *\n * @public\n */\nexport const processingResult = Object.freeze({\n /**\n * Associates a NotFoundError with the processing state of the current entity.\n */\n notFoundError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new NotFoundError(message),\n };\n },\n\n /**\n * Associates an InputError with the processing state of the current entity.\n */\n inputError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new InputError(message),\n };\n },\n\n /**\n * Associates a general Error with the processing state of the current entity.\n */\n generalError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return { type: 'error', location: atLocation, error: new Error(message) };\n },\n\n /**\n * Emits a location. In effect, this is analogous to emitting a Location kind\n * child entity. This is commonly used in discovery processors. Do not use\n * this while processing Location entities.\n */\n location(newLocation: LocationSpec): CatalogProcessorResult {\n return { type: 'location', location: newLocation };\n },\n\n /**\n * Emits a child of the current entity, associated with a certain location.\n */\n entity(\n atLocation: LocationSpec,\n newEntity: Entity,\n options?: {\n /**\n * Sets the location key of the emitted entity, overriding the default one derived from the location.\n *\n * To set a `null` location key the value `null` must be used.\n */\n locationKey?: string | null;\n },\n ): CatalogProcessorResult {\n return {\n type: 'entity',\n location: atLocation,\n entity: newEntity,\n locationKey: options?.locationKey,\n };\n },\n\n /**\n * Emits a relation owned by the current entity. The relation does not have to\n * start or end at the current entity. The relation only lives for as long as\n * the current entity lives.\n */\n relation(spec: EntityRelationSpec): CatalogProcessorResult {\n return { type: 'relation', relation: spec };\n },\n\n /**\n * Associates the given refresh key with the current entity. The effect of\n * this is that the entity will be marked for refresh when such requests are\n * made.\n */\n refresh(key: string): CatalogProcessorResult {\n return { type: 'refresh', key };\n },\n} as const);\n"],"names":["NotFoundError","InputError"],"mappings":";;;;AA2BO,MAAM,gBAAA,GAAmB,OAAO,MAAA,CAAO;AAAA;AAAA;AAAA;AAAA,EAI5C,aAAA,CACE,YACA,OAAA,EACwB;AACxB,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,OAAA;AAAA,MACN,QAAA,EAAU,UAAA;AAAA,MACV,KAAA,EAAO,IAAIA,oBAAA,CAAc,OAAO;AAAA,KAClC;AAAA,EACF,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA,CACE,YACA,OAAA,EACwB;AACxB,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,OAAA;AAAA,MACN,QAAA,EAAU,UAAA;AAAA,MACV,KAAA,EAAO,IAAIC,iBAAA,CAAW,OAAO;AAAA,KAC/B;AAAA,EACF,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YAAA,CACE,YACA,OAAA,EACwB;AACxB,IAAA,OAAO,EAAE,MAAM,OAAA,EAAS,QAAA,EAAU,YAAY,KAAA,EAAO,IAAI,KAAA,CAAM,OAAO,CAAA,EAAE;AAAA,EAC1E,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAS,WAAA,EAAmD;AAC1D,IAAA,OAAO,EAAE,IAAA,EAAM,UAAA,EAAY,QAAA,EAAU,WAAA,EAAY;AAAA,EACnD,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA,CACE,UAAA,EACA,SAAA,EACA,OAAA,EAQwB;AACxB,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,QAAA;AAAA,MACN,QAAA,EAAU,UAAA;AAAA,MACV,MAAA,EAAQ,SAAA;AAAA,MACR,aAAa,OAAA,EAAS;AAAA,KACxB;AAAA,EACF,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAS,IAAA,EAAkD;AACzD,IAAA,OAAO,EAAE,IAAA,EAAM,UAAA,EAAY,QAAA,EAAU,IAAA,EAAK;AAAA,EAC5C,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,QAAQ,GAAA,EAAqC;AAC3C,IAAA,OAAO,EAAE,IAAA,EAAM,SAAA,EAAW,GAAA,EAAI;AAAA,EAChC;AACF,CAAU;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalogService.cjs.js","sources":["../src/catalogService.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AuthService,\n BackstageCredentials,\n coreServices,\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CatalogApi,\n CatalogClient,\n CatalogRequestOptions,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n GetLocationsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n QueryLocationsInitialRequest,\n QueryLocationsRequest,\n QueryLocationsResponse,\n StreamEntitiesRequest,\n ValidateEntityResponse,\n} from '@backstage/catalog-client';\nimport { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\n\n/**\n * @public\n */\nexport interface CatalogServiceRequestOptions {\n credentials: BackstageCredentials;\n}\n\n/**\n * A version of the {@link @backstage/catalog-client#CatalogApi | CatalogApi} that\n * requires backend credentials to be passed instead of a token.\n *\n * @public\n */\nexport interface CatalogService {\n getEntities(\n request: GetEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n queryEntities(\n request: QueryEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Entity | undefined>;\n\n removeEntityByUid(\n uid: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n refreshEntity(\n entityRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n getLocations(\n request: {} | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetLocationsResponse>;\n\n queryLocations(\n request: QueryLocationsRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryLocationsResponse>;\n\n streamLocations(\n request: QueryLocationsInitialRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Location[]>;\n\n getLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n getLocationByRef(\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n addLocation(\n location: AddLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AddLocationResponse>;\n\n removeLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n updateLocation(\n id: string,\n location: { type?: string; target: string },\n options: CatalogServiceRequestOptions,\n ): Promise<Location>;\n\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n validateEntity(\n entity: Entity,\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<ValidateEntityResponse>;\n\n analyzeLocation(\n location: AnalyzeLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AnalyzeLocationResponse>;\n\n streamEntities(\n request: StreamEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Entity[]>;\n}\n\nclass DefaultCatalogService implements CatalogService {\n readonly #auth: AuthService;\n readonly #catalogApi: CatalogApi;\n\n constructor({\n catalogApi,\n auth,\n }: {\n catalogApi: CatalogApi;\n auth: AuthService;\n }) {\n this.#catalogApi = catalogApi;\n this.#auth = auth;\n }\n\n async getEntities(\n request: GetEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesResponse> {\n return this.#catalogApi.getEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n return this.#catalogApi.getEntitiesByRefs(\n request,\n await this.#getOptions(options),\n );\n }\n\n async queryEntities(\n request: QueryEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n return this.#catalogApi.queryEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return this.#catalogApi.getEntityAncestors(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Entity | undefined> {\n return this.#catalogApi.getEntityByRef(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async removeEntityByUid(\n uid: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.removeEntityByUid(\n uid,\n await this.#getOptions(options),\n );\n }\n\n async refreshEntity(\n entityRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.refreshEntity(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n return this.#catalogApi.getEntityFacets(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getLocations(\n request: {} | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetLocationsResponse> {\n return this.#catalogApi.getLocations(\n request,\n await this.#getOptions(options),\n );\n }\n\n async queryLocations(\n request: QueryLocationsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryLocationsResponse> {\n return this.#catalogApi.queryLocations(\n request,\n await this.#getOptions(options),\n );\n }\n\n async *streamLocations(\n request: QueryLocationsInitialRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Location[]> {\n yield* this.#catalogApi.streamLocations(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationById(\n id,\n await this.#getOptions(options),\n );\n }\n\n async getLocationByRef(\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationByRef(\n locationRef,\n await this.#getOptions(options),\n );\n }\n\n async addLocation(\n location: AddLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AddLocationResponse> {\n return this.#catalogApi.addLocation(\n location,\n await this.#getOptions(options),\n );\n }\n\n async removeLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.removeLocationById(\n id,\n await this.#getOptions(options),\n );\n }\n\n async updateLocation(\n id: string,\n location: { type?: string; target: string },\n options: CatalogServiceRequestOptions,\n ): Promise<Location> {\n return this.#catalogApi.updateLocation(\n id,\n location,\n await this.#getOptions(options),\n );\n }\n\n async getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationByEntity(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<ValidateEntityResponse> {\n return this.#catalogApi.validateEntity(\n entity,\n locationRef,\n await this.#getOptions(options),\n );\n }\n\n async analyzeLocation(\n location: AnalyzeLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AnalyzeLocationResponse> {\n return this.#catalogApi.analyzeLocation(\n location,\n await this.#getOptions(options),\n );\n }\n\n async *streamEntities(\n request: StreamEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Entity[]> {\n yield* this.#catalogApi.streamEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async #getOptions(\n options: CatalogServiceRequestOptions,\n ): Promise<CatalogRequestOptions> {\n return this.#auth.getPluginRequestToken({\n onBehalfOf: options.credentials,\n targetPluginId: 'catalog',\n });\n }\n}\n\n/**\n * The catalogService provides the catalog API.\n *\n * @public\n */\nexport const catalogServiceRef = createServiceRef<CatalogService>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n auth: coreServices.auth,\n discoveryApi: coreServices.discovery,\n },\n async factory({ auth, discoveryApi }) {\n return new DefaultCatalogService({\n auth,\n catalogApi: new CatalogClient({ discoveryApi }),\n });\n },\n }),\n});\n"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient"],"mappings":";;;;;AA0KA,MAAM,qBAAA,CAAgD;AAAA,EAC3C,KAAA;AAAA,EACA,WAAA;AAAA,EAET,WAAA,CAAY;AAAA,IACV,UAAA;AAAA,IACA;AAAA,GACF,EAGG;AACD,IAAA,IAAA,CAAK,WAAA,GAAc,UAAA;AACnB,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAA;AAAA,EACf;AAAA,EAEA,MAAM,WAAA,CACJ,OAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,OAAO,KAAK,WAAA,CAAY,WAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAA,CAAK,WAAA,CAAY,OAAO;AAAA,KAChC;AAAA,EACF;AAAA,EAEA,MAAM,iBAAA,CACJ,OAAA,EACA,OAAA,EACoC;AACpC,IAAA,OAAO,KAAK,WAAA,CAAY,iBAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAA,CAAK,WAAA,CAAY,OAAO;AAAA,KAChC;AAAA,EACF;AAAA,EAEA,MAAM,aAAA,CACJ,OAAA,EACA,OAAA,EACgC;AAChC,IAAA,OAAO,KAAK,WAAA,CAAY,aAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAA,CAAK,WAAA,CAAY,OAAO;AAAA,KAChC;AAAA,EACF;AAAA,EAEA,MAAM,kBAAA,CACJ,OAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,KAAK,WAAA,CAAY,kBAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAA,CAAK,WAAA,CAAY,OAAO;AAAA,KAChC;AAAA,EACF;AAAA,EAEA,MAAM,cAAA,CACJ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["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AuthService,\n BackstageCredentials,\n coreServices,\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CatalogApi,\n CatalogClient,\n CatalogRequestOptions,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n GetLocationsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n QueryLocationsInitialRequest,\n QueryLocationsRequest,\n QueryLocationsResponse,\n StreamEntitiesRequest,\n ValidateEntityResponse,\n} from '@backstage/catalog-client';\nimport { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\n\n/**\n * @public\n */\nexport interface CatalogServiceRequestOptions {\n credentials: BackstageCredentials;\n}\n\n/**\n * A version of the {@link @backstage/catalog-client#CatalogApi | CatalogApi} that\n * requires backend credentials to be passed instead of a token.\n *\n * @public\n */\nexport interface CatalogService {\n getEntities(\n request: GetEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n queryEntities(\n request: QueryEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Entity | undefined>;\n\n removeEntityByUid(\n uid: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n refreshEntity(\n entityRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n getLocations(\n request: {} | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetLocationsResponse>;\n\n queryLocations(\n request: QueryLocationsRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryLocationsResponse>;\n\n streamLocations(\n request: QueryLocationsInitialRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Location[]>;\n\n getLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n getLocationByRef(\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n addLocation(\n location: AddLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AddLocationResponse>;\n\n removeLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n updateLocation(\n id: string,\n location: { type?: string; target: string },\n options: CatalogServiceRequestOptions,\n ): Promise<Location>;\n\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n validateEntity(\n entity: Entity,\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<ValidateEntityResponse>;\n\n analyzeLocation(\n location: AnalyzeLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AnalyzeLocationResponse>;\n\n streamEntities(\n request: StreamEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Entity[]>;\n}\n\nclass DefaultCatalogService implements CatalogService {\n readonly #auth: AuthService;\n readonly #catalogApi: CatalogApi;\n\n constructor({\n catalogApi,\n auth,\n }: {\n catalogApi: CatalogApi;\n auth: AuthService;\n }) {\n this.#catalogApi = catalogApi;\n this.#auth = auth;\n }\n\n async getEntities(\n request: GetEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesResponse> {\n return this.#catalogApi.getEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n return this.#catalogApi.getEntitiesByRefs(\n request,\n await this.#getOptions(options),\n );\n }\n\n async queryEntities(\n request: QueryEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n return this.#catalogApi.queryEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return this.#catalogApi.getEntityAncestors(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Entity | undefined> {\n return this.#catalogApi.getEntityByRef(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async removeEntityByUid(\n uid: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.removeEntityByUid(\n uid,\n await this.#getOptions(options),\n );\n }\n\n async refreshEntity(\n entityRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.refreshEntity(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n return this.#catalogApi.getEntityFacets(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getLocations(\n request: {} | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetLocationsResponse> {\n return this.#catalogApi.getLocations(\n request,\n await this.#getOptions(options),\n );\n }\n\n async queryLocations(\n request: QueryLocationsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryLocationsResponse> {\n return this.#catalogApi.queryLocations(\n request,\n await this.#getOptions(options),\n );\n }\n\n async *streamLocations(\n request: QueryLocationsInitialRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Location[]> {\n yield* this.#catalogApi.streamLocations(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationById(\n id,\n await this.#getOptions(options),\n );\n }\n\n async getLocationByRef(\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationByRef(\n locationRef,\n await this.#getOptions(options),\n );\n }\n\n async addLocation(\n location: AddLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AddLocationResponse> {\n return this.#catalogApi.addLocation(\n location,\n await this.#getOptions(options),\n );\n }\n\n async removeLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.removeLocationById(\n id,\n await this.#getOptions(options),\n );\n }\n\n async updateLocation(\n id: string,\n location: { type?: string; target: string },\n options: CatalogServiceRequestOptions,\n ): Promise<Location> {\n return this.#catalogApi.updateLocation(\n id,\n location,\n await this.#getOptions(options),\n );\n }\n\n async getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationByEntity(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<ValidateEntityResponse> {\n return this.#catalogApi.validateEntity(\n entity,\n locationRef,\n await this.#getOptions(options),\n );\n }\n\n async analyzeLocation(\n location: AnalyzeLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AnalyzeLocationResponse> {\n return this.#catalogApi.analyzeLocation(\n location,\n await this.#getOptions(options),\n );\n }\n\n async *streamEntities(\n request: StreamEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): AsyncIterable<Entity[]> {\n yield* this.#catalogApi.streamEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async #getOptions(\n options: CatalogServiceRequestOptions,\n ): Promise<CatalogRequestOptions> {\n return this.#auth.getPluginRequestToken({\n onBehalfOf: options.credentials,\n targetPluginId: 'catalog',\n });\n }\n}\n\n/**\n * The catalogService provides the catalog API.\n *\n * @public\n */\nexport const catalogServiceRef = createServiceRef<CatalogService>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n auth: coreServices.auth,\n discoveryApi: coreServices.discovery,\n },\n async factory({ auth, discoveryApi }) {\n return new DefaultCatalogService({\n auth,\n catalogApi: new CatalogClient({ discoveryApi }),\n });\n },\n }),\n});\n"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient"],"mappings":";;;;;AA0KA,MAAM,qBAAA,CAAgD;AAAA,EAC3C,KAAA;AAAA,EACA,WAAA;AAAA,EAET,WAAA,CAAY;AAAA,IACV,UAAA;AAAA,IACA;AAAA,GACF,EAGG;AACD,IAAA,IAAA,CAAK,WAAA,GAAc,UAAA;AACnB,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAA;AAAA,EACf;AAAA,EAEA,MAAM,WAAA,CACJ,OAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,OAAO,KAAK,WAAA,CAAY,WAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAA,CAAK,WAAA,CAAY,OAAO;AAAA,KAChC;AAAA,EACF;AAAA,EAEA,MAAM,iBAAA,CACJ,OAAA,EACA,OAAA,EACoC;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AoBA,iCAAA,CAAiC;AAAA,EAChE,EAAA,EAAI,gBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAA,CAAqB;AAAA,IACnB,OAAA;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,MAAMC,6BAAA,CAAa,IAAA;AAAA,MACnB,cAAcA,6BAAA,CAAa;AAAA,KAC7B;AAAA,IACA,MAAM,OAAA,CAAQ,EAAE,IAAA,EAAM,cAAa,EAAG;AACpC,MAAA,OAAO,IAAI,qBAAA,CAAsB;AAAA,QAC/B,IAAA;AAAA,QACA,UAAA,EAAY,IAAIC,2BAAA,CAAc,EAAE,cAAc;AAAA,OAC/C,CAAA;AAAA,IACH;AAAA,GACD;AACL,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"conversion.cjs.js","sources":["../src/conversion.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 Entity,\n LocationEntityV1alpha1,\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n stringifyEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { createHash } from 'node:crypto';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * A standard way of producing a machine generated name for a location.\n *\n * @public\n */\nexport function locationSpecToMetadataName(location: LocationSpec) {\n const hash = createHash('sha1')\n .update(`${location.type}:${location.target}`)\n .digest('hex');\n return `generated-${hash}`;\n}\n\n/**\n * A standard way of producing a machine generated Location kind entity for a\n * location.\n *\n * @public\n */\nexport function locationSpecToLocationEntity(opts: {\n location: LocationSpec;\n parentEntity?: Entity;\n}): LocationEntityV1alpha1 {\n const location = opts.location;\n const parentEntity = opts.parentEntity;\n\n let ownLocation: string;\n let originLocation: string;\n if (parentEntity) {\n const maybeOwnLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_LOCATION];\n if (!maybeOwnLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have a location annotation`,\n );\n }\n ownLocation = maybeOwnLocation;\n const maybeOriginLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_ORIGIN_LOCATION];\n if (!maybeOriginLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have an origin location annotation`,\n );\n }\n originLocation = maybeOriginLocation;\n } else {\n ownLocation = stringifyLocationRef(location);\n originLocation = ownLocation;\n }\n\n const result: LocationEntityV1alpha1 = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Location',\n metadata: {\n name: locationSpecToMetadataName(location),\n annotations: {\n [ANNOTATION_LOCATION]: ownLocation,\n [ANNOTATION_ORIGIN_LOCATION]: originLocation,\n },\n },\n spec: {\n type: location.type,\n target: location.target,\n presence: location.presence,\n },\n };\n\n return result;\n}\n"],"names":["createHash","ANNOTATION_LOCATION","stringifyEntityRef","stringifyLocationRef","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;AAgCO,SAAS,2BAA2B,QAAA,EAAwB;AACjE,EAAA,MAAM,IAAA,GAAOA,sBAAA,CAAW,MAAM,CAAA,CAC3B,OAAO,CAAA,EAAG,QAAA,CAAS,IAAI,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA,CAC5C,OAAO,KAAK,CAAA;AACf,EAAA,OAAO,aAAa,IAAI,CAAA,CAAA;AAC1B;AAQO,SAAS,6BAA6B,IAAA,EAGlB;AACzB,EAAA,MAAM,WAAW,IAAA,CAAK,QAA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ACf,QAAQ,QAAA,CAAS,MAAA;AAAA,MACjB,UAAU,QAAA,CAAS;AAAA;AACrB,GACF;AAEA,EAAA,OAAO,MAAA;AACT;;;;;"}
1
+ {"version":3,"file":"conversion.cjs.js","sources":["../src/conversion.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 Entity,\n LocationEntityV1alpha1,\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n stringifyEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { createHash } from 'node:crypto';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * A standard way of producing a machine generated name for a location.\n *\n * @public\n */\nexport function locationSpecToMetadataName(location: LocationSpec) {\n const hash = createHash('sha1')\n .update(`${location.type}:${location.target}`)\n .digest('hex');\n return `generated-${hash}`;\n}\n\n/**\n * A standard way of producing a machine generated Location kind entity for a\n * location.\n *\n * @public\n */\nexport function locationSpecToLocationEntity(opts: {\n location: LocationSpec;\n parentEntity?: Entity;\n}): LocationEntityV1alpha1 {\n const location = opts.location;\n const parentEntity = opts.parentEntity;\n\n let ownLocation: string;\n let originLocation: string;\n if (parentEntity) {\n const maybeOwnLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_LOCATION];\n if (!maybeOwnLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have a location annotation`,\n );\n }\n ownLocation = maybeOwnLocation;\n const maybeOriginLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_ORIGIN_LOCATION];\n if (!maybeOriginLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have an origin location annotation`,\n );\n }\n originLocation = maybeOriginLocation;\n } else {\n ownLocation = stringifyLocationRef(location);\n originLocation = ownLocation;\n }\n\n const result: LocationEntityV1alpha1 = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Location',\n metadata: {\n name: locationSpecToMetadataName(location),\n annotations: {\n [ANNOTATION_LOCATION]: ownLocation,\n [ANNOTATION_ORIGIN_LOCATION]: originLocation,\n },\n },\n spec: {\n type: location.type,\n target: location.target,\n presence: location.presence,\n },\n };\n\n return result;\n}\n"],"names":["createHash","ANNOTATION_LOCATION","stringifyEntityRef","stringifyLocationRef","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;AAgCO,SAAS,2BAA2B,QAAA,EAAwB;AACjE,EAAA,MAAM,IAAA,GAAOA,sBAAA,CAAW,MAAM,CAAA,CAC3B,OAAO,CAAA,EAAG,QAAA,CAAS,IAAI,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA,CAC5C,OAAO,KAAK,CAAA;AACf,EAAA,OAAO,aAAa,IAAI,CAAA,CAAA;AAC1B;AAQO,SAAS,6BAA6B,IAAA,EAGlB;AACzB,EAAA,MAAM,WAAW,IAAA,CAAK,QAAA;AACtB,EAAA,MAAM,eAAe,IAAA,CAAK,YAAA;AAE1B,EAAA,IAAI,WAAA;AACJ,EAAA,IAAI,cAAA;AACJ,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,gBAAA,GACJ,YAAA,CAAa,QAAA,CAAS,WAAA,GAAcC,gCAAmB,CAAA;AACzD,IAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,eAAA,EAAkBC,+BAAA;AAAA,UAChB;AAAA,SACD,CAAA,eAAA,EAAkBC,iCAAA;AAAA,UACjB;AAAA,SACD,CAAA,qCAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,WAAA,GAAc,gBAAA;AACd,IAAA,MAAM,mBAAA,GACJ,YAAA,CAAa,QAAA,CAAS,WAAA,GAAcC,uCAA0B,CAAA;AAChE,IAAA,IAAI,CAAC,mBAAA,EAAqB;AACxB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,eAAA,EAAkBF,+BAAA;AAAA,UAChB;AAAA,SACD,CAAA,eAAA,EAAkBC,iCAAA;AAAA,UACjB;AAAA,SACD,CAAA,6CAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,cAAA,GAAiB,mBAAA;AAAA,EACnB,CAAA,MAAO;AACL,IAAA,WAAA,GAAcA,kCAAqB,QAAQ,CAAA;AAC3C,IAAA,cAAA,GAAiB,WAAA;AAAA,EACnB;AAEA,EAAA,MAAM,MAAA,GAAiC;AAAA,IACrC,UAAA,EAAY,uBAAA;AAAA,IACZ,IAAA,EAAM,UAAA;AAAA,IACN,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,2BAA2B,QAAQ,CAAA;AAAA,MACzC,WAAA,EAAa;AAAA,QACX,CAACF,gCAAmB,GAAG,WAAA;AAAA,QACvB,CAACG,uCAA0B,GAAG;AAAA;AAChC,KACF;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,MAAM,QAAA,CAAS,IAAA;AAAA,MACf,QAAQ,QAAA,CAAS,MAAA;AAAA,MACjB,UAAU,QAAA,CAAS;AAAA;AACrB,GACF;AAEA,EAAA,OAAO,MAAA;AACT;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.cjs.js","sources":["../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { Entity, Validators } from '@backstage/catalog-model';\nimport { CatalogModelSource } from '@backstage/catalog-model/alpha';\nimport type {\n CatalogProcessor,\n CatalogProcessorParser,\n EntityProvider,\n LocationAnalyzer,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\n\n/**\n * @public\n */\nexport interface CatalogLocationsExtensionPoint {\n /**\n * Allows setting custom location types, such as showcased in: https://backstage.io/docs/features/software-catalog/external-integrations/#creating-a-catalog-data-reader-processor\n * @param locationTypes - List of location types to allow, default is \"url\" and \"file\"\n */\n setAllowedLocationTypes(locationTypes: Array<string>): void;\n}\n\n/**\n * @public\n */\nexport const catalogLocationsExtensionPoint =\n createExtensionPoint<CatalogLocationsExtensionPoint>({\n id: 'catalog.locations',\n });\n\n/**\n * @public\n */\nexport interface CatalogProcessingExtensionPoint {\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * This function also can replace a Default processor if the provided processor\n * matches the processor name.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;\n\n setOnProcessingErrorHandler(\n handler: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void,\n ): void;\n}\n\n/** @alpha */\nexport interface CatalogModelExtensionPoint {\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldValidators(validators: Partial<Validators>): void;\n\n /**\n * Sets the entity data parser which is used to read raw data from locations.\n *\n * @param parser - Parser which will used to extract entities from raw data\n */\n setEntityDataParser(parser: CatalogProcessorParser): void;\n\n /**\n * Adds a catalog model source to be part of the compiled entity model.\n *\n * @param source - The model source to add\n */\n addModelSource(source: CatalogModelSource): void;\n}\n\n/**\n * @public\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n\n/**\n * @public\n */\nexport interface CatalogAnalysisExtensionPoint {\n /**\n * Replaces the entire location analyzer with a new one.\n *\n * @remarks\n *\n * By providing a factory function you can access all the SCM analyzers that\n * have been added through `addScmLocationAnalyzer`. If you provide a\n * `LocationAnalyzer` directly, the SCM analyzers will be ignored.\n */\n setLocationAnalyzer(\n analyzerOrFactory:\n | LocationAnalyzer\n | ((options: {\n scmLocationAnalyzers: ScmLocationAnalyzer[];\n }) => Promise<{ locationAnalyzer: LocationAnalyzer }>),\n ): void;\n\n /**\n * Adds an analyzer for a specific SCM type to the default location analyzer.\n */\n addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer): void;\n}\n\n/**\n * @public\n */\nexport const catalogAnalysisExtensionPoint =\n createExtensionPoint<CatalogAnalysisExtensionPoint>({\n id: 'catalog.analysis',\n });\n\n/** @alpha */\nexport const catalogModelExtensionPoint =\n createExtensionPoint<CatalogModelExtensionPoint>({\n id: 'catalog.model',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AA0CO,MAAM,iCACXA,qCAAA,CAAqD;AAAA,EACnD,EAAA,EAAI;AACN,CAAC;AA8EI,MAAM,kCACXA,qCAAA,CAAsD;AAAA,EACpD,EAAA,EAAI;AACN,CAAC;AAgCI,MAAM,gCACXA,qCAAA,CAAoD;AAAA,EAClD,EAAA,EAAI;AACN,CAAC;AAGI,MAAM,6BACXA,qCAAA,CAAiD;AAAA,EAC/C,EAAA,EAAI;AACN,CAAC;;;;;;;"}
1
+ {"version":3,"file":"extensions.cjs.js","sources":["../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { Entity, Validators } from '@backstage/catalog-model';\nimport { CatalogModelSource } from '@backstage/catalog-model/alpha';\nimport type {\n CatalogProcessor,\n CatalogProcessorParser,\n EntityProvider,\n LocationAnalyzer,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\n\n/**\n * @public\n */\nexport interface CatalogLocationsExtensionPoint {\n /**\n * Allows setting custom location types, such as showcased in: https://backstage.io/docs/features/software-catalog/external-integrations/#creating-a-catalog-data-reader-processor\n * @param locationTypes - List of location types to allow, default is \"url\" and \"file\"\n */\n setAllowedLocationTypes(locationTypes: Array<string>): void;\n}\n\n/**\n * @public\n */\nexport const catalogLocationsExtensionPoint =\n createExtensionPoint<CatalogLocationsExtensionPoint>({\n id: 'catalog.locations',\n });\n\n/**\n * @public\n */\nexport interface CatalogProcessingExtensionPoint {\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * This function also can replace a Default processor if the provided processor\n * matches the processor name.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;\n\n setOnProcessingErrorHandler(\n handler: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void,\n ): void;\n}\n\n/** @alpha */\nexport interface CatalogModelExtensionPoint {\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldValidators(validators: Partial<Validators>): void;\n\n /**\n * Sets the entity data parser which is used to read raw data from locations.\n *\n * @param parser - Parser which will used to extract entities from raw data\n */\n setEntityDataParser(parser: CatalogProcessorParser): void;\n\n /**\n * Adds a catalog model source to be part of the compiled entity model.\n *\n * @param source - The model source to add\n */\n addModelSource(source: CatalogModelSource): void;\n}\n\n/**\n * @public\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n\n/**\n * @public\n */\nexport interface CatalogAnalysisExtensionPoint {\n /**\n * Replaces the entire location analyzer with a new one.\n *\n * @remarks\n *\n * By providing a factory function you can access all the SCM analyzers that\n * have been added through `addScmLocationAnalyzer`. If you provide a\n * `LocationAnalyzer` directly, the SCM analyzers will be ignored.\n */\n setLocationAnalyzer(\n analyzerOrFactory:\n | LocationAnalyzer\n | ((options: {\n scmLocationAnalyzers: ScmLocationAnalyzer[];\n }) => Promise<{ locationAnalyzer: LocationAnalyzer }>),\n ): void;\n\n /**\n * Adds an analyzer for a specific SCM type to the default location analyzer.\n */\n addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer): void;\n}\n\n/**\n * @public\n */\nexport const catalogAnalysisExtensionPoint =\n createExtensionPoint<CatalogAnalysisExtensionPoint>({\n id: 'catalog.analysis',\n });\n\n/** @alpha */\nexport const catalogModelExtensionPoint =\n createExtensionPoint<CatalogModelExtensionPoint>({\n id: 'catalog.model',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AA0CO,MAAM,iCACXA,qCAAA,CAAqD;AAAA,EACnD,EAAA,EAAI;AACN,CAAC;AA8EI,MAAM,kCACXA,qCAAA,CAAsD;AAAA,EACpD,EAAA,EAAI;AACN,CAAC;AAgCI,MAAM,gCACXA,qCAAA,CAAoD;AAAA,EAClD,EAAA,EAAI;AACN,CAAC;AAGI,MAAM,6BACXA,qCAAA,CAAiD;AAAA,EAC/C,EAAA,EAAI;AACN,CAAC;;;;;"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { LocationSpec as LocationSpec$1, AnalyzeLocationRequest, AnalyzeLocation
4
4
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
5
5
  import { BackstageCredentials } from '@backstage/backend-plugin-api';
6
6
  import { GetEntitiesRequest, GetEntitiesResponse, GetEntitiesByRefsRequest, GetEntitiesByRefsResponse, QueryEntitiesRequest, QueryEntitiesResponse, GetEntityAncestorsRequest, GetEntityAncestorsResponse, GetEntityFacetsRequest, GetEntityFacetsResponse, GetLocationsResponse, QueryLocationsRequest, QueryLocationsResponse, QueryLocationsInitialRequest, Location, AddLocationRequest, AddLocationResponse, ValidateEntityResponse, StreamEntitiesRequest } from '@backstage/catalog-client';
7
- export { C as CatalogAnalysisExtensionPoint, a as CatalogLocationsExtensionPoint, c as CatalogProcessingExtensionPoint, d as catalogAnalysisExtensionPoint, e as catalogLocationsExtensionPoint, g as catalogProcessingExtensionPoint } from './types/extensions.d-B2z19h7d.js';
7
+ export { a as CatalogAnalysisExtensionPoint, b as CatalogLocationsExtensionPoint, d as CatalogProcessingExtensionPoint, e as catalogAnalysisExtensionPoint, f as catalogLocationsExtensionPoint, g as catalogProcessingExtensionPoint } from './types/extensions.d-DwAgFule.js';
8
8
  import '@backstage/catalog-model/alpha';
9
9
  import '@backstage/plugin-catalog-node';
10
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"parse.cjs.js","sources":["../../src/processing/parse.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { Entity, stringifyLocationRef } from '@backstage/catalog-model';\nimport lodash from 'lodash';\nimport yaml from 'yaml';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\nimport { CatalogProcessorResult } from '../api/processor';\nimport { processingResult } from '../api/processingResult';\n\n/**\n * Options for parsing entity YAML files.\n *\n * @public\n */\nexport interface ParseEntityYamlOptions {\n enableYamlMerge?: boolean;\n}\n\n/**\n * A helper function that parses a YAML file, properly handling multiple\n * documents in a single file.\n *\n * @public\n * @remarks\n *\n * Each document is expected to be a valid Backstage entity. Each item in the\n * iterable is in the form of an entity result if the document seemed like a\n * valid object, or in the form of an error result if it seemed incorrect. This\n * way, you can choose to retain a partial result if you want.\n *\n * Note that this function does NOT perform any validation of the entities. No\n * assumptions whatsoever can be made on the emnitted entities except that they\n * are valid JSON objects.\n */\nexport function* parseEntityYaml(\n data: string | Buffer,\n location: LocationSpec,\n options?: ParseEntityYamlOptions,\n): Iterable<CatalogProcessorResult> {\n const parseOptions = { merge: options?.enableYamlMerge ?? false };\n\n let documents: yaml.Document.Parsed[];\n try {\n documents = yaml\n .parseAllDocuments(\n typeof data === 'string' ? data : data.toString('utf8'),\n parseOptions,\n )\n .filter(d => d);\n } catch (e) {\n const loc = stringifyLocationRef(location);\n const message = `Failed to parse YAML at ${loc}, ${e}`;\n yield processingResult.generalError(location, message);\n return;\n }\n\n for (const document of documents) {\n if (document.errors?.length) {\n const loc = stringifyLocationRef(location);\n const message = `YAML error at ${loc}, ${document.errors[0]}`;\n yield processingResult.generalError(location, message);\n } else {\n const json = document.toJSON();\n if (lodash.isPlainObject(json)) {\n yield processingResult.entity(location, json as Entity);\n } else if (json === null) {\n // Ignore null values, these happen if there is an empty document in the\n // YAML file, for example if --- is added to the end of the file.\n } else {\n const message = `Expected object at root, got ${typeof json}`;\n yield processingResult.generalError(location, message);\n }\n }\n }\n}\n"],"names":["yaml","stringifyLocationRef","processingResult","lodash"],"mappings":";;;;;;;;;;;;AAgDO,UAAU,eAAA,CACf,IAAA,EACA,QAAA,EACA,OAAA,EACkC;AAClC,EAAA,MAAM,YAAA,GAAe,EAAE,KAAA,EAAO,OAAA,EAAS,mBAAmB,KAAA,EAAM;AAEhE,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI;AACF,IAAA,SAAA,GAAYA,qBAAA,CACT,iBAAA;AAAA,MACC,OAAO,IAAA,KAAS,QAAA,GAAW,IAAA,GAAO,IAAA,CAAK,SAAS,MAAM,CAAA;AAAA,MACtD;AAAA,KACF,CACC,MAAA,CAAO,CAAA,CAAA,KAAK,CAAC,CAAA;AAAA,EAClB,SAAS,CAAA,EAAG;AACV,IAAA,MAAM,GAAA,GAAMC,kCAAqB,QAAQ,CAAA;AACzC,IAAA,MAAM,OAAA,GAAU,CAAA,wBAAA,EAA2B,GAAG,CAAA,EAAA,EAAK,CAAC,CAAA,CAAA;AACpD,IAAA,MAAMC,iCAAA,CAAiB,YAAA,CAAa,QAAA,EAAU,OAAO,CAAA;AACrD,IAAA;AAAA,EACF;AAEA,EAAA,KAAA,MAAW,YAAY,SAAA,EAAW;AAChC,IAAA,IAAI,QAAA,CAAS,QAAQ,MAAA,EAAQ;AAC3B,MAAA,MAAM,GAAA,GAAMD,kCAAqB,QAAQ,CAAA;AACzC,MAAA,MAAM,UAAU,CAAA,cAAA,EAAiB,GAAG,KAAK,QAAA,CAAS,MAAA,CAAO,CAAC,CAAC,CAAA,CAAA;AAC3D,MAAA,MAAMC,iCAAA,CAAiB,YAAA,CAAa,QAAA,EAAU,OAAO,CAAA;AAAA,IACvD,CAAA,MAAO;AACL,MAAA,MAAM,IAAA,GAAO,SAAS,MAAA,EAAO;AAC7B,MAAA,IAAIC,uBAAA,CAAO,aAAA,CAAc,IAAI,CAAA,EAAG;AAC9B,QAAA,MAAMD,iCAAA,CAAiB,MAAA,CAAO,QAAA,EAAU,IAAc,CAAA;AAAA,MACxD,CAAA,MAAA,IAAW,SAAS,IAAA,EAAM,CAG1B,MAAO;AACL,QAAA,MAAM,OAAA,GAAU,CAAA,6BAAA,EAAgC,OAAO,IAAI,CAAA,CAAA;AAC3D,QAAA,MAAMA,iCAAA,CAAiB,YAAA,CAAa,QAAA,EAAU,OAAO,CAAA;AAAA,MACvD;AAAA,IACF;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"parse.cjs.js","sources":["../../src/processing/parse.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { Entity, stringifyLocationRef } from '@backstage/catalog-model';\nimport lodash from 'lodash';\nimport yaml from 'yaml';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\nimport { CatalogProcessorResult } from '../api/processor';\nimport { processingResult } from '../api/processingResult';\n\n/**\n * Options for parsing entity YAML files.\n *\n * @public\n */\nexport interface ParseEntityYamlOptions {\n enableYamlMerge?: boolean;\n}\n\n/**\n * A helper function that parses a YAML file, properly handling multiple\n * documents in a single file.\n *\n * @public\n * @remarks\n *\n * Each document is expected to be a valid Backstage entity. Each item in the\n * iterable is in the form of an entity result if the document seemed like a\n * valid object, or in the form of an error result if it seemed incorrect. This\n * way, you can choose to retain a partial result if you want.\n *\n * Note that this function does NOT perform any validation of the entities. No\n * assumptions whatsoever can be made on the emnitted entities except that they\n * are valid JSON objects.\n */\nexport function* parseEntityYaml(\n data: string | Buffer,\n location: LocationSpec,\n options?: ParseEntityYamlOptions,\n): Iterable<CatalogProcessorResult> {\n const parseOptions = { merge: options?.enableYamlMerge ?? false };\n\n let documents: yaml.Document.Parsed[];\n try {\n documents = yaml\n .parseAllDocuments(\n typeof data === 'string' ? data : data.toString('utf8'),\n parseOptions,\n )\n .filter(d => d);\n } catch (e) {\n const loc = stringifyLocationRef(location);\n const message = `Failed to parse YAML at ${loc}, ${e}`;\n yield processingResult.generalError(location, message);\n return;\n }\n\n for (const document of documents) {\n if (document.errors?.length) {\n const loc = stringifyLocationRef(location);\n const message = `YAML error at ${loc}, ${document.errors[0]}`;\n yield processingResult.generalError(location, message);\n } else {\n const json = document.toJSON();\n if (lodash.isPlainObject(json)) {\n yield processingResult.entity(location, json as Entity);\n } else if (json === null) {\n // Ignore null values, these happen if there is an empty document in the\n // YAML file, for example if --- is added to the end of the file.\n } else {\n const message = `Expected object at root, got ${typeof json}`;\n yield processingResult.generalError(location, message);\n }\n }\n }\n}\n"],"names":["yaml","stringifyLocationRef","processingResult","lodash"],"mappings":";;;;;;;;;;;;AAgDO,UAAU,eAAA,CACf,IAAA,EACA,QAAA,EACA,OAAA,EACkC;AAClC,EAAA,MAAM,YAAA,GAAe,EAAE,KAAA,EAAO,OAA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YAAA,CAAa,QAAA,EAAU,OAAO,CAAA;AAAA,MACvD;AAAA,IACF;AAAA,EACF;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"provideStaticCatalogModel.cjs.js","sources":["../src/provideStaticCatalogModel.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { createBackendModule } from '@backstage/backend-plugin-api';\nimport {\n CatalogModelLayer,\n CatalogModelSources,\n} from '@backstage/catalog-model/alpha';\nimport { catalogModelExtensionPoint } from './extensions';\n\n/**\n * Creates a backend module that registers static catalog model layers.\n *\n * @alpha\n * @remarks\n *\n * This is a convenience function for registering catalog model layers\n * without having to manually create a backend module and interact with\n * the catalog model extension point. The built-in default catalog entity\n * model is always included automatically.\n *\n * @example\n * ```ts\n * backend.add(\n * provideStaticCatalogModel({\n * layers: [scaffolderCatalogModelLayer],\n * }),\n * );\n * ```\n */\nexport function provideStaticCatalogModel(options?: {\n layers?: CatalogModelLayer[];\n}) {\n return createBackendModule({\n pluginId: 'catalog',\n moduleId: 'static-catalog-model',\n register(reg) {\n reg.registerInit({\n deps: {\n model: catalogModelExtensionPoint,\n },\n async init({ model }) {\n model.addModelSource(\n CatalogModelSources.static(options?.layers ?? []),\n );\n },\n });\n },\n });\n}\n"],"names":["createBackendModule","catalogModelExtensionPoint","CatalogModelSources"],"mappings":";;;;;;AA2CO,SAAS,0BAA0B,OAAA,EAEvC;AACD,EAAA,OAAOA,oCAAA,CAAoB;AAAA,IACzB,QAAA,EAAU,SAAA;AAAA,IACV,QAAA,EAAU,sBAAA;AAAA,IACV,SAAS,GAAA,EAAK;AACZ,MAAA,GAAA,CAAI,YAAA,CAAa;AAAA,QACf,IAAA,EAAM;AAAA,UACJ,KAAA,EAAOC;AAAA,SACT;AAAA,QACA,MAAM,IAAA,CAAK,EAAE,KAAA,EAAM,EAAG;AACpB,UAAA,KAAA,CAAM,cAAA;AAAA,YACJC,yBAAA,CAAoB,MAAA,CAAO,OAAA,EAAS,MAAA,IAAU,EAAE;AAAA,WAClD;AAAA,QACF;AAAA,OACD,CAAA;AAAA,IACH;AAAA,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"provideStaticCatalogModel.cjs.js","sources":["../src/provideStaticCatalogModel.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { createBackendModule } from '@backstage/backend-plugin-api';\nimport {\n CatalogModelLayer,\n CatalogModelSources,\n} from '@backstage/catalog-model/alpha';\nimport { catalogModelExtensionPoint } from './extensions';\n\n/**\n * Creates a backend module that registers static catalog model layers.\n *\n * @alpha\n * @remarks\n *\n * This is a convenience function for registering catalog model layers\n * without having to manually create a backend module and interact with\n * the catalog model extension point. The built-in default catalog entity\n * model is always included automatically.\n *\n * @example\n * ```ts\n * backend.add(\n * provideStaticCatalogModel({\n * layers: [scaffolderCatalogModelLayer],\n * }),\n * );\n * ```\n */\nexport function provideStaticCatalogModel(options?: {\n layers?: CatalogModelLayer[];\n}) {\n return createBackendModule({\n pluginId: 'catalog',\n moduleId: 'static-catalog-model',\n register(reg) {\n reg.registerInit({\n deps: {\n model: catalogModelExtensionPoint,\n },\n async init({ model }) {\n model.addModelSource(\n CatalogModelSources.static(options?.layers ?? []),\n );\n },\n });\n },\n });\n}\n"],"names":["createBackendModule","catalogModelExtensionPoint","CatalogModelSources"],"mappings":";;;;;;AA2CO,SAAS,0BAA0B,OAAA,EAEvC;AACD,EAAA,OAAOA,oCAAA,CAAoB;AAAA,IACzB,QAAA,EAAU,SAAA;AAAA,IACV,QAAA,EAAU,sBAAA;AAAA,IACV,SAAS,GAAA,EAAK;AACZ,MAAA,GAAA,CAAI,YAAA,CAAa;AAAA,QACf,IAAA,EAAM;AAAA,UACJ,KAAA,EAAOC;AAAA,SACT;AAAA,QACA,MAAM,IAAA,CAAK,EAAE,KAAA,EAAM,EAAG;AACpB,UAAA,KAAA,CAAM,cAAA;AAAA,YACJC,yBAAA,CAAoB,MAAA,CAAO,OAAA,EAAS,MAAA,IAAU,EAAE;AAAA,WAClD;AAAA,QACF;AAAA,OACD,CAAA;AAAA,IACH;AAAA,GACD,CAAA;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultCatalogScmEventsService.cjs.js","sources":["../../src/scmEvents/DefaultCatalogScmEventsService.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { Counter, MetricsAPI } from '@opentelemetry/api';\nimport {\n CatalogScmEvent,\n CatalogScmEventsService,\n CatalogScmEventsServiceSubscriber,\n} from './types';\n\n/**\n * The default implementation of the\n * {@link CatalogScmEventsService}/{@link catalogScmEventsServiceRef}.\n *\n * @internal\n * @remarks\n *\n * This implementation is in-memory, which requires the producers and consumer\n * (the catalog backend) to be deployed together.\n *\n * It's defined in here instead of in the catalog-backend plugin because this\n * allows us to have a default factory whether you happen to be co-installed\n * with the catalog-backend plugin or not.\n */\nexport class DefaultCatalogScmEventsService implements CatalogScmEventsService {\n readonly #subscribers: Set<CatalogScmEventsServiceSubscriber>;\n readonly #metrics: {\n actions: Counter<{ action: string }>;\n };\n\n constructor(metrics: MetricsAPI) {\n this.#subscribers = new Set();\n\n const meter = metrics.getMeter('default');\n this.#metrics = {\n actions: meter.createCounter('catalog.events.scm.actions', {\n description:\n 'Number of actions taken as a result of SCM event messages',\n unit: 'short',\n }),\n };\n }\n\n subscribe(subscriber: CatalogScmEventsServiceSubscriber): {\n unsubscribe: () => void;\n } {\n this.#subscribers.add(subscriber);\n return {\n unsubscribe: () => {\n this.#subscribers.delete(subscriber);\n },\n };\n }\n\n async publish(events: CatalogScmEvent[]): Promise<void> {\n await Promise.all(\n Array.from(this.#subscribers).map(async subscriber => {\n try {\n await subscriber.onEvents(events);\n } catch (error) {\n // The subscribers are expected to handle errors themselves.\n }\n }),\n );\n }\n\n markEventActionTaken(options: { count?: number; action: string }): void {\n this.#metrics.actions.add(options.count ?? 1, { action: options.action });\n }\n}\n"],"names":[],"mappings":";;AAqCO,MAAM,8BAAA,CAAkE;AAAA,EACpE,YAAA;AAAA,EACA,QAAA;AAAA,EAIT,YAAY,OAAA,EAAqB;AAC/B,IAAA,IAAA,CAAK,YAAA,uBAAmB,GAAA,EAAI;AAE5B,IAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,QAAA,CAAS,SAAS,CAAA;AACxC,IAAA,IAAA,CAAK,QAAA,GAAW;AAAA,MACd,OAAA,EAAS,KAAA,CAAM,aAAA,CAAc,4BAAA,EAA8B;AAAA,QACzD,WAAA,EACE,2DAAA;AAAA,QACF,IAAA,EAAM;AAAA,OACP;AAAA,KACH;AAAA,EACF;AAAA,EAEA,UAAU,UAAA,EAER;AACA,IAAA,IAAA,CAAK,YAAA,CAAa,IAAI,UAAU,CAAA;AAChC,IAAA,OAAO;AAAA,MACL,aAAa,MAAM;AACjB,QAAA,IAAA,CAAK,YAAA,CAAa,OAAO,UAAU,CAAA;AAAA,MACrC;AAAA,KACF;AAAA,EACF;AAAA,EAEA,MAAM,QAAQ,MAAA,EAA0C;AACtD,IAAA,MAAM,OAAA,CAAQ,GAAA;AAAA,MACZ,MAAM,IAAA,CAAK,IAAA,CAAK,YAAY,CAAA,CAAE,GAAA,CAAI,OAAM,UAAA,KAAc;AACpD,QAAA,IAAI;AACF,UAAA,MAAM,UAAA,CAAW,SAAS,MAAM,CAAA;AAAA,QAClC,SAAS,KAAA,EAAO;AAAA,QAEhB;AAAA,MACF,CAAC;AAAA,KACH;AAAA,EACF;AAAA,EAEA,qBAAqB,OAAA,EAAmD;AACtE,IAAA,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,OAAA,CAAQ,KAAA,IAAS,GAAG,EAAE,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,CAAA;AAAA,EAC1E;AACF;;;;"}
1
+ {"version":3,"file":"DefaultCatalogScmEventsService.cjs.js","sources":["../../src/scmEvents/DefaultCatalogScmEventsService.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { Counter, MetricsAPI } from '@opentelemetry/api';\nimport {\n CatalogScmEvent,\n CatalogScmEventsService,\n CatalogScmEventsServiceSubscriber,\n} from './types';\n\n/**\n * The default implementation of the\n * {@link CatalogScmEventsService}/{@link catalogScmEventsServiceRef}.\n *\n * @internal\n * @remarks\n *\n * This implementation is in-memory, which requires the producers and consumer\n * (the catalog backend) to be deployed together.\n *\n * It's defined in here instead of in the catalog-backend plugin because this\n * allows us to have a default factory whether you happen to be co-installed\n * with the catalog-backend plugin or not.\n */\nexport class DefaultCatalogScmEventsService implements CatalogScmEventsService {\n readonly #subscribers: Set<CatalogScmEventsServiceSubscriber>;\n readonly #metrics: {\n actions: Counter<{ action: string }>;\n };\n\n constructor(metrics: MetricsAPI) {\n this.#subscribers = new Set();\n\n const meter = metrics.getMeter('default');\n this.#metrics = {\n actions: meter.createCounter('catalog.events.scm.actions', {\n description:\n 'Number of actions taken as a result of SCM event messages',\n unit: 'short',\n }),\n };\n }\n\n subscribe(subscriber: CatalogScmEventsServiceSubscriber): {\n unsubscribe: () => void;\n } {\n this.#subscribers.add(subscriber);\n return {\n unsubscribe: () => {\n this.#subscribers.delete(subscriber);\n },\n };\n }\n\n async publish(events: CatalogScmEvent[]): Promise<void> {\n await Promise.all(\n Array.from(this.#subscribers).map(async subscriber => {\n try {\n await subscriber.onEvents(events);\n } catch (error) {\n // The subscribers are expected to handle errors themselves.\n }\n }),\n );\n }\n\n markEventActionTaken(options: { count?: number; action: string }): void {\n this.#metrics.actions.add(options.count ?? 1, { action: options.action });\n }\n}\n"],"names":[],"mappings":";;AAqCO,MAAM,8BAAA,CAAkE;AAAA,EACpE,YAAA;AAAA,EACA,QAAA;AAAA,EAIT,YAAY,OAAA,EAAqB;AAC/B,IAAA,IAAA,CAAK,YAAA,uBAAmB,GAAA,EAAI;AAE5B,IAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,QAAA,CAAS,SAAS,CAAA;AACxC,IAAA,IAAA,CAAK,QAAA,GAAW;AAAA,MACd,OAAA,EAAS,KAAA,CAAM,aAAA,CAAc,4BAAA,EAA8B;AAAA,QACzD,WAAA,EACE,2DAAA;AAAA,QACF,IAAA,EAAM;AAAA,OACP;AAAA,KACH;AAAA,EACF;AAAA,EAEA,UAAU,UAAA,EAER;AACA,IAAA,IAAA,CAAK,YAAA,CAAa,IAAI,UAAU,CAAA;AAChC,IAAA,OAAO;AAAA,MACL,aAAa,MAAM;AACjB,QAAA,IAAA,CAAK,YAAA,CAAa,OAAO,UAAU,CAAA;AAAA,MACrC;AAAA,KACF;AAAA,EACF;AAAA,EAEA,MAAM,QAAQ,MAAA,EAA0C;AACtD,IAAA,MAAM,OAAA,CAAQ,GAAA;AAAA,MACZ,MAAM,IAAA,CAAK,IAAA,CAAK,YAAY,CAAA,CAAE,GAAA,CAAI,OAAM,UAAA,KAAc;AACpD,QAAA,IAAI;AACF,UAAA,MAAM,UAAA,CAAW,SAAS,MAAM,CAAA;AAAA,QAClC,SAAS,KAAA,EAAO;AAAA,QAEhB;AAAA,MACF,CAAC;AAAA,KACH;AAAA,EACF;AAAA,EAEA,qBAAqB,OAAA,EAAmD;AACtE,IAAA,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,OAAA,CAAQ,KAAA,IAAS,GAAG,EAAE,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,CAAA;AAAA,EAC1E;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalogScmEventsServiceRef.cjs.js","sources":["../../src/scmEvents/catalogScmEventsServiceRef.ts"],"sourcesContent":["/*\n * Copyright 2025 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 createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { metrics } from '@opentelemetry/api';\nimport { CatalogScmEventsService } from './types';\nimport { DefaultCatalogScmEventsService } from './DefaultCatalogScmEventsService';\n\n/**\n * A service that allows publishing and subscribing to source control management\n * system events.\n *\n * @alpha\n * @remarks\n *\n * The default implementation of this service acts in-memory, which requires the\n * producers and consumer (the catalog backend) to be deployed together.\n */\nexport const catalogScmEventsServiceRef =\n createServiceRef<CatalogScmEventsService>({\n id: 'catalog.scm-events.alpha',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {},\n createRootContext() {\n return new DefaultCatalogScmEventsService(metrics);\n },\n factory(_, ctx) {\n return ctx;\n },\n }),\n });\n"],"names":["createServiceRef","createServiceFactory","DefaultCatalogScmEventsService","metrics"],"mappings":";;;;;;AAkCO,MAAM,6BACXA,iCAAA,CAA0C;AAAA,EACxC,EAAA,EAAI,0BAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAA,CAAqB;AAAA,IACnB,OAAA;AAAA,IACA,MAAM,EAAC;AAAA,IACP,iBAAA,GAAoB;AAClB,MAAA,OAAO,IAAIC,8DAA+BC,WAAO,CAAA;AAAA,IACnD,CAAA;AAAA,IACA,OAAA,CAAQ,GAAG,GAAA,EAAK;AACd,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACD;AACL,CAAC;;;;"}
1
+ {"version":3,"file":"catalogScmEventsServiceRef.cjs.js","sources":["../../src/scmEvents/catalogScmEventsServiceRef.ts"],"sourcesContent":["/*\n * Copyright 2025 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 createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { metrics } from '@opentelemetry/api';\nimport { CatalogScmEventsService } from './types';\nimport { DefaultCatalogScmEventsService } from './DefaultCatalogScmEventsService';\n\n/**\n * A service that allows publishing and subscribing to source control management\n * system events.\n *\n * @alpha\n * @remarks\n *\n * The default implementation of this service acts in-memory, which requires the\n * producers and consumer (the catalog backend) to be deployed together.\n */\nexport const catalogScmEventsServiceRef =\n createServiceRef<CatalogScmEventsService>({\n id: 'catalog.scm-events.alpha',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {},\n createRootContext() {\n return new DefaultCatalogScmEventsService(metrics);\n },\n factory(_, ctx) {\n return ctx;\n },\n }),\n });\n"],"names":["createServiceRef","createServiceFactory","DefaultCatalogScmEventsService","metrics"],"mappings":";;;;;;AAkCO,MAAM,6BACXA,iCAAA,CAA0C;AAAA,EACxC,EAAA,EAAI,0BAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAA,CAAqB;AAAA,IACnB,OAAA;AAAA,IACA,MAAM,EAAC;AAAA,IACP,iBAAA,GAAoB;AAClB,MAAA,OAAO,IAAIC,8DAA+BC,WAAO,CAAA;AAAA,IACnD,CAAA;AAAA,IACA,OAAA,CAAQ,GAAG,GAAA,EAAK;AACd,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACD;AACL,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"catalogServiceMock.cjs.js","sources":["../../src/testUtils/catalogServiceMock.ts"],"sourcesContent":["/*\n * Copyright 2024 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 createServiceFactory,\n ServiceFactory,\n} from '@backstage/backend-plugin-api';\nimport { InMemoryCatalogClient } from '@backstage/catalog-client/testUtils';\nimport { Entity } from '@backstage/catalog-model';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { createServiceMock } from '@backstage/backend-test-utils';\nimport { CatalogServiceMock } from './types';\n\n/**\n * Creates a fake catalog client that handles entities in memory storage. Note\n * that this client may be severely limited in functionality, and advanced\n * functions may not be available at all.\n *\n * @public\n */\nexport function catalogServiceMock(options?: {\n entities?: Entity[];\n}): CatalogServiceMock {\n return new InMemoryCatalogClient(options);\n}\n\n/**\n * A collection of mock functionality for the catalog service.\n *\n * @public\n */\nexport namespace catalogServiceMock {\n /**\n * Creates a fake catalog client that handles entities in memory storage. Note\n * that this client may be severely limited in functionality, and advanced\n * functions may not be available at all.\n */\n export const factory = (options?: { entities?: Entity[] }) =>\n createServiceFactory({\n service: catalogServiceRef,\n deps: {},\n factory: () => new InMemoryCatalogClient(options),\n }) as ServiceFactory<CatalogServiceMock, 'plugin', 'singleton'>;\n /**\n * Creates a catalog client whose methods are mock functions, possibly with\n * some of them overloaded by the caller.\n */\n export const mock = createServiceMock<CatalogServiceMock>(\n catalogServiceRef,\n () => ({\n getEntities: jest.fn(),\n getEntitiesByRefs: jest.fn(),\n queryEntities: jest.fn(),\n getEntityAncestors: jest.fn(),\n getEntityByRef: jest.fn(),\n removeEntityByUid: jest.fn(),\n refreshEntity: jest.fn(),\n getEntityFacets: jest.fn(),\n getLocations: jest.fn(),\n queryLocations: jest.fn(),\n streamLocations: jest.fn(),\n getLocationById: jest.fn(),\n getLocationByRef: jest.fn(),\n addLocation: jest.fn(),\n removeLocationById: jest.fn(),\n updateLocation: jest.fn(),\n getLocationByEntity: jest.fn(),\n validateEntity: jest.fn(),\n analyzeLocation: jest.fn(),\n streamEntities: jest.fn(),\n }),\n );\n}\n"],"names":["InMemoryCatalogClient","catalogServiceMock","createServiceFactory","catalogServiceRef","createServiceMock"],"mappings":";;;;;;;AAiCO,SAAS,mBAAmB,OAAA,EAEZ;AACrB,EAAA,OAAO,IAAIA,gCAAsB,OAAO,CAAA;AAC1C;AAAA,CAOO,CAAUC,mBAAAA,KAAV;AAME,EAAMA,mBA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"version":3,"file":"catalogServiceMock.cjs.js","sources":["../../src/testUtils/catalogServiceMock.ts"],"sourcesContent":["/*\n * Copyright 2024 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 createServiceFactory,\n ServiceFactory,\n} from '@backstage/backend-plugin-api';\nimport { InMemoryCatalogClient } from '@backstage/catalog-client/testUtils';\nimport { Entity } from '@backstage/catalog-model';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { createServiceMock } from '@backstage/backend-test-utils';\nimport { CatalogServiceMock } from './types';\n\n/**\n * Creates a fake catalog client that handles entities in memory storage. Note\n * that this client may be severely limited in functionality, and advanced\n * functions may not be available at all.\n *\n * @public\n */\nexport function catalogServiceMock(options?: {\n entities?: Entity[];\n}): CatalogServiceMock {\n return new InMemoryCatalogClient(options);\n}\n\n/**\n * A collection of mock functionality for the catalog service.\n *\n * @public\n */\nexport namespace catalogServiceMock {\n /**\n * Creates a fake catalog client that handles entities in memory storage. Note\n * that this client may be severely limited in functionality, and advanced\n * functions may not be available at all.\n */\n export const factory = (options?: { entities?: Entity[] }) =>\n createServiceFactory({\n service: catalogServiceRef,\n deps: {},\n factory: () => new InMemoryCatalogClient(options),\n }) as ServiceFactory<CatalogServiceMock, 'plugin', 'singleton'>;\n /**\n * Creates a catalog client whose methods are mock functions, possibly with\n * some of them overloaded by the caller.\n */\n export const mock = createServiceMock<CatalogServiceMock>(\n catalogServiceRef,\n () => ({\n getEntities: jest.fn(),\n getEntitiesByRefs: jest.fn(),\n queryEntities: jest.fn(),\n getEntityAncestors: jest.fn(),\n getEntityByRef: jest.fn(),\n removeEntityByUid: jest.fn(),\n refreshEntity: jest.fn(),\n getEntityFacets: jest.fn(),\n getLocations: jest.fn(),\n queryLocations: jest.fn(),\n streamLocations: jest.fn(),\n getLocationById: jest.fn(),\n getLocationByRef: jest.fn(),\n addLocation: jest.fn(),\n removeLocationById: jest.fn(),\n updateLocation: jest.fn(),\n getLocationByEntity: jest.fn(),\n validateEntity: jest.fn(),\n analyzeLocation: jest.fn(),\n streamEntities: jest.fn(),\n }),\n );\n}\n"],"names":["InMemoryCatalogClient","catalogServiceMock","createServiceFactory","catalogServiceRef","createServiceMock"],"mappings":";;;;;;;AAiCO,SAAS,mBAAmB,OAAA,EAEZ;AACrB,EAAA,OAAO,IAAIA,gCAAsB,OAAO,CAAA;AAC1C;AAAA,CAOO,CAAUC,mBAAAA,KAAV;AAME,EAAMA,mBAAAA,CAAA,OAAA,GAAU,CAAC,OAAA,KACtBC,qCAAA,CAAqB;AAAA,IACnB,OAAA,EAASC,mCAAA;AAAA,IACT,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAIH,+BAAA,CAAsB,OAAO;AAAA,GACjD,CAAA;AAKI,EAAMC,oBAAA,IAAA,GAAOG,kCAAA;AAAA,IAClBD,mCAAA;AAAA,IACA,OAAO;AAAA,MACL,WAAA,EAAa,KAAK,EAAA,EAAG;AAAA,MACrB,iBAAA,EAAmB,KAAK,EAAA,EAAG;AAAA,MAC3B,aAAA,EAAe,KAAK,EAAA,EAAG;AAAA,MACvB,kBAAA,EAAoB,KAAK,EAAA,EAAG;AAAA,MAC5B,cAAA,EAAgB,KAAK,EAAA,EAAG;AAAA,MACxB,iBAAA,EAAmB,KAAK,EAAA,EAAG;AAAA,MAC3B,aAAA,EAAe,KAAK,EAAA,EAAG;AAAA,MACvB,eAAA,EAAiB,KAAK,EAAA,EAAG;AAAA,MACzB,YAAA,EAAc,KAAK,EAAA,EAAG;AAAA,MACtB,cAAA,EAAgB,KAAK,EAAA,EAAG;AAAA,MACxB,eAAA,EAAiB,KAAK,EAAA,EAAG;AAAA,MACzB,eAAA,EAAiB,KAAK,EAAA,EAAG;AAAA,MACzB,gBAAA,EAAkB,KAAK,EAAA,EAAG;AAAA,MAC1B,WAAA,EAAa,KAAK,EAAA,EAAG;AAAA,MACrB,kBAAA,EAAoB,KAAK,EAAA,EAAG;AAAA,MAC5B,cAAA,EAAgB,KAAK,EAAA,EAAG;AAAA,MACxB,mBAAA,EAAqB,KAAK,EAAA,EAAG;AAAA,MAC7B,cAAA,EAAgB,KAAK,EAAA,EAAG;AAAA,MACxB,eAAA,EAAiB,KAAK,EAAA,EAAG;AAAA,MACzB,cAAA,EAAgB,KAAK,EAAA;AAAG,KAC1B;AAAA,GACF;AAAA,CAAA,EAxCe,kBAAA,KAAA,kBAAA,GAAA,EAAA,CAAA,CAAA;;"}
@@ -1,7 +1,7 @@
1
1
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
2
- import { Entity, Validators } from '@backstage/catalog-model';
2
+ import { Validators, Entity } from '@backstage/catalog-model';
3
3
  import { CatalogModelSource } from '@backstage/catalog-model/alpha';
4
- import { LocationAnalyzer, ScmLocationAnalyzer, CatalogProcessor, EntityProvider, PlaceholderResolver, CatalogProcessorParser } from '@backstage/plugin-catalog-node';
4
+ import { CatalogProcessorParser, LocationAnalyzer, ScmLocationAnalyzer, CatalogProcessor, EntityProvider, PlaceholderResolver } from '@backstage/plugin-catalog-node';
5
5
 
6
6
  /**
7
7
  * @public
@@ -111,5 +111,5 @@ declare const catalogAnalysisExtensionPoint: _backstage_backend_plugin_api.Exten
111
111
  /** @alpha */
112
112
  declare const catalogModelExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogModelExtensionPoint>;
113
113
 
114
- export { catalogAnalysisExtensionPoint as d, catalogLocationsExtensionPoint as e, catalogModelExtensionPoint as f, catalogProcessingExtensionPoint as g };
115
- export type { CatalogAnalysisExtensionPoint as C, CatalogLocationsExtensionPoint as a, CatalogModelExtensionPoint as b, CatalogProcessingExtensionPoint as c };
114
+ export { catalogModelExtensionPoint as c, catalogAnalysisExtensionPoint as e, catalogLocationsExtensionPoint as f, catalogProcessingExtensionPoint as g };
115
+ export type { CatalogModelExtensionPoint as C, CatalogAnalysisExtensionPoint as a, CatalogLocationsExtensionPoint as b, CatalogProcessingExtensionPoint as d };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-node",
3
- "version": "0.0.0-nightly-20260918023200",
3
+ "version": "0.0.0-nightly-20260920023043",
4
4
  "description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
5
5
  "backstage": {
6
6
  "role": "node-library",
@@ -72,25 +72,25 @@
72
72
  "test": "backstage-cli package test"
73
73
  },
74
74
  "dependencies": {
75
- "@backstage/backend-plugin-api": "1.10.1",
76
- "@backstage/catalog-client": "1.16.2",
77
- "@backstage/catalog-model": "1.10.1",
78
- "@backstage/errors": "1.3.1",
79
- "@backstage/plugin-catalog-common": "1.2.0",
80
- "@backstage/plugin-permission-common": "0.9.11",
81
- "@backstage/plugin-permission-node": "0.11.4",
75
+ "@backstage/backend-plugin-api": "0.0.0-nightly-20260920023043",
76
+ "@backstage/catalog-client": "0.0.0-nightly-20260920023043",
77
+ "@backstage/catalog-model": "0.0.0-nightly-20260920023043",
78
+ "@backstage/errors": "0.0.0-nightly-20260920023043",
79
+ "@backstage/plugin-catalog-common": "0.0.0-nightly-20260920023043",
80
+ "@backstage/plugin-permission-common": "0.0.0-nightly-20260920023043",
81
+ "@backstage/plugin-permission-node": "0.0.0-nightly-20260920023043",
82
82
  "@backstage/types": "1.2.2",
83
83
  "@opentelemetry/api": "^1.9.0",
84
84
  "lodash": "^4.17.21",
85
85
  "yaml": "^2.0.0"
86
86
  },
87
87
  "devDependencies": {
88
- "@backstage/backend-test-utils": "0.0.0-nightly-20260918023200",
89
- "@backstage/cli": "0.0.0-nightly-20260918023200",
88
+ "@backstage/backend-test-utils": "0.0.0-nightly-20260920023043",
89
+ "@backstage/cli": "0.0.0-nightly-20260920023043",
90
90
  "msw": "^2.0.0"
91
91
  },
92
92
  "peerDependencies": {
93
- "@backstage/backend-test-utils": "0.0.0-nightly-20260918023200"
93
+ "@backstage/backend-test-utils": "0.0.0-nightly-20260920023043"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "@backstage/backend-test-utils": {