From 26d10d94cac8f0b581221063cc94d698f4fa47a2 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Fri, 3 Nov 2023 13:12:20 +0100 Subject: [PATCH 1/2] refactor: revert back to *old* way of cloning --- packages/core/src/exposed-thing.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/exposed-thing.ts b/packages/core/src/exposed-thing.ts index d0c080c48..e5dacf716 100644 --- a/packages/core/src/exposed-thing.ts +++ b/packages/core/src/exposed-thing.ts @@ -122,7 +122,9 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing { this.actions = {}; this.events = {}; - const deepClonedModel = structuredClone(thingModel); + // Deep clone the Thing Model + // without functions or methods + const deepClonedModel = JSON.parse(JSON.stringify(thingModel)); Object.assign(this, deepClonedModel); // unset "@type":"tm:ThingModel" ? From 2976374a3cfe3f2f1143776dc10260b4ad24025e Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Fri, 3 Nov 2023 13:49:04 +0100 Subject: [PATCH 2/2] refactor: properly start server add launch configuration for counter (server) as well --- .vscode/launch.json | 8 ++++++++ packages/cli/src/cli-default-servient.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index e16df8924..5649b4a3b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,6 +10,14 @@ "args": ["--client-only", "counter-client.js"], "cwd": "${workspaceRoot}/examples/scripts/" }, + { + "type": "node", + "request": "launch", + "name": "Launch Counter", + "program": "${workspaceRoot}/packages/cli/dist/cli.js", + "args": ["counter.js"], + "cwd": "${workspaceRoot}/examples/scripts/" + }, { "type": "node", "request": "attach", diff --git a/packages/cli/src/cli-default-servient.ts b/packages/cli/src/cli-default-servient.ts index 57969034a..09f0aed48 100644 --- a/packages/cli/src/cli-default-servient.ts +++ b/packages/cli/src/cli-default-servient.ts @@ -123,7 +123,7 @@ export default class DefaultServient extends Servient { } let coapServer: CoapServer | undefined; - if (this.config.servient.clientOnly == null) { + if (this.config.servient.clientOnly === false) { if (this.config.http != null) { const httpServer = new HttpServer(this.config.http); this.addServer(httpServer);