@backstage/plugin-catalog-node 1.0.2-next.1 → 1.1.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,20 @@
1
1
  # @backstage/plugin-catalog-node
2
2
 
3
+ ## 1.1.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 9743bc788c: Added refresh function to the `EntityProviderConnection` to be able to schedule refreshes from entity providers.
8
+
9
+ ### Patch Changes
10
+
11
+ - 409ed984e8: Updated usage of experimental backend service APIs.
12
+ - Updated dependencies
13
+ - @backstage/backend-plugin-api@0.1.2-next.2
14
+ - @backstage/catalog-client@1.1.0-next.2
15
+ - @backstage/catalog-model@1.1.1-next.0
16
+ - @backstage/errors@1.1.1-next.0
17
+
3
18
  ## 1.0.2-next.1
4
19
 
5
20
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-node",
3
- "version": "1.0.2-next.1",
3
+ "version": "1.1.0-next.2",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -168,7 +168,7 @@ export declare type CatalogProcessorResult = CatalogProcessorLocationResult | Ca
168
168
  * The catalogService provides the catalog API.
169
169
  * @alpha
170
170
  */
171
- export declare const catalogServiceRef: ServiceRef<CatalogApi>;
171
+ export declare const catalogServiceRef: ServiceRef<CatalogApi, "plugin">;
172
172
 
173
173
  /**
174
174
  * Entities that are not yet processed.
@@ -201,6 +201,10 @@ export declare interface EntityProviderConnection {
201
201
  * Applies either a full or delta update to the catalog engine.
202
202
  */
203
203
  applyMutation(mutation: EntityProviderMutation): Promise<void>;
204
+ /**
205
+ * Schedules a refresh on all of the entities that has a matching refresh key associated with the provided keys.
206
+ */
207
+ refresh(options: EntityProviderRefreshOptions): Promise<void>;
204
208
  }
205
209
 
206
210
  /**
@@ -218,6 +222,13 @@ export declare type EntityProviderMutation = {
218
222
  removed: DeferredEntity[];
219
223
  };
220
224
 
225
+ /**
226
+ * @public
227
+ */
228
+ export declare type EntityProviderRefreshOptions = {
229
+ keys: string[];
230
+ };
231
+
221
232
  /**
222
233
  * Holds the relation data for entities.
223
234
  *
@@ -188,6 +188,10 @@ export declare interface EntityProviderConnection {
188
188
  * Applies either a full or delta update to the catalog engine.
189
189
  */
190
190
  applyMutation(mutation: EntityProviderMutation): Promise<void>;
191
+ /**
192
+ * Schedules a refresh on all of the entities that has a matching refresh key associated with the provided keys.
193
+ */
194
+ refresh(options: EntityProviderRefreshOptions): Promise<void>;
191
195
  }
192
196
 
193
197
  /**
@@ -205,6 +209,13 @@ export declare type EntityProviderMutation = {
205
209
  removed: DeferredEntity[];
206
210
  };
207
211
 
212
+ /**
213
+ * @public
214
+ */
215
+ export declare type EntityProviderRefreshOptions = {
216
+ keys: string[];
217
+ };
218
+
208
219
  /**
209
220
  * Holds the relation data for entities.
210
221
  *
package/dist/index.cjs.js CHANGED
@@ -15,13 +15,11 @@ const catalogServiceRef = backendPluginApi.createServiceRef({
15
15
  defaultFactory: async (service) => backendPluginApi.createServiceFactory({
16
16
  service,
17
17
  deps: {
18
- discoveryFactory: backendPluginApi.discoveryServiceRef
18
+ discoveryApi: backendPluginApi.discoveryServiceRef
19
19
  },
20
- factory: async ({ discoveryFactory }) => {
21
- const discoveryApi = await discoveryFactory("root");
22
- const catalogClient$1 = new catalogClient.CatalogClient({ discoveryApi });
23
- return async (_pluginId) => {
24
- return catalogClient$1;
20
+ async factory() {
21
+ return async ({ discoveryApi }) => {
22
+ return new catalogClient.CatalogClient({ discoveryApi });
25
23
  };
26
24
  }
27
25
  })
@@ -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 discoveryFactory: discoveryServiceRef,\n },\n factory: async ({ discoveryFactory }) => {\n const discoveryApi = await discoveryFactory('root');\n const catalogClient = new CatalogClient({ discoveryApi });\n return async _pluginId => {\n return catalogClient;\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","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,O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E,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, 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;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -188,6 +188,10 @@ export declare interface EntityProviderConnection {
188
188
  * Applies either a full or delta update to the catalog engine.
189
189
  */
190
190
  applyMutation(mutation: EntityProviderMutation): Promise<void>;
191
+ /**
192
+ * Schedules a refresh on all of the entities that has a matching refresh key associated with the provided keys.
193
+ */
194
+ refresh(options: EntityProviderRefreshOptions): Promise<void>;
191
195
  }
192
196
 
193
197
  /**
@@ -205,6 +209,13 @@ export declare type EntityProviderMutation = {
205
209
  removed: DeferredEntity[];
206
210
  };
207
211
 
212
+ /**
213
+ * @public
214
+ */
215
+ export declare type EntityProviderRefreshOptions = {
216
+ keys: string[];
217
+ };
218
+
208
219
  /**
209
220
  * Holds the relation data for entities.
210
221
  *
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.0.2-next.1",
4
+ "version": "1.1.0-next.2",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -24,20 +24,20 @@
24
24
  "postpack": "backstage-cli package postpack"
25
25
  },
26
26
  "dependencies": {
27
- "@backstage/backend-plugin-api": "^0.1.2-next.1",
28
- "@backstage/catalog-client": "^1.0.5-next.1",
29
- "@backstage/catalog-model": "^1.1.0",
30
- "@backstage/errors": "1.1.0",
27
+ "@backstage/backend-plugin-api": "^0.1.2-next.2",
28
+ "@backstage/catalog-client": "^1.1.0-next.2",
29
+ "@backstage/catalog-model": "^1.1.1-next.0",
30
+ "@backstage/errors": "1.1.1-next.0",
31
31
  "@backstage/types": "^1.0.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@backstage/backend-common": "^0.15.1-next.2",
35
- "@backstage/backend-test-utils": "^0.1.28-next.2",
36
- "@backstage/cli": "^0.19.0-next.2"
34
+ "@backstage/backend-common": "^0.15.1-next.3",
35
+ "@backstage/backend-test-utils": "^0.1.28-next.3",
36
+ "@backstage/cli": "^0.19.0-next.3"
37
37
  },
38
38
  "files": [
39
39
  "dist",
40
40
  "alpha"
41
41
  ],
42
- "gitHead": "24f889f173370f060725fcf9404081e40769beb4"
42
+ "gitHead": "2f458448f850dc68a711e2f31d14a91f96cf175d"
43
43
  }