@backstage/plugin-catalog-node 1.1.1-next.0 → 1.2.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @backstage/plugin-catalog-node
2
2
 
3
+ ## 1.2.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 404366c853: Deprecated the `LocationSpec` type. It got moved from this package to the `@backstage/plugin-catalog-common` so make sure imports are updated.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/plugin-catalog-common@1.0.7-next.2
13
+ - @backstage/backend-plugin-api@0.1.3-next.2
14
+ - @backstage/catalog-client@1.1.1-next.2
15
+ - @backstage/catalog-model@1.1.2-next.2
16
+ - @backstage/errors@1.1.2-next.2
17
+ - @backstage/types@1.0.0
18
+
19
+ ## 1.1.1-next.1
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @backstage/catalog-client@1.1.1-next.1
25
+ - @backstage/backend-plugin-api@0.1.3-next.1
26
+ - @backstage/catalog-model@1.1.2-next.1
27
+ - @backstage/errors@1.1.2-next.1
28
+ - @backstage/types@1.0.0
29
+
3
30
  ## 1.1.1-next.0
4
31
 
5
32
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-node",
3
- "version": "1.1.1-next.0",
3
+ "version": "1.2.0-next.2",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -11,6 +11,7 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
11
11
  import { Entity } from '@backstage/catalog-model';
12
12
  import { ExtensionPoint } from '@backstage/backend-plugin-api';
13
13
  import { JsonValue } from '@backstage/types';
14
+ import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common';
14
15
  import { ServiceRef } from '@backstage/backend-plugin-api';
15
16
 
16
17
  /**
@@ -45,7 +46,7 @@ export declare type CatalogProcessor = {
45
46
  * @param cache - A cache for storing values local to this processor and the current entity.
46
47
  * @returns True if handled by this processor, false otherwise
47
48
  */
48
- readLocation?(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
49
+ readLocation?(location: LocationSpec_2, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
49
50
  /**
50
51
  * Pre-processes an emitted entity, after it has been emitted but before it
51
52
  * has been validated.
@@ -63,7 +64,7 @@ export declare type CatalogProcessor = {
63
64
  * @param cache - A cache for storing values local to this processor and the current entity.
64
65
  * @returns The same entity or a modified version of it
65
66
  */
66
- preProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, originLocation: LocationSpec, cache: CatalogProcessorCache): Promise<Entity>;
67
+ preProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, originLocation: LocationSpec_2, cache: CatalogProcessorCache): Promise<Entity>;
67
68
  /**
68
69
  * Validates the entity as a known entity kind, after it has been pre-
69
70
  * processed and has passed through basic overall validation.
@@ -85,7 +86,7 @@ export declare type CatalogProcessor = {
85
86
  * @param cache - A cache for storing values local to this processor and the current entity.
86
87
  * @returns The same entity or a modified version of it
87
88
  */
88
- postProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
89
+ postProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
89
90
  };
90
91
 
91
92
  /**
@@ -122,20 +123,20 @@ export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) =
122
123
  export declare type CatalogProcessorEntityResult = {
123
124
  type: 'entity';
124
125
  entity: Entity;
125
- location: LocationSpec;
126
+ location: LocationSpec_2;
126
127
  };
127
128
 
128
129
  /** @public */
129
130
  export declare type CatalogProcessorErrorResult = {
130
131
  type: 'error';
131
132
  error: Error;
132
- location: LocationSpec;
133
+ location: LocationSpec_2;
133
134
  };
134
135
 
135
136
  /** @public */
136
137
  export declare type CatalogProcessorLocationResult = {
137
138
  type: 'location';
138
- location: LocationSpec;
139
+ location: LocationSpec_2;
139
140
  };
140
141
 
141
142
  /**
@@ -146,7 +147,7 @@ export declare type CatalogProcessorLocationResult = {
146
147
  */
147
148
  export declare type CatalogProcessorParser = (options: {
148
149
  data: Buffer;
149
- location: LocationSpec;
150
+ location: LocationSpec_2;
150
151
  }) => AsyncIterable<CatalogProcessorResult>;
151
152
 
152
153
  /** @public */
