Skip to content

Commit

Permalink
chore: release v1.5.1
Browse files Browse the repository at this point in the history
* (foxriver76) ensure compatible `adapter-core` version
  • Loading branch information
foxriver76 committed May 28, 2024
1 parent aac84d7 commit a4a79e1
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 44 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Unsubscribe from object changes by pattern.
Make a query to the object database.
* design *(string)*: 'system' or other designs like `custom`, but it must exist object `_design/custom`. Too 99,9% use `system`.
* search *(string)*: object type, like `state`, `instance`, `adapter`, `host`, ...
* params *(string)*: parameters for the query in form `{startkey: 'system.adapter.', endkey: 'system.adapter.\u9999'}`
* params *(string)*: parameters for the query in form `{startkey: 'system.adapter.', endkey?: 'system.adapter.\u9999', depth?: number}`
* callback *(function)*: `function (error)`

### <a name="setobject_w"></a>setObject(id, obj, callback)
Expand Down Expand Up @@ -759,7 +759,7 @@ Unsubscribe from object changes by pattern.
Make a query to the object database.
* design *(string)*: 'system' or other designs like `custom`, but it must exist object `_design/custom`. Too 99,9% use `system`.
* search *(string)*: object type, like `state`, `instance`, `adapter`, `host`, ...
* params *(string)*: parameters for the query in form `{startkey: 'system.adapter.', endkey: 'system.adapter.\u9999'}`
* params *(string)*: parameters for the query in form `{startkey: 'system.adapter.', endkey?: 'system.adapter.\u9999', depth?: number}`
* callback *(function)*: `function (error)`

### <a name="setobject_a"></a>setObject(id, obj, callback)
Expand Down Expand Up @@ -979,6 +979,9 @@ Read all instances of the given adapter, or all instances of all adapters if ada
-->

## Changelog
### 1.5.1 (2024-05-28)
* (foxriver76) ensure compatible `adapter-core` version

### 1.5.0 (2024-02-22)
* (bluefox) Extended getObjects function with the possibility to read the list of IDs in admin

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iobroker/socket-classes",
"version": "1.5.0",
"version": "1.5.1",
"description": "ioBroker server-side web sockets",
"author": {
"name": "bluefox",
Expand All @@ -21,7 +21,7 @@
"url": "https://github.com/ioBroker/ioBroker.socket-classes"
},
"dependencies": {
"@iobroker/adapter-core": "^3.0.4",
"@iobroker/adapter-core": "^3.1.4",
"axios": "^1.6.7",
"cookie-parser": "^1.4.6",
"passport": "^0.7.0"
Expand Down
91 changes: 51 additions & 40 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,55 +22,66 @@ describe('Implement tests', () => {
config: {},
getObjectView: (design, search, params, options, callback) => {
const data = require('./data.json');
const rows = Object.keys(data).map(id => data[id].type === search && ({ id, value: data[id] })).filter(it => it);
const rows = Object.keys(data)
.map(id => data[id].type === search && { id, value: data[id] })
.filter(it => it);

callback(null, { rows });
}
});
await new Promise((resolve, reject) => server.commands.commands['getObjectView'](
{_acl: { user: 'system.user.admin' } },
'system',
'state',
{startkey: 'hm-rpc.1.', endkey: 'hm-rpc.1.\u9999', depth: 1},
(err, result) => {
if (result.rows.find(it => it.value.type !== 'folder')) {
reject();
await new Promise((resolve, reject) =>
server.commands.commands['getObjectView'](
{ _acl: { user: 'system.user.admin' } },
'system',
'state',
{ startkey: 'hm-rpc.1.', endkey: 'hm-rpc.1.\u9999', depth: 1 },
(err, result) => {
if (result.rows.find(it => it.value.type !== 'folder')) {
reject();
}
if (!result.rows.length) {
reject();
}
resolve();
}
if (!result.rows.length) {
reject();
}
resolve();
}));
)
);

await new Promise((resolve, reject) => server.commands.commands['getObjectView'](
{_acl: { user: 'system.user.admin' } },
'system',
'state',
{startkey: 'hm-rpc.1.', endkey: 'hm-rpc.1.\u9999', depth: 2},
(err, result) => {
if (result.rows.find(it => it.value.type !== 'folder')) {
reject();
}
if (!result.rows.length) {
reject();
await new Promise((resolve, reject) =>
server.commands.commands['getObjectView'](
{ _acl: { user: 'system.user.admin' } },
'system',
'state',
{ startkey: 'hm-rpc.1.', endkey: 'hm-rpc.1.\u9999', depth: 2 },
(err, result) => {
if (result.rows.find(it => it.value.type !== 'folder')) {
reject();
}
if (!result.rows.length) {
reject();
}
resolve();
}
resolve();
}));
)
);

await new Promise((resolve, reject) => server.commands.commands['getObjectView'](
{_acl: { user: 'system.user.admin' } },
'system',
'channel',
{startkey: 'hm-rpc.1.', endkey: 'hm-rpc.1.\u9999', depth: 1},
(err, result) => {
if (result.rows.find(it => it.value.type !== 'channel')) {
reject();
}
if (!result.rows.length) {
reject();
await new Promise((resolve, reject) =>
server.commands.commands['getObjectView'](
{ _acl: { user: 'system.user.admin' } },
'system',
'channel',
{ startkey: 'hm-rpc.1.', endkey: 'hm-rpc.1.\u9999', depth: 1 },
(err, result) => {
if (result.rows.find(it => it.value.type !== 'channel')) {
reject();
}
if (!result.rows.length) {
reject();
}
resolve();
}
resolve();
}));
)
);

server.close();
}).timeout(30000);
Expand Down

0 comments on commit a4a79e1

Please sign in to comment.