Skip to content

Commit 5071bac

Browse files
authored
feat: message broker (#289)
* chore: bump all dependencies * chore: 3.16.0 version * feat: message broker client * feat: messagebroker client * feat: add support to messagebroker service #288 * chore: tests * chore: fixed unit tests for nock + README
1 parent f6cfe02 commit 5071bac

16 files changed

+525
-79
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Changelog
22

3+
## 3.16.0 - (Tyrian Vienna) - September 2021
4+
5+
- CLI: new `mc message-broker` command - manage message broker subscriptions and webhooks
6+
- SDK: message broker client
7+
- Bumped all dependencies
8+
39
## 3.15.0 - (Pineapple) Vienna) - August 2021
410

511
- changed generated code for the mindconnect agent and agent management client to support BIG_STRING AND TIMESTAMP see MDS-329054
612
- Upgraded validation to newest ajv - the validation of the timeseries had to be rewritten due to deprecation of addKeyword interface in ajv
713
- Bumped all dependencies
814

9-
1015
## 3.14.0 - (Cool Grey Vienna) - June 2021
1116

1217
### Announcement 3.14.0

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ It implements support for both frontend (browser e.g. angular, react...) and bac
327327
| Oauth Authorization | :heavy_check_mark: | :heavy_check_mark: |
328328
| Tenant Management | :heavy_check_mark: | :heavy_check_mark: |
329329
| Token Management | :heavy_check_mark: | :heavy_check_mark: |
330+
| Message Broker* (preview) | :heavy_check_mark: | :heavy_check_mark: |
330331
| Usage Transparency | :heavy_check_mark: | |
331332

333+
*) Message Broker is only available on preview tenants
334+
332335
### IoT and Storage
333336

334337
| Name |SDK - Client | Command |

package-lock.json

+23-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mindconnect/mindconnect-nodejs",
3-
"version": "3.15.0",
3+
"version": "3.16.0",
44
"description": "NodeJS Library for MindSphere Connectivity - TypeScript SDK for MindSphere - MindSphere Command Line Interface - MindSphere Development Proxy",
55
"main": "./dist/src/index.js",
66
"browser": "./dist/src/index.bundle.js",
@@ -75,26 +75,26 @@
7575
"@types/jsonwebtoken": "^8.5.5",
7676
"@types/lodash": "^4.14.172",
7777
"@types/mocha": "^9.0.0",
78-
"@types/node": "^16.6.2",
78+
"@types/node": "^16.7.13",
7979
"@types/update-notifier": "^5.1.0",
8080
"@types/uuid": "^8.3.1",
8181
"chai": "^4.3.4",
8282
"concurrently": "^6.2.1",
8383
"copyfiles": "^2.4.1",
8484
"cross-env": "^7.0.3",
8585
"license-checker": "^25.0.1",
86-
"mocha": "^9.0.3",
86+
"mocha": "^9.1.1",
8787
"mocha-jenkins-reporter": "^0.4.6",
88-
"nock": "^12.0.3",
88+
"nock": "^13.1.3",
8989
"pkg": "^5.3.1",
9090
"rimraf": "^3.0.2",
91-
"rollup": "^2.56.2",
91+
"rollup": "^2.56.3",
9292
"rollup-plugin-node-polyfills": "^0.2.1",
9393
"rollup-plugin-terser": "^7.0.2",
9494
"ts-node": "^10.2.1",
9595
"tslib": "^2.3.1",
9696
"tslint": "^6.1.2",
97-
"typescript": "^4.3.5",
97+
"typescript": "^4.4.2",
9898
"typescript-tslint-plugin": "^1.0.1"
9999
},
100100
"repository": {

src/api/sdk/common/mindsphere-sdk.ts

+24-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ import { AnomalyDetectionClient } from "../anomaly-detection/anomaly-detection";
33
import { AssetManagementClient } from "../asset/asset-management";
44
import { DataExchangeClient } from "../data-exchange/data-exchange";
55
import { DataLakeClient } from "../data-lake/data-lake";
6-
import { DeviceStatusManagementClient } from "../open-edge/open-edge";
7-
import { DeviceManagementClient } from "../open-edge/open-edge";
8-
import { DeviceConfigurationClient } from "../open-edge/open-edge";
9-
import { DeploymentWorkflowClient } from "../open-edge/open-edge";
10-
import { EdgeAppInstanceManagementClient } from "../open-edge/open-edge";
11-
import { EdgeAppDeploymentClient } from "../open-edge/open-edge";
12-
import { FirmwareDeploymentClient } from "../open-edge/open-edge";
136
import { EventAnalyticsClient } from "../event-analytics/eventanalytics";
147
import { EventManagementClient } from "../event/event-management";
158
import { IdentityManagementClient } from "../identity/identity";
@@ -21,8 +14,18 @@ import { IotFileClient } from "../iotfile/iot-file";
2114
import { JobManagerClient } from "../jobmanager/jobmanager";
2215
import { KPICalculationClient } from "../kpi/kpi";
2316
import { MindConnectApiClient } from "../mcapi/mcapi";
17+
import { MessageBrokerClient } from "../messagebroker/messagebroker";
2418
import { ModelManagementClient } from "../model/model-management";
2519
import { NotificationClientV4 } from "../notification-v4/notification-v4";
20+
import {
21+
DeploymentWorkflowClient,
22+
DeviceConfigurationClient,
23+
DeviceManagementClient,
24+
DeviceStatusManagementClient,
25+
EdgeAppDeploymentClient,
26+
EdgeAppInstanceManagementClient,
27+
FirmwareDeploymentClient,
28+
} from "../open-edge/open-edge";
2629
import { SemanticDataInterconnectClient } from "../sdi/sdi-v4";
2730
import { SignalCalculationClient } from "../signal-calculation/signal-calculation";
2831
import { SignalValidationClient } from "../signal-validation/signal-validation";
@@ -507,4 +510,18 @@ export class MindSphereSdk extends SdkClient {
507510
this._semanticDataInterConnectClient || new SemanticDataInterconnectClient(this._authenticator);
508511
return this._semanticDataInterConnectClient;
509512
}
513+
514+
private _messageBrokerClient?: MessageBrokerClient;
515+
516+
/**
517+
* * Message Broker Client
518+
*
519+
* @returns {MessageBrokerClient}
520+
*
521+
* @memberOf MindSphereSdk
522+
*/
523+
public GetMessageBrokerClient(): MessageBrokerClient {
524+
this._messageBrokerClient = this._messageBrokerClient || new MessageBrokerClient(this._authenticator);
525+
return this._messageBrokerClient;
526+
}
510527
}

