From 4970fb5f4b852723a27f58bab6b281e8b1c86855 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Tue, 7 Oct 2025 15:51:51 +0200 Subject: [PATCH 1/4] refactor: avoid deprecated api 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead n/no-deprecated-api --- eslint.config.mjs | 2 +- packages/binding-coap/src/coap-client.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 752c49bbd..1b44686fd 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -83,7 +83,7 @@ export default defineConfig([ "n/no-unsupported-features/node-builtins": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 "n/no-extraneous-import": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 - "n/no-deprecated-api": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 + "n/no-deprecated-api": "error", "n/no-unpublished-import": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 "n/no-process-exit": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430 "n/hashbang": "warn", diff --git a/packages/binding-coap/src/coap-client.ts b/packages/binding-coap/src/coap-client.ts index d264c7cfe..f05cca5bf 100644 --- a/packages/binding-coap/src/coap-client.ts +++ b/packages/binding-coap/src/coap-client.ts @@ -209,7 +209,7 @@ export default class CoapClient implements ProtocolClient { public setSecurity = (metadata: Array): boolean => true; private uriToOptions(uri: string): CoapRequestParams { - const requestUri = url.parse(uri); + const requestUri = new url.URL(uri); const agentOptions = this.agentOptions; agentOptions.type = net.isIPv6(requestUri.hostname ?? "") ? "udp6" : "udp4"; this.agent = new Agent(agentOptions); @@ -219,7 +219,10 @@ export default class CoapClient implements ProtocolClient { hostname: requestUri.hostname ?? "", port: requestUri.port != null ? parseInt(requestUri.port, 10) : 5683, pathname: requestUri.pathname ?? "", - query: requestUri.query ?? "", + query: + requestUri.search && requestUri.search.length > 0 && requestUri.search[0] === "?" + ? requestUri.search.substring(1) + : "", observe: false, multicast: false, confirmable: true, From 31d782b5669c30887ae454fc4d2cf127c7d5c5a7 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Mon, 13 Oct 2025 14:11:41 +0200 Subject: [PATCH 2/4] refactor: use same ipv6 localhost [::1] vs. [::] --- packages/binding-coap/test/coap-server-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/binding-coap/test/coap-server-test.ts b/packages/binding-coap/test/coap-server-test.ts index 9ab0fc540..5a77a322d 100644 --- a/packages/binding-coap/test/coap-server-test.ts +++ b/packages/binding-coap/test/coap-server-test.ts @@ -219,7 +219,7 @@ class CoapServerTest { await coapServer.expose(testThing); - const uri = `coap://[::1]:${coapServer.getPort()}/test/`; + const uri = `coap://[::]:${coapServer.getPort()}/test/`; const coapClient = new CoapClient(coapServer); const resp = await coapClient.readResource(new Form(uri + "properties/test")); From 6c4396adbf8f6186311e7c1e3f6200520e701136 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Mon, 13 Oct 2025 14:26:01 +0200 Subject: [PATCH 3/4] refactor: use :: for localhost --- packages/binding-coap/test/coap-server-test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/binding-coap/test/coap-server-test.ts b/packages/binding-coap/test/coap-server-test.ts index 5a77a322d..e22e1f623 100644 --- a/packages/binding-coap/test/coap-server-test.ts +++ b/packages/binding-coap/test/coap-server-test.ts @@ -201,7 +201,7 @@ class CoapServerTest { } @test async "should support IPv6"() { - const coapServer = new CoapServer({ port: PORT, address: "::" }); + const coapServer = new CoapServer({ port: PORT, address: "::1" }); await coapServer.start(new Servient()); const testThing = new ExposedThing(new Servient(), { @@ -219,7 +219,7 @@ class CoapServerTest { await coapServer.expose(testThing); - const uri = `coap://[::]:${coapServer.getPort()}/test/`; + const uri = `coap://[::1]:${coapServer.getPort()}/test/`; const coapClient = new CoapClient(coapServer); const resp = await coapClient.readResource(new Form(uri + "properties/test")); From fb536450cf5912c5b19a5ec86c330d2096a6aea5 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Mon, 13 Oct 2025 14:58:07 +0200 Subject: [PATCH 4/4] chore: similar to issue 1138 ? --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e354a807..fc7cf156a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,6 +51,11 @@ jobs: run: | sudo echo "127.0.0.1" `hostname` | sudo tee -a /etc/hosts + - name: Add missing ipv6 hostname to /etc/hosts + if: matrix.os == 'macos-latest' + run: | + sudo echo "::1" `hostname` | sudo tee -a /etc/hosts + # Enables the output of log messages from the Node.js debug module # for workflow runs that are being retried with "debug logging" # enabled.