feat(tech-inights): adds getFactSchemas method to client

Signed-off-by: Fernando.Teixeira <fernando.Teixeira@traderev.com>
This commit is contained in:
Fernando.Teixeira
2023-01-25 14:09:15 -05:00
parent bcb490f4db
commit 4024b37449
7 changed files with 85 additions and 59 deletions
+1 -57
View File
@@ -20,6 +20,7 @@ import {
PluginEndpointDiscovery,
TokenManager,
} from '@backstage/backend-common';
import { FactSchema } from '@backstage/plugin-tech-insights-common';
import { Logger } from 'winston';
/**
@@ -79,63 +80,6 @@ export type FlatTechInsightFact = TechInsightFact & {
id: string;
};
/**
* A record type to specify individual fact shapes
*
* Used as part of a schema to validate, identify and generically construct usage implementations
* of individual fact values in the system.
*
* @public
*/
export type FactSchema = {
/**
* Name of the fact
*/
[name: string]: {
/**
* Type of the individual fact value
*
* Numbers are split into integers and floating point values.
* `set` indicates a collection of values, `object` indicates JSON serializable value
*/
type:
| 'integer'
| 'float'
| 'string'
| 'boolean'
| 'datetime'
| 'set'
| 'object';
/**
* A description of this individual fact value
*/
description: string;
/**
* Optional semver string to indicate when this specific fact definition was added to the schema
*/
since?: string;
/**
* Metadata related to an individual fact.
* Can contain links, additional description texts and other actionable data.
*
* Currently loosely typed, but in the future when patterns emerge, key shapes can be defined
*
* examples:
* ```
* \{
* link: 'https://sonarqube.mycompany.com/fix-these-issues',
* suggestion: 'To affect this value, you can do x, y, z',
* minValue: 0
* \}
* ```
*/
metadata?: Record<string, any>;
};
};
/**
* @public
*
@@ -14,13 +14,13 @@
* limitations under the License.
*/
import {
FactSchema,
TechInsightFact,
FlatTechInsightFact,
FactSchemaDefinition,
FactLifecycle,
} from './facts';
import { DateTime } from 'luxon';
import { FactSchema } from '@backstage/plugin-tech-insights-common';
/**
* TechInsights Database