-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Exabyte-io/update/SOF-7521-fix
Update/SOF-7521 fix
- Loading branch information
Showing
29 changed files
with
7,362 additions
and
2,730 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,5 +41,6 @@ | |
"@typescript-eslint" | ||
] | ||
} | ||
] | ||
], | ||
"ignorePatterns": ["dist/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Standata } from "./base"; | ||
export declare class ApplicationStandata extends Standata { | ||
static runtimeData: { | ||
standataConfig: { | ||
categories: { | ||
model: string[]; | ||
language_type: string[]; | ||
purpose: string[]; | ||
}; | ||
entities: { | ||
filename: string; | ||
categories: string[]; | ||
}[]; | ||
}; | ||
filesMapByName: { | ||
"espresso_gnu_540.json": { | ||
name: string; | ||
shortName: string; | ||
summary: string; | ||
version: string; | ||
build: string; | ||
hasAdvancedComputeOptions: boolean; | ||
isLicensed: boolean; | ||
}; | ||
"python_386.json": { | ||
name: string; | ||
shortName: string; | ||
summary: string; | ||
version: string; | ||
build: string; | ||
hasAdvancedComputeOptions: boolean; | ||
isLicensed: boolean; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
var __importDefault = | ||
(this && this.__importDefault) || | ||
function (mod) { | ||
return mod && mod.__esModule ? mod : { default: mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ApplicationStandata = void 0; | ||
const base_1 = require("./base"); | ||
const applications_json_1 = __importDefault(require("./runtime_data/applications.json")); | ||
class ApplicationStandata extends base_1.Standata {} | ||
exports.ApplicationStandata = ApplicationStandata; | ||
ApplicationStandata.runtimeData = applications_json_1.default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
interface EntityItem { | ||
filename: string; | ||
categories: string[]; | ||
} | ||
interface EntityCategories { | ||
[key: string]: string[]; | ||
} | ||
export interface StandataConfig { | ||
categories: EntityCategories; | ||
entities: EntityItem[]; | ||
} | ||
interface RuntimeData { | ||
standataConfig: StandataConfig; | ||
filesMapByName: object; | ||
} | ||
export declare class Standata { | ||
static runtimeData: RuntimeData; | ||
static getRuntimeDataConfigs(): any[]; | ||
entities: EntityItem[]; | ||
categories: string[]; | ||
protected categoryMap: EntityCategories; | ||
protected lookupTable: { | ||
[key: string]: Set<string>; | ||
}; | ||
constructor(config?: StandataConfig); | ||
flattenCategories(separator?: string): string[]; | ||
convertTagToCategory(...tags: string[]): string[]; | ||
protected createLookupTable(): { | ||
[key: string]: Set<string>; | ||
}; | ||
protected loadEntity(filename: string): object | undefined; | ||
protected filterByCategories(...categories: string[]): string[]; | ||
findEntitiesByTags(...tags: string[]): object[]; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Standata = void 0; | ||
class Standata { | ||
static getRuntimeDataConfigs() { | ||
return Object.values(this.runtimeData.filesMapByName); | ||
} | ||
constructor(config) { | ||
const ctor = this.constructor; | ||
this.categoryMap = config ? config.categories : ctor.runtimeData.standataConfig.categories; | ||
this.entities = config ? config.entities : ctor.runtimeData.standataConfig.entities; | ||
this.categories = this.flattenCategories(); | ||
this.lookupTable = this.createLookupTable(); | ||
} | ||
flattenCategories(separator = "/") { | ||
const categories = Object.entries(this.categoryMap) | ||
.flatMap(([type, tags]) => tags.map((t) => `${type}${separator}${t}`)) | ||
.sort((a, b) => a.localeCompare(b)); | ||
return [...new Set(categories)]; | ||
} | ||
convertTagToCategory(...tags) { | ||
return this.categories.filter((c) => tags.some((t) => c.split("/")[1] === t)); | ||
} | ||
createLookupTable() { | ||
const lookupTable = {}; | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const entity of this.entities) { | ||
const categories_ = this.convertTagToCategory(...entity.categories); | ||
const { filename } = entity; | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const category of categories_) { | ||
if (category in lookupTable) { | ||
lookupTable[category].add(filename); | ||
} else { | ||
lookupTable[category] = new Set([filename]); | ||
} | ||
} | ||
} | ||
return lookupTable; | ||
} | ||
loadEntity(filename) { | ||
var _a, _b; | ||
const ctor = this.constructor; | ||
return (_b = | ||
(_a = ctor.runtimeData) === null || _a === void 0 ? void 0 : _a.filesMapByName) === | ||
null || _b === void 0 | ||
? void 0 | ||
: _b[filename]; | ||
} | ||
filterByCategories(...categories) { | ||
if (!categories.length) { | ||
return []; | ||
} | ||
let filenames = this.entities.map((e) => e.filename); | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const category of categories) { | ||
filenames = filenames.filter((f) => { | ||
var _a; | ||
return (_a = this.lookupTable[category]) === null || _a === void 0 | ||
? void 0 | ||
: _a.has(f); | ||
}); | ||
} | ||
return filenames; | ||
} | ||
findEntitiesByTags(...tags) { | ||
const categories_ = this.convertTagToCategory(...tags); | ||
const filenames = this.filterByCategories(...categories_) || []; | ||
return filenames.map((f) => this.loadEntity(f)).filter((e) => e !== undefined); | ||
} | ||
} | ||
exports.Standata = Standata; | ||
Standata.runtimeData = { | ||
standataConfig: { entities: [], categories: {} }, | ||
filesMapByName: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
Oops, something went wrong.