Split lib from modules
This commit is contained in:
Generated
+1518
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "example",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/express": "^4.17.20",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"typescript": "^5.2.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"mqtt": "^5.1.4",
|
||||||
|
"prototyp": "file:../lib"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { MultiMessageBroker, FileImporter } from "prototyp";
|
||||||
|
|
||||||
|
import HTTPInterfaceServer from "./modules/httpInterfaceServer";
|
||||||
|
import MQTTConnector from "./modules/mqttConnector";
|
||||||
|
|
||||||
|
const aas = FileImporter.readAASByPath("../owntest.json");
|
||||||
|
|
||||||
|
const broker = new MultiMessageBroker();
|
||||||
|
broker.registerInterfaceConnection({ interfaceConnection: MQTTConnector, config: { reconnectPeriod: 1000 }})
|
||||||
|
broker.registerAAS({ aas, serverInterfaces: { serverInterface: HTTPInterfaceServer, config: { bindPort: 3000, bindAddress: "0.0.0.0" } } });
|
||||||
|
|
||||||
|
broker.prepare();
|
||||||
|
broker.start();
|
||||||
+19
-24
@@ -1,20 +1,16 @@
|
|||||||
import type { Express } from "express";
|
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { jsonization, types } from "@aas-core-works/aas-core3.0-typescript";
|
import { AbstractInterfaceServer, Types, Traverser, AASCoreJsonization, AASCoreTypes } from "prototyp";
|
||||||
import AASInterfaceServer from "../server";
|
|
||||||
import type { OnRequestCallback, Request } from "../types/requests";
|
|
||||||
import Traverser from "../helper/traverser";
|
|
||||||
|
|
||||||
export type Config = {
|
export type Config = {
|
||||||
bindAddress: string,
|
bindAddress: string,
|
||||||
bindPort: number,
|
bindPort: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
export default class HTTPInterfaceServer extends AbstractInterfaceServer<Config> {
|
||||||
public static serverInterfaceName: string = "HTTPInterfaceServer";
|
public static serverInterfaceName: string = "HTTPInterfaceServer";
|
||||||
public static supportsSubscriptions: boolean = false; // TODO, longpolling?
|
public static supportsSubscriptions: boolean = false; // TODO, longpolling?
|
||||||
|
|
||||||
private app: Express = express();
|
private app: express.Express = express();
|
||||||
private server: any = null;
|
private server: any = null;
|
||||||
private observers: any[] = [];
|
private observers: any[] = [];
|
||||||
|
|
||||||
@@ -62,12 +58,8 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.app.use("/*", (req, res, next) => {
|
|
||||||
console.log(req.originalUrl); next();
|
|
||||||
});
|
|
||||||
|
|
||||||
// /aas
|
// /aas
|
||||||
this.app.get("/aas", (_, res) => res.json(jsonization.toJsonable(this.aas)).end());
|
this.app.get("/aas", (_, res) => res.json(AASCoreJsonization.toJsonable(this.aas)).end());
|
||||||
this.app.put("/aas", NOT_IMPLEMENTED);
|
this.app.put("/aas", NOT_IMPLEMENTED);
|
||||||
this.app.delete("/aas", NOT_IMPLEMENTED);
|
this.app.delete("/aas", NOT_IMPLEMENTED);
|
||||||
// /aas/$reference
|
// /aas/$reference
|
||||||
@@ -87,7 +79,7 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
const sm = getSM(req.params.smId);
|
const sm = getSM(req.params.smId);
|
||||||
|
|
||||||
if (sm === null) return res.status(404).end();
|
if (sm === null) return res.status(404).end();
|
||||||
return res.json(jsonization.toJsonable(sm)).end()
|
return res.json(AASCoreJsonization.toJsonable(sm)).end()
|
||||||
});
|
});
|
||||||
this.app.put("/aas/submodels/:smId", NOT_IMPLEMENTED);
|
this.app.put("/aas/submodels/:smId", NOT_IMPLEMENTED);
|
||||||
this.app.patch("/aas/submodels/:smId", NOT_IMPLEMENTED);
|
this.app.patch("/aas/submodels/:smId", NOT_IMPLEMENTED);
|
||||||
@@ -101,7 +93,7 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
const sm = getSM(req.params.smId);
|
const sm = getSM(req.params.smId);
|
||||||
|
|
||||||
if (sm === null || sm.submodelElements === null) return res.status(404).end();
|
if (sm === null || sm.submodelElements === null) return res.status(404).end();
|
||||||
return res.json(sm.submodelElements.map(element => jsonization.toJsonable(element))).end();
|
return res.json(sm.submodelElements.map(element => AASCoreJsonization.toJsonable(element))).end();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Main function
|
// Main function
|
||||||
@@ -114,7 +106,7 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
|
|
||||||
if (idShortPathString === "") {
|
if (idShortPathString === "") {
|
||||||
if (req.method === "GET") {
|
if (req.method === "GET") {
|
||||||
const json = sm.submodelElements.map(element => jsonization.toJsonable(element));
|
const json = sm.submodelElements.map(element => AASCoreJsonization.toJsonable(element));
|
||||||
return res.json(json).end();
|
return res.json(json).end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,22 +123,25 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
|
|
||||||
const idShortPath = endingMatch ? idShortPathString.replace(new RegExp(`${endingMatch}$`), "").split("/") : idShortPathString.split("/");
|
const idShortPath = endingMatch ? idShortPathString.replace(new RegExp(`${endingMatch}$`), "").split("/") : idShortPathString.split("/");
|
||||||
|
|
||||||
console.log(idShortPath, endingMatch)
|
|
||||||
|
|
||||||
switch (endingMatch) {
|
switch (endingMatch) {
|
||||||
case undefined: {
|
case undefined: {
|
||||||
if (req.method !== "GET") return res.status(501).end();
|
if (req.method !== "GET") return res.status(501).end();
|
||||||
const prop = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
const prop = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
||||||
if (prop === null || !types.isProperty(prop)) return res.status(404).end();
|
if (prop === null || !AASCoreTypes.isProperty(prop)) return res.status(404).end();
|
||||||
|
|
||||||
return res.json(jsonization.toJsonable(prop)).end();
|
return res.json(AASCoreJsonization.toJsonable(prop)).end();
|
||||||
}
|
}
|
||||||
case "/value":
|
case "/value":
|
||||||
if (req.method !== "GET" && req.method !== "PUT") return res.status(501).end();
|
if (req.method !== "GET" && req.method !== "PUT") return res.status(501).end();
|
||||||
const prop = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
const prop = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
||||||
if (prop === null || !types.isProperty(prop)) return res.status(404).end();
|
console.log((prop as AASCoreTypes.Property).constructor.name)
|
||||||
|
if (prop === null || !AASCoreTypes.isProperty(prop)) {
|
||||||
|
// @ts-ignore
|
||||||
|
console.log(prop === null, !AASCoreTypes.isProperty(prop))
|
||||||
|
return res.status(404).end();
|
||||||
|
}
|
||||||
|
|
||||||
const request: Request = req.method === "GET" ? { type: "READ", target: prop } : { type: "WRITE", target: prop, extraData: { value: req.body } };
|
const request: Types.RequestTypes.Request = req.method === "GET" ? { type: "READ", target: prop } : { type: "WRITE", target: prop, extraData: { value: req.body } };
|
||||||
|
|
||||||
const value = this.onRequestCallback(request);
|
const value = this.onRequestCallback(request);
|
||||||
|
|
||||||
@@ -159,7 +154,7 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
case "/invoke": {
|
case "/invoke": {
|
||||||
if (req.method !== "POST") return res.status(405).end();
|
if (req.method !== "POST") return res.status(405).end();
|
||||||
const op = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
const op = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
||||||
if (op === null || !types.isOperation(op)) return res.status(404).end();
|
if (op === null || !AASCoreTypes.isOperation(op)) return res.status(404).end();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// Parameter?
|
// Parameter?
|
||||||
@@ -170,11 +165,11 @@ export default class HTTPInterfaceServer extends AASInterfaceServer<Config> {
|
|||||||
case "/invoke-async": {
|
case "/invoke-async": {
|
||||||
if (req.method !== "POST") return res.status(405).end();
|
if (req.method !== "POST") return res.status(405).end();
|
||||||
const op = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
const op = Traverser.getElementByIdPath(this.aas, sm, idShortPath);
|
||||||
if (op === null || !types.isOperation(op)) return res.status(404).end();
|
if (op === null || !AASCoreTypes.isOperation(op)) return res.status(404).end();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// Invoke operation and get handle
|
// Invoke operation and get handle
|
||||||
const request: Request = { type: "CALL-ASYNC", target: op, extraData: { args: req.body } };
|
const request: Types.RequestTypes.Request = { type: "CALL-ASYNC", target: op, extraData: { args: req.body } };
|
||||||
|
|
||||||
const handle = this.onRequestCallback(request);
|
const handle = this.onRequestCallback(request);
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as mqtt from "mqtt";
|
import * as mqtt from "mqtt";
|
||||||
import InterfaceConnectionObject from "../interfaceConnectionObject";
|
import { AbstractConnectionObject } from "prototyp";
|
||||||
import type { types } from "@aas-core-works/aas-core3.0-typescript";
|
import type { AASCoreTypes } from "prototyp";
|
||||||
|
|
||||||
export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClientOptions> {
|
export default class MQTTConnector extends AbstractConnectionObject<mqtt.IClientOptions> {
|
||||||
public static readonly connectorName: string = "MQTT Connector";
|
public static readonly connectorName: string = "MQTT Connector";
|
||||||
public static readonly uriProtocol: string[] = ["mqtt", "mqtts"];
|
public static readonly uriProtocol: string[] = ["mqtt", "mqtts"];
|
||||||
public static readonly connectionType: "ON_DEMAND" | "PERMANENT" = "PERMANENT";
|
public static readonly connectionType: "ON_DEMAND" | "PERMANENT" = "PERMANENT";
|
||||||
@@ -32,7 +32,7 @@ export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClien
|
|||||||
this.client = null;
|
this.client = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public readProperty(prop: types.Property): any {
|
public readProperty(prop: AASCoreTypes.Property): any {
|
||||||
console.log(prop);
|
console.log(prop);
|
||||||
const cc = this.mapper.get(prop);
|
const cc = this.mapper.get(prop);
|
||||||
console.log(cc);
|
console.log(cc);
|
||||||
@@ -60,7 +60,7 @@ export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClien
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public writeProperty(prop: types.Property, value: any): boolean {
|
public writeProperty(prop: AASCoreTypes.Property, value: any): boolean {
|
||||||
const cc = this.mapper.get(prop);
|
const cc = this.mapper.get(prop);
|
||||||
if (cc === undefined || !this.client || !this.client.connected) return false;
|
if (cc === undefined || !this.client || !this.client.connected) return false;
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClien
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public observeProperty(prop: types.Property, callback: (value: any) => void): boolean {
|
public observeProperty(prop: AASCoreTypes.Property, callback: (value: any) => void): boolean {
|
||||||
const cc = this.mapper.get(prop);
|
const cc = this.mapper.get(prop);
|
||||||
if (cc === undefined || !cc.observable || !this.client || !this.client.connected) return false;
|
if (cc === undefined || !cc.observable || !this.client || !this.client.connected) return false;
|
||||||
|
|
||||||
@@ -83,28 +83,28 @@ export default class MQTTConnector extends InterfaceConnectionObject<mqtt.IClien
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public callActionSync(action: types.Operation, args: Record<string, any>): any {
|
public callActionSync(action: AASCoreTypes.Operation, args: Record<string, any>): any {
|
||||||
// TODO
|
// TODO
|
||||||
// Vorher mal ne ordentliche Mapping-Definition
|
// Vorher mal ne ordentliche Mapping-Definition
|
||||||
|
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public callActionAsync(action: types.Operation, args: Record<string, any>): string | null {
|
public callActionAsync(action: AASCoreTypes.Operation, args: Record<string, any>): string | null {
|
||||||
// TODO
|
// TODO
|
||||||
// Vorher mal ne ordentliche Mapping-Definition
|
// Vorher mal ne ordentliche Mapping-Definition
|
||||||
|
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public subscribeEvent(event: types.BasicEventElement, callback: (event: types.BasicEventElement) => void): boolean {
|
public subscribeEvent(event: AASCoreTypes.BasicEventElement, callback: (event: AASCoreTypes.BasicEventElement) => void): boolean {
|
||||||
// TODO
|
// TODO
|
||||||
// Vorher mal ne ordentliche Mapping-Definition
|
// Vorher mal ne ordentliche Mapping-Definition
|
||||||
|
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsubscribeEvent(event: types.BasicEventElement): void {
|
public unsubscribeEvent(event: AASCoreTypes.BasicEventElement): void {
|
||||||
// TODO
|
// TODO
|
||||||
// Vorher mal ne ordentliche Mapping-Definition
|
// Vorher mal ne ordentliche Mapping-Definition
|
||||||
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "commonjs", /* Specify what module code is generated. */
|
||||||
|
"rootDir": "./src", /* Specify the root folder within your source files. */
|
||||||
|
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
"baseUrl": "src", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
"paths": {
|
||||||
|
"types/*": ["types/*"],
|
||||||
|
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||||
|
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||||
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||||
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||||
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
|
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
||||||
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||||
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
|
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
|
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
|
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
|
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
|
"noFallthroughCasesInSwitch": false, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+2
-2402
File diff suppressed because it is too large
Load Diff
+1
-4
@@ -9,17 +9,14 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.19",
|
|
||||||
"@types/node": "^20.8.2",
|
"@types/node": "^20.8.2",
|
||||||
"@types/uuid": "^9.0.6",
|
"@types/uuid": "^9.0.6",
|
||||||
"ts-node": "^10.9.1",
|
|
||||||
"typescript": "^5.2.2"
|
"typescript": "^5.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aas-core-works/aas-core3.0-typescript": "^1.0.0-rc.3",
|
"@aas-core-works/aas-core3.0-typescript": "^1.0.0-rc.3",
|
||||||
"express": "^4.18.2",
|
|
||||||
"mqtt": "^5.1.2",
|
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { types } from "@aas-core-works/aas-core3.0-typescript";
|
import { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||||
import { ConnectionConfiguration, AIMCMap } from "../types/aimcConf";
|
import { ConnectionConfiguration, AIMCMap } from "./types/aimcConf";
|
||||||
import AIMCParser from "./AIMCParser";
|
import AIMCParser from "./parser/AIMCParser";
|
||||||
import Traverser from "../helper/traverser";
|
import Traverser from "./helper/traverser";
|
||||||
import AIDParser from "./AIDParser";
|
import AIDParser from "./parser/AIDParser";
|
||||||
import { SubmodelElementCollection } from "@aas-core-works/aas-core3.0-typescript/dist/types/types";
|
import { SubmodelElementCollection } from "@aas-core-works/aas-core3.0-typescript/dist/types/types";
|
||||||
|
|
||||||
export default class AIMCMapper {
|
export default class AIMCMapper {
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as FileImporter } from "./fileImporter";
|
||||||
|
export { default as Traverser } from "./traverser";
|
||||||
+8
-11
@@ -1,13 +1,10 @@
|
|||||||
import MultiMessageBroker from "./multimessageBroker";
|
export { default as MultiMessageBroker } from "./multimessageBroker";
|
||||||
import HTTPInterfaceServer from "./example_modules/httpInterfaceServer";
|
export { default as AbstractConnectionObject } from "./interfaceConnectionObject";
|
||||||
import FileImporter from "./helper/fileImporter";
|
export { default as AbstractInterfaceServer } from "./server";
|
||||||
import MQTTConnector from "./example_modules/mqttConnector";
|
export { default as AIMCMapper } from "./AIMCMapper";
|
||||||
|
|
||||||
const aas = FileImporter.readAASByPath("../owntest.json");
|
export * as Types from "./types";
|
||||||
|
export { Traverser, FileImporter } from "./helper";
|
||||||
|
export { AIDParser, AIMCParser } from "./parser";
|
||||||
|
|
||||||
const broker = new MultiMessageBroker();
|
export { jsonization as AASCoreJsonization, types as AASCoreTypes } from "@aas-core-works/aas-core3.0-typescript";
|
||||||
broker.registerInterfaceConnection({ interfaceConnection: MQTTConnector, config: { reconnectPeriod: 1000 }})
|
|
||||||
broker.registerAAS({ aas, serverInterfaces: { serverInterface: HTTPInterfaceServer, config: { bindPort: 3000, bindAddress: "0.0.0.0" } } });
|
|
||||||
|
|
||||||
broker.prepare();
|
|
||||||
broker.start();
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { types } from "@aas-core-works/aas-core3.0-typescript";
|
import type { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||||
import AIMCMapper from "./parser/AIMCMapper";
|
import AIMCMapper from "./AIMCMapper";
|
||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import type { EndpointMetadata } from "./types/aidConf";
|
import type { EndpointMetadata } from "./types/aidConf";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { types } from "@aas-core-works/aas-core3.0-typescript";
|
|||||||
import type AASInterfaceServer from "./server";
|
import type AASInterfaceServer from "./server";
|
||||||
import type { Request } from "./types/requests";
|
import type { Request } from "./types/requests";
|
||||||
import type InterfaceConnectionObject from "interfaceConnectionObject";
|
import type InterfaceConnectionObject from "interfaceConnectionObject";
|
||||||
import AIMCMapper from "./parser/AIMCMapper";
|
import AIMCMapper from "./AIMCMapper";
|
||||||
import AIDParser from "./parser/AIDParser";
|
import AIDParser from "./parser/AIDParser";
|
||||||
import { EndpointMetadata } from "types/aidConf";
|
import { EndpointMetadata } from "types/aidConf";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as AIDParser } from "./AIDParser";
|
||||||
|
export { default as AIMCParser } from "./AIMCParser";
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export * as AIDTypes from "./aidConf";
|
||||||
|
export * as AIMCTypes from "./aimcConf"
|
||||||
|
export * as CommonTypes from "./common";
|
||||||
|
export * as RequestTypes from "./requests";
|
||||||
+3
-3
@@ -51,10 +51,10 @@
|
|||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
/* Emit */
|
/* Emit */
|
||||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
||||||
|
|||||||
Reference in New Issue
Block a user