@wiotp/sdk 0.7.6-pre.monitoring-dashboard-updates → 0.7.8

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.
@@ -15,7 +15,7 @@ var _tinycache = _interopRequireDefault(require("tinycache"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
 
18
- function _typeof(obj) { 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); }
18
+ 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); }
19
19
 
20
20
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
21
 
@@ -23,29 +23,33 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
23
23
 
24
24
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
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
+
26
32
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
27
33
 
28
34
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
35
 
30
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
36
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
31
37
 
32
- 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); }
33
-
34
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
39
 
36
40
  var uuidv4 = require('uuid/v4');
37
41
 
38
- var BaseClient =
39
- /*#__PURE__*/
40
- function (_events$EventEmitter) {
42
+ var BaseClient = /*#__PURE__*/function (_events$EventEmitter) {
41
43
  _inherits(BaseClient, _events$EventEmitter);
42
44
 
45
+ var _super = _createSuper(BaseClient);
46
+
43
47
  function BaseClient(config) {
44
48
  var _this;
45
49
 
46
50
  _classCallCheck(this, BaseClient);
47
51
 
48
- _this = _possibleConstructorReturn(this, _getPrototypeOf(BaseClient).call(this));
52
+ _this = _super.call(this);
49
53
  _this.log = _loglevel["default"];
50
54
 
51
55
  _this.log.setDefaultLevel(config.options.logLevel);
@@ -240,6 +244,16 @@ function (_events$EventEmitter) {
240
244
  value: function _publish(topic, msg, QoS, callback) {
241
245
  QoS = QoS || 0;
242
246
 
247
+ if (this.mqtt == null) {
248
+ this.emit('error', "[BaseClient:_unsubscribe] MQTT Client is not initialized - call connect() first");
249
+ return;
250
+ }
251
+
252
+ if (!this.mqtt.connected) {
253
+ this.emit('error', "[BaseClient:_unsubscribe] MQTT Client is not connected - call connect() first");
254
+ return;
255
+ }
256
+
243
257
  if ((_typeof(msg) === 'object' || typeof msg === 'boolean' || typeof msg === 'number') && !Buffer.isBuffer(msg)) {
244
258
  // mqtt library does not support sending JSON/Boolean/Number data. So stringifying it.
245
259
  // All JSON object, array will be encoded.
@@ -21,9 +21,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
21
21
  *****************************************************************************
22
22
  *
23
23
  */
24
- var BaseConfig =
25
- /*#__PURE__*/
26
- function () {
24
+ var BaseConfig = /*#__PURE__*/function () {
27
25
  function BaseConfig(identity, auth, options) {
28
26
  _classCallCheck(this, BaseConfig);
29
27
 
@@ -19,7 +19,7 @@ var _util = require("../util");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
21
 
22
- function _typeof(obj) { 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); }
22
+ 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); }
23
23
 
24
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
25
 
@@ -33,9 +33,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
33
33
 
34
34
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
35
35
 
36
- var ApiClient =
37
- /*#__PURE__*/
38
- function () {
36
+ var ApiClient = /*#__PURE__*/function () {
39
37
  function ApiClient(config) {
40
38
  _classCallCheck(this, ApiClient);
41
39
 
@@ -99,7 +97,7 @@ function () {
99
97
  }
100
98
 
101
99
  if (_this.config.getAdditionalHeaders()) {
102
- xhrConfig.headers = _objectSpread({}, xhrConfig.headers, {}, _this.config.getAdditionalHeaders());
100
+ xhrConfig.headers = _objectSpread(_objectSpread({}, xhrConfig.headers), _this.config.getAdditionalHeaders());
103
101
  }
104
102
 
105
103
  function transformResponse(response) {
@@ -390,7 +388,8 @@ function () {
390
388
  var blob = new Blob([data.schemaFile], {
391
389
  type: "application/json"
392
390
  });
393
- formData.append('schemaFile', blob);
391
+ var schemaFileName = "".concat(data.name || 'schema', ".json");
392
+ formData.append('schemaFile', blob, schemaFileName);
394
393
  }
395
394
 
396
395
  if (data.name) {
@@ -410,7 +409,8 @@ function () {
410
409
  type: "application/json",
411
410
  name: data.name
412
411
  });
413
- formData.append('schemaFile', blob);
412
+ var schemaFileName = "".concat(data.name || 'schema', ".json");
413
+ formData.append('schemaFile', blob, schemaFileName);
414
414
  }
415
415
  }
416
416
 
@@ -424,7 +424,7 @@ function () {
424
424
  }
425
425
 
426
426
  if (_this2.config.getAdditionalHeaders()) {
427
- xhrConfig.headers = _objectSpread({}, xhrConfig.headers, {}, _this2.config.getAdditionalHeaders());
427
+ xhrConfig.headers = _objectSpread(_objectSpread({}, xhrConfig.headers), _this2.config.getAdditionalHeaders());
428
428
  }
429
429
 
430
430
  function transformResponse(response) {
@@ -5,21 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = exports.handleError = exports.ServiceNotFound = exports.DestinationAlreadyExists = exports.InvalidServiceCredentials = exports.WiotpError = void 0;
7
7
 
8
- function _typeof(obj) { 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); }
8
+ 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); }
9
9
 
10
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
11
 
12
+ 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); }
13
+
14
+ 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); }; }
15
+
12
16
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
13
17
 
14
18
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
19
 
16
- 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); }
17
-
18
20
  function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
