Skip to content

Commit d2d7833

Browse files
authored
Merge pull request #1256 from danielpeintner/issue-1249
Remove AID tooling
2 parents fdc678b + b0d851d commit d2d7833

10 files changed

Lines changed: 3 additions & 7924 deletions

File tree

examples/browser/aid-tools.html

Lines changed: 0 additions & 77 deletions
This file was deleted.

examples/browser/aid-tools.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/td-tools/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Current Maintainer(s): [@danielpeintner](https://github.com/danielpeintner) [@re
66

77
In the following example it is shown how td-tools of node-wot can be used.
88

9+
Note: Some additional tooling (e.g., AAS AID, TD to AsyncAPI Converter) can be found in its own repository (see https://github.com/eclipse-thingweb/td-tools).
10+
911
### Prerequisites
1012

1113
- `npm install @node-wot/td-tools`

packages/td-tools/src/td-tools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export * from "./thing-description";
2020
export * from "./td-parser";
2121
export * from "./td-helpers";
2222
export * from "./thing-model-helpers";
23-
export * from "./util/asset-interface-description";
2423
type DeepPartial<T> = T extends Record<string, unknown>
2524
? {
2625
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>;

packages/td-tools/src/util/README.md

Lines changed: 1 addition & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -2,105 +2,4 @@
22

33
## Asset Interface Description
44

5-
The [IDTA Asset Interface Description (AID) working group](https://github.com/admin-shell-io/submodel-templates/tree/main/development/Asset%20Interface%20Description/1/0) defines a submodel that can be used to describe the asset's service interface or asset's related service interfaces. The current AID working assumptions reuse existing definitions from [WoT Thing Descriptions](https://www.w3.org/TR/wot-thing-description11/) and hence it is possible to consume AAS with AID definitions with node-wot (e.g., read/subscribe live data of the asset and/or associated service).
6-
7-
### Sample Applications
8-
9-
#### Prerequisites
10-
11-
- `npm install @node-wot/td-tools`
12-
- `npm install @node-wot/core`
13-
- `npm install @node-wot/binding-http`
14-
15-
#### AAS/AID to WoT TD
16-
17-
The file `counterHTTP.json` describes the counter sample in AAS/AID format for http binding. The `AssetInterfaceDescriptionUtil` utility class allows to transform the AID format to a valid WoT TD format which in the end can be properly consumed by node-wot.
18-
19-
The example `aid-to-td.js` tries to transform an AID submodel (from an AAS file) into a regular WoT TD.
20-
Note: Besides converting the AID submodel it is also possible to convert a full AAS file (see `transformTD2AAS(...)`).
21-
22-
```js
23-
// aid-to-td.js
24-
const fs = require("fs/promises"); // to read JSON file in AID format
25-
26-
Servient = require("@node-wot/core").Servient;
27-
HttpClientFactory = require("@node-wot/binding-http").HttpClientFactory;
28-
29-
// AID Util
30-
AssetInterfaceDescriptionUtil = require("@node-wot/td-tools").AssetInterfaceDescriptionUtil;
31-
32-
// create Servient and add HTTP binding
33-
let servient = new Servient();
34-
servient.addClientFactory(new HttpClientFactory(null));
35-
36-
let assetInterfaceDescriptionUtil = new AssetInterfaceDescriptionUtil();
37-
38-
async function example() {
39-
try {
40-
const aas = await fs.readFile("counterHTTP.json", {
41-
encoding: "utf8",
42-
});
43-
// pick AID submodel
44-
const aid = JSON.stringify(JSON.parse(aas).submodels[0]);
45-
46-
// transform AID to WoT TD
47-
const tdAID = assetInterfaceDescriptionUtil.transformSM2TD(aid, `{"title": "counter"}`);
48-
// Note: transformSM2TD() may have up to 3 input parameters
49-
// * aid (required): AID submodel in JSON format
50-
// * template (optional): Initial TD template
51-
// * submodelRegex (optional): Submodel filter based on regular expression
52-
// e.g., filtering HTTP only by calling transformAAS2TD(aas, `{}`, "HTTP")
53-
54-
// do work as usual
55-
const WoT = await servient.start();
56-
const thing = await WoT.consume(JSON.parse(tdAID));
57-
58-
// read property count
59-
const read1 = await thing.readProperty("count");
60-
console.log("count value is: ", await read1.value());
61-
} catch (err) {
62-
console.log(err);
63-
}
64-
}
65-
66-
// launch example
67-
example();
68-
```
69-
70-
#### WoT TD to AAS/AID
71-
72-
The example `td-to-aid.js` tries to load the online counter TD and converts it to an AID submodel in JSON format.
73-
Note: Besides converting it into an AID submodel it is also possible to convert it into a full AAS form (see `transformTD2AAS(...)`).
74-
75-
```js
76-
// td-to-aid.js
77-
AssetInterfaceDescriptionUtil = require("@node-wot/td-tools").AssetInterfaceDescriptionUtil;
78-
79-
let assetInterfaceDescriptionUtil = new AssetInterfaceDescriptionUtil();
80-
81-
async function example() {
82-
try {
83-
const response = await fetch("http://plugfest.thingweb.io:8083/counter");
84-
const counterTD = await response.json();
85-
86-
const sm = assetInterfaceDescriptionUtil.transformTD2SM(JSON.stringify(counterTD), ["http", "coap"]);
87-
88-
// print JSON format of AID submodel
89-
console.log(sm);
90-
} catch (err) {
91-
console.log(err);
92-
}
93-
}
94-
95-
// launch example
96-
example();
97-
```
98-
99-
#### Run the sample scripts
100-
101-
`node aid-to-td.js`
102-
... will show the counter value retrieved from http://plugfest.thingweb.io:8083/counter/properties/count
103-
Note: make sure that the file `counterHTTP.json` is in the same folder as the script.
104-
105-
`node td-to-aid.js`
106-
... will show the online counter in AAS/AID JSON format (compliant with AAS V3.0 and can be imported by AASX Package Explorer).
5+
Note: The AID tooling has been moved to its own repository (see https://github.com/eclipse-thingweb/td-tools/tree/main/node/aas-aid).

0 commit comments

Comments
 (0)