Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
josephgregoryii committed Oct 9, 2024
1 parent 20eddc1 commit be33c35
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
11 changes: 9 additions & 2 deletions utils/build-validate-quickstart-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ const getSchema = (filepath: string): ArtifactSchema => {

// NOTE: we could run these in parallel to speed up the script
export const getArtifactComponents = (): ArtifactComponents => {
const quickstarts = Quickstart.getAll().map((quickstart) => quickstart.transformForArtifact());
const quickstarts = Quickstart
.getAll()
.map((quickstart) => quickstart.transformForArtifact());

console.log(`[*] Found ${quickstarts.length} quickstarts`);

const dataSources = DataSource.getAll().map((dataSource) => dataSource.transformForArtifact());
const dataSources = DataSource
.getAll()
.map((dataSource) => dataSource.transformForArtifact());

console.log(`[*] Found ${dataSources.length} dataSources`);

const alerts = Alert.getAll().reduce((acc, alert) => {
Expand All @@ -49,6 +55,7 @@ export const getArtifactComponents = (): ArtifactComponents => {
return { ...acc, ...conditions }

}, {});

console.log(`[*] Found ${Object.keys(alerts).length} alerts`);

const dashboards = Dashboard.getAll().reduce((acc, dash) => {
Expand Down
8 changes: 5 additions & 3 deletions utils/lib/Quickstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
QuickstartSupportLevel,
} from '../types/QuickstartMutationVariable';
import type { QuickstartConfig } from '../types/QuickstartConfig';
import {ArtifactQuickstartConfig} from '../types/Artifact';
import { ArtifactQuickstartConfig } from '../types/Artifact';

export interface QuickstartMutationResponse {
quickstart: {
Expand Down Expand Up @@ -199,6 +199,10 @@ class Quickstart {
};
}

/**
* Method extracts criteria from the config and returns an object appropriately
* structured for the artifact.
*/
transformForArtifact(): ArtifactQuickstartConfig {
const {
authors,
Expand All @@ -216,7 +220,6 @@ class Quickstart {
alertPolicies = [],
} = this.config;


const metadata = {
quickstartUuid: id,
authors: authors && authors.map((author) => ({ name: author })),
Expand All @@ -242,7 +245,6 @@ class Quickstart {
alertPolicies,
};


return metadata;
}

Expand Down
8 changes: 4 additions & 4 deletions utils/types/DataSourceConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export interface DataSourceConfig {
icon?: string;
}

export type DataSourceConfigInstall<T = DataSourceConfigInstallDirective> = {
primary: T;
fallback?: T;
export type DataSourceConfigInstall = {
primary: DataSourceConfigInstallDirective;
fallback?: DataSourceConfigInstallDirective;
};

export type DataSourceConfigInstallDirective =
Expand All @@ -23,7 +23,7 @@ interface DataSourceConfigLinkDirective {
};
}

export interface DataSourceConfigNerdletDirective {
interface DataSourceConfigNerdletDirective {
nerdlet: {
nerdletId: string;
nerdletState: Record<string, string>;
Expand Down

0 comments on commit be33c35

Please sign in to comment.