@backstage/plugin-tech-insights-backend-module-jsonfc
Advanced tools
Comparing version 0.0.0-nightly-20240416021242 to 0.0.0-nightly-20240420021132
# @backstage/plugin-tech-insights-backend-module-jsonfc | ||
## 0.0.0-nightly-20240416021242 | ||
## 0.0.0-nightly-20240420021132 | ||
### Patch Changes | ||
- 4565cda: These packages have been migrated to the [backstage/community-plugins](https://github.com/backstage/community-plugins) repository. | ||
- Updated dependencies | ||
- @backstage/plugin-tech-insights-common@0.0.0-nightly-20240420021132 | ||
- @backstage/plugin-tech-insights-node@0.0.0-nightly-20240420021132 | ||
- @backstage/backend-plugin-api@0.0.0-nightly-20240420021132 | ||
- @backstage/backend-common@0.0.0-nightly-20240420021132 | ||
- @backstage/config@1.2.0 | ||
- @backstage/errors@1.2.4 | ||
- @backstage/types@1.1.1 | ||
## 0.1.49 | ||
### Patch Changes | ||
- d5a1fe1: Replaced winston logger with `LoggerService` | ||
- Updated dependencies | ||
- @backstage/backend-common@0.0.0-nightly-20240416021242 | ||
- @backstage/plugin-tech-insights-node@0.0.0-nightly-20240416021242 | ||
- @backstage/backend-plugin-api@0.0.0-nightly-20240416021242 | ||
- @backstage/backend-common@0.21.7 | ||
- @backstage/plugin-tech-insights-node@0.6.0 | ||
- @backstage/backend-plugin-api@0.6.17 | ||
- @backstage/config@1.2.0 | ||
@@ -13,0 +27,0 @@ - @backstage/errors@1.2.4 |
{ | ||
"name": "@backstage/plugin-tech-insights-backend-module-jsonfc", | ||
"version": "0.0.0-nightly-20240416021242", | ||
"version": "0.0.0-nightly-20240420021132", | ||
"backstage": { | ||
"role": "backend-plugin-module" | ||
"role": "backend-plugin-module", | ||
"moved": "@backstage-community/plugin-tech-insights-backend-module-jsonfc" | ||
}, | ||
@@ -40,8 +41,8 @@ "publishConfig": { | ||
"dependencies": { | ||
"@backstage/backend-common": "^0.0.0-nightly-20240416021242", | ||
"@backstage/backend-plugin-api": "^0.0.0-nightly-20240416021242", | ||
"@backstage/backend-common": "^0.0.0-nightly-20240420021132", | ||
"@backstage/backend-plugin-api": "^0.0.0-nightly-20240420021132", | ||
"@backstage/config": "^1.2.0", | ||
"@backstage/errors": "^1.2.4", | ||
"@backstage/plugin-tech-insights-common": "^0.2.12", | ||
"@backstage/plugin-tech-insights-node": "^0.0.0-nightly-20240416021242", | ||
"@backstage/plugin-tech-insights-common": "^0.0.0-nightly-20240420021132", | ||
"@backstage/plugin-tech-insights-node": "^0.0.0-nightly-20240420021132", | ||
"@backstage/types": "^1.1.1", | ||
@@ -54,6 +55,7 @@ "ajv": "^8.10.0", | ||
"devDependencies": { | ||
"@backstage/backend-test-utils": "^0.0.0-nightly-20240416021242", | ||
"@backstage/cli": "^0.0.0-nightly-20240416021242" | ||
"@backstage/backend-test-utils": "^0.0.0-nightly-20240420021132", | ||
"@backstage/cli": "^0.0.0-nightly-20240420021132" | ||
}, | ||
"configSchema": "config.json" | ||
"configSchema": "config.json", | ||
"deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-tech-insights-backend-module-jsonfc instead." | ||
} |
156
README.md
@@ -1,155 +0,3 @@ | ||
# Tech Insights Backend JSON Rules engine fact checker module | ||
# Deprecated | ||
This is an extension to module to tech-insights-backend plugin, which provides basic framework and functionality to implement tech insights within Backstage. | ||
This module provides functionality to run checks against a [json-rules-engine](https://github.com/CacheControl/json-rules-engine) and provide boolean logic by simply building checks using JSON conditions. | ||
## Getting started | ||
To add this FactChecker into your Tech Insights you need to install the module into your backend application: | ||
```bash | ||
# From your Backstage root directory | ||
yarn --cwd packages/backend add @backstage/plugin-tech-insights-backend-module-jsonfc | ||
``` | ||
### Add to the backend | ||
```ts title="packages/backend/src/index.ts" | ||
backend.add(import('@backstage/plugin-tech-insights-backend-module-jsonfc')); | ||
``` | ||
This setup requires checks to be provided using the config. | ||
### Add to the backend (old) | ||
Modify the `techInsights.ts` file to contain a reference to the FactCheckers implementation. | ||
```diff | ||
+import { JsonRulesEngineFactCheckerFactory } from '@backstage/plugin-tech-insights-backend-module-jsonfc'; | ||
+const myFactCheckerFactory = new JsonRulesEngineFactCheckerFactory({ | ||
+ checks: [], | ||
+ logger: env.logger, | ||
+}), | ||
const builder = buildTechInsightsContext({ | ||
logger: env.logger, | ||
config: env.config, | ||
database: env.database, | ||
discovery: env.discovery, | ||
tokenManager: env.tokenManager, | ||
factRetrievers: [myFactRetrieverRegistration], | ||
+ factCheckerFactory: myFactCheckerFactory | ||
}); | ||
``` | ||
By default, this implementation comes with an in-memory storage to store checks. You can inject an additional data store by adding an implementation of `TechInsightCheckRegistry` into the constructor options when creating a `JsonRulesEngineFactCheckerFactory`. That can be done as follows | ||
```diff | ||
const myTechInsightCheckRegistry: TechInsightCheckRegistry<MyCheckType> = // snip | ||
const myFactCheckerFactory = new JsonRulesEngineFactCheckerFactory({ | ||
checks: [], | ||
logger: env.logger, | ||
+ checkRegistry: myTechInsightCheckRegistry | ||
}), | ||
``` | ||
## Adding checks in code | ||
Checks for this FactChecker are constructed as [`json-rules-engine` compatible JSON rules](https://github.com/CacheControl/json-rules-engine/blob/master/docs/rules.md#conditions). A check could look like the following for example: | ||
```ts | ||
import { | ||
JSON_RULE_ENGINE_CHECK_TYPE, | ||
TechInsightJsonRuleCheck, | ||
} from '@backstage/plugin-tech-insights-backend-module-jsonfc'; | ||
export const exampleCheck: TechInsightJsonRuleCheck = { | ||
id: 'demodatacheck', // Unique identifier of this check | ||
name: 'demodatacheck', // A human readable name of this check to be displayed in the UI | ||
type: JSON_RULE_ENGINE_CHECK_TYPE, // Type identifier of the check. Used to run logic against, determine persistence option to use and render correct components on the UI | ||
description: 'A fact check for demoing purposes', // A description to be displayed in the UI | ||
factIds: ['documentation-number-factretriever'], // References to fact ids that this check uses. See documentation on FactRetrievers for more information on these | ||
rule: { | ||
// The actual rule | ||
conditions: { | ||
all: [ | ||
// 2 options are available, all and any conditions. | ||
{ | ||
fact: 'examplenumberfact', // Reference to an individual fact to check against | ||
operator: 'greaterThanInclusive', // Operator to use. See: https://github.com/CacheControl/json-rules-engine/blob/master/docs/rules.md#operators for more | ||
value: 2, // The threshold value that the fact must satisfy | ||
}, | ||
], | ||
}, | ||
}, | ||
successMetadata: { | ||
// Additional metadata to be returned if the check has passed | ||
link: 'https://link.to.some.information.com', | ||
}, | ||
failureMetadata: { | ||
// Additional metadata to be returned if the check has failed | ||
link: 'https://sonar.mysonarqube.com/increasing-number-value', | ||
}, | ||
}; | ||
``` | ||
## Adding checks in config | ||
Example: | ||
```yaml title="app-config.yaml" | ||
techInsights: | ||
factChecker: | ||
checks: | ||
groupOwnerCheck: | ||
type: json-rules-engine | ||
name: Group Owner Check | ||
description: Verifies that a group has been set as the spec.owner for this entity | ||
factIds: | ||
- entityOwnershipFactRetriever | ||
rule: | ||
conditions: | ||
all: | ||
- fact: hasGroupOwner | ||
operator: equal | ||
value: true | ||
``` | ||
### More than one `factIds` for a check. | ||
When more than one is supplied, the requested fact **MUST** be present in at least one of the fact retrievers. | ||
The order of the fact retrievers defined in the `factIds` array has no bearing on the checks, the check will merge all facts from the various retrievers, and then check against latest fact . | ||
# Custom operators | ||
json-rules-engine supports a limited [number of built-in operators](https://github.com/CacheControl/json-rules-engine/blob/master/docs/rules.md#operators) that can be used in conditions. You can add your own operators by adding them to the `operators` array in the `JsonRulesEngineFactCheckerFactory` constructor. For example: | ||
```diff | ||
+ import { Operator } from 'json-rules-engine'; | ||
const myFactCheckerFactory = new JsonRulesEngineFactCheckerFactory({ | ||
checks: [], | ||
logger: env.logger, | ||
+ operators: [ new Operator("startsWith", (a, b) => a.startsWith(b) ] | ||
}) | ||
``` | ||
And you can then use it in your checks like this: | ||
```js | ||
... | ||
rule: { | ||
conditions: { | ||
any: [ | ||
{ | ||
fact: 'version', | ||
operator: 'startsWith', | ||
value: '12', | ||
}, | ||
], | ||
}, | ||
} | ||
``` | ||
This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-tech-insights-backend-module-jsonfc` instead. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98700
1
4
+ Added@aws-sdk/client-codecommit@3.654.0(transitive)
+ Added@aws-sdk/client-cognito-identity@3.654.0(transitive)
+ Added@aws-sdk/client-s3@3.654.0(transitive)
+ Added@aws-sdk/client-sso@3.654.0(transitive)
+ Added@aws-sdk/client-sso-oidc@3.654.0(transitive)
+ Added@aws-sdk/client-sts@3.654.0(transitive)
+ Added@aws-sdk/core@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-cognito-identity@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-env@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-http@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-ini@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-node@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-process@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-sso@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-web-identity@3.654.0(transitive)
+ Added@aws-sdk/credential-providers@3.654.0(transitive)
+ Added@aws-sdk/middleware-bucket-endpoint@3.654.0(transitive)
+ Added@aws-sdk/middleware-expect-continue@3.654.0(transitive)
+ Added@aws-sdk/middleware-flexible-checksums@3.654.0(transitive)
+ Added@aws-sdk/middleware-host-header@3.654.0(transitive)
+ Added@aws-sdk/middleware-location-constraint@3.654.0(transitive)
+ Added@aws-sdk/middleware-logger@3.654.0(transitive)
+ Added@aws-sdk/middleware-recursion-detection@3.654.0(transitive)
+ Added@aws-sdk/middleware-sdk-s3@3.654.0(transitive)
+ Added@aws-sdk/middleware-ssec@3.654.0(transitive)
+ Added@aws-sdk/middleware-user-agent@3.654.0(transitive)
+ Added@aws-sdk/region-config-resolver@3.654.0(transitive)
+ Added@aws-sdk/signature-v4-multi-region@3.654.0(transitive)
+ Added@aws-sdk/token-providers@3.654.0(transitive)
+ Added@aws-sdk/types@3.654.0(transitive)
+ Added@aws-sdk/util-endpoints@3.654.0(transitive)
+ Added@aws-sdk/util-user-agent-browser@3.654.0(transitive)
+ Added@aws-sdk/util-user-agent-node@3.654.0(transitive)
+ Added@aws-sdk/xml-builder@3.654.0(transitive)
+ Added@azure/core-auth@1.8.0(transitive)
+ Added@azure/core-rest-pipeline@1.17.0(transitive)
+ Added@azure/core-util@1.10.0(transitive)
+ Added@backstage/backend-common@0.0.0-nightly-202409170218060.25.0(transitive)
+ Added@backstage/backend-plugin-api@0.0.0-nightly-202409190231431.0.0(transitive)
+ Added@backstage/catalog-client@1.7.0(transitive)
+ Added@backstage/catalog-model@1.7.0(transitive)
+ Added@backstage/config-loader@0.0.0-nightly-202409170218061.9.1(transitive)
+ Added@backstage/integration@0.0.0-nightly-202409170218061.15.0(transitive)
+ Added@backstage/plugin-auth-node@0.0.0-nightly-202409190231430.5.2(transitive)
+ Added@google-cloud/storage@7.13.0(transitive)
+ Added@smithy/abort-controller@3.1.4(transitive)
+ Added@smithy/config-resolver@3.0.8(transitive)
+ Added@smithy/core@2.4.3(transitive)
+ Added@smithy/credential-provider-imds@3.2.3(transitive)
+ Added@smithy/eventstream-codec@3.1.5(transitive)
+ Added@smithy/eventstream-serde-browser@3.0.9(transitive)
+ Added@smithy/eventstream-serde-config-resolver@3.0.6(transitive)
+ Added@smithy/eventstream-serde-node@3.0.8(transitive)
+ Added@smithy/eventstream-serde-universal@3.0.8(transitive)
+ Added@smithy/fetch-http-handler@3.2.7(transitive)
+ Added@smithy/hash-blob-browser@3.1.5(transitive)
+ Added@smithy/hash-node@3.0.6(transitive)
+ Added@smithy/hash-stream-node@3.1.5(transitive)
+ Added@smithy/invalid-dependency@3.0.6(transitive)
+ Added@smithy/md5-js@3.0.6(transitive)
+ Added@smithy/middleware-content-length@3.0.8(transitive)
+ Added@smithy/middleware-endpoint@3.1.3(transitive)
+ Added@smithy/middleware-retry@3.0.18(transitive)
+ Added@smithy/middleware-serde@3.0.6(transitive)
+ Added@smithy/middleware-stack@3.0.6(transitive)
+ Added@smithy/node-config-provider@3.1.7(transitive)
+ Added@smithy/node-http-handler@3.2.2(transitive)
+ Added@smithy/property-provider@3.1.6(transitive)
+ Added@smithy/protocol-http@4.1.3(transitive)
+ Added@smithy/querystring-builder@3.0.6(transitive)
+ Added@smithy/querystring-parser@3.0.6(transitive)
+ Added@smithy/service-error-classification@3.0.6(transitive)
+ Added@smithy/shared-ini-file-loader@3.1.7(transitive)
+ Added@smithy/signature-v4@4.1.3(transitive)
+ Added@smithy/smithy-client@3.3.2(transitive)
+ Added@smithy/types@3.4.2(transitive)
+ Added@smithy/url-parser@3.0.6(transitive)
+ Added@smithy/util-defaults-mode-browser@3.0.18(transitive)
+ Added@smithy/util-defaults-mode-node@3.0.18(transitive)
+ Added@smithy/util-endpoints@2.1.2(transitive)
+ Added@smithy/util-middleware@3.0.6(transitive)
+ Added@smithy/util-retry@3.0.6(transitive)
+ Added@smithy/util-stream@3.1.6(transitive)
+ Added@smithy/util-waiter@3.1.5(transitive)
+ Added@types/jsonwebtoken@9.0.7(transitive)
+ Added@types/qs@6.9.16(transitive)
+ Addedjose@5.9.2(transitive)
+ Addedmysql2@3.11.3(transitive)
+ Addedpg@8.13.0(transitive)
+ Addedpg-connection-string@2.7.0(transitive)
+ Addedpg-pool@3.7.0(transitive)
+ Addedpg-protocol@1.7.0(transitive)
+ Addedssh2@1.16.0(transitive)
+ Addedstreamx@2.20.1(transitive)
+ Addedtext-decoder@1.2.0(transitive)
- Removed@aws-sdk/client-codecommit@3.650.0(transitive)
- Removed@aws-sdk/client-cognito-identity@3.650.0(transitive)
- Removed@aws-sdk/client-s3@3.650.0(transitive)
- Removed@aws-sdk/client-sso@3.650.0(transitive)
- Removed@aws-sdk/client-sso-oidc@3.650.0(transitive)
- Removed@aws-sdk/client-sts@3.650.0(transitive)
- Removed@aws-sdk/core@3.649.0(transitive)
- Removed@aws-sdk/credential-provider-cognito-identity@3.650.0(transitive)
- Removed@aws-sdk/credential-provider-env@3.649.0(transitive)
- Removed@aws-sdk/credential-provider-http@3.649.0(transitive)
- Removed@aws-sdk/credential-provider-ini@3.650.0(transitive)
- Removed@aws-sdk/credential-provider-node@3.650.0(transitive)
- Removed@aws-sdk/credential-provider-process@3.649.0(transitive)
- Removed@aws-sdk/credential-provider-sso@3.650.0(transitive)
- Removed@aws-sdk/credential-provider-web-identity@3.649.0(transitive)
- Removed@aws-sdk/credential-providers@3.650.0(transitive)
- Removed@aws-sdk/middleware-bucket-endpoint@3.649.0(transitive)
- Removed@aws-sdk/middleware-expect-continue@3.649.0(transitive)
- Removed@aws-sdk/middleware-flexible-checksums@3.649.0(transitive)
- Removed@aws-sdk/middleware-host-header@3.649.0(transitive)
- Removed@aws-sdk/middleware-location-constraint@3.649.0(transitive)
- Removed@aws-sdk/middleware-logger@3.649.0(transitive)
- Removed@aws-sdk/middleware-recursion-detection@3.649.0(transitive)
- Removed@aws-sdk/middleware-sdk-s3@3.649.0(transitive)
- Removed@aws-sdk/middleware-ssec@3.649.0(transitive)
- Removed@aws-sdk/middleware-user-agent@3.649.0(transitive)
- Removed@aws-sdk/region-config-resolver@3.649.0(transitive)
- Removed@aws-sdk/signature-v4-multi-region@3.649.0(transitive)
- Removed@aws-sdk/token-providers@3.649.0(transitive)
- Removed@aws-sdk/types@3.649.0(transitive)
- Removed@aws-sdk/util-endpoints@3.649.0(transitive)
- Removed@aws-sdk/util-user-agent-browser@3.649.0(transitive)
- Removed@aws-sdk/util-user-agent-node@3.649.0(transitive)
- Removed@aws-sdk/xml-builder@3.649.0(transitive)
- Removed@azure/core-auth@1.7.2(transitive)
- Removed@azure/core-rest-pipeline@1.16.3(transitive)
- Removed@azure/core-util@1.9.2(transitive)
- Removed@backstage/backend-common@0.0.0-nightly-20240912022955(transitive)
- Removed@backstage/backend-plugin-api@0.0.0-nightly-20240912022955(transitive)
- Removed@backstage/catalog-client@0.0.0-nightly-20240912022955(transitive)
- Removed@backstage/catalog-model@1.6.0(transitive)
- Removed@backstage/config-loader@0.0.0-nightly-20240912022955(transitive)
- Removed@backstage/integration@0.0.0-nightly-20240912022955(transitive)
- Removed@backstage/plugin-auth-node@0.0.0-nightly-20240912022955(transitive)
- Removed@backstage/plugin-tech-insights-common@0.2.13(transitive)
- Removed@google-cloud/storage@7.12.1(transitive)
- Removed@smithy/abort-controller@3.1.2(transitive)
- Removed@smithy/config-resolver@3.0.6(transitive)
- Removed@smithy/core@2.4.1(transitive)
- Removed@smithy/credential-provider-imds@3.2.1(transitive)
- Removed@smithy/eventstream-codec@3.1.3(transitive)
- Removed@smithy/eventstream-serde-browser@3.0.7(transitive)
- Removed@smithy/eventstream-serde-config-resolver@3.0.4(transitive)
- Removed@smithy/eventstream-serde-node@3.0.6(transitive)
- Removed@smithy/eventstream-serde-universal@3.0.6(transitive)
- Removed@smithy/fetch-http-handler@3.2.5(transitive)
- Removed@smithy/hash-blob-browser@3.1.3(transitive)
- Removed@smithy/hash-node@3.0.4(transitive)
- Removed@smithy/hash-stream-node@3.1.3(transitive)
- Removed@smithy/invalid-dependency@3.0.4(transitive)
- Removed@smithy/md5-js@3.0.4(transitive)
- Removed@smithy/middleware-content-length@3.0.6(transitive)
- Removed@smithy/middleware-endpoint@3.1.1(transitive)
- Removed@smithy/middleware-retry@3.0.16(transitive)
- Removed@smithy/middleware-serde@3.0.4(transitive)
- Removed@smithy/middleware-stack@3.0.4(transitive)
- Removed@smithy/node-config-provider@3.1.5(transitive)
- Removed@smithy/node-http-handler@3.2.0(transitive)
- Removed@smithy/property-provider@3.1.4(transitive)
- Removed@smithy/protocol-http@4.1.1(transitive)
- Removed@smithy/querystring-builder@3.0.4(transitive)
- Removed@smithy/querystring-parser@3.0.4(transitive)
- Removed@smithy/service-error-classification@3.0.4(transitive)
- Removed@smithy/shared-ini-file-loader@3.1.5(transitive)
- Removed@smithy/signature-v4@4.1.1(transitive)
- Removed@smithy/smithy-client@3.3.0(transitive)
- Removed@smithy/types@3.4.0(transitive)
- Removed@smithy/url-parser@3.0.4(transitive)
- Removed@smithy/util-defaults-mode-browser@3.0.16(transitive)
- Removed@smithy/util-defaults-mode-node@3.0.16(transitive)
- Removed@smithy/util-endpoints@2.1.0(transitive)
- Removed@smithy/util-middleware@3.0.4(transitive)
- Removed@smithy/util-retry@3.0.4(transitive)
- Removed@smithy/util-stream@3.1.4(transitive)
- Removed@smithy/util-waiter@3.1.3(transitive)
- Removed@types/jsonwebtoken@9.0.6(transitive)
- Removed@types/qs@6.9.15(transitive)
- Removedjose@5.8.0(transitive)
- Removedmysql2@3.11.2(transitive)
- Removedpg@8.12.0(transitive)
- Removedpg-connection-string@2.6.4(transitive)
- Removedpg-pool@3.6.2(transitive)
- Removedpg-protocol@1.6.1(transitive)
- Removedssh2@1.15.0(transitive)
- Removedstreamx@2.20.0(transitive)
- Removedtext-decoder@1.1.1(transitive)
Updated@backstage/backend-common@^0.0.0-nightly-20240420021132
Updated@backstage/backend-plugin-api@^0.0.0-nightly-20240420021132
Updated@backstage/plugin-tech-insights-common@^0.0.0-nightly-20240420021132
Updated@backstage/plugin-tech-insights-node@^0.0.0-nightly-20240420021132