Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add AAS AID tooling #7

Merged

Conversation

danielpeintner
Copy link
Member

@danielpeintner danielpeintner commented Mar 8, 2024

I took over AID code from node-wot td-tools.

What is working:

  • npm run build
  • npm run test

TODOs/ To be decided

  • version number to use ? "1.0.0" ? see c7a66ea
  • update examples
    • remove browser example since there is no wot-bundle.min.js and I don't think it is worth building such just for AID, see 25989fd
  • remove deprecated method, see 1b54f9c
  • renaming
    • of files see 23dcfb6
    • methods? We have the following public methods and I would like to rename some of them
      • transformAAS2TD(...) --> fine
      • transformTD2AAS(...) --> fine
      • transformSM2TD(...) --> not sure if "SM" for sub-model should be used, maybe transformAID2TD(...) ??
      • transformTD2SM(...) --> same as above
      • RESOLUTION, we have two public methods only
        • transformAID2TD(aasAID: string, template?: string, submodelRegex?: string): string
          • auto-detect whether we get full AAS or AID submodel only
        • transformTD2AID(td: string, options?: Options, protocols?: string[]): string
          • by default AID submodel is created but an option createAAS can be passed to get a full AAS
  • update plural, see Should AID tools name be changed to interfaceS ? node-wot#1235, see 487ffb5

@danielpeintner danielpeintner marked this pull request as draft March 8, 2024 14:28
@egekorkan
Copy link
Member

We had a quick look and I think we should not have the eslint and prettier in each tool folder. There are root configs available and seem similar.

@danielpeintner
Copy link
Member Author

danielpeintner commented Mar 15, 2024

We had a quick look and I think we should not have the eslint and prettier in each tool folder. There are root configs available and seem similar.

Makes sense. I didn't even look at the root level. Anyhow, I noticed some shortcoming w.r.t. to the current setup.

  • in node-wot we used to have eslint-plugin-unused-imports. I think having this might be useful
  • I also noticed that "npm run lint" does not screem if I have unused variables in my code. Useful again I think.
  • I also wonder whether prettier & linting should be based on language level (hence moving it into the /node directory )

Hence, I opened a dedicated issue for it (see #8)

BTW, the PR is now ready for review! There are still todos like renaming etc

@danielpeintner danielpeintner marked this pull request as ready for review March 15, 2024 10:50
@egekorkan
Copy link
Member

We have discussed in the call:

  • We will adopt version 1.0.0
  • Browserified version should just work. In Playground, we install via npm and use the dist folder outputs. Since AID tooling has no Node.js dependency (in first glance), it should be just fine. We can remove the browser example and just point to Playground. The bundled version can be mentioned in the readme as the output of dist folder.
  • The function names discussion:
    • We should get input from Sebastian and users of AAS
    • Ege's preference is to have only two functions where "AAS wrapper or not" is another argument.

@danielpeintner
Copy link
Member Author

The PR is now ready for review. As discussed there are now two public methods only

  • transformAID2TD(aasAID: string, template?: string, submodelRegex?: string): string
    • auto-detect whether we get full AAS or AID submodel only
  • transformTD2AID(td: string, options?: Options, protocols?: string[]): string
    • by default AID submodel is created but an option createAAS can be passed to get a full AAS

@danielpeintner
Copy link
Member Author

@sebastiankb @Kaz040 are the revised public method names (see #7 (comment)) fine by you?

> npx depcheck
Unused devDependencies
* typescript-standard
Missing dependencies
* wot-thing-description-types: .\src\asset-interfaces-description.ts
@Kaz040
Copy link

Kaz040 commented Apr 10, 2024

@sebastiankb @Kaz040 are the revised public method names (see #7 (comment)) fine by you?

@danielpeintner , The names are ok for me.

@sebastiankb
Copy link

its perfect for me. ready for merge

@danielpeintner danielpeintner merged commit 348e68e into eclipse-thingweb:main Apr 10, 2024
1 check passed
@danielpeintner
Copy link
Member Author

FYI: aas-aid package available on NPM (see https://www.npmjs.com/package/@thingweb/aas-aid)

@mrtnzagustin
Copy link

Guys, sorry for adding a comment here but I am not able to use/reach the transformTD2AAS function. Do you have any example of how to use it? is it already implemented?

@danielpeintner
Copy link
Member Author

danielpeintner commented May 15, 2024

An example is given in the NPM readme of or can be found also at the new home.

Note: the naming of the functions has been slightly changed (e.g., transformAID2TD(...) or transformTD2AID(...)).

@mrtnzagustin
Copy link

Those two are working fine, but the one that generates the AASX (transformTD2AAS) format is missed.
image

image

@mrtnzagustin
Copy link

Mmmm I saw this comment:
"transformTD2AID(td: string, options?: Options, protocols?: string[]): string -> by default AID submodel is created but an option createAAS can be passed to get a full AAS"

Do I need to use the createAAS parameter? We may need to update the documentation to reflect that approach.

@danielpeintner
Copy link
Member Author

Mmmm I saw this comment: "transformTD2AID(td: string, options?: Options, protocols?: string[]): string -> by default AID submodel is created but an option createAAS can be passed to get a full AAS"

Do I need to use the createAAS parameter? We may need to update the documentation to reflect that approach.

Yes, correct. As mentioned in the example

const sm = assetInterfacesDescription.transformTD2AID(JSON.stringify(counterTD), { createAAS: true }, [

Do you think we should improve the documentation?
Please feel free to provide a PR to https://github.com/eclipse-thingweb/td-tools/blob/main/node/aas-aid/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants