Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acaad.abstractions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acaad/abstractions",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "Abstractions for Any Computer as a Device (ACaaD)",
"files": [
"./dist"
Expand Down
2 changes: 1 addition & 1 deletion acaad.core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acaad/core",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "acaad",
"main": "dist/cjs/src/index.js",
"module": "./dist/esnext/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion acaad.core/src/ComponentManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@
).pipe(Effect.withSpan('acaad:cs:onUnhandledEvent'));
}

this._logger.logWarning(`Discarded valid, but unhandled event: '${event.name}'`);
this._logger.logTrace(`Discarded valid, but unhandled event: '${event.name}'`);

Check warning on line 741 in acaad.core/src/ComponentManager.ts

View check run for this annotation

Codecov / codecov/patch

acaad.core/src/ComponentManager.ts#L741

Added line #L741 was not covered by tests
return yield* Effect.void;
});
}
Expand Down
4 changes: 3 additions & 1 deletion acaad.core/src/services/AcaadResponseParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export class AcaadResponseParser implements IResponseParser {
outcome: AcaadOutcome
): Effect.Effect<unknown, AcaadError> {
return Effect.gen(this, function* () {
return yield* this.parseSingleValue(metadata, outcome.outcomeRaw);
const jsonParsed = yield* this.tryParseJsonEff(metadata, outcome.outcomeRaw!);

return yield* this.parseSingleValue(metadata, jsonParsed);
});
}

Expand Down
9 changes: 7 additions & 2 deletions acaad.core/tests/integration/events/inbound-events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ describe('inbound events', () => {
const rndServer = intTestContext.getRandomServer();
const rndCd = rndServer.getRandomComponent(ComponentType.Sensor);

const event = TestEventFactory.createComponentOutcomeEvent(rndCd.toIdentifier());
const expectedOutcomeRaw = 'the-original-outcome';
const event = TestEventFactory.createComponentOutcomeEvent(
rndCd.toIdentifier(),
undefined,
expectedOutcomeRaw
);

const checkpoint = stateObserver.waitForSpanAsync('acaad:cs:updateComponentState');

Expand All @@ -66,7 +71,7 @@ describe('inbound events', () => {

const expectedStateUpdate: InboundStateUpdate = {
originalOutcome: event.outcome,
determinedTargetState: event.outcome.outcomeRaw,
determinedTargetState: expectedOutcomeRaw,
metadata: expect.anything()
};

Expand Down
6 changes: 4 additions & 2 deletions acaad.core/tests/integration/factories/test-event-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class TestEventFactory {
componentName,
new AcaadOutcome({
success: true,
outcomeRaw: outcomeRaw
outcomeRaw: JSON.stringify(outcomeRaw)
})
);
}
Expand All @@ -30,7 +30,9 @@ export class TestEventFactory {
componentDescriptor.toIdentifier(),
new AcaadOutcome({
success: true,
outcomeRaw: targetState ? componentDescriptor.onIff.toString() : 'not-the-on-iff-value'
outcomeRaw: JSON.stringify(
targetState ? componentDescriptor.onIff.toString() : 'not-the-on-iff-value'
)
})
);
}
Expand Down
14 changes: 7 additions & 7 deletions acaad.core/tests/unit/services/AcaadResponseParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ describe('AcaadResponseParser', () => {

it.each([
{
outcomeRaw: 'test-string',
outcomeRaw: '\"test-string\"',
cardinality: 'Single',
type: 'String',
expectedResult: 'test-string'
},
{
outcomeRaw: '',
outcomeRaw: '\"\"',
cardinality: 'Single',
type: 'String',
expectedResult: ''
Expand All @@ -186,19 +186,19 @@ describe('AcaadResponseParser', () => {
expectedResult: false
},
{
outcomeRaw: 'tRUe',
outcomeRaw: '\"tRUe\"',
cardinality: 'Single',
type: 'Boolean',
expectedResult: true
},
{
outcomeRaw: 'faLSE',
outcomeRaw: '\"faLSE\"',
cardinality: 'Single',
type: 'Boolean',
expectedResult: false
},
{
outcomeRaw: 'test-string',
outcomeRaw: '\"test-string\"',
cardinality: 'Single',
type: 'Boolean',
expectedError: new OutcomeNotParseableError('Boolean', 'Single', 'test-string')
Expand All @@ -210,7 +210,7 @@ describe('AcaadResponseParser', () => {
expectedResult: 1337
},
{
outcomeRaw: 'test-string',
outcomeRaw: '\"test-string\"',
cardinality: 'Single',
type: 'Long',
expectedError: new OutcomeNotParseableError('Long', 'Single', 'test-string')
Expand All @@ -228,7 +228,7 @@ describe('AcaadResponseParser', () => {
expectedResult: 1337.4711
},
{
outcomeRaw: 'test-string',
outcomeRaw: '\"test-string\"',
cardinality: 'Single',
type: 'Decimal',
expectedError: new OutcomeNotParseableError('Decimal', 'Single', 'test-string')
Expand Down
2 changes: 1 addition & 1 deletion acaad.testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acaad/testing",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "acaad",
"main": "dist/cjs/index.js",
"module": "./dist/esnext/index.js",
Expand Down
2 changes: 1 addition & 1 deletion acaad.toolchain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acaad/toolchain",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "acaad",
"author": {
"name": "OlliMartin",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@acaad/abstractions",
"comment": "",
"type": "none"
}
],
"packageName": "@acaad/abstractions"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@acaad/core",
"comment": "Fixed issue in single-value parsing",
"type": "none"
}
],
"packageName": "@acaad/core"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@acaad/testing",
"comment": "",
"type": "none"
}
],
"packageName": "@acaad/testing"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@acaad/toolchain",
"comment": "",
"type": "none"
}
],
"packageName": "@acaad/toolchain"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "iobroker.acaad",
"comment": "Adjustments for new core release",
"type": "none"
}
],
"packageName": "iobroker.acaad"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "iobroker.acaad",
"comment": "Parse single values as well",
"type": "none"
}
],
"packageName": "iobroker.acaad"
}
Loading