First skeleton

This commit is contained in:
Daniel Kluge
2023-10-16 12:55:31 +02:00
parent 696da82e10
commit 2bf455b44a
11 changed files with 189 additions and 40 deletions
+7
View File
@@ -0,0 +1,7 @@
import type { types } from "@aas-core-works/aas-core3.0rc02-typescript";
type AASParsingType = types.Environment | types.AssetAdministrationShell | types.Submodel;
export interface Parser<T extends AASParsingType> {
parse(): T | T[];
}
+21
View File
@@ -0,0 +1,21 @@
import { readdir, readFile } from "fs/promises";
export async function getAllAASFiles(aasPath: string): Promise<string[]> {
const files = await readdir(aasPath);
return files.filter(file => file.endsWith(".json")).map(file => `${aasPath}/${file}`);
}
export async function getAASFileContent(aasPath: string): Promise<string> {
const content = await readFile(aasPath, { encoding: "utf-8" });
return content;
}
export async function getAllAASFileContents(aasPath: string): Promise<string[]> {
const files = await getAllAASFiles(aasPath)
const content = [];
for (const file of files) {
content.push(await getAASFileContent(file));
}
return content;
}
+12
View File
@@ -0,0 +1,12 @@
import type { types } from "@aas-core-works/aas-core3.0rc02-typescript";
type AASRequestType = types.Environment | types.Submodel;
type AASResponseType = types.BasicEventElement | types.ValueList;
interface RequestTransformer<T extends AASRequestType, U> {
transform(request: T): U;
}
interface NorthboundResponseTransformer<T, U extends AASResponseType> {
transform(response: T): U;
}