Skip to content

Commit

Permalink
Merge branch 'master' into pr/1072
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
danielpeintner committed Sep 13, 2023
2 parents b5fa9c7 + c10fba2 commit 6406085
Show file tree
Hide file tree
Showing 25 changed files with 1,390 additions and 1,570 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]

steps:
- name: Checkout
Expand Down Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18

- name: Install
run: npm ci
Expand All @@ -54,10 +54,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install node v16
- name: install node v18
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18
- name: verify packages version consistency accross sub-modules
run: npm run check:versions

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]

steps:
- name: Checkout
Expand Down Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18

- name: Install
run: npm ci
Expand All @@ -54,10 +54,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install node v16
- name: install node v18
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18
- name: verify packages version consistency accross sub-modules
run: npm run check:versions

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ cs.addCodec(new MyCodec("application/myType"));

### To use with Node.js

> **Warning**: We no longer actively support Node.js version 14 and lower.
> **Warning**: We no longer actively support Node.js version 16 and lower.
- [Node.js](https://nodejs.org/) version 14+
- [npm](https://www.npmjs.com/) version 7+
- [Node.js](https://nodejs.org/) version 18+
- [npm](https://www.npmjs.com/) version 9+

#### Linux

Expand Down
32 changes: 29 additions & 3 deletions examples/quickstart/simple-coffee-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ servient.addServer(
})
);
core_1.Helpers.setStaticAddress("plugfest.thingweb.io"); // comment this out if you are testing locally
let waterAmount = 100;
let beansAmount = 100;
let milkAmount = 100;
let waterAmount = 1000;
let beansAmount = 1000;
let milkAmount = 1000;
// promisify timeout since it does not return a promise
function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
Expand Down Expand Up @@ -70,6 +70,13 @@ servient.start().then((WoT) => {
enum: ["espresso", "cappuccino", "americano"],
},
},
refill: {
synchronous: true,
input: {
type: "string",
enum: ["water", "beans", "milk"],
},
},
},
})
.then((thing) => {
Expand Down Expand Up @@ -119,6 +126,25 @@ servient.start().then((WoT) => {
throw new Error("Wrong coffee input");
}
});
thing.setActionHandler("refill", async (params, options) => {
const selectedResource = await params.value();
console.info("received refill order of ", selectedResource);
switch (selectedResource) {
case "water":
waterAmount = 1000;
break;
case "beans":
beansAmount = 1000;
break;
case "milk":
milkAmount = 1000;
break;
default:
throw new Error("Wrong refill input");
}
thing.emitPropertyChange("resources");
return undefined;
});
// expose the thing
thing.expose().then(() => {
console.info(thing.getThingDescription().title + " ready");
Expand Down
Loading

0 comments on commit 6406085

Please sign in to comment.