@wiotp/sdk 0.7.8 → 0.8.0

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.
@@ -1,42 +1,43 @@
1
1
  "use strict";
2
2
 
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
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports["default"] = void 0;
9
-
10
7
  var _loglevel = _interopRequireDefault(require("loglevel"));
11
-
12
8
  var errors = _interopRequireWildcard(require("./ApiErrors"));
13
-
14
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
18
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
12
+ 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); }
20
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
22
- 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, descriptor.key, descriptor); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
-
26
- var DscClient = /*#__PURE__*/function () {
14
+ 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); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ 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); } /**
18
+ *****************************************************************************
19
+ Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
20
+ All rights reserved. This program and the accompanying materials
21
+ are made available under the terms of the Eclipse Public License v1.0
22
+ which accompanies this distribution, and is available at
23
+ http://www.eclipse.org/legal/epl-v10.html
24
+ *****************************************************************************
25
+ *
26
+ */
27
+ var DscClient = exports["default"] = /*#__PURE__*/function () {
27
28
  function DscClient(apiClient) {
28
29
  _classCallCheck(this, DscClient);
30
+ this.log = _loglevel["default"];
29
31
 
30
- this.log = _loglevel["default"]; // callApi(method, expectedHttpCode, expectJsonContent, paths, body, params) {
31
-
32
+ // callApi(method, expectedHttpCode, expectJsonContent, paths, body, params) {
32
33
  this.apiClient = apiClient;
33
34
  }
35
+
34
36
  /**************************************
35
37
  ** Services
36
38
  **************************************/
37
- // {name, description, type, credentials}
38
-
39
39
 
40
+ // {name, description, type, credentials}
40
41
  _createClass(DscClient, [{
41
42
  key: "createService",
42
43
  value: function createService(service) {
@@ -50,20 +51,20 @@ var DscClient = /*#__PURE__*/function () {
50
51
  key: "createCloudantService",
51
52
  value: function createCloudantService(_ref) {
52
53
  var name = _ref.name,
53
- description = _ref.description,
54
- username = _ref.username,
55
- password = _ref.password,
56
- _ref$host = _ref.host,
57
- host = _ref$host === void 0 ? "".concat(username, ".cloudant.com") : _ref$host,
58
- _ref$port = _ref.port,
59
- port = _ref$port === void 0 ? 443 : _ref$port,
60
- _ref$url = _ref.url,
61
- url = _ref$url === void 0 ? "https://".concat(username, ":").concat(password, "@").concat(host) : _ref$url,
62
- apikey = _ref.apikey,
63
- iam_apikey_name = _ref.iam_apikey_name,
64
- iam_apikey_description = _ref.iam_apikey_description,
65
- iam_role_crn = _ref.iam_role_crn,
66
- iam_serviceid_crn = _ref.iam_serviceid_crn;
54
+ description = _ref.description,
55
+ username = _ref.username,
56
+ password = _ref.password,
57
+ _ref$host = _ref.host,
58
+ host = _ref$host === void 0 ? "".concat(username, ".cloudant.com") : _ref$host,
59
+ _ref$port = _ref.port,
60
+ port = _ref$port === void 0 ? 443 : _ref$port,
61
+ _ref$url = _ref.url,
62
+ url = _ref$url === void 0 ? "https://".concat(username, ":").concat(password, "@").concat(host) : _ref$url,
63
+ apikey = _ref.apikey,
64
+ iam_apikey_name = _ref.iam_apikey_name,
65
+ iam_apikey_description = _ref.iam_apikey_description,
66
+ iam_role_crn = _ref.iam_role_crn,
67
+ iam_serviceid_crn = _ref.iam_serviceid_crn;
67
68
  return this.createService({
68
69
  name: name,
69
70
  description: description,
@@ -86,17 +87,17 @@ var DscClient = /*#__PURE__*/function () {
86
87
  key: "createEventstreamsService",
87
88
  value: function createEventstreamsService(_ref2) {
88
89
  var name = _ref2.name,
89
- description = _ref2.description,
90
- api_key = _ref2.api_key,
91
- kafka_admin_url = _ref2.kafka_admin_url,
92
- kafka_brokers_sasl = _ref2.kafka_brokers_sasl,
93
- user = _ref2.user,
94
- password = _ref2.password,
95
- apikey = _ref2.apikey,
96
- iam_apikey_name = _ref2.iam_apikey_name,
97
- iam_apikey_description = _ref2.iam_apikey_description,
98
- iam_role_crn = _ref2.iam_role_crn,
99
- iam_serviceid_crn = _ref2.iam_serviceid_crn;
90
+ description = _ref2.description,
91
+ api_key = _ref2.api_key,
92
+ kafka_admin_url = _ref2.kafka_admin_url,
93
+ kafka_brokers_sasl = _ref2.kafka_brokers_sasl,
94
+ user = _ref2.user,
95
+ password = _ref2.password,
96
+ apikey = _ref2.apikey,
97
+ iam_apikey_name = _ref2.iam_apikey_name,
98
+ iam_apikey_description = _ref2.iam_apikey_description,
99
+ iam_role_crn = _ref2.iam_role_crn,
100
+ iam_serviceid_crn = _ref2.iam_serviceid_crn;
100
101
  return this.createService({
101
102
  name: name,
102
103
  description: description,
@@ -141,23 +142,24 @@ var DscClient = /*#__PURE__*/function () {
141
142
  return errors.handleError(err, {});
142
143
  });
143
144
  }
145
+
144
146
  /**************************************
145
147
  ** Historian Connectors
146
148
  **************************************/
147
- // {name, description, serviceId, timezone, enabled}
148
149
 
150
+ // {name, description, serviceId, timezone, enabled}
149
151
  }, {
150
152
  key: "createConnector",
151
153
  value: function createConnector(_ref3) {
152
154
  var name = _ref3.name,
153
- type = _ref3.type,
154
- _ref3$description = _ref3.description,
155
- description = _ref3$description === void 0 ? undefined : _ref3$description,
156
- serviceId = _ref3.serviceId,
157
- _ref3$timezone = _ref3.timezone,
158
- timezone = _ref3$timezone === void 0 ? 'UTC' : _ref3$timezone,
159
- _ref3$enabled = _ref3.enabled,
160
- enabled = _ref3$enabled === void 0 ? true : _ref3$enabled;
155
+ type = _ref3.type,
156
+ _ref3$description = _ref3.description,
157
+ description = _ref3$description === void 0 ? undefined : _ref3$description,
158
+ serviceId = _ref3.serviceId,
159
+ _ref3$timezone = _ref3.timezone,
160
+ timezone = _ref3$timezone === void 0 ? 'UTC' : _ref3$timezone,
161
+ _ref3$enabled = _ref3.enabled,
162
+ enabled = _ref3$enabled === void 0 ? true : _ref3$enabled;
161
163
  return this.apiClient.callApi('POST', 201, true, ['historianconnectors'], {
162
164
  name: name,
163
165
  description: description,
@@ -173,12 +175,12 @@ var DscClient = /*#__PURE__*/function () {
173
175
  key: "updateConnector",
174
176
  value: function updateConnector(_ref4) {
175
177
  var id = _ref4.id,
176
- name = _ref4.name,
177
- description = _ref4.description,
178
- serviceId = _ref4.serviceId,
179
- type = _ref4.type,
180
- enabled = _ref4.enabled,
181
- timezone = _ref4.timezone;
178
+ name = _ref4.name,
179
+ description = _ref4.description,
180
+ serviceId = _ref4.serviceId,
181
+ type = _ref4.type,
182
+ enabled = _ref4.enabled,
183
+ timezone = _ref4.timezone;
182
184
  return this.apiClient.callApi('PUT', 200, true, ['historianconnectors', id], {
183
185
  id: id,
184
186
  name: name,
@@ -195,9 +197,9 @@ var DscClient = /*#__PURE__*/function () {
195
197
  key: "getConnectors",
196
198
  value: function getConnectors(_ref5) {
197
199
  var name = _ref5.name,
198
- serviceType = _ref5.serviceType,
199
- enabled = _ref5.enabled,
200
- serviceId = _ref5.serviceId;
200
+ serviceType = _ref5.serviceType,
201
+ enabled = _ref5.enabled,
202
+ serviceId = _ref5.serviceId;
201
203
  return this.apiClient.callApi('GET', 200, true, ['historianconnectors'], null, {
202
204
  name: name ? name : undefined,
203
205
  type: serviceType ? serviceType : undefined,
@@ -214,11 +216,11 @@ var DscClient = /*#__PURE__*/function () {
214
216
  return errors.handleError(err, {});
215
217
  });
216
218
  }
219
+
217
220
  /**************************************
218
221
  ** Destinations
219
222
  **************************************/
220
223
  // {name, type, configuration}
221
-
222
224
  }, {
223
225
  key: "createDestination",
224
226
  value: function createDestination(connectorId, destination) {
@@ -232,7 +234,7 @@ var DscClient = /*#__PURE__*/function () {
232
234
  key: "createCloudantDestination",
233
235
  value: function createCloudantDestination(connectorId, _ref6) {
234
236
  var name = _ref6.name,
235
- bucketInterval = _ref6.bucketInterval;
237
+ bucketInterval = _ref6.bucketInterval;
236
238
  return this.createDestination(connectorId, {
237
239
  name: name,
238
240
  type: 'cloudant',
@@ -245,8 +247,8 @@ var DscClient = /*#__PURE__*/function () {
245
247
  key: "createEventstreamsDestination",
246
248
  value: function createEventstreamsDestination(connectorId, _ref7) {
247
249
  var name = _ref7.name,
248
- _ref7$partitions = _ref7.partitions,
249
- partitions = _ref7$partitions === void 0 ? 1 : _ref7$partitions;
250
+ _ref7$partitions = _ref7.partitions,
251
+ partitions = _ref7$partitions === void 0 ? 1 : _ref7$partitions;
250
252
  return this.createDestination(connectorId, {
251
253
  name: name,
252
254
  type: 'eventstreams',
@@ -275,12 +277,13 @@ var DscClient = /*#__PURE__*/function () {
275
277
  return errors.handleError(err, {});
276
278
  });
277
279
  }
280
+
278
281
  /**************************************
279
282
  ** Forwarding Rules
280
283
  **************************************/
284
+
281
285
  // {name, destinationName, type:event, selector: {deviceType, eventId}}
282
286
  // {name, destinationName, type:state, selector: {logicalInterfaceId}}
283
-
284
287
  }, {
285
288
  key: "createForwardingRule",
286
289
  value: function createForwardingRule(connectorId, forwardingrule) {
@@ -292,11 +295,11 @@ var DscClient = /*#__PURE__*/function () {
292
295
  key: "createEventForwardingRule",
293
296
  value: function createEventForwardingRule(connectorId, _ref8) {
294
297
  var name = _ref8.name,
295
- destinationName = _ref8.destinationName,
296
- _ref8$deviceType = _ref8.deviceType,
297
- deviceType = _ref8$deviceType === void 0 ? '*' : _ref8$deviceType,
298
- _ref8$eventId = _ref8.eventId,
299
- eventId = _ref8$eventId === void 0 ? '*' : _ref8$eventId;
298
+ destinationName = _ref8.destinationName,
299
+ _ref8$deviceType = _ref8.deviceType,
300
+ deviceType = _ref8$deviceType === void 0 ? '*' : _ref8$deviceType,
301
+ _ref8$eventId = _ref8.eventId,
302
+ eventId = _ref8$eventId === void 0 ? '*' : _ref8$eventId;
300
303
  return this.createForwardingRule(connectorId, {
301
304
  name: name,
302
305
  destinationName: destinationName,
@@ -323,8 +326,5 @@ var DscClient = /*#__PURE__*/function () {
323
326
  });
324
327
  }
325
328
  }]);
326
-
327
329
  return DscClient;
328
- }();
329
-
330
- exports["default"] = DscClient;
330
+ }();
@@ -4,27 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _loglevel = _interopRequireDefault(require("loglevel"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
9
+ 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); }
12
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
- 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, descriptor.key, descriptor); } }
15
-
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
-
18
- var LecClient = /*#__PURE__*/function () {
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
+ *****************************************************************************
16
+ Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
17
+ All rights reserved. This program and the accompanying materials
18
+ are made available under the terms of the Eclipse Public License v1.0
19
+ which accompanies this distribution, and is available at
20
+ http://www.eclipse.org/legal/epl-v10.html
21
+ *****************************************************************************
22
+ *
23
+ */
24
+ var LecClient = exports["default"] = /*#__PURE__*/function () {
19
25
  function LecClient(apiClient) {
20
26
  _classCallCheck(this, LecClient);
21
-
22
27
  this.log = _loglevel["default"];
23
- this.apiClient = apiClient; // Create an alias to the apiClient's callApi
28
+ this.apiClient = apiClient;
24
29
 
30
+ // Create an alias to the apiClient's callApi
25
31
  this.callApi = this.apiClient.callApi.bind(this.apiClient);
26
32
  }
27
-
28
33
  _createClass(LecClient, [{
29
34
  key: "getLastEvents",
30
35
  value: function getLastEvents(type, id) {
@@ -38,9 +43,6 @@ var LecClient = /*#__PURE__*/function () {
38
43
  return this.callApi('GET', 200, true, ["device", "types", type, "devices", id, "events", eventType], null);
39
44
  }
40
45
  }]);
41
-
42
46
  return LecClient;
43
47
  }();
44
-
45
- exports["default"] = LecClient;
46
48
  ;
@@ -4,27 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _loglevel = _interopRequireDefault(require("loglevel"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
9
+ 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); }
12
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
- 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, descriptor.key, descriptor); } }
15
-
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
-
18
- var MgmtClient = /*#__PURE__*/function () {
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
+ *****************************************************************************
16
+ Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
17
+ All rights reserved. This program and the accompanying materials
18
+ are made available under the terms of the Eclipse Public License v1.0
19
+ which accompanies this distribution, and is available at
20
+ http://www.eclipse.org/legal/epl-v10.html
21
+ *****************************************************************************
22
+ *
23
+ */
24
+ var MgmtClient = exports["default"] = /*#__PURE__*/function () {
19
25
  function MgmtClient(apiClient) {
20
26
  _classCallCheck(this, MgmtClient);
21
-
22
27
  this.log = _loglevel["default"];
23
- this.apiClient = apiClient; // Create an alias to the apiClient's callApi
28
+ this.apiClient = apiClient;
24
29
 
30
+ // Create an alias to the apiClient's callApi
25
31
  this.callApi = this.apiClient.callApi.bind(this.apiClient);
26
32
  }
27
-
28
33
  _createClass(MgmtClient, [{
29
34
  key: "getAllDeviceManagementRequests",
30
35
  value: function getAllDeviceManagementRequests() {
@@ -67,9 +72,6 @@ var MgmtClient = /*#__PURE__*/function () {
67
72
  return this.callApi('GET', 200, true, ['mgmt', 'requests', requestId, 'deviceStatus', typeId, deviceId], null);
68
73
  }
69
74
  }]);
70
-
71
75
  return MgmtClient;
72
76
  }();
73
-
74
- exports["default"] = MgmtClient;
75
77
  ;
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
7
+ 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); }
8
8
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
- 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, descriptor.key, descriptor); } }
11
-
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
13
-
9
+ 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); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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); }
14
13
  /**
15
14
  *****************************************************************************
16
15
  Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
@@ -21,13 +20,11 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
21
20
  *****************************************************************************
22
21
  *
23
22
  */
24
- var RegistryClient = /*#__PURE__*/function () {
23
+ var RegistryClient = exports["default"] = /*#__PURE__*/function () {
25
24
  function RegistryClient(apiClient) {
26
25
  _classCallCheck(this, RegistryClient);
27
-
28
26
  this.apiClient = apiClient;
29
27
  }
30
-
31
28
  _createClass(RegistryClient, [{
32
29
  key: "listAllDevicesOfType",
33
30
  value: function listAllDevicesOfType(type) {
@@ -66,8 +63,8 @@ var RegistryClient = /*#__PURE__*/function () {
66
63
  }, {
67
64
  key: "registerDeviceType",
68
65
  value: function registerDeviceType(typeId, description, deviceInfo, metadata, classId) {
69
- this.apiClient.log.debug("[ApiClient] registerDeviceType(" + typeId + ", " + description + ", " + deviceInfo + ", " + metadata + ", " + classId + ")"); // TODO: field validation
70
-
66
+ this.apiClient.log.debug("[ApiClient] registerDeviceType(" + typeId + ", " + description + ", " + deviceInfo + ", " + metadata + ", " + classId + ")");
67
+ // TODO: field validation
71
68
  classId = classId || "Device";
72
69
  var body = {
73
70
  id: typeId,
@@ -81,8 +78,8 @@ var RegistryClient = /*#__PURE__*/function () {
81
78
  }, {
82
79
  key: "registerDevice",
83
80
  value: function registerDevice(type, deviceId, authToken, deviceInfo, location, metadata) {
84
- this.apiClient.log.debug("[ApiClient] registerDevice(" + type + ", " + deviceId + ", " + deviceInfo + ", " + location + ", " + metadata + ")"); // TODO: field validation
85
-
81
+ this.apiClient.log.debug("[ApiClient] registerDevice(" + type + ", " + deviceId + ", " + deviceInfo + ", " + location + ", " + metadata + ")");
82
+ // TODO: field validation
86
83
  var body = {
87
84
  deviceId: deviceId,
88
85
  authToken: authToken,
@@ -116,6 +113,7 @@ var RegistryClient = /*#__PURE__*/function () {
116
113
  this.apiClient.log.debug("[ApiClient] getDevice(" + type + ", " + deviceId + ")");
117
114
  return this.apiClient.callApi('GET', 200, true, ['device', 'types', type, 'devices', deviceId], null);
118
115
  }
116
+
119
117
  /**
120
118
  * Register multiple new devices, each request can contain a maximum of 512KB.
121
119
  * The response body will contain the generated authentication tokens for all devices.
@@ -126,13 +124,13 @@ var RegistryClient = /*#__PURE__*/function () {
126
124
  * <a href="https://docs.internetofthings.ibmcloud.com/swagger/v0002.html#!/Bulk_Operations/post_bulk_devices_add">link</a>
127
125
  * for more information about the schema to be used
128
126
  */
129
-
130
127
  }, {
131
128
  key: "registerMultipleDevices",
132
129
  value: function registerMultipleDevices(arryOfDevicesToBeAdded) {
133
130
  this.apiClient.log.debug("[ApiClient] arryOfDevicesToBeAdded() - BULK");
134
131
  return this.apiClient.callApi('POST', 201, true, ["bulk", "devices", "add"], JSON.stringify(arryOfDevicesToBeAdded));
135
132
  }
133
+
136
134
  /**
137
135
  * Delete multiple devices, each request can contain a maximum of 512Kb
138
136
  *
@@ -140,7 +138,6 @@ var RegistryClient = /*#__PURE__*/function () {
140
138
  * <a href="https://docs.internetofthings.ibmcloud.com/swagger/v0002.html#!/Bulk_Operations/post_bulk_devices_remove">link</a>
141
139
  * for more information about the schema to be used.
142
140
  */
143
-
144
141
  }, {
145
142
  key: "deleteMultipleDevices",
146
143
  value: function deleteMultipleDevices(arryOfDevicesToBeDeleted) {
@@ -224,9 +221,6 @@ var RegistryClient = /*#__PURE__*/function () {
224
221
  return this.apiClient.callApi('GET', 200, true, ['logs', 'connection'], null, params);
225
222
  }
226
223
  }]);
227
-
228
224
  return RegistryClient;
229
225
  }();
230
-
231
- exports["default"] = RegistryClient;
232
226
  ;
@@ -4,27 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _loglevel = _interopRequireDefault(require("loglevel"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
9
+ 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); }
12
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
- 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, descriptor.key, descriptor); } }
15
-
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
-
18
- var RulesClient = /*#__PURE__*/function () {
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
+ *****************************************************************************
16
+ Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
17
+ All rights reserved. This program and the accompanying materials
18
+ are made available under the terms of the Eclipse Public License v1.0
19
+ which accompanies this distribution, and is available at
20
+ http://www.eclipse.org/legal/epl-v10.html
21
+ *****************************************************************************
22
+ *
23
+ */
24
+ var RulesClient = exports["default"] = /*#__PURE__*/function () {
19
25
  function RulesClient(apiClient) {
20
26
  _classCallCheck(this, RulesClient);
21
-
22
27
  this.log = _loglevel["default"];
23
- this.apiClient = apiClient; // Create an alias to the apiClient's callApi
28
+ this.apiClient = apiClient;
24
29
 
30
+ // Create an alias to the apiClient's callApi
25
31
  this.callApi = this.apiClient.callApi.bind(this.apiClient);
26
32
  }
27
-
28
33
  _createClass(RulesClient, [{
29
34
  key: "getRulesForLogicalInterface",
30
35
  value: function getRulesForLogicalInterface(logicalInterfaceId) {
@@ -71,11 +76,8 @@ var RulesClient = /*#__PURE__*/function () {
71
76
  return this.callApi('DELETE', 204, false, base);
72
77
  }
73
78
  }]);
74
-
75
79
  return RulesClient;
76
80
  }();
77
-
78
- exports["default"] = RulesClient;
79
81
  RulesClient.RuleNotificationStrategy = {
80
82
  EVERY_TIME: function EVERY_TIME() {
81
83
  return {