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

Run prettier on main #1339

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/browser/counter.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Browser Counter Example</title>
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Browser Native node-wot tryout</title>
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/smart-coffee-machine.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Smart Coffee Machine</title>
Expand Down
8 changes: 4 additions & 4 deletions packages/binding-modbus/src/modbus-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,17 @@ export default class ModbusClient implements ProtocolClient {
mode === "r"
? ModbusFunction.readCoil
: contentLength > 1
? ModbusFunction.writeMultipleCoils
: ModbusFunction.writeSingleCoil;
? ModbusFunction.writeMultipleCoils
: ModbusFunction.writeSingleCoil;
break;
case "HoldingRegister":
// the content length must be divided by 2 (holding registers are 16bit)
result["modv:function"] =
mode === "r"
? ModbusFunction.readHoldingRegisters
: contentLength / 2 > 1
? ModbusFunction.writeMultipleHoldingRegisters
: ModbusFunction.writeSingleHoldingRegister;
? ModbusFunction.writeMultipleHoldingRegisters
: ModbusFunction.writeSingleHoldingRegister;
break;
case "InputRegister":
result["modv:function"] = ModbusFunction.readInputRegister;
Expand Down
5 changes: 4 additions & 1 deletion packages/binding-mqtt/src/mqtt-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default class MqttClient implements ProtocolClient {
private scheme: string;
private pools: Map<string, MQTTMessagePool> = new Map();

constructor(private config: MqttClientConfig = {}, secure = false) {
constructor(
private config: MqttClientConfig = {},
secure = false
) {
this.scheme = "mqtt" + (secure ? "s" : "");
}

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 @@ -590,8 +590,8 @@ export class OPCUAProtocolClient implements ProtocolClient {
valueRank === -1
? VariantArrayType.Scalar
: valueRank === 1
? VariantArrayType.Array
: VariantArrayType.Matrix;
? VariantArrayType.Array
: VariantArrayType.Matrix;

const n = (a: unknown) => Buffer.from(JSON.stringify(a));
const v = await this._contentToVariant(content2.type, n(bodyInput[name ?? "null"]), basicDataType);
Expand Down
3 changes: 3 additions & 0 deletions packages/browser-bundle/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * as Core from "@node-wot/core";
export * as Http from "@node-wot/binding-http";
export * as WebSocket from "@node-wot/binding-websockets";
20 changes: 10 additions & 10 deletions packages/core/src/codecs/octetstream-codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,26 @@ export default class OctetstreamCodec implements ContentCodec {
? bytes.readInt16BE(0)
: bytes.readUInt16BE(0)
: signed
? bytes.readInt16LE(0)
: bytes.readUInt16LE(0);
? bytes.readInt16LE(0)
: bytes.readUInt16LE(0);

case 32:
return bigEndian
? signed
? bytes.readInt32BE(0)
: bytes.readUInt32BE(0)
: signed
? bytes.readInt32LE(0)
: bytes.readUInt32LE(0);
? bytes.readInt32LE(0)
: bytes.readUInt32LE(0);

default: {
const result = bigEndian
? signed
? bytes.readIntBE(0, dataLength / 8)
: bytes.readUIntBE(0, dataLength / 8)
: signed
? bytes.readIntLE(0, dataLength / 8)
: bytes.readUIntLE(0, dataLength / 8);
? bytes.readIntLE(0, dataLength / 8)
: bytes.readUIntLE(0, dataLength / 8);
// warn about numbers being too big to be represented as safe integers
if (!Number.isSafeInteger(result)) {
warn("Result is not a safe integer");
Expand Down Expand Up @@ -460,8 +460,8 @@ export default class OctetstreamCodec implements ContentCodec {
? buf.writeInt16BE(value, 0)
: buf.writeUInt16BE(value, 0)
: signed
? buf.writeInt16LE(value, 0)
: buf.writeUInt16LE(value, 0);
? buf.writeInt16LE(value, 0)
: buf.writeUInt16LE(value, 0);
break;

case 4:
Expand All @@ -470,8 +470,8 @@ export default class OctetstreamCodec implements ContentCodec {
? buf.writeInt32BE(value, 0)
: buf.writeUInt32BE(value, 0)
: signed
? buf.writeInt32LE(value, 0)
: buf.writeUInt32LE(value, 0);
? buf.writeInt32LE(value, 0)
: buf.writeUInt32LE(value, 0);
break;

default:
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/consumed-thing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,12 @@ function findFormIndexWithScoring(

class InternalEventSubscription extends InternalSubscription {
private formIndex: number;
constructor(thing: ConsumedThing, name: string, client: ProtocolClient, private readonly form: FormElementEvent) {
constructor(
thing: ConsumedThing,
name: string,
client: ProtocolClient,
private readonly form: FormElementEvent
) {
super(thing, name, client);
const index = this.thing.events?.[name].forms.indexOf(form as Form);
if (index === undefined || index < 0) {
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/wot-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
const { debug } = createLoggers("core", "wot-impl");

class ThingDiscoveryProcess implements WoT.ThingDiscoveryProcess {
constructor(private directory: WoT.ConsumedThing, public filter?: WoT.ThingFilter) {

constructor(
private directory: ConsumedThing,
public filter?: WoT.ThingFilter
) {
this.filter = filter;
this.done = false;
}
Expand Down Expand Up @@ -83,7 +87,7 @@
const directoryThingDescription = await this.requestThingDescription(url);
const consumedDirectory = await this.consume(directoryThingDescription);

return new ThingDiscoveryProcess(consumedDirectory, filter);

Check failure on line 90 in packages/core/src/wot-impl.ts

View workflow job for this annotation

GitHub Actions / Tests (macos-latest, Node 20.x)

Argument of type 'WoT.ConsumedThing' is not assignable to parameter of type 'import("/Users/runner/work/node-wot/node-wot/packages/core/src/consumed-thing").default'.

Check failure on line 90 in packages/core/src/wot-impl.ts

View workflow job for this annotation

GitHub Actions / Tests (ubuntu-latest, Node 18.x)

Argument of type 'WoT.ConsumedThing' is not assignable to parameter of type 'import("/home/runner/work/node-wot/node-wot/packages/core/src/consumed-thing").default'.

Check failure on line 90 in packages/core/src/wot-impl.ts

View workflow job for this annotation

GitHub Actions / Tests (ubuntu-latest, Node 20.x)

Argument of type 'WoT.ConsumedThing' is not assignable to parameter of type 'import("/home/runner/work/node-wot/node-wot/packages/core/src/consumed-thing").default'.
}

/** @inheritDoc */
Expand Down
11 changes: 6 additions & 5 deletions packages/td-tools/src/td-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export * from "./thing-description";
export * from "./td-parser";
export * from "./td-helpers";
export * from "./thing-model-helpers";
type DeepPartial<T> = T extends Record<string, unknown>
? {
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>;
}
: T;
type DeepPartial<T> =
T extends Record<string, unknown>
? {
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>;
}
: T;

/**
* @deprecated Will be removed in the future. Please use '@node-wot/core' package instead.
Expand Down
Loading