src/api/sdk/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export * from "./jobmanager/jobmanager";
3232
export * from "./jobmanager/jobmanager-models";
3333
export * from "./mcapi/mcapi";
3434
export * from "./mcapi/mcapi-models";
35+
export * from "./messagebroker/messagebroker";
36+
export * from "./messagebroker/messagebroker-models";
3537
export * from "./model/model-management";
3638
export * from "./model/model-models";
3739
export * from "./notification-v4/notification-v4";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
export namespace MessageBrokerModels {
2+
/**
3+
*
4+
* @export
5+
* @class RequiredError
6+
* @extends {Error}
7+
*/
8+
export class RequiredError extends Error {
9+
name: "RequiredError" = "RequiredError";
10+
constructor(public field: string, msg?: string) {
11+
super(msg);
12+
}
13+
}
14+
15+
/**
16+
* Error response body model.
17+
* @export
18+
* @interface Errors
19+
*/
20+
export interface Errors {
21+
/**
22+
* Concrete error codes and messages are defined at operation error response descriptions in this API specification.
23+
* @type {Array<ErrorsErrors>}
24+
* @memberof Errors
25+
*/
26+
errors?: Array<ErrorsErrors>;
27+
}
28+
/**
29+
*
30+
* @export
31+
* @interface ErrorsErrors
32+
*/
33+
export interface ErrorsErrors {
34+
/**
35+
* Unique error code. Every code is bound to one message.
36+
* @type {string}
37+
* @memberof ErrorsErrors
38+
*/
39+
code: string;
40+
/**
41+
* Logging correlation ID for debugging purposes.
42+
* @type {string}
43+
* @memberof ErrorsErrors
44+
*/
45+
logref: string;
46+
/**
47+
* Human readable error message in English.
48+
* @type {string}
49+
* @memberof ErrorsErrors
50+
*/
51+
message: string;
52+
}
53+
/**
54+
*
55+
* @export
56+
* @interface Messages
57+
*/
58+
export interface Messages {
59+
/**
60+
* Message to publish.
61+
* @type {string}
62+
* @memberof Messages
63+
*/
64+
content?: string;
65+
66+
//! fix: manual fix for the type as the OpenAPI spec was not complete
67+
[x: string]: any | undefined;
68+
}
69+
/**
70+
*
71+
* @export
72+
* @interface SubscriberTopicInput
73+
*/
74+
export interface SubscriberTopicInput {
75+
/**
76+
*
77+
* @type {WebHookURL}
78+
* @memberof SubscriberTopicInput
79+
*/
80+
uri: WebHookURL;
81+
}
82+
/**
83+
* Id of the topic. Format: mdsp.{tenant}.{service}.v{version}.{type}.{additional}
84+
* @export
85+
*/
86+
export type TopicId = string;
87+
/**
88+
* Gateway uri on which the app will receive notifications.
89+
* @export
90+
*/
91+
export type WebHookURL = string;
92+
}

0 commit comments

Comments
 (0)