@@ -259,12 +260,9 @@ export declare type EntityRelationSpec = {
259
260
  * default value: 'required'.
260
261
  *
261
262
  * @public
263
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
262
264
  */
263
- export declare type LocationSpec = {
264
- type: string;
265
- target: string;
266
- presence?: 'optional' | 'required';
267
- };
265
+ export declare type LocationSpec = LocationSpec_2;
268
266
 
269
267
  /**
270
268
  * Factory functions for the standard processing result types.
@@ -272,11 +270,11 @@ export declare type LocationSpec = {
272
270
  * @public
273
271
  */
274
272
  export declare const processingResult: Readonly<{
275
- readonly notFoundError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
276
- readonly inputError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
277
- readonly generalError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
278
- readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
279
- readonly entity: (atLocation: LocationSpec, newEntity: Entity) => CatalogProcessorResult;
273
+ readonly notFoundError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
274
+ readonly inputError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
275
+ readonly generalError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
276
+ readonly location: (newLocation: LocationSpec_2) => CatalogProcessorResult;
277
+ readonly entity: (atLocation: LocationSpec_2, newEntity: Entity) => CatalogProcessorResult;
280
278
  readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
281
279
  readonly refresh: (key: string) => CatalogProcessorResult;
282
280
  }>;
@@ -11,6 +11,7 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
11
11
  import { Entity } from '@backstage/catalog-model';
12
12
  import { ExtensionPoint } from '@backstage/backend-plugin-api';
13
13
  import { JsonValue } from '@backstage/types';
14
+ import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common';
14
15
  import { ServiceRef } from '@backstage/backend-plugin-api';
15
16
 
16
17
  /* Excluded from this release type: CatalogProcessingExtensionPoint */
@@ -36,7 +37,7 @@ export declare type CatalogProcessor = {
36
37
  * @param cache - A cache for storing values local to this processor and the current entity.
37
38
  * @returns True if handled by this processor, false otherwise
38
39
  */
39
- readLocation?(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
40
+ readLocation?(location: LocationSpec_2, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
40
41
  /**
41
42
  * Pre-processes an emitted entity, after it has been emitted but before it
42
43
  * has been validated.
@@ -54,7 +55,7 @@ export declare type CatalogProcessor = {
54
55
  * @param cache - A cache for storing values local to this processor and the current entity.
55
56
  * @returns The same entity or a modified version of it
56
57
  */
57
- preProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, originLocation: LocationSpec, cache: CatalogProcessorCache): Promise<Entity>;
58
+ preProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, originLocation: LocationSpec_2, cache: CatalogProcessorCache): Promise<Entity>;
58
59
  /**
59
60
  * Validates the entity as a known entity kind, after it has been pre-
60
61
  * processed and has passed through basic overall validation.
@@ -76,7 +77,7 @@ export declare type CatalogProcessor = {
76
77
  * @param cache - A cache for storing values local to this processor and the current entity.
77
78
  * @returns The same entity or a modified version of it
78
79
  */
79
- postProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
80
+ postProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
80
81
  };
81
82
 
82
83
  /**
@@ -113,20 +114,20 @@ export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) =
113
114
  export declare type CatalogProcessorEntityResult = {
114
115
  type: 'entity';
115
116
  entity: Entity;
116
- location: LocationSpec;
117
+ location: LocationSpec_2;
117
118
  };
118
119
 
119
120
  /** @public */
120
121
  export declare type CatalogProcessorErrorResult = {
121
122
  type: 'error';
122
123
  error: Error;
123
- location: LocationSpec;
124
+ location: LocationSpec_2;
124
125
  };
125
126
 
126
127
  /** @public */
127
128
  export declare type CatalogProcessorLocationResult = {
128
129
  type: 'location';
129
- location: LocationSpec;
130
+ location: LocationSpec_2;
130
131
  };
131
132
 
132
133
  /**
@@ -137,7 +138,7 @@ export declare type CatalogProcessorLocationResult = {
137
138
  */
138
139
  export declare type CatalogProcessorParser = (options: {
139
140
  data: Buffer;
140
- location: LocationSpec;
141
+ location: LocationSpec_2;
141
142
  }) => AsyncIterable<CatalogProcessorResult>;
142
143
 
143
144
  /** @public */
@@ -246,12 +247,9 @@ export declare type EntityRelationSpec = {
246
247
  * default value: 'required'.
247
248
  *
248
249
  * @public
250
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
249
251
  */
250
- export declare type LocationSpec = {
251
- type: string;
252
- target: string;
253
- presence?: 'optional' | 'required';
254
- };
252
+ export declare type LocationSpec = LocationSpec_2;
255
253
 
256
254
  /**
257
255
  * Factory functions for the standard processing result types.
@@ -259,11 +257,11 @@ export declare type LocationSpec = {
259
257
  * @public
260
258
  */
261
259
  export declare const processingResult: Readonly<{
262
- readonly notFoundError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
263
- readonly inputError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
264
- readonly generalError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
265
- readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
266
- readonly entity: (atLocation: LocationSpec, newEntity: Entity) => CatalogProcessorResult;
260
+ readonly notFoundError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
261
+ readonly inputError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
262
+ readonly generalError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
263
+ readonly location: (newLocation: LocationSpec_2) => CatalogProcessorResult;
264
+ readonly entity: (atLocation: LocationSpec_2, newEntity: Entity) => CatalogProcessorResult;
267
265
  readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
268
266
  readonly refresh: (key: string) => CatalogProcessorResult;
269
267
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/extensions.ts","../src/catalogService.ts","../src/api/processingResult.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 */\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { EntityProvider } from './api';\nimport { CatalogProcessor } from './api/processor';\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n","/*\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 createServiceFactory,\n createServiceRef,\n discoveryServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\n\n/**\n * The catalogService provides the catalog API.\n * @alpha\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n discoveryApi: discoveryServiceRef,\n },\n async factory() {\n return async ({ discoveryApi }) => {\n return new CatalogClient({ discoveryApi });\n };\n },\n }),\n});\n","/*\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, LocationSpec } from './common';\n\n/**\n * Factory functions for the standard processing result types.\n *\n * @public\n */\nexport const processingResult = Object.freeze({\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 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 generalError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return { type: 'error', location: atLocation, error: new Error(message) };\n },\n\n location(newLocation: LocationSpec): CatalogProcessorResult {\n return { type: 'location', location: newLocation };\n },\n\n entity(atLocation: LocationSpec, newEntity: Entity): CatalogProcessorResult {\n return { type: 'entity', location: atLocation, entity: newEntity };\n },\n\n relation(spec: EntityRelationSpec): CatalogProcessorResult {\n return { type: 'relation', relation: spec };\n },\n\n refresh(key: string): CatalogProcessorResult {\n return { type: 'refresh', key };\n },\n} as const);\n"],"names":["createExtensionPoint","createServiceRef","createServiceFactory","discoveryServiceRef","CatalogClient","NotFoundError","InputError"],"mappings":";;;;;;;;AAkCO,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;ACVI,MAAM,oBAAoBC,iCAA6B,CAAA;AAAA,EAC5D,EAAI,EAAA,gBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAqB,CAAA;AAAA,IACnB,OAAA;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,YAAc,EAAAC,oCAAA;AAAA,KAChB;AAAA,IACA,MAAM,OAAU,GAAA;AACd,MAAO,OAAA,OAAO,EAAE,YAAA,EAAmB,KAAA;AACjC,QAAA,OAAO,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,CAAA,CAAA;AAAA,OAC3C,CAAA;AAAA,KACF;AAAA,GACD,CAAA;AACL,CAAC;;ACfY,MAAA,gBAAA,GAAmB,OAAO,MAAO,CAAA;AAAA,EAC5C,aAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,IAAIC,oBAAA,CAAc,OAAO,CAAA;AAAA,KAClC,CAAA;AAAA,GACF;AAAA,EAEA,UAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,IAAIC,iBAAA,CAAW,OAAO,CAAA;AAAA,KAC/B,CAAA;AAAA,GACF;AAAA,EAEA,YAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA,EAAE,MAAM,OAAS,EAAA,QAAA,EAAU,YAAY,KAAO,EAAA,IAAI,KAAM,CAAA,OAAO,CAAE,EAAA,CAAA;AAAA,GAC1E;AAAA,EAEA,SAAS,WAAmD,EAAA;AAC1D,IAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,QAAA,EAAU,WAAY,EAAA,CAAA;AAAA,GACnD;AAAA,EAEA,MAAA,CAAO,YAA0B,SAA2C,EAAA;AAC1E,IAAA,OAAO,EAAE,IAAM,EAAA,QAAA,EAAU,QAAU,EAAA,UAAA,EAAY,QAAQ,SAAU,EAAA,CAAA;AAAA,GACnE;AAAA,EAEA,SAAS,IAAkD,EAAA;AACzD,IAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,QAAA,EAAU,IAAK,EAAA,CAAA;AAAA,GAC5C;AAAA,EAEA,QAAQ,GAAqC,EAAA;AAC3C,IAAO,OAAA,EAAE,IAAM,EAAA,SAAA,EAAW,GAAI,EAAA,CAAA;AAAA,GAChC;AACF,CAAU;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/extensions.ts","../src/catalogService.ts","../src/api/processingResult.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 */\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { EntityProvider } from './api';\nimport { CatalogProcessor } from './api/processor';\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n","/*\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 createServiceFactory,\n createServiceRef,\n discoveryServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\n\n/**\n * The catalogService provides the catalog API.\n * @alpha\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n discoveryApi: discoveryServiceRef,\n },\n async factory() {\n return async ({ discoveryApi }) => {\n return new CatalogClient({ discoveryApi });\n };\n },\n }),\n});\n","/*\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 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 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 generalError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return { type: 'error', location: atLocation, error: new Error(message) };\n },\n\n location(newLocation: LocationSpec): CatalogProcessorResult {\n return { type: 'location', location: newLocation };\n },\n\n entity(atLocation: LocationSpec, newEntity: Entity): CatalogProcessorResult {\n return { type: 'entity', location: atLocation, entity: newEntity };\n },\n\n relation(spec: EntityRelationSpec): CatalogProcessorResult {\n return { type: 'relation', relation: spec };\n },\n\n refresh(key: string): CatalogProcessorResult {\n return { type: 'refresh', key };\n },\n} as const);\n"],"names":["createExtensionPoint","createServiceRef","createServiceFactory","discoveryServiceRef","CatalogClient","NotFoundError","InputError"],"mappings":";;;;;;;;AAkCO,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;ACVI,MAAM,oBAAoBC,iCAA6B,CAAA;AAAA,EAC5D,EAAI,EAAA,gBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAqB,CAAA;AAAA,IACnB,OAAA;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,YAAc,EAAAC,oCAAA;AAAA,KAChB;AAAA,IACA,MAAM,OAAU,GAAA;AACd,MAAO,OAAA,OAAO,EAAE,YAAA,EAAmB,KAAA;AACjC,QAAA,OAAO,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,CAAA,CAAA;AAAA,OAC3C,CAAA;AAAA,KACF;AAAA,GACD,CAAA;AACL,CAAC;;ACdY,MAAA,gBAAA,GAAmB,OAAO,MAAO,CAAA;AAAA,EAC5C,aAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,IAAIC,oBAAA,CAAc,OAAO,CAAA;AAAA,KAClC,CAAA;AAAA,GACF;AAAA,EAEA,UAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,IAAIC,iBAAA,CAAW,OAAO,CAAA;AAAA,KAC/B,CAAA;AAAA,GACF;AAAA,EAEA,YAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA,EAAE,MAAM,OAAS,EAAA,QAAA,EAAU,YAAY,KAAO,EAAA,IAAI,KAAM,CAAA,OAAO,CAAE,EAAA,CAAA;AAAA,GAC1E;AAAA,EAEA,SAAS,WAAmD,EAAA;AAC1D,IAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,QAAA,EAAU,WAAY,EAAA,CAAA;AAAA,GACnD;AAAA,EAEA,MAAA,CAAO,YAA0B,SAA2C,EAAA;AAC1E,IAAA,OAAO,EAAE,IAAM,EAAA,QAAA,EAAU,QAAU,EAAA,UAAA,EAAY,QAAQ,SAAU,EAAA,CAAA;AAAA,GACnE;AAAA,EAEA,SAAS,IAAkD,EAAA;AACzD,IAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,QAAA,EAAU,IAAK,EAAA,CAAA;AAAA,GAC5C;AAAA,EAEA,QAAQ,GAAqC,EAAA;AAC3C,IAAO,OAAA,EAAE,IAAM,EAAA,SAAA,EAAW,GAAI,EAAA,CAAA;AAAA,GAChC;AACF,CAAU;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
11
11
  import { Entity } from '@backstage/catalog-model';
12
12
  import { ExtensionPoint } from '@backstage/backend-plugin-api';
13
13
  import { JsonValue } from '@backstage/types';
14
+ import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common';
14
15
  import { ServiceRef } from '@backstage/backend-plugin-api';
15
16
 
16
17
  /* Excluded from this release type: CatalogProcessingExtensionPoint */
@@ -36,7 +37,7 @@ export declare type CatalogProcessor = {
36
37
  * @param cache - A cache for storing values local to this processor and the current entity.
37
38
  * @returns True if handled by this processor, false otherwise
38
39
  */
39
- readLocation?(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
40
+ readLocation?(location: LocationSpec_2, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
40
41
  /**
41
42
  * Pre-processes an emitted entity, after it has been emitted but before it
42
43
  * has been validated.
@@ -54,7 +55,7 @@ export declare type CatalogProcessor = {
54
55
  * @param cache - A cache for storing values local to this processor and the current entity.
55
56
  * @returns The same entity or a modified version of it
56
57
  */
57
- preProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, originLocation: LocationSpec, cache: CatalogProcessorCache): Promise<Entity>;
58
+ preProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, originLocation: LocationSpec_2, cache: CatalogProcessorCache): Promise<Entity>;
58
59
  /**
59
60
  * Validates the entity as a known entity kind, after it has been pre-
60
61
  * processed and has passed through basic overall validation.
@@ -76,7 +77,7 @@ export declare type CatalogProcessor = {
76
77
  * @param cache - A cache for storing values local to this processor and the current entity.
77
78
  * @returns The same entity or a modified version of it
78
79
  */
79
- postProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
80
+ postProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
80
81
  };
81
82
 
82
83
  /**
@@ -113,20 +114,20 @@ export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) =
113
114
  export declare type CatalogProcessorEntityResult = {
114
115
  type: 'entity';
115
116
  entity: Entity;
116
- location: LocationSpec;
117
+ location: LocationSpec_2;
117
118
  };
118
119
 
119
120
  /** @public */
120
121
  export declare type CatalogProcessorErrorResult = {
121
122
  type: 'error';
122
123
  error: Error;
123
- location: LocationSpec;
124
+ location: LocationSpec_2;
124
125
  };
125
126
 
126
127
  /** @public */
127
128
  export declare type CatalogProcessorLocationResult = {
128
129
  type: 'location';
129
- location: LocationSpec;
130
+ location: LocationSpec_2;
130
131
  };
131
132
 
132
133
  /**
@@ -137,7 +138,7 @@ export declare type CatalogProcessorLocationResult = {
137
138
  */
138
139
  export declare type CatalogProcessorParser = (options: {
139
140
  data: Buffer;
140
- location: LocationSpec;
141
+ location: LocationSpec_2;
141
142
  }) => AsyncIterable<CatalogProcessorResult>;
142
143
 
143
144
  /** @public */
@@ -246,12 +247,9 @@ export declare type EntityRelationSpec = {
246
247
  * default value: 'required'.
247
248
  *
248
249
  * @public
250
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
249
251
  */
250
- export declare type LocationSpec = {
251
- type: string;
252
- target: string;
253
- presence?: 'optional' | 'required';
254
- };
252
+ export declare type LocationSpec = LocationSpec_2;
255
253
 
256
254
  /**
257
255
  * Factory functions for the standard processing result types.
@@ -259,11 +257,11 @@ export declare type LocationSpec = {
259
257
  * @public
260
258
  */
261
259
  export declare const processingResult: Readonly<{
262
- readonly notFoundError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
263
- readonly inputError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
264
- readonly generalError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
265
- readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
266
- readonly entity: (atLocation: LocationSpec, newEntity: Entity) => CatalogProcessorResult;
260
+ readonly notFoundError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
261
+ readonly inputError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
262
+ readonly generalError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
263
+ readonly location: (newLocation: LocationSpec_2) => CatalogProcessorResult;
264
+ readonly entity: (atLocation: LocationSpec_2, newEntity: Entity) => CatalogProcessorResult;
267
265
  readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
268
266
  readonly refresh: (key: string) => CatalogProcessorResult;
269
267
  }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-node",
3
3
  "description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
4
- "version": "1.1.1-next.0",
4
+ "version": "1.2.0-next.2",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -24,16 +24,17 @@
24
24
  "postpack": "backstage-cli package postpack"
25
25
  },
26
26
  "dependencies": {
27
- "@backstage/backend-plugin-api": "^0.1.3-next.0",
28
- "@backstage/catalog-client": "^1.1.1-next.0",
29
- "@backstage/catalog-model": "^1.1.2-next.0",
30
- "@backstage/errors": "^1.1.2-next.0",
27
+ "@backstage/backend-plugin-api": "^0.1.3-next.2",
28
+ "@backstage/catalog-client": "^1.1.1-next.2",
29
+ "@backstage/catalog-model": "^1.1.2-next.2",
30
+ "@backstage/errors": "^1.1.2-next.2",
31
+ "@backstage/plugin-catalog-common": "^1.0.7-next.2",
31
32
  "@backstage/types": "^1.0.0"
32
33
  },
33
34
  "devDependencies": {
34
- "@backstage/backend-common": "^0.15.2-next.0",
35
- "@backstage/backend-test-utils": "^0.1.29-next.0",
36
- "@backstage/cli": "^0.20.0-next.0"
35
+ "@backstage/backend-common": "^0.15.2-next.2",
36
+ "@backstage/backend-test-utils": "^0.1.29-next.2",
37
+ "@backstage/cli": "^0.20.0-next.2"
37
38
  },
38
39
  "files": [
39
40
  "dist",