First skeleton
This commit is contained in:
@@ -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[];
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user