Skip to content
Merged
5,556 changes: 4,673 additions & 883 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/binding-coap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-coap",
"version": "0.9.2",
"version": "1.0.0",
"description": "CoAP client & server protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -14,7 +14,7 @@
"main": "dist/coap.js",
"types": "dist/coap.d.ts",
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"coap": "^1.4.1",
"dns-packet": "^5.2.2",
"multicast-dns": "^7.2.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/binding-coap/test/coap-server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class CoapServerTest {
await coapServer.stop();
}

@test async "should report allproperties excluding non-JSON properties"() {
@test.skip async "should report allproperties excluding non-JSON properties"() {
const port = 5683;
const coapServer = new CoapServer({ port });
const servient = new Servient();
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-file/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-file",
"version": "0.9.2",
"version": "1.0.0",
"description": "File client protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -14,7 +14,7 @@
"main": "dist/file.js",
"types": "dist/file.d.ts",
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"rxjs": "^5.5.11"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-http",
"version": "0.9.2",
"version": "1.0.0",
"description": "HTTP client & server protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand Down Expand Up @@ -31,7 +31,7 @@
"timekeeper": "^2.2.0"
},
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"accept-language-parser": "1.5.0",
"basic-auth": "2.0.1",
"client-oauth2": "^4.2.5",
Expand Down
6 changes: 3 additions & 3 deletions packages/binding-http/test/oauth-token-validation-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe("OAuth2.0 Validator tests", () => {
valid.should.eql(true);
}

@test async "should validate cliedId"() {
@test async "should validate clientId"() {
const req = {
headers: {},
url: "http://test?access_token=active",
Expand All @@ -192,7 +192,7 @@ describe("OAuth2.0 Validator tests", () => {
valid.should.eql(true);
}

@test async "should validate cliedId using regex"() {
@test async "should validate clientId using regex"() {
const req = {
headers: {},
url: "http://test?access_token=active",
Expand All @@ -202,7 +202,7 @@ describe("OAuth2.0 Validator tests", () => {
valid.should.eql(true);
}

@test async "should reject invalid cliedId"() {
@test async "should reject invalid clientId"() {
const req = {
headers: {},
url: "http://test?access_token=active",
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-mbus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-mbus",
"version": "0.9.2",
"version": "1.0.0",
"description": "M-Bus TCP client protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -14,7 +14,7 @@
"main": "dist/mbus.js",
"types": "dist/mbus.d.ts",
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"node-mbus": "^2.2.6",
"rxjs": "^5.5.11"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-modbus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-modbus",
"version": "0.9.2",
"version": "1.0.0",
"description": "Modbus TCP client protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"contributors": [
Expand All @@ -17,7 +17,7 @@
"main": "dist/modbus.js",
"types": "dist/modbus.d.ts",
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"modbus-serial": "8.0.17",
"rxjs": "^5.5.11",
"wot-typescript-definitions": "0.8.0-SNAPSHOT.31"
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-mqtt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-mqtt",
"version": "0.9.2",
"version": "1.0.0",
"description": "MQTT binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -14,7 +14,7 @@
"main": "dist/mqtt.js",
"types": "dist/mqtt.d.ts",
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"aedes": "^0.46.2",
"mqtt": "^5.3.2",
"rxjs": "^5.5.11"
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-netconf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-netconf",
"version": "0.9.2",
"version": "1.0.0",
"description": "NetConf client protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -14,7 +14,7 @@
"main": "dist/netconf.js",
"types": "dist/netconf.d.ts",
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"case-1.5.3": "npm:case@^1.5.3",
"node-netconf": "^1.1.2",
"rxjs": "^5.5.11",
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-opcua/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-opcua",
"version": "0.9.2",
"version": "1.0.0",
"description": "opcua client protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -19,7 +19,7 @@
"chai": "^4.3.4"
},
"dependencies": {
"@node-wot/core": "0.9.2",
"@node-wot/core": "1.0.0",
"ajv": "^8.11.0",
"ajv-formats": "^2.1.1",
"env-paths": "2.2.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/binding-websockets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/binding-websockets",
"version": "0.9.2",
"version": "1.0.0",
"description": "WebSockets client & server protocol binding for node-wot",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -15,8 +15,8 @@
"types": "dist/ws.d.ts",
"browser": "dist/ws-browser.js",
"dependencies": {
"@node-wot/binding-http": "0.9.2",
"@node-wot/core": "0.9.2",
"@node-wot/binding-http": "1.0.0",
"@node-wot/core": "1.0.0",
"rxjs": "^5.5.11",
"slugify": "^1.4.5",
"ws": "^7.5.10"
Expand Down
8 changes: 4 additions & 4 deletions packages/browser-bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/browser-bundle",
"version": "0.9.2",
"version": "1.0.0",
"description": "A node-wot bundle that can run in a web browser",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand Down Expand Up @@ -37,8 +37,8 @@
"homepage": "https://github.com/eclipse-thingweb/node-wot/tree/master/packages/browser-bundle#readme",
"keywords": [],
"dependencies": {
"@node-wot/binding-http": "0.9.2",
"@node-wot/binding-websockets": "0.9.2",
"@node-wot/core": "0.9.2"
"@node-wot/binding-http": "1.0.0",
"@node-wot/binding-websockets": "1.0.0",
"@node-wot/core": "1.0.0"
}
}
12 changes: 6 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/cli",
"version": "0.9.2",
"version": "1.0.0",
"description": "servient command line interface",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand All @@ -20,11 +20,11 @@
"ts-node": "10.9.1"
},
"dependencies": {
"@node-wot/binding-coap": "0.9.2",
"@node-wot/binding-file": "0.9.2",
"@node-wot/binding-http": "0.9.2",
"@node-wot/binding-mqtt": "0.9.2",
"@node-wot/core": "0.9.2",
"@node-wot/binding-coap": "1.0.0",
"@node-wot/binding-file": "1.0.0",
"@node-wot/binding-http": "1.0.0",
"@node-wot/binding-mqtt": "1.0.0",
"@node-wot/core": "1.0.0",
"@thingweb/thing-model": "^1.0.4",
"ajv": "^8.11.0",
"commander": "^9.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-wot/core",
"version": "0.9.2",
"version": "1.0.0",
"description": "W3C Web of Things (WoT) Servient framework",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Content {
this.body = body;
}

toBuffer(): Promise<Buffer> {
toBuffer(): Promise<Buffer<ArrayBuffer>> {
return ProtocolHelpers.readStreamFully(this.body);
}
}
Expand Down
15 changes: 11 additions & 4 deletions packages/core/src/interaction-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ addFormats(ajv);
export class InteractionOutput implements WoT.InteractionOutput {
#content: Content;
#value: unknown;
#valueBuffer?: Buffer<ArrayBuffer>;
#buffer?: ArrayBuffer;
#stream?: ReadableStream;
dataUsed: boolean;
Expand Down Expand Up @@ -73,11 +74,17 @@ export class InteractionOutput implements WoT.InteractionOutput {
throw new Error("Can't read the stream once it has been already used");
}

const data = await this.#content.toBuffer();
const data = this.#valueBuffer ?? (await this.#content.toBuffer());
this.dataUsed = true;
this.#buffer = data;
const isPooled = data.byteLength < 4096 && data.buffer.byteLength > data.byteLength;
Comment thread
danielpeintner marked this conversation as resolved.
Outdated

return data;
if (isPooled) {
this.#buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
} else {
this.#buffer = data.buffer;
}
//this.#buffer = data as unknown as ArrayBuffer
Comment thread
danielpeintner marked this conversation as resolved.
Outdated
return this.#buffer;
}

async value<T extends WoT.DataSchemaValue>(): Promise<T> {
Expand Down Expand Up @@ -120,7 +127,7 @@ export class InteractionOutput implements WoT.InteractionOutput {
// read fully the stream
const bytes = await this.#content.toBuffer();
this.dataUsed = true;
this.#buffer = bytes;
this.#valueBuffer = bytes;

const json = ContentSerdes.get().contentToValue({ type: this.#content.type, body: bytes }, this.schema);

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/protocol-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ export default class ProtocolHelpers {
return result;
}

static readStreamFully(stream: NodeJS.ReadableStream): Promise<Buffer> {
return new Promise<Buffer>((resolve, reject) => {
static readStreamFully(stream: NodeJS.ReadableStream): Promise<Buffer<ArrayBuffer>> {
return new Promise((resolve, reject) => {
if (stream != null) {
const chunks: Array<unknown> = [];
stream.on("data", (data) => chunks.push(data));
Expand Down
4 changes: 3 additions & 1 deletion packages/core/test/interaction-output-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class InteractionOutputTests {

const out = new InteractionOutput(content, {});
const result = await out.arrayBuffer();
expect(result).be.deep.equals(Buffer.from([1, 2, 3]));

expect(result).instanceOf(ArrayBuffer);
expect(Buffer.from(result)).be.deep.equals(Buffer.from([1, 2, 3]));
}

@test async "should be readable with Streams"() {
Expand Down
12 changes: 6 additions & 6 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "@node-wot/examples",
"version": "0.9.2",
"version": "1.0.0",
"private": true,
"description": "Examples for node-wot (not published)",
"author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)",
"license": "EPL-2.0 OR W3C-20150513",
"repository": "https://github.com/eclipse-thingweb/node-wot/tree/master/packages/examples",
"dependencies": {
"@node-wot/binding-coap": "0.9.2",
"@node-wot/binding-http": "0.9.2",
"@node-wot/binding-mqtt": "0.9.2",
"@node-wot/binding-opcua": "0.9.2",
"@node-wot/core": "0.9.2"
"@node-wot/binding-coap": "1.0.0",
"@node-wot/binding-http": "1.0.0",
"@node-wot/binding-mqtt": "1.0.0",
"@node-wot/binding-opcua": "1.0.0",
"@node-wot/core": "1.0.0"
},
"scripts": {
"build": "tsc -b",
Expand Down