Skip to content

Commit 03702bd

Browse files
committed
Re-introduce visible member of property descriptions, bump ipc-schema and bump version to 1.1.1
1 parent 10e41f7 commit 03702bd

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gateway-addon",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Bindings for WebThings Gateway add-ons",
55
"scripts": {
66
"build": "if [ ! -d schema/messages ]; then git submodule init; fi; git submodule update && node generate-version.js && node generate-types.js && tsc -p .",

src/property.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export class Property<T extends Any> {
5151

5252
private value?: T;
5353

54+
private visible: boolean;
55+
5456
private prevGetValue?: T;
5557

5658
constructor(device: Device, name: string, propertyDescr: PropertySchema) {
@@ -63,9 +65,15 @@ export class Property<T extends Any> {
6365
assert.equal(
6466
typeof propertyDescr,
6567
'object',
66-
'Please update plugin to use property description.'
68+
'Please update add-on to use property description.'
6769
);
6870

71+
if (typeof propertyDescr.visible !== 'undefined') {
72+
console.warn(
73+
'The "visible" member of property descriptions is ' +
74+
'deprecated, please update your add-on.'
75+
);
76+
}
6977
const legacyDescription = <LegacyPropertyDescription>(<unknown>propertyDescr);
7078

7179
this.title = propertyDescr.title || legacyDescription.label;
@@ -79,6 +87,7 @@ export class Property<T extends Any> {
7987
this.readOnly = propertyDescr.readOnly;
8088
this.multipleOf = propertyDescr.multipleOf;
8189
this.links = propertyDescr.links ?? [];
90+
this.visible = propertyDescr.visible ?? true; // For backwards compat
8291
}
8392

8493
/**
@@ -89,6 +98,7 @@ export class Property<T extends Any> {
8998
return {
9099
name: this.name,
91100
value: this.value,
101+
visible: this.visible,
92102
title: this.title,
93103
type: this.type,
94104
'@type': this['@type'],

0 commit comments

Comments
 (0)