@wiotp/sdk 0.7.8 → 0.7.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseClient.js +36 -82
- package/dist/BaseConfig.js +24 -36
- package/dist/api/ApiClient.js +60 -76
- package/dist/api/ApiErrors.js +29 -74
- package/dist/api/DscClient.js +77 -77
- package/dist/api/LecClient.js +17 -15
- package/dist/api/MgmtClient.js +17 -15
- package/dist/api/RegistryClient.js +12 -18
- package/dist/api/RulesClient.js +17 -15
- package/dist/api/StateClient.js +70 -132
- package/dist/application/ApplicationClient.js +53 -137
- package/dist/application/ApplicationConfig.js +43 -64
- package/dist/application/index.js +0 -3
- package/dist/bundled/wiotp-bundle.js +39030 -34326
- package/dist/bundled/wiotp-bundle.min.js +7 -6
- package/dist/device/DeviceClient.js +25 -54
- package/dist/device/DeviceConfig.js +37 -59
- package/dist/device/index.js +0 -3
- package/dist/gateway/GatewayClient.js +27 -61
- package/dist/gateway/GatewayConfig.js +22 -33
- package/dist/gateway/index.js +0 -3
- package/dist/index.js +14 -28
- package/dist/util.js +9 -15
- package/package.json +24 -24
- package/src/BaseClient.js +1 -1
- package/src/application/ApplicationConfig.js +1 -1
|
@@ -1,70 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _util = require("../util");
|
|
9
|
-
|
|
10
9
|
var _BaseClient2 = _interopRequireDefault(require("../BaseClient"));
|
|
11
|
-
|
|
12
10
|
var _DeviceConfig = _interopRequireDefault(require("./DeviceConfig"));
|
|
13
|
-
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
17
|
-
|
|
18
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
27
|
-
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
13
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
36
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
22
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /**
|
|
26
|
+
*****************************************************************************
|
|
27
|
+
Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
|
|
28
|
+
All rights reserved. This program and the accompanying materials
|
|
29
|
+
are made available under the terms of the Eclipse Public License v1.0
|
|
30
|
+
which accompanies this distribution, and is available at
|
|
31
|
+
http://www.eclipse.org/legal/epl-v10.html
|
|
32
|
+
*****************************************************************************
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
42
35
|
var WILDCARD_TOPIC = 'iot-2/cmd/+/fmt/+';
|
|
43
36
|
var CMD_RE = /^iot-2\/cmd\/(.+)\/fmt\/(.+)$/;
|
|
44
|
-
|
|
45
37
|
var util = require('util');
|
|
46
|
-
|
|
47
|
-
var DeviceClient = /*#__PURE__*/function (_BaseClient) {
|
|
38
|
+
var DeviceClient = exports["default"] = /*#__PURE__*/function (_BaseClient) {
|
|
48
39
|
_inherits(DeviceClient, _BaseClient);
|
|
49
|
-
|
|
50
|
-
var _super = _createSuper(DeviceClient);
|
|
51
|
-
|
|
52
40
|
function DeviceClient(config) {
|
|
53
41
|
var _this;
|
|
54
|
-
|
|
55
42
|
_classCallCheck(this, DeviceClient);
|
|
56
|
-
|
|
57
43
|
if (!config instanceof _DeviceConfig["default"]) {
|
|
58
44
|
throw new Error("Config must be an instance of DeviceConfig");
|
|
59
45
|
}
|
|
60
|
-
|
|
61
|
-
_this = _super.call(this, config);
|
|
62
|
-
|
|
46
|
+
_this = _callSuper(this, DeviceClient, [config]);
|
|
63
47
|
_this.log.debug("[DeviceClient:constructor] DeviceClient initialized for " + config.getClientId());
|
|
64
|
-
|
|
65
48
|
return _this;
|
|
66
49
|
}
|
|
67
|
-
|
|
68
50
|
_createClass(DeviceClient, [{
|
|
69
51
|
key: "_commandSubscriptionCallback",
|
|
70
52
|
value: function _commandSubscriptionCallback(err, granted) {
|
|
@@ -82,9 +64,7 @@ var DeviceClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
82
64
|
key: "connect",
|
|
83
65
|
value: function connect() {
|
|
84
66
|
var _this2 = this;
|
|
85
|
-
|
|
86
67
|
_get(_getPrototypeOf(DeviceClient.prototype), "connect", this).call(this);
|
|
87
|
-
|
|
88
68
|
this.mqtt.on('connect', function () {
|
|
89
69
|
// On connect establish a subscription for commands sent to this device (but not if connecting to quickstart)
|
|
90
70
|
if (!_this2.config.isQuickstart()) {
|
|
@@ -96,9 +76,7 @@ var DeviceClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
96
76
|
});
|
|
97
77
|
this.mqtt.on('message', function (topic, payload) {
|
|
98
78
|
_this2.log.debug("[DeviceClient:onMessage] Message received on topic : " + topic + " with payload : " + payload);
|
|
99
|
-
|
|
100
79
|
var match = CMD_RE.exec(topic);
|
|
101
|
-
|
|
102
80
|
if (match) {
|
|
103
81
|
_this2.emit('command', match[1], match[2], payload, topic);
|
|
104
82
|
}
|
|
@@ -108,22 +86,15 @@ var DeviceClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
108
86
|
key: "publishEvent",
|
|
109
87
|
value: function publishEvent(eventId, format, data, qos, callback) {
|
|
110
88
|
qos = qos || 0;
|
|
111
|
-
|
|
112
89
|
if (!(0, _util.isDefined)(eventId) || !(0, _util.isDefined)(format)) {
|
|
113
90
|
this.log.error("[DeviceClient:publishEvent] Required params for publishEvent not present");
|
|
114
91
|
this.emit('error', "[DeviceClient:publishEvent] Required params for publishEvent not present");
|
|
115
92
|
return;
|
|
116
93
|
}
|
|
117
|
-
|
|
118
94
|
var topic = util.format("iot-2/evt/%s/fmt/%s", eventId, format);
|
|
119
|
-
|
|
120
95
|
this._publish(topic, data, qos, callback);
|
|
121
|
-
|
|
122
96
|
return this;
|
|
123
97
|
}
|
|
124
98
|
}]);
|
|
125
|
-
|
|
126
99
|
return DeviceClient;
|
|
127
|
-
}(_BaseClient2["default"]);
|
|
128
|
-
|
|
129
|
-
exports["default"] = DeviceClient;
|
|
100
|
+
}(_BaseClient2["default"]);
|
|
@@ -1,71 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _BaseConfig2 = _interopRequireDefault(require("../BaseConfig"));
|
|
9
|
-
|
|
10
9
|
var _loglevel = _interopRequireDefault(require("loglevel"));
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
15
|
-
|
|
16
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
25
|
-
|
|
26
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
27
|
-
|
|
28
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
29
|
-
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
30
18
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /**
|
|
23
|
+
*****************************************************************************
|
|
24
|
+
Copyright (c) 2019 IBM Corporation and other Contributors.
|
|
25
|
+
All rights reserved. This program and the accompanying materials
|
|
26
|
+
are made available under the terms of the Eclipse Public License v1.0
|
|
27
|
+
which accompanies this distribution, and is available at
|
|
28
|
+
http://www.eclipse.org/legal/epl-v10.html
|
|
29
|
+
*****************************************************************************
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
36
32
|
var YAML = require('yaml');
|
|
37
|
-
|
|
38
33
|
var fs = require('fs');
|
|
39
|
-
|
|
40
|
-
var DeviceConfig = /*#__PURE__*/function (_BaseConfig) {
|
|
34
|
+
var DeviceConfig = exports["default"] = /*#__PURE__*/function (_BaseConfig) {
|
|
41
35
|
_inherits(DeviceConfig, _BaseConfig);
|
|
42
|
-
|
|
43
|
-
var _super = _createSuper(DeviceConfig);
|
|
44
|
-
|
|
45
36
|
function DeviceConfig(identity, auth, options) {
|
|
46
37
|
var _this;
|
|
47
|
-
|
|
48
38
|
_classCallCheck(this, DeviceConfig);
|
|
39
|
+
_this = _callSuper(this, DeviceConfig, [identity, auth, options]);
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
//Validate the arguments
|
|
52
42
|
if (_this.identity == null) {
|
|
53
43
|
throw new Error("Missing identity from configuration");
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
if (!("orgId" in _this.identity) || _this.identity.orgId == null) {
|
|
57
46
|
throw new Error("Missing identity.orgId from configuration");
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
if (!("typeId" in _this.identity) || _this.identity.typeId == null) {
|
|
61
49
|
throw new Error("Missing identity.typeId from configuration");
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
if (!("deviceId" in _this.identity) || _this.identity.deviceId == null) {
|
|
65
52
|
throw new Error("Missing identity.deviceId from configuration");
|
|
66
|
-
}
|
|
67
|
-
|
|
53
|
+
}
|
|
68
54
|
|
|
55
|
+
// Authentication is not supported for quickstart
|
|
69
56
|
if (_this.identity.orgId == "quickstart") {
|
|
70
57
|
if (_this.auth != null) {
|
|
71
58
|
throw new Error("Quickstart service does not support device authentication");
|
|
@@ -74,15 +61,12 @@ var DeviceConfig = /*#__PURE__*/function (_BaseConfig) {
|
|
|
74
61
|
if (_this.auth == null) {
|
|
75
62
|
throw new Error("Missing auth from configuration");
|
|
76
63
|
}
|
|
77
|
-
|
|
78
64
|
if (!("token" in _this.auth) || _this.auth.token == null) {
|
|
79
65
|
throw new Error("Missing auth.token from configuration");
|
|
80
66
|
}
|
|
81
67
|
}
|
|
82
|
-
|
|
83
68
|
return _this;
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
_createClass(DeviceConfig, [{
|
|
87
71
|
key: "getOrgId",
|
|
88
72
|
value: function getOrgId() {
|
|
@@ -113,15 +97,17 @@ var DeviceConfig = /*#__PURE__*/function (_BaseConfig) {
|
|
|
113
97
|
//Identity
|
|
114
98
|
var orgId = process.env.WIOTP_IDENTITY_ORGID || null;
|
|
115
99
|
var typeId = process.env.WIOTP_IDENTITY_TYPEID || null;
|
|
116
|
-
var deviceId = process.env.WIOTP_IDENTITY_DEVICEID || null;
|
|
100
|
+
var deviceId = process.env.WIOTP_IDENTITY_DEVICEID || null;
|
|
117
101
|
|
|
118
|
-
|
|
102
|
+
// Auth
|
|
103
|
+
var authToken = process.env.WIOTP_AUTH_TOKEN || null;
|
|
119
104
|
|
|
105
|
+
// Also support WIOTP_API_TOKEN usage
|
|
120
106
|
if (authToken == null) {
|
|
121
107
|
authToken = process.env.WIOTP_API_TOKEN || null;
|
|
122
|
-
}
|
|
123
|
-
|
|
108
|
+
}
|
|
124
109
|
|
|
110
|
+
// Options
|
|
125
111
|
var domain = process.env.WIOTP_OPTIONS_DOMAIN || null;
|
|
126
112
|
var logLevel = process.env.WIOTP_OPTIONS_LOGLEVEL || "info";
|
|
127
113
|
var port = process.env.WIOTP_OPTIONS_MQTT_PORT || null;
|
|
@@ -130,12 +116,12 @@ var DeviceConfig = /*#__PURE__*/function (_BaseConfig) {
|
|
|
130
116
|
var cleanStart = process.env.WIOTP_OPTIONS_MQTT_CLEANSTART || "true";
|
|
131
117
|
var sessionExpiry = process.env.WIOTP_OPTIONS_MQTT_SESSIONEXPIRY || 3600;
|
|
132
118
|
var keepAlive = process.env.WIOTP_OPTIONS_MQTT_KEEPALIVE || 60;
|
|
133
|
-
var sharedSubs = process.env.WIOTP_OPTIONS_MQTT_SHAREDSUBSCRIPTION || "false";
|
|
119
|
+
var sharedSubs = process.env.WIOTP_OPTIONS_MQTT_SHAREDSUBSCRIPTION || "false";
|
|
134
120
|
|
|
121
|
+
// String to int conversions
|
|
135
122
|
if (port != null) {
|
|
136
123
|
port = parseInt(port);
|
|
137
124
|
}
|
|
138
|
-
|
|
139
125
|
sessionExpiry = parseInt(sessionExpiry);
|
|
140
126
|
keepAlive = parseInt(keepAlive);
|
|
141
127
|
var identity = {
|
|
@@ -156,14 +142,13 @@ var DeviceConfig = /*#__PURE__*/function (_BaseConfig) {
|
|
|
156
142
|
caFile: caFile
|
|
157
143
|
}
|
|
158
144
|
};
|
|
159
|
-
var auth = null;
|
|
160
|
-
|
|
145
|
+
var auth = null;
|
|
146
|
+
// Quickstart doesn't support auth, so ensure we only add this if it's defined
|
|
161
147
|
if (authToken != null) {
|
|
162
148
|
auth = {
|
|
163
149
|
token: authToken
|
|
164
150
|
};
|
|
165
151
|
}
|
|
166
|
-
|
|
167
152
|
return new DeviceConfig(identity, auth, options);
|
|
168
153
|
}
|
|
169
154
|
}, {
|
|
@@ -189,36 +174,29 @@ var DeviceConfig = /*#__PURE__*/function (_BaseConfig) {
|
|
|
189
174
|
keepAlive: 60
|
|
190
175
|
caFile: /path/to/certificateAuthorityFile.pem
|
|
191
176
|
*/
|
|
177
|
+
|
|
192
178
|
var configFile = fs.readFileSync(configFilePath, 'utf8');
|
|
193
179
|
var data = YAML.parse(configFile);
|
|
194
|
-
|
|
195
180
|
if (!fs.existsSync(configFilePath)) {
|
|
196
181
|
throw new Error("File not found");
|
|
197
182
|
} else {
|
|
198
183
|
try {
|
|
199
184
|
var _configFile = fs.readFileSync(configFilePath, 'utf8');
|
|
200
|
-
|
|
201
185
|
var data = YAML.parse(_configFile);
|
|
202
186
|
} catch (err) {
|
|
203
187
|
throw new Error("Error reading device configuration file: " + err.code);
|
|
204
188
|
}
|
|
205
189
|
}
|
|
206
|
-
|
|
207
190
|
if ("options" in data & "logLevel" in data["options"]) {
|
|
208
191
|
var validLevels = ["error", "warning", "info", "debug"];
|
|
209
|
-
|
|
210
192
|
if (!validLevels.includes(data["options"]["logLevel"])) {
|
|
211
193
|
throw new Error("Optional setting options.logLevel (Currently: " + data["options"]["logLevel"] + ") must be one of error, warning, info, debug");
|
|
212
194
|
}
|
|
213
195
|
} else {
|
|
214
196
|
data["options"]["logLevel"] = _loglevel["default"].GetLogger(data["options"]["logLevel"].toUpperCase());
|
|
215
197
|
}
|
|
216
|
-
|
|
217
198
|
return new DeviceConfig(data['identity'], data['auth'], data['options']);
|
|
218
199
|
}
|
|
219
200
|
}]);
|
|
220
|
-
|
|
221
201
|
return DeviceConfig;
|
|
222
|
-
}(_BaseConfig2["default"]);
|
|
223
|
-
|
|
224
|
-
exports["default"] = DeviceConfig;
|
|
202
|
+
}(_BaseConfig2["default"]);
|
package/dist/device/index.js
CHANGED
|
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "DeviceConfig", {
|
|
|
15
15
|
return _DeviceConfig["default"];
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
var _DeviceClient = _interopRequireDefault(require("./DeviceClient"));
|
|
20
|
-
|
|
21
19
|
var _DeviceConfig = _interopRequireDefault(require("./DeviceConfig"));
|
|
22
|
-
|
|
23
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -1,85 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _BaseClient2 = _interopRequireDefault(require("../BaseClient"));
|
|
9
|
-
|
|
10
9
|
var _GatewayConfig = _interopRequireDefault(require("./GatewayConfig"));
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
15
|
-
|
|
16
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
25
|
-
|
|
26
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
-
|
|
28
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
-
|
|
30
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
-
|
|
32
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
33
|
-
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
34
18
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
-
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
21
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
22
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
24
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /**
|
|
25
|
+
*****************************************************************************
|
|
26
|
+
Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
|
|
27
|
+
All rights reserved. This program and the accompanying materials
|
|
28
|
+
are made available under the terms of the Eclipse Public License v1.0
|
|
29
|
+
which accompanies this distribution, and is available at
|
|
30
|
+
http://www.eclipse.org/legal/epl-v10.html
|
|
31
|
+
*****************************************************************************
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
40
34
|
var CMD_RE = /^iot-2\/type\/(.+)\/id\/(.+)\/cmd\/(.+)\/fmt\/(.+)$/;
|
|
41
|
-
|
|
42
35
|
var util = require('util');
|
|
43
|
-
|
|
44
|
-
var GatewayClient = /*#__PURE__*/function (_BaseClient) {
|
|
36
|
+
var GatewayClient = exports["default"] = /*#__PURE__*/function (_BaseClient) {
|
|
45
37
|
_inherits(GatewayClient, _BaseClient);
|
|
46
|
-
|
|
47
|
-
var _super = _createSuper(GatewayClient);
|
|
48
|
-
|
|
49
38
|
function GatewayClient(config) {
|
|
50
39
|
var _this;
|
|
51
|
-
|
|
52
40
|
_classCallCheck(this, GatewayClient);
|
|
53
|
-
|
|
54
41
|
if (!config instanceof _GatewayConfig["default"]) {
|
|
55
42
|
throw new Error("Config must be an instance of GatewayConfig");
|
|
56
43
|
}
|
|
57
|
-
|
|
58
44
|
if (config.isQuickstart()) {
|
|
59
45
|
throw new Error('[GatewayClient:constructor] Quickstart not supported in Gateways');
|
|
60
46
|
}
|
|
61
|
-
|
|
62
|
-
_this = _super.call(this, config);
|
|
63
|
-
|
|
47
|
+
_this = _callSuper(this, GatewayClient, [config]);
|
|
64
48
|
_this.log.debug("[GatewayClient:constructor] GatewayClient initialized for " + config.getClientId());
|
|
65
|
-
|
|
66
49
|
return _this;
|
|
67
50
|
}
|
|
68
|
-
|
|
69
51
|
_createClass(GatewayClient, [{
|
|
70
52
|
key: "connect",
|
|
71
53
|
value: function connect() {
|
|
72
54
|
var _this2 = this;
|
|
73
|
-
|
|
74
55
|
_get(_getPrototypeOf(GatewayClient.prototype), "connect", this).call(this);
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
this.mqtt.on('connect', function () {
|
|
57
|
+
// This gateway client implemention does not automatically subscribe to any commands!?
|
|
77
58
|
});
|
|
78
59
|
this.mqtt.on('message', function (topic, payload) {
|
|
79
60
|
_this2.log.debug("[GatewayClient:onMessage] Message received on topic : " + topic + " with payload : " + payload);
|
|
80
|
-
|
|
81
61
|
var match = CMD_RE.exec(topic);
|
|
82
|
-
|
|
83
62
|
if (match) {
|
|
84
63
|
_this2.emit('command', match[1], match[2], match[3], match[4], payload, topic);
|
|
85
64
|
}
|
|
@@ -100,9 +79,7 @@ var GatewayClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
100
79
|
value: function _publishEvent(typeId, deviceId, eventId, format, data, qos, callback) {
|
|
101
80
|
var topic = util.format("iot-2/type/%s/id/%s/evt/%s/fmt/%s", typeId, deviceId, eventId, format);
|
|
102
81
|
qos = qos || 0;
|
|
103
|
-
|
|
104
82
|
this._publish(topic, data, qos, callback);
|
|
105
|
-
|
|
106
83
|
return this;
|
|
107
84
|
}
|
|
108
85
|
}, {
|
|
@@ -114,9 +91,7 @@ var GatewayClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
114
91
|
format = format || '+';
|
|
115
92
|
qos = qos || 0;
|
|
116
93
|
var topic = "iot-2/type/" + typeId + "/id/" + deviceId + "/cmd/" + commandId + "/fmt/" + format;
|
|
117
|
-
|
|
118
94
|
this._subscribe(topic, qos, callback);
|
|
119
|
-
|
|
120
95
|
return this;
|
|
121
96
|
}
|
|
122
97
|
}, {
|
|
@@ -127,9 +102,7 @@ var GatewayClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
127
102
|
commandId = commandId || '+';
|
|
128
103
|
format = format || '+';
|
|
129
104
|
var topic = "iot-2/type/" + typeId + "/id/" + deviceId + "/cmd/" + commandId + "/fmt/" + format;
|
|
130
|
-
|
|
131
105
|
this._unsubscribe(topic, callback);
|
|
132
|
-
|
|
133
106
|
return this;
|
|
134
107
|
}
|
|
135
108
|
}, {
|
|
@@ -139,9 +112,7 @@ var GatewayClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
139
112
|
format = format || '+';
|
|
140
113
|
qos = qos || 0;
|
|
141
114
|
var topic = "iot-2/type/" + this.config.identity.typeId + "/id/" + this.config.identity.deviceId + "/cmd/" + commandId + "/fmt/" + format;
|
|
142
|
-
|
|
143
115
|
this._subscribe(topic, qos, callback);
|
|
144
|
-
|
|
145
116
|
return this;
|
|
146
117
|
}
|
|
147
118
|
}, {
|
|
@@ -150,14 +121,9 @@ var GatewayClient = /*#__PURE__*/function (_BaseClient) {
|
|
|
150
121
|
commandId = commandId || '+';
|
|
151
122
|
format = format || '+';
|
|
152
123
|
var topic = "iot-2/type/" + this.config.identity.typeId + "/id/" + this.config.identity.deviceId + "/cmd/" + commandId + "/fmt/" + format;
|
|
153
|
-
|
|
154
124
|
this._unsubscribe(topic, callback);
|
|
155
|
-
|
|
156
125
|
return this;
|
|
157
126
|
}
|
|
158
127
|
}]);
|
|
159
|
-
|
|
160
128
|
return GatewayClient;
|
|
161
|
-
}(_BaseClient2["default"]);
|
|
162
|
-
|
|
163
|
-
exports["default"] = GatewayClient;
|
|
129
|
+
}(_BaseClient2["default"]);
|
|
@@ -1,56 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _DeviceConfig2 = _interopRequireDefault(require("../device/DeviceConfig"));
|
|
9
|
-
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
|
-
|
|
14
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
|
|
24
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
-
|
|
26
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
27
|
-
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
28
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /**
|
|
22
|
+
*****************************************************************************
|
|
23
|
+
Copyright (c) 2019 IBM Corporation and other Contributors.
|
|
24
|
+
All rights reserved. This program and the accompanying materials
|
|
25
|
+
are made available under the terms of the Eclipse Public License v1.0
|
|
26
|
+
which accompanies this distribution, and is available at
|
|
27
|
+
http://www.eclipse.org/legal/epl-v10.html
|
|
28
|
+
*****************************************************************************
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
var GatewayConfig = exports["default"] = /*#__PURE__*/function (_DeviceConfig) {
|
|
35
32
|
_inherits(GatewayConfig, _DeviceConfig);
|
|
36
|
-
|
|
37
|
-
var _super = _createSuper(GatewayConfig);
|
|
38
|
-
|
|
39
33
|
function GatewayConfig(identity, auth, options) {
|
|
40
34
|
_classCallCheck(this, GatewayConfig);
|
|
41
|
-
|
|
42
|
-
return _super.call(this, identity, auth, options);
|
|
35
|
+
return _callSuper(this, GatewayConfig, [identity, auth, options]);
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
_createClass(GatewayConfig, [{
|
|
46
38
|
key: "getClientId",
|
|
47
39
|
value: function getClientId() {
|
|
48
40
|
return "g:" + this.identity.orgId + ":" + this.identity.typeId + ":" + this.identity.deviceId;
|
|
49
41
|
}
|
|
50
42
|
}]);
|
|
51
|
-
|
|
52
43
|
return GatewayConfig;
|
|
53
44
|
}(_DeviceConfig2["default"]);
|
|
54
|
-
|
|
55
|
-
exports["default"] = GatewayConfig;
|
|
56
45
|
;
|