@backstage/plugin-catalog-node 1.4.6-next.1 → 1.4.6
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 +4 -15
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +0 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -27
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-node
|
|
2
2
|
|
|
3
|
-
## 1.4.6
|
|
3
|
+
## 1.4.6
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- 7a2e2924c7: Added docs to `processingResult`
|
|
8
7
|
- Updated dependencies
|
|
9
|
-
- @backstage/backend-plugin-api@0.6.5
|
|
10
|
-
- @backstage/catalog-client@1.4.4
|
|
11
|
-
- @backstage/catalog-model@1.4.2
|
|
12
|
-
- @backstage/errors@1.2.2
|
|
13
|
-
- @backstage/types@1.1.1
|
|
14
|
-
- @backstage/plugin-catalog-common@1.0.16
|
|
8
|
+
- @backstage/backend-plugin-api@0.6.5
|
|
15
9
|
|
|
16
|
-
## 1.4.
|
|
10
|
+
## 1.4.5
|
|
17
11
|
|
|
18
12
|
### Patch Changes
|
|
19
13
|
|
|
20
14
|
- Updated dependencies
|
|
21
|
-
- @backstage/backend-plugin-api@0.6.
|
|
22
|
-
- @backstage/catalog-client@1.4.4
|
|
23
|
-
- @backstage/catalog-model@1.4.2
|
|
24
|
-
- @backstage/errors@1.2.2
|
|
25
|
-
- @backstage/types@1.1.1
|
|
26
|
-
- @backstage/plugin-catalog-common@1.0.16
|
|
15
|
+
- @backstage/backend-plugin-api@0.6.4
|
|
27
16
|
|
|
28
17
|
## 1.4.4
|
|
29
18
|
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -7,9 +7,6 @@ var catalogModel = require('@backstage/catalog-model');
|
|
|
7
7
|
var crypto = require('crypto');
|
|
8
8
|
|
|
9
9
|
const processingResult = Object.freeze({
|
|
10
|
-
/**
|
|
11
|
-
* Associates a NotFoundError with the processing state of the current entity.
|
|
12
|
-
*/
|
|
13
10
|
notFoundError(atLocation, message) {
|
|
14
11
|
return {
|
|
15
12
|
type: "error",
|
|
@@ -17,9 +14,6 @@ const processingResult = Object.freeze({
|
|
|
17
14
|
error: new errors.NotFoundError(message)
|
|
18
15
|
};
|
|
19
16
|
},
|
|
20
|
-
/**
|
|
21
|
-
* Associates an InputError with the processing state of the current entity.
|
|
22
|
-
*/
|
|
23
17
|
inputError(atLocation, message) {
|
|
24
18
|
return {
|
|
25
19
|
type: "error",
|
|
@@ -27,39 +21,18 @@ const processingResult = Object.freeze({
|
|
|
27
21
|
error: new errors.InputError(message)
|
|
28
22
|
};
|
|
29
23
|
},
|
|
30
|
-
/**
|
|
31
|
-
* Associates a general Error with the processing state of the current entity.
|
|
32
|
-
*/
|
|
33
24
|
generalError(atLocation, message) {
|
|
34
25
|
return { type: "error", location: atLocation, error: new Error(message) };
|
|
35
26
|
},
|
|
36
|
-
/**
|
|
37
|
-
* Emits a location. In effect, this is analogous to emitting a Location kind
|
|
38
|
-
* child entity. This is commonly used in discovery processors. Do not use
|
|
39
|
-
* this while processing Location entities.
|
|
40
|
-
*/
|
|
41
27
|
location(newLocation) {
|
|
42
28
|
return { type: "location", location: newLocation };
|
|
43
29
|
},
|
|
44
|
-
/**
|
|
45
|
-
* Emits a child of the current entity, associated with a certain location.
|
|
46
|
-
*/
|
|
47
30
|
entity(atLocation, newEntity) {
|
|
48
31
|
return { type: "entity", location: atLocation, entity: newEntity };
|
|
49
32
|
},
|
|
50
|
-
/**
|
|
51
|
-
* Emits a relation owned by the current entity. The relation does not have to
|
|
52
|
-
* start or end at the current entity. The relation only lives for as long as
|
|
53
|
-
* the current entity lives.
|
|
54
|
-
*/
|
|
55
33
|
relation(spec) {
|
|
56
34
|
return { type: "relation", relation: spec };
|
|
57
35
|
},
|
|
58
|
-
/**
|
|
59
|
-
* Associates the given refresh key with the current entity. The effect of
|
|
60
|
-
* this is that the entity will be marked for refresh when such requests are
|
|
61
|
-
* made.
|
|
62
|
-
*/
|
|
63
36
|
refresh(key) {
|
|
64
37
|
return { type: "refresh", key };
|
|
65
38
|
}
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/api/processingResult.ts","../src/conversion.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
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/api/processingResult.ts","../src/conversion.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 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","/*\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 '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":["NotFoundError","InputError","createHash","ANNOTATION_LOCATION","stringifyEntityRef","stringifyLocationRef","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;;;;AA2Ba,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;A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,GAAA,WAAA,CAAA;AAAA,GACnB;AAEA,EAAA,MAAM,MAAiC,GAAA;AAAA,IACrC,UAAY,EAAA,uBAAA;AAAA,IACZ,IAAM,EAAA,UAAA;AAAA,IACN,QAAU,EAAA;AAAA,MACR,IAAA,EAAM,2BAA2B,QAAQ,CAAA;AAAA,MACzC,WAAa,EAAA;AAAA,QACX,CAACF,gCAAmB,GAAG,WAAA;AAAA,QACvB,CAACG,uCAA0B,GAAG,cAAA;AAAA,OAChC;AAAA,KACF;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,MAAM,QAAS,CAAA,IAAA;AAAA,MACf,QAAQ,QAAS,CAAA,MAAA;AAAA,MACjB,UAAU,QAAS,CAAA,QAAA;AAAA,KACrB;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -171,39 +171,12 @@ type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorE
|
|
|
171
171
|
* @public
|
|
172
172
|
*/
|
|
173
173
|
declare const processingResult: Readonly<{
|
|
174
|
-
/**
|
|
175
|
-
* Associates a NotFoundError with the processing state of the current entity.
|
|
176
|
-
*/
|
|
177
174
|
readonly notFoundError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult;
|
|
178
|
-
/**
|
|
179
|
-
* Associates an InputError with the processing state of the current entity.
|
|
180
|
-
*/
|
|
181
175
|
readonly inputError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult;
|
|
182
|
-
/**
|
|
183
|
-
* Associates a general Error with the processing state of the current entity.
|
|
184
|
-
*/
|
|
185
176
|
readonly generalError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult;
|
|
186
|
-
/**
|
|
187
|
-
* Emits a location. In effect, this is analogous to emitting a Location kind
|
|
188
|
-
* child entity. This is commonly used in discovery processors. Do not use
|
|
189
|
-
* this while processing Location entities.
|
|
190
|
-
*/
|
|
191
177
|
readonly location: (newLocation: LocationSpec$1) => CatalogProcessorResult;
|
|
192
|
-
/**
|
|
193
|
-
* Emits a child of the current entity, associated with a certain location.
|
|
194
|
-
*/
|
|
195
178
|
readonly entity: (atLocation: LocationSpec$1, newEntity: Entity) => CatalogProcessorResult;
|
|
196
|
-
/**
|
|
197
|
-
* Emits a relation owned by the current entity. The relation does not have to
|
|
198
|
-
* start or end at the current entity. The relation only lives for as long as
|
|
199
|
-
* the current entity lives.
|
|
200
|
-
*/
|
|
201
179
|
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
202
|
-
/**
|
|
203
|
-
* Associates the given refresh key with the current entity. The effect of
|
|
204
|
-
* this is that the entity will be marked for refresh when such requests are
|
|
205
|
-
* made.
|
|
206
|
-
*/
|
|
207
180
|
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
208
181
|
}>;
|
|
209
182
|
|
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.4.6
|
|
4
|
+
"version": "1.4.6",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"postpack": "backstage-cli package postpack"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@backstage/backend-plugin-api": "^0.6.5
|
|
43
|
+
"@backstage/backend-plugin-api": "^0.6.5",
|
|
44
44
|
"@backstage/catalog-client": "^1.4.4",
|
|
45
45
|
"@backstage/catalog-model": "^1.4.2",
|
|
46
46
|
"@backstage/errors": "^1.2.2",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@backstage/types": "^1.1.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@backstage/backend-common": "^0.19.7
|
|
52
|
-
"@backstage/backend-test-utils": "^0.2.6
|
|
53
|
-
"@backstage/cli": "^0.
|
|
51
|
+
"@backstage/backend-common": "^0.19.7",
|
|
52
|
+
"@backstage/backend-test-utils": "^0.2.6",
|
|
53
|
+
"@backstage/cli": "^0.22.13"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
56
|
"dist",
|