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

update opcua modules - remove unnecessary data transformation #1072

Closed
wants to merge 9 commits into from
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<img title="ThingWeb" alt="Thingweb logo" src="https://raw.githubusercontent.com/eclipse-thingweb/website/master/misc/thingweb_logo.svg" width="300px">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/eclipse-thingweb/website/master/misc/thingweb_logo_for_dark_bg.svg">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/eclipse-thingweb/website/master/misc/thingweb_logo.svg">
<img title="ThingWeb" alt="Thingweb logo" src="https://raw.githubusercontent.com/eclipse-thingweb/website/master/misc/thingweb_logo.svg" width="300">
</picture>

## node-wot

Expand Down
2,275 changes: 1,324 additions & 951 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"build:podman": "podman build -t wot-servient .",
"clean:dist": "npm exec --workspaces -- npx rimraf tsconfig.tsbuildinfo dist",
"update:wot-typescript-definitions": "npx npm-check-updates -u -f \"wot-typescript-definitions\" --deep",
"update:node-opcua": "npx npm-check-updates -u -f node-opcua* --deep --dep prod,debug,peer",
"link": "npm link -ws"
},
"workspaces": [
Expand All @@ -52,6 +53,7 @@
"@types/node": "16.18.35",
"@types/readable-stream": "^2.3.13",
"@types/sinon": "10.0.2",
"@types/ws": "^8.5.7",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"c8": "^7.11.0",
Expand Down
45 changes: 22 additions & 23 deletions packages/binding-opcua/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,28 @@
"@node-wot/td-tools": "0.8.10",
"ajv": "^8.11.0",
"ajv-formats": "^2.1.1",
"node-opcua-address-space": "2.77.0",
"node-opcua-basic-types": "2.77.0",
"node-opcua-binary-stream": "2.77.0",
"node-opcua-buffer-utils": "2.77.0",
"node-opcua-client": "2.77.0",
"node-opcua-constants": "2.77.0",
"node-opcua-data-model": "2.77.0",
"node-opcua-data-value": "2.77.0",
"node-opcua-date-time": "2.77.0",
"node-opcua-debug": "2.77.0",
"node-opcua-extension-object": "2.77.0",
"node-opcua-factory": "2.77.0",
"node-opcua-json": "0.19.1",
"node-opcua-nodeid": "2.77.0",
"node-opcua-numeric-range": "2.77.0",
"node-opcua-pseudo-session": "2.77.0",
"node-opcua-pubsub-client": "0.19.1",
"node-opcua-service-browse": "2.77.0",
"node-opcua-service-translate-browse-path": "2.77.0",
"node-opcua-status-code": "2.77.0",
"node-opcua-types": "2.77.0",
"node-opcua-variant": "2.77.0",
"node-opcua": "2.77.0",
"node-opcua-address-space": "2.115.0",
"node-opcua-basic-types": "2.114.0",
"node-opcua-binary-stream": "2.114.0",
"node-opcua-buffer-utils": "2.114.0",
"node-opcua-client": "2.115.0",
"node-opcua-constants": "2.114.0",
"node-opcua-data-model": "2.114.0",
"node-opcua-data-value": "2.114.0",
"node-opcua-date-time": "2.114.0",
"node-opcua-debug": "2.114.0",
"node-opcua-extension-object": "2.114.0",
"node-opcua-factory": "2.114.0",
"node-opcua-json": "0.50.0",
"node-opcua-nodeid": "2.114.0",
"node-opcua-numeric-range": "2.114.0",
"node-opcua-pseudo-session": "2.114.0",
"node-opcua-service-browse": "2.114.0",
"node-opcua-service-translate-browse-path": "2.114.0",
"node-opcua-status-code": "2.114.0",
"node-opcua-types": "2.114.0",
"node-opcua-variant": "2.114.0",
"node-opcua": "2.115.0",
"rxjs": "5.5.11"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-opcua/src/opcua-protocol-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { schemaDataValue } from "./codec";
import { FormElementProperty } from "wot-thing-description-types";
import { opcuaJsonEncodeVariant } from "node-opcua-json";
import { Argument, BrowseDescription, BrowseResult } from "node-opcua-types";
import { isGoodish, ReferenceTypeIds } from "node-opcua";
import { isGoodish2, ReferenceTypeIds } from "node-opcua";

const { debug } = createLoggers("binding-opcua", "opcua-protocol-client");

Expand Down Expand Up @@ -308,7 +308,7 @@ export class OPCUAProtocolClient implements ProtocolClient {
return statusCode;
});
debug(`writeResource: statusCode ${statusCode}`);
if (statusCode !== StatusCodes.Good && !isGoodish(statusCode)) {
if (statusCode !== StatusCodes.Good && !isGoodish2(statusCode, { treatUncertainAsBad: false })) {
throw new Error("Error in OPCUA Write : " + statusCode.toString());
}
}
Expand Down
16 changes: 9 additions & 7 deletions packages/binding-opcua/test/full-opcua-thing-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,17 @@ describe("Full OPCUA Thing Test", () => {
const readHandler = async () => temperature;
thing.setPropertyReadHandler("temperature", readHandler);

const temperatureCheck1 = await readHandler();
expect(temperatureCheck1).to.equal(10);

temperature = 100;
try {
erossignon marked this conversation as resolved.
Show resolved Hide resolved
const temperatureCheck1 = await readHandler();
expect(temperatureCheck1).to.equal(10);

const temperatureCheck2 = await readHandler();
expect(temperatureCheck2).to.equal(100);
temperature = 100;

await servient.shutdown();
const temperatureCheck2 = await readHandler();
expect(temperatureCheck2).to.equal(100);
} finally {
await servient.shutdown();
}
});

async function makeThing() {
Expand Down
Loading