19
21
 
20
- function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
22
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
21
23
 
22
- function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
24
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
23
25
 
24
26
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
25
27
 
@@ -27,36 +29,36 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
27
29
 
28
30
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
31
 
30
- var WiotpError =
31
- /*#__PURE__*/
32
- function (_Error) {
32
+ var WiotpError = /*#__PURE__*/function (_Error) {
33
33
  _inherits(WiotpError, _Error);
34
34
 
35
+ var _super = _createSuper(WiotpError);
36
+
35
37
  function WiotpError(message, cause) {
36
38
  var _this;
37
39
 
38
40
  _classCallCheck(this, WiotpError);
39
41
 
40
- _this = _possibleConstructorReturn(this, _getPrototypeOf(WiotpError).call(this, message));
42
+ _this = _super.call(this, message);
41
43
  _this.cause = cause;
42
44
  _this.name = _this.constructor.name;
43
45
  return _this;
44
46
  }
45
47
 
46
48
  return WiotpError;
47
- }(_wrapNativeSuper(Error));
49
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
48
50
 
49
51
  exports.WiotpError = WiotpError;
50
52
 
51
- var InvalidServiceCredentials =
52
- /*#__PURE__*/
53
- function (_WiotpError) {
53
+ var InvalidServiceCredentials = /*#__PURE__*/function (_WiotpError) {
54
54
  _inherits(InvalidServiceCredentials, _WiotpError);
55
55
 
56
+ var _super2 = _createSuper(InvalidServiceCredentials);
57
+
56
58
  function InvalidServiceCredentials() {
57
59
  _classCallCheck(this, InvalidServiceCredentials);
58
60
 
59
- return _possibleConstructorReturn(this, _getPrototypeOf(InvalidServiceCredentials).apply(this, arguments));
61
+ return _super2.apply(this, arguments);
60
62
  }
61
63
 
62
64
  return InvalidServiceCredentials;
@@ -64,15 +66,15 @@ function (_WiotpError) {
64
66
 
65
67
  exports.InvalidServiceCredentials = InvalidServiceCredentials;
66
68
 
67
- var DestinationAlreadyExists =
68
- /*#__PURE__*/
69
- function (_WiotpError2) {
69
+ var DestinationAlreadyExists = /*#__PURE__*/function (_WiotpError2) {
70
70
  _inherits(DestinationAlreadyExists, _WiotpError2);
71
71
 
72
+ var _super3 = _createSuper(DestinationAlreadyExists);
73
+
72
74
  function DestinationAlreadyExists() {
73
75
  _classCallCheck(this, DestinationAlreadyExists);
74
76
 
75
- return _possibleConstructorReturn(this, _getPrototypeOf(DestinationAlreadyExists).apply(this, arguments));
77
+ return _super3.apply(this, arguments);
76
78
  }
77
79
 
78
80
  return DestinationAlreadyExists;
@@ -80,15 +82,15 @@ function (_WiotpError2) {
80
82
 
81
83
  exports.DestinationAlreadyExists = DestinationAlreadyExists;
82
84
 
83
- var ServiceNotFound =
84
- /*#__PURE__*/
85
- function (_WiotpError3) {
85
+ var ServiceNotFound = /*#__PURE__*/function (_WiotpError3) {
86
86
  _inherits(ServiceNotFound, _WiotpError3);
87
87
 
88
+ var _super4 = _createSuper(ServiceNotFound);
89
+
88
90
  function ServiceNotFound() {
89
91
  _classCallCheck(this, ServiceNotFound);
90
92
 
91
- return _possibleConstructorReturn(this, _getPrototypeOf(ServiceNotFound).apply(this, arguments));
93
+ return _super4.apply(this, arguments);
92
94
  }
93
95
 
94
96
  return ServiceNotFound;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { 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); }
3
+ 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); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -23,9 +23,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
23
23
 
24
24
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
25
 
26
- var DscClient =
27
- /*#__PURE__*/
28
- function () {
26
+ var DscClient = /*#__PURE__*/function () {
29
27
  function DscClient(apiClient) {
30
28
  _classCallCheck(this, DscClient);
31
29
 
@@ -15,9 +15,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
15
15
 
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
17
 
18
- var LecClient =
19
- /*#__PURE__*/
20
- function () {
18
+ var LecClient = /*#__PURE__*/function () {
21
19
  function LecClient(apiClient) {
22
20
  _classCallCheck(this, LecClient);
23
21
 
@@ -15,9 +15,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
15
15
 
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
17
 
18
- var MgmtClient =
19
- /*#__PURE__*/
20
- function () {
18
+ var MgmtClient = /*#__PURE__*/function () {
21
19
  function MgmtClient(apiClient) {
22
20
  _classCallCheck(this, MgmtClient);
23
21
 
@@ -21,9 +21,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
21
21
  *****************************************************************************
22
22
  *
23
23
  */
24
- var RegistryClient =
25
- /*#__PURE__*/
26
- function () {
24
+ var RegistryClient = /*#__PURE__*/function () {
27
25
  function RegistryClient(apiClient) {
28
26
  _classCallCheck(this, RegistryClient);
29
27
 
@@ -15,9 +15,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
15
15
 
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
17
 
18
- var RulesClient =
19
- /*#__PURE__*/
20
- function () {
18
+ var RulesClient = /*#__PURE__*/function () {
21
19
  function RulesClient(apiClient) {
22
20
  _classCallCheck(this, RulesClient);
23
21
 
@@ -15,9 +15,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
15
15
 
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
17
 
18
- var StateClient =
19
- /*#__PURE__*/
20
- function () {
18
+ var StateClient = /*#__PURE__*/function () {
21
19
  function StateClient(apiClient) {
22
20
  _classCallCheck(this, StateClient);
23
21
 
@@ -27,7 +27,7 @@ var _ApplicationConfig = _interopRequireDefault(require("./ApplicationConfig"));
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
29
 
30
- function _typeof(obj) { 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); }
30
+ 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); }
31
31
 
32
32
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
33
 
@@ -35,20 +35,24 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
35
35
 
36
36
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
37
37
 
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
39
-
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
-
42
38
  function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } 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(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
43
39
 
44
40
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
45
41
 
46
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
-
48
42
  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); }
49
43
 
50
44
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
51
45
 
46
+ 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); }; }
47
+
48
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
49
+
50
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
+
52
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
53
+
54
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
55
+
52
56
  var DEVICE_EVT_RE = /^iot-2\/type\/(.+)\/id\/(.+)\/evt\/(.+)\/fmt\/(.+)$/;
53
57
  var DEVICE_CMD_RE = /^iot-2\/type\/(.+)\/id\/(.+)\/cmd\/(.+)\/fmt\/(.+)$/;
54
58
  var DEVICE_STATE_RE = /^iot-2\/type\/(.+)\/id\/(.+)\/intf\/(.+)\/evt\/state$/;
@@ -58,11 +62,11 @@ var RULE_ERROR_RE = /^iot-2\/intf\/(.+)\/rule\/(.+)\/err\/data$/;
58
62
  var DEVICE_MON_RE = /^iot-2\/type\/(.+)\/id\/(.+)\/mon$/;
59
63
  var APP_MON_RE = /^iot-2\/app\/(.+)\/mon$/;
60
64
 
61
- var ApplicationClient =
62
- /*#__PURE__*/
63
- function (_BaseClient) {
65
+ var ApplicationClient = /*#__PURE__*/function (_BaseClient) {
64
66
  _inherits(ApplicationClient, _BaseClient);
65
67
 
68
+ var _super = _createSuper(ApplicationClient);
69
+
66
70
  function ApplicationClient(config) {
67
71
  var _this;
68
72
 
@@ -72,7 +76,7 @@ function (_BaseClient) {
72
76
  throw new Error("Config must be an instance of ApplicationConfig");
73
77
  }
74
78
 
75
- _this = _possibleConstructorReturn(this, _getPrototypeOf(ApplicationClient).call(this, config));
79
+ _this = _super.call(this, config);
76
80
  _this.useLtpa = config.auth && config.auth.useLtpa;
77
81
 
78
82
  if (config.auth && config.auth.useLtpa || config.getOrgId() != "quickstart") {
@@ -11,7 +11,7 @@ var _loglevel = _interopRequireDefault(require("loglevel"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
 
14
- function _typeof(obj) { 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); }
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
15
 
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
 
@@ -19,15 +19,19 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
19
19
 
20
20
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
21
21
 
22
+ 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); }
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
+
22
28
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
23
29
 
24
30
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
31
 
26
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
27
33
 
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); }
34
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
35
 
32
36
  var YAML = require('yaml');
33
37
 
@@ -35,17 +39,17 @@ var fs = require('fs');
35
39
 
36
40
  var uuidv4 = require('uuid/v4');
37
41
 
38
- var ApplicationConfig =
39
- /*#__PURE__*/
40
- function (_BaseConfig) {
42
+ var ApplicationConfig = /*#__PURE__*/function (_BaseConfig) {
41
43
  _inherits(ApplicationConfig, _BaseConfig);
42
44
 
45
+ var _super = _createSuper(ApplicationConfig);
46
+
43
47
  function ApplicationConfig(identity, auth, options) {
44
48
  var _this;
45
49
 
46
50
  _classCallCheck(this, ApplicationConfig);
47
51
 
48
- _this = _possibleConstructorReturn(this, _getPrototypeOf(ApplicationConfig).call(this, identity, auth, options)); // Authentication is not supported for quickstart
52
+ _this = _super.call(this, identity, auth, options); // Authentication is not supported for quickstart
49
53
  // and not required when auth.useLtpa is set
50
54
 
51
55
  if (_this.auth != null && !_this.auth.useLtpa) {
@@ -101,7 +105,7 @@ function (_BaseConfig) {
101
105
  value: function getClientId() {
102
106
  var clientIdPrefix = "a";
103
107
 
104
- if (this.sharedSubscription == true) {
108
+ if (this.options.mqtt.sharedSubscription == true) {
105
109
  clientIdPrefix = "A";
106
110
  }
107
111