Skip to content

Commit

Permalink
Re-introduce visible member of property descriptions, bump ipc-schema…
Browse files Browse the repository at this point in the history
… and bump version to 1.1.1
  • Loading branch information
benfrancis committed Dec 14, 2022
1 parent 10e41f7 commit 03702bd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gateway-addon",
"version": "1.1.0",
"version": "1.1.1",
"description": "Bindings for WebThings Gateway add-ons",
"scripts": {
"build": "if [ ! -d schema/messages ]; then git submodule init; fi; git submodule update && node generate-version.js && node generate-types.js && tsc -p .",
Expand Down
2 changes: 1 addition & 1 deletion schema
12 changes: 11 additions & 1 deletion src/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class Property<T extends Any> {

private value?: T;

private visible: boolean;

private prevGetValue?: T;

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

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

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

/**
Expand All @@ -89,6 +98,7 @@ export class Property<T extends Any> {
return {
name: this.name,
value: this.value,
visible: this.visible,
title: this.title,
type: this.type,
'@type': this['@type'],
Expand Down

0 comments on commit 03702bd

Please sign in to comment.