Skip to content

Commit

Permalink
Updated to latest package
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Aug 3, 2021
1 parent c18818b commit 8a92819
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 78 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# FastyBird IoT devices module

[![Build Status](https://badgen.net/github/checks/FastyBird/devices-module/master?cache=300&style=flast-square)](https://github.com/FastyBird/devices-module/actions)
[![Build Status](https://badgen.net/github/checks/FastyBird/devices-module/master?cache=300&style=flat-square)](https://github.com/FastyBird/devices-module/actions)
[![Licence](https://badgen.net/github/license/FastyBird/devices-module?cache=300&style=flat-square)](https://github.com/FastyBird/devices-module/blob/master/LICENSE.md)

![PHP](https://badgen.net/packagist/php/FastyBird/devices-module?cache=300&style=flast-square)
[![PHP code coverage](https://badgen.net/coveralls/c/github/FastyBird/devices-module?cache=300&style=flast-square)](https://coveralls.io/r/FastyBird/devices-module)
[![PHP latest stable](https://badgen.net/packagist/v/FastyBird/devices-module/latest?cache=300&style=flast-square)](https://packagist.org/packages/FastyBird/devices-module)
[![PHP downloads total](https://badgen.net/packagist/dt/FastyBird/devices-module?cache=300&style=flast-square)](https://packagist.org/packages/FastyBird/devices-module)
![PHP](https://badgen.net/packagist/php/FastyBird/devices-module?cache=300&style=flat-square)
[![PHP code coverage](https://badgen.net/coveralls/c/github/FastyBird/devices-module?cache=300&style=flat-square)](https://coveralls.io/r/FastyBird/devices-module)
[![PHP latest stable](https://badgen.net/packagist/v/FastyBird/devices-module/latest?cache=300&style=flat-square)](https://packagist.org/packages/FastyBird/devices-module)
[![PHP downloads total](https://badgen.net/packagist/dt/FastyBird/devices-module?cache=300&style=flat-square)](https://packagist.org/packages/FastyBird/devices-module)
[![PHPStan](https://img.shields.io/badge/phpstan-enabled-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan)

[![JS latest stable](https://badgen.net/npm/v/@fastybird/devices-module?cache=300&style=flast-square)](https://www.npmjs.com/package/@fastybird/devices-module)
[![JS downloads total](https://badgen.net/npm/dt/@fastybird/devices-module?cache=300&style=flast-square)](https://www.npmjs.com/package/@fastybird/devices-module)
![Types](https://badgen.net/npm/types/@fastybird/devices-module?cache=300&style=flast-square)
[![JS latest stable](https://badgen.net/npm/v/@fastybird/devices-module?cache=300&style=flat-square)](https://www.npmjs.com/package/@fastybird/devices-module)
[![JS downloads total](https://badgen.net/npm/dt/@fastybird/devices-module?cache=300&style=flat-square)](https://www.npmjs.com/package/@fastybird/devices-module)
![Types](https://badgen.net/npm/types/@fastybird/devices-module?cache=300&style=flat-square)

![Python](https://badgen.net/pypi/python/fastybird-devices-module?cache=300&style=flat-square)
[![Python latest stable](https://badgen.net/pypi/v/fastybird-devices-module?cache=300&style=flast-square)](https://pypi.org/project/fastybird-devices-module/)
[![Python latest stable](https://badgen.net/pypi/v/fastybird-devices-module?cache=300&style=flat-square)](https://pypi.org/project/fastybird-devices-module/)
[![Python downloads month](https://img.shields.io/pypi/dm/fastybird-devices-module?cache=300&style=flat-square)](https://pypi.org/project/fastybird-devices-module/)
[![Black](https://img.shields.io/badge/black-enabled-brightgreen.svg?style=flat-square)](https://github.com/psf/black)

Expand Down
18 changes: 9 additions & 9 deletions public/lib/models/channel-configuration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ const moduleActions: ActionTree<ChannelConfigurationState, unknown> = {

if (
![
RoutingKeys.CHANNELS_CONFIGURATION_CREATED_ENTITY,
RoutingKeys.CHANNELS_CONFIGURATION_UPDATED_ENTITY,
RoutingKeys.CHANNELS_CONFIGURATION_DELETED_ENTITY,
RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_CREATED,
RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_UPDATED,
RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_DELETED,
].includes(payload.routingKey as RoutingKeys)
) {
return false
Expand All @@ -332,12 +332,12 @@ const moduleActions: ActionTree<ChannelConfigurationState, unknown> = {
if (validate(body)) {
if (
!ChannelConfiguration.query().where('id', body.id).exists() &&
(payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_UPDATED_ENTITY || payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_DELETED_ENTITY)
(payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_UPDATED || payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_DELETED)
) {
throw new Error('devices-module.channel-configuration.update.failed')
}

if (payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_DELETED_ENTITY) {
if (payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_DELETED) {
commit('SET_SEMAPHORE', {
type: SemaphoreTypes.DELETING,
id: body.id,
Expand All @@ -358,16 +358,16 @@ const moduleActions: ActionTree<ChannelConfigurationState, unknown> = {
})
}
} else {
if (payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_UPDATED_ENTITY && state.semaphore.updating.includes(body.id)) {
if (payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_UPDATED && state.semaphore.updating.includes(body.id)) {
return true
}

commit('SET_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})

const entityData: { [index: string]: string | number | string[] | number[] | boolean[] | DataType | null | undefined } = {
const entityData: { [index: string]: string | number | (string | number | boolean)[] | DataType | null | undefined } = {
type: ChannelConfigurationEntityTypes.CONFIGURATION,
}

Expand Down Expand Up @@ -408,7 +408,7 @@ const moduleActions: ActionTree<ChannelConfigurationState, unknown> = {
)
} finally {
commit('CLEAR_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CHANNELS_CONFIGURATION_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})
}
Expand Down
16 changes: 8 additions & 8 deletions public/lib/models/channel-properties/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ const moduleActions: ActionTree<ChannelPropertyState, unknown> = {

if (
![
RoutingKeys.CHANNELS_PROPERTY_CREATED_ENTITY,
RoutingKeys.CHANNELS_PROPERTY_UPDATED_ENTITY,
RoutingKeys.CHANNELS_PROPERTY_DELETED_ENTITY,
RoutingKeys.CHANNELS_PROPERTY_ENTITY_CREATED,
RoutingKeys.CHANNELS_PROPERTY_ENTITY_UPDATED,
RoutingKeys.CHANNELS_PROPERTY_ENTITY_DELETED,
].includes(payload.routingKey as RoutingKeys)
) {
return false
Expand All @@ -332,12 +332,12 @@ const moduleActions: ActionTree<ChannelPropertyState, unknown> = {
if (validate(body)) {
if (
!ChannelProperty.query().where('id', body.id).exists() &&
(payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_UPDATED_ENTITY || payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_DELETED_ENTITY)
(payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_ENTITY_UPDATED || payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_ENTITY_DELETED)
) {
throw new Error('devices-module.channel-properties.update.failed')
}

if (payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_DELETED_ENTITY) {
if (payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_ENTITY_DELETED) {
commit('SET_SEMAPHORE', {
type: SemaphoreTypes.DELETING,
id: body.id,
Expand All @@ -358,12 +358,12 @@ const moduleActions: ActionTree<ChannelPropertyState, unknown> = {
})
}
} else {
if (payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_UPDATED_ENTITY && state.semaphore.updating.includes(body.id)) {
if (payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_ENTITY_UPDATED && state.semaphore.updating.includes(body.id)) {
return true
}

commit('SET_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})

Expand Down Expand Up @@ -408,7 +408,7 @@ const moduleActions: ActionTree<ChannelPropertyState, unknown> = {
)
} finally {
commit('CLEAR_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CHANNELS_PROPERTY_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})
}
Expand Down
16 changes: 8 additions & 8 deletions public/lib/models/channels/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ const moduleActions: ActionTree<ChannelState, unknown> = {

if (
![
RoutingKeys.CHANNELS_CREATED_ENTITY,
RoutingKeys.CHANNELS_UPDATED_ENTITY,
RoutingKeys.CHANNELS_DELETED_ENTITY,
RoutingKeys.CHANNELS_ENTITY_CREATED,
RoutingKeys.CHANNELS_ENTITY_UPDATED,
RoutingKeys.CHANNELS_ENTITY_DELETED,
].includes(payload.routingKey as RoutingKeys)
) {
return false
Expand All @@ -317,12 +317,12 @@ const moduleActions: ActionTree<ChannelState, unknown> = {
if (validate(body)) {
if (
!Channel.query().where('id', body.id).exists() &&
(payload.routingKey === RoutingKeys.CHANNELS_UPDATED_ENTITY || payload.routingKey === RoutingKeys.CHANNELS_DELETED_ENTITY)
(payload.routingKey === RoutingKeys.CHANNELS_ENTITY_UPDATED || payload.routingKey === RoutingKeys.CHANNELS_ENTITY_DELETED)
) {
throw new Error('devices-module.channels.update.failed')
}

if (payload.routingKey === RoutingKeys.CHANNELS_DELETED_ENTITY) {
if (payload.routingKey === RoutingKeys.CHANNELS_ENTITY_DELETED) {
commit('SET_SEMAPHORE', {
type: SemaphoreTypes.DELETING,
id: body.id,
Expand All @@ -343,12 +343,12 @@ const moduleActions: ActionTree<ChannelState, unknown> = {
})
}
} else {
if (payload.routingKey === RoutingKeys.CHANNELS_UPDATED_ENTITY && state.semaphore.updating.includes(body.id)) {
if (payload.routingKey === RoutingKeys.CHANNELS_ENTITY_UPDATED && state.semaphore.updating.includes(body.id)) {
return true
}

commit('SET_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CHANNELS_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CHANNELS_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})

Expand Down Expand Up @@ -393,7 +393,7 @@ const moduleActions: ActionTree<ChannelState, unknown> = {
)
} finally {
commit('CLEAR_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CHANNELS_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CHANNELS_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})
}
Expand Down
18 changes: 9 additions & 9 deletions public/lib/models/connectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const moduleState: ConnectorState = {

const moduleGetters: GetterTree<ConnectorState, unknown> = {
firstLoadFinished: state => (): boolean => {
return !!state.firstLoad
return state.firstLoad
},

getting: state => (id: string): boolean => {
Expand Down Expand Up @@ -270,9 +270,9 @@ const moduleActions: ActionTree<ConnectorState, unknown> = {

if (
![
RoutingKeys.CONNECTOR_CREATED_ENTITY,
RoutingKeys.CONNECTOR_UPDATED_ENTITY,
RoutingKeys.CONNECTOR_DELETED_ENTITY,
RoutingKeys.CONNECTOR_ENTITY_CREATED,
RoutingKeys.CONNECTOR_ENTITY_UPDATED,
RoutingKeys.CONNECTOR_ENTITY_DELETED,
].includes(payload.routingKey as RoutingKeys)
) {
return false
Expand All @@ -285,12 +285,12 @@ const moduleActions: ActionTree<ConnectorState, unknown> = {
if (validate(body)) {
if (
!Connector.query().where('id', body.id).exists() &&
(payload.routingKey === RoutingKeys.CONNECTOR_UPDATED_ENTITY || payload.routingKey === RoutingKeys.CONNECTOR_DELETED_ENTITY)
(payload.routingKey === RoutingKeys.CONNECTOR_ENTITY_UPDATED || payload.routingKey === RoutingKeys.CONNECTOR_ENTITY_DELETED)
) {
throw new Error('devices-module.connectors.update.failed')
}

if (payload.routingKey === RoutingKeys.CONNECTOR_DELETED_ENTITY) {
if (payload.routingKey === RoutingKeys.CONNECTOR_ENTITY_DELETED) {
commit('SET_SEMAPHORE', {
type: SemaphoreTypes.DELETING,
id: body.id,
Expand All @@ -311,12 +311,12 @@ const moduleActions: ActionTree<ConnectorState, unknown> = {
})
}
} else {
if (payload.routingKey === RoutingKeys.CONNECTOR_UPDATED_ENTITY && state.semaphore.updating.includes(body.id)) {
if (payload.routingKey === RoutingKeys.CONNECTOR_ENTITY_UPDATED && state.semaphore.updating.includes(body.id)) {
return true
}

commit('SET_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CONNECTOR_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CONNECTOR_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})

Expand Down Expand Up @@ -346,7 +346,7 @@ const moduleActions: ActionTree<ConnectorState, unknown> = {
)
} finally {
commit('CLEAR_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.CONNECTOR_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.CONNECTOR_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})
}
Expand Down
18 changes: 9 additions & 9 deletions public/lib/models/device-configuration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ const moduleActions: ActionTree<DeviceConfigurationState, unknown> = {

if (
![
RoutingKeys.DEVICES_CONFIGURATION_CREATED_ENTITY,
RoutingKeys.DEVICES_CONFIGURATION_UPDATED_ENTITY,
RoutingKeys.DEVICES_CONFIGURATION_DELETED_ENTITY,
RoutingKeys.DEVICES_CONFIGURATION_ENTITY_CREATED,
RoutingKeys.DEVICES_CONFIGURATION_ENTITY_UPDATED,
RoutingKeys.DEVICES_CONFIGURATION_ENTITY_DELETED,
].includes(payload.routingKey as RoutingKeys)
) {
return false
Expand All @@ -324,12 +324,12 @@ const moduleActions: ActionTree<DeviceConfigurationState, unknown> = {
if (validate(body)) {
if (
!DeviceConfiguration.query().where('id', body.id).exists() &&
(payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_UPDATED_ENTITY || payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_DELETED_ENTITY)
(payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_ENTITY_UPDATED || payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_ENTITY_DELETED)
) {
throw new Error('devices-module.device-configuration.update.failed')
}

if (payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_DELETED_ENTITY) {
if (payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_ENTITY_DELETED) {
commit('SET_SEMAPHORE', {
type: SemaphoreTypes.DELETING,
id: body.id,
Expand All @@ -350,16 +350,16 @@ const moduleActions: ActionTree<DeviceConfigurationState, unknown> = {
})
}
} else {
if (payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_UPDATED_ENTITY && state.semaphore.updating.includes(body.id)) {
if (payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_ENTITY_UPDATED && state.semaphore.updating.includes(body.id)) {
return true
}

commit('SET_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})

const entityData: { [index: string]: string | number | string[] | number[] | boolean[] | DataType | null | undefined } = {
const entityData: { [index: string]: string | number | (string | number | boolean)[] | DataType | null | undefined } = {
type: DeviceConfigurationEntityTypes.CONFIGURATION,
}

Expand Down Expand Up @@ -400,7 +400,7 @@ const moduleActions: ActionTree<DeviceConfigurationState, unknown> = {
)
} finally {
commit('CLEAR_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.DEVICES_CONFIGURATION_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})
}
Expand Down
16 changes: 8 additions & 8 deletions public/lib/models/device-connector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ const moduleActions: ActionTree<DeviceConnectorState, unknown> = {

if (
![
RoutingKeys.DEVICES_CONNECTOR_CREATED_ENTITY,
RoutingKeys.DEVICES_CONNECTOR_UPDATED_ENTITY,
RoutingKeys.DEVICES_CONNECTOR_DELETED_ENTITY,
RoutingKeys.DEVICES_CONNECTOR_ENTITY_CREATED,
RoutingKeys.DEVICES_CONNECTOR_ENTITY_UPDATED,
RoutingKeys.DEVICES_CONNECTOR_ENTITY_DELETED,
].includes(payload.routingKey as RoutingKeys)
) {
return false
Expand All @@ -356,12 +356,12 @@ const moduleActions: ActionTree<DeviceConnectorState, unknown> = {
if (validate(body)) {
if (
!DeviceConnector.query().where('id', body.id).exists() &&
(payload.routingKey === RoutingKeys.DEVICES_PROPERTY_UPDATED_ENTITY || payload.routingKey === RoutingKeys.DEVICES_PROPERTY_DELETED_ENTITY)
(payload.routingKey === RoutingKeys.DEVICES_CONNECTOR_ENTITY_UPDATED || payload.routingKey === RoutingKeys.DEVICES_CONNECTOR_ENTITY_DELETED)
) {
throw new Error('devices-module.device-connector.update.failed')
}

if (payload.routingKey === RoutingKeys.DEVICES_PROPERTY_DELETED_ENTITY) {
if (payload.routingKey === RoutingKeys.DEVICES_CONNECTOR_ENTITY_DELETED) {
commit('SET_SEMAPHORE', {
type: SemaphoreTypes.DELETING,
id: body.id,
Expand All @@ -382,12 +382,12 @@ const moduleActions: ActionTree<DeviceConnectorState, unknown> = {
})
}
} else {
if (payload.routingKey === RoutingKeys.DEVICES_PROPERTY_UPDATED_ENTITY && state.semaphore.updating.includes(body.id)) {
if (payload.routingKey === RoutingKeys.DEVICES_CONNECTOR_ENTITY_UPDATED && state.semaphore.updating.includes(body.id)) {
return true
}

commit('SET_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.DEVICES_PROPERTY_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.DEVICES_CONNECTOR_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})

Expand Down Expand Up @@ -429,7 +429,7 @@ const moduleActions: ActionTree<DeviceConnectorState, unknown> = {
)
} finally {
commit('CLEAR_SEMAPHORE', {
type: payload.routingKey === RoutingKeys.DEVICES_PROPERTY_UPDATED_ENTITY ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
type: payload.routingKey === RoutingKeys.DEVICES_CONNECTOR_ENTITY_UPDATED ? SemaphoreTypes.UPDATING : SemaphoreTypes.CREATING,
id: body.id,
})
}
Expand Down
Loading

0 comments on commit 8a92819

Please sign in to comment.