@webex/internal-plugin-device 2.59.3-next.1 → 2.59.4

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.
Files changed (41) hide show
  1. package/.eslintrc.js +6 -6
  2. package/README.md +80 -80
  3. package/babel.config.js +3 -3
  4. package/dist/config.js +27 -27
  5. package/dist/config.js.map +1 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/device.js +226 -226
  8. package/dist/device.js.map +1 -1
  9. package/dist/features/feature-collection.js +14 -14
  10. package/dist/features/feature-collection.js.map +1 -1
  11. package/dist/features/feature-model.js +73 -73
  12. package/dist/features/feature-model.js.map +1 -1
  13. package/dist/features/features-model.js +28 -28
  14. package/dist/features/features-model.js.map +1 -1
  15. package/dist/features/index.js.map +1 -1
  16. package/dist/index.js +4 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/interceptors/device-url.js +8 -8
  19. package/dist/interceptors/device-url.js.map +1 -1
  20. package/dist/metrics.js.map +1 -1
  21. package/jest.config.js +3 -3
  22. package/package.json +16 -17
  23. package/process +1 -1
  24. package/src/config.js +60 -60
  25. package/src/constants.js +23 -23
  26. package/src/device.js +835 -835
  27. package/src/features/feature-collection.js +30 -30
  28. package/src/features/feature-model.js +189 -189
  29. package/src/features/features-model.js +96 -96
  30. package/src/features/index.js +5 -5
  31. package/src/index.js +29 -29
  32. package/src/interceptors/device-url.js +61 -61
  33. package/src/metrics.js +5 -5
  34. package/test/integration/spec/device.js +904 -904
  35. package/test/integration/spec/webex.js +42 -42
  36. package/test/unit/spec/device.js +409 -409
  37. package/test/unit/spec/features/feature-collection.js +24 -24
  38. package/test/unit/spec/features/feature-model.js +255 -255
  39. package/test/unit/spec/features/features-model.js +97 -97
  40. package/test/unit/spec/interceptors/device-url.js +215 -215
  41. package/test/unit/spec/wdm-dto.json +104 -104
package/.eslintrc.js CHANGED
@@ -1,6 +1,6 @@
1
- const config = {
2
- root: true,
3
- extends: ['@webex/eslint-config-legacy'],
4
- };
5
-
6
- module.exports = config;
1
+ const config = {
2
+ root: true,
3
+ extends: ['@webex/eslint-config-legacy'],
4
+ };
5
+
6
+ module.exports = config;
package/README.md CHANGED
@@ -1,80 +1,80 @@
1
- # @webex/internal-plugin-device
2
-
3
- [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
-
5
- > Plugin for device management
6
-
7
- This is an internal Cisco Webex plugin. As such, it does not strictly adhere to semantic versioning. Use at your own risk. If you're not working on one of our first party clients, please look at our [developer api](https://developer.webex.com/) and stick to our public plugins.
8
-
9
- - [Install](#install)
10
- - [Usage](#usage)
11
- - [Maintainers](#maintainers)
12
- - [Contribute](#contribute)
13
- - [License](#license)
14
-
15
- ## Install
16
-
17
- ```bash
18
- npm install --save @webex/internal-plugin-device
19
- ```
20
-
21
- ## Usage
22
-
23
- ```js
24
- import '@webex/internal-plugin-device';
25
-
26
- import WebexCore from '@webex/webex-core';
27
-
28
- const webex = new WebexCore();
29
-
30
- // Namespace.
31
- webex.internal.device;
32
-
33
- // Register the device.
34
- webex.internal.device
35
- .register()
36
- .then(() => {}) // On successful registration.
37
- .catch(() => {}); // On failed registration.
38
-
39
- // Refresh the device.
40
- webex.internal.device
41
- .refresh()
42
- .then(() => {}) // On successful refresh.
43
- .catch(() => {}); // On failed refresh.
44
-
45
- // Unregister the device.
46
- webex.internal.device
47
- .unregister()
48
- .then(() => {}) // On successful unregistration.
49
- .catch(() => {}); // On failed unregistration.
50
-
51
- // Get the current web socket url. Accepts a boolean to enable waiting for the
52
- // url to populate.
53
- webex.internal.device
54
- .getWebSocketUrl(true)
55
- .then((url) => {}) // Resolves to the url when it is retrievable.
56
- .catch(() => {}); // Rejects when the url is not available.
57
-
58
- // Commonly referenced properties.
59
-
60
- // The device's url once registered.
61
- webex.internal.device.url;
62
-
63
- // The registered device's user uuid.
64
- webex.internal.device.userId;
65
-
66
- // Determines if the device is registered.
67
- webex.internal.device.registered;
68
- ```
69
-
70
- ## Maintainers
71
-
72
- This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
73
-
74
- ## Contribute
75
-
76
- Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
77
-
78
- ## License
79
-
80
- © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
1
+ # @webex/internal-plugin-device
2
+
3
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
+
5
+ > Plugin for device management
6
+
7
+ This is an internal Cisco Webex plugin. As such, it does not strictly adhere to semantic versioning. Use at your own risk. If you're not working on one of our first party clients, please look at our [developer api](https://developer.webex.com/) and stick to our public plugins.
8
+
9
+ - [Install](#install)
10
+ - [Usage](#usage)
11
+ - [Maintainers](#maintainers)
12
+ - [Contribute](#contribute)
13
+ - [License](#license)
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install --save @webex/internal-plugin-device
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```js
24
+ import '@webex/internal-plugin-device';
25
+
26
+ import WebexCore from '@webex/webex-core';
27
+
28
+ const webex = new WebexCore();
29
+
30
+ // Namespace.
31
+ webex.internal.device;
32
+
33
+ // Register the device.
34
+ webex.internal.device
35
+ .register()
36
+ .then(() => {}) // On successful registration.
37
+ .catch(() => {}); // On failed registration.
38
+
39
+ // Refresh the device.
40
+ webex.internal.device
41
+ .refresh()
42
+ .then(() => {}) // On successful refresh.
43
+ .catch(() => {}); // On failed refresh.
44
+
45
+ // Unregister the device.
46
+ webex.internal.device
47
+ .unregister()
48
+ .then(() => {}) // On successful unregistration.
49
+ .catch(() => {}); // On failed unregistration.
50
+
51
+ // Get the current web socket url. Accepts a boolean to enable waiting for the
52
+ // url to populate.
53
+ webex.internal.device
54
+ .getWebSocketUrl(true)
55
+ .then((url) => {}) // Resolves to the url when it is retrievable.
56
+ .catch(() => {}); // Rejects when the url is not available.
57
+
58
+ // Commonly referenced properties.
59
+
60
+ // The device's url once registered.
61
+ webex.internal.device.url;
62
+
63
+ // The registered device's user uuid.
64
+ webex.internal.device.userId;
65
+
66
+ // Determines if the device is registered.
67
+ webex.internal.device.registered;
68
+ ```
69
+
70
+ ## Maintainers
71
+
72
+ This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
73
+
74
+ ## Contribute
75
+
76
+ Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
77
+
78
+ ## License
79
+
80
+ © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
package/babel.config.js CHANGED
@@ -1,3 +1,3 @@
1
- const babelConfigLegacy = require('@webex/babel-config-legacy');
2
-
3
- module.exports = babelConfigLegacy;
1
+ const babelConfigLegacy = require('@webex/babel-config-legacy');
2
+
3
+ module.exports = babelConfigLegacy;
package/dist/config.js CHANGED
@@ -8,22 +8,22 @@ exports.default = void 0;
8
8
  var _common = require("@webex/common");
9
9
  var _default = {
10
10
  device: {
11
- /**
12
- * The duration to wait for the catalog to populate in seconds.
13
- *
14
- * @type {number}
11
+ /**
12
+ * The duration to wait for the catalog to populate in seconds.
13
+ *
14
+ * @type {number}
15
15
  */
16
16
  canRegisterWaitDuration: 10,
17
- /**
18
- * The default configuration group when sending registration requests.
19
- *
20
- * @type {Object}
17
+ /**
18
+ * The default configuration group when sending registration requests.
19
+ *
20
+ * @type {Object}
21
21
  */
22
22
  defaults: {
23
- /**
24
- * The default body configuration of registration requests.
25
- *
26
- * @type {Object}
23
+ /**
24
+ * The default body configuration of registration requests.
25
+ *
26
+ * @type {Object}
27
27
  */
28
28
  body: {
29
29
  name: (typeof process.title === 'string' ? process.title.trim() : undefined) || _common.inBrowser && 'browser' || 'javascript',
@@ -34,25 +34,25 @@ var _default = {
34
34
  systemVersion: '1.0.0'
35
35
  }
36
36
  },
37
- /**
38
- * When true, the **wdm** service will enforce an inactivity duration.
39
- *
40
- * @type {boolean}
37
+ /**
38
+ * When true, the **wdm** service will enforce an inactivity duration.
39
+ *
40
+ * @type {boolean}
41
41
  */
42
42
  enableInactivityEnforcement: false,
43
- /**
44
- * When true, the device registration will include a ttl value of
45
- * {@link config.device.ephemeralDeviceTTL} and refresh on an interval of
46
- * {@link config.device.ephemeralDeviceTTL} / 2 + 60 seconds.
47
- *
48
- * @type {boolean}
43
+ /**
44
+ * When true, the device registration will include a ttl value of
45
+ * {@link config.device.ephemeralDeviceTTL} and refresh on an interval of
46
+ * {@link config.device.ephemeralDeviceTTL} / 2 + 60 seconds.
47
+ *
48
+ * @type {boolean}
49
49
  */
50
50
  ephemeral: false,
51
- /**
52
- * The ttl value to include in device registration if
53
- * {@link config.device.ephemeral} is true. Measured in seconds.
54
- *
55
- * @type {boolean}
51
+ /**
52
+ * The ttl value to include in device registration if
53
+ * {@link config.device.ephemeral} is true. Measured in seconds.
54
+ *
55
+ * @type {boolean}
56
56
  */
57
57
  ephemeralDeviceTTL: 30 * 60
58
58
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","_default","device","canRegisterWaitDuration","defaults","body","name","process","title","trim","undefined","inBrowser","deviceType","WEB","model","localizedModel","systemName","systemVersion","enableInactivityEnforcement","ephemeral","ephemeralDeviceTTL","exports","default"],"sources":["config.js"],"sourcesContent":["import {inBrowser, deviceType} from '@webex/common';\r\n\r\nexport default {\r\n device: {\r\n /**\r\n * The duration to wait for the catalog to populate in seconds.\r\n *\r\n * @type {number}\r\n */\r\n canRegisterWaitDuration: 10,\r\n\r\n /**\r\n * The default configuration group when sending registration requests.\r\n *\r\n * @type {Object}\r\n */\r\n defaults: {\r\n /**\r\n * The default body configuration of registration requests.\r\n *\r\n * @type {Object}\r\n */\r\n body: {\r\n name:\r\n (typeof process.title === 'string' ? process.title.trim() : undefined) ||\r\n (inBrowser && 'browser') ||\r\n 'javascript',\r\n deviceType: deviceType.WEB,\r\n model: 'web-js-sdk',\r\n localizedModel: 'webex-js-sdk',\r\n systemName: 'WEBEX_JS_SDK',\r\n systemVersion: '1.0.0',\r\n },\r\n },\r\n\r\n /**\r\n * When true, the **wdm** service will enforce an inactivity duration.\r\n *\r\n * @type {boolean}\r\n */\r\n enableInactivityEnforcement: false,\r\n\r\n /**\r\n * When true, the device registration will include a ttl value of\r\n * {@link config.device.ephemeralDeviceTTL} and refresh on an interval of\r\n * {@link config.device.ephemeralDeviceTTL} / 2 + 60 seconds.\r\n *\r\n * @type {boolean}\r\n */\r\n ephemeral: false,\r\n\r\n /**\r\n * The ttl value to include in device registration if\r\n * {@link config.device.ephemeral} is true. Measured in seconds.\r\n *\r\n * @type {boolean}\r\n */\r\n ephemeralDeviceTTL: 30 * 60,\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAoD,IAAAC,QAAA,GAErC;EACbC,MAAM,EAAE;IACN;AACJ;AACA;AACA;AACA;IACIC,uBAAuB,EAAE,EAAE;IAE3B;AACJ;AACA;AACA;AACA;IACIC,QAAQ,EAAE;MACR;AACN;AACA;AACA;AACA;MACMC,IAAI,EAAE;QACJC,IAAI,EACF,CAAC,OAAOC,OAAO,CAACC,KAAK,KAAK,QAAQ,GAAGD,OAAO,CAACC,KAAK,CAACC,IAAI,EAAE,GAAGC,SAAS,KACpEC,iBAAS,IAAI,SAAU,IACxB,YAAY;QACdC,UAAU,EAAEA,kBAAU,CAACC,GAAG;QAC1BC,KAAK,EAAE,YAAY;QACnBC,cAAc,EAAE,cAAc;QAC9BC,UAAU,EAAE,cAAc;QAC1BC,aAAa,EAAE;MACjB;IACF,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIC,2BAA2B,EAAE,KAAK;IAElC;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,SAAS,EAAE,KAAK;IAEhB;AACJ;AACA;AACA;AACA;AACA;IACIC,kBAAkB,EAAE,EAAE,GAAG;EAC3B;AACF,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAArB,QAAA"}
1
+ {"version":3,"names":["_common","require","_default","device","canRegisterWaitDuration","defaults","body","name","process","title","trim","undefined","inBrowser","deviceType","WEB","model","localizedModel","systemName","systemVersion","enableInactivityEnforcement","ephemeral","ephemeralDeviceTTL","exports","default"],"sources":["config.js"],"sourcesContent":["import {inBrowser, deviceType} from '@webex/common';\n\nexport default {\n device: {\n /**\n * The duration to wait for the catalog to populate in seconds.\n *\n * @type {number}\n */\n canRegisterWaitDuration: 10,\n\n /**\n * The default configuration group when sending registration requests.\n *\n * @type {Object}\n */\n defaults: {\n /**\n * The default body configuration of registration requests.\n *\n * @type {Object}\n */\n body: {\n name:\n (typeof process.title === 'string' ? process.title.trim() : undefined) ||\n (inBrowser && 'browser') ||\n 'javascript',\n deviceType: deviceType.WEB,\n model: 'web-js-sdk',\n localizedModel: 'webex-js-sdk',\n systemName: 'WEBEX_JS_SDK',\n systemVersion: '1.0.0',\n },\n },\n\n /**\n * When true, the **wdm** service will enforce an inactivity duration.\n *\n * @type {boolean}\n */\n enableInactivityEnforcement: false,\n\n /**\n * When true, the device registration will include a ttl value of\n * {@link config.device.ephemeralDeviceTTL} and refresh on an interval of\n * {@link config.device.ephemeralDeviceTTL} / 2 + 60 seconds.\n *\n * @type {boolean}\n */\n ephemeral: false,\n\n /**\n * The ttl value to include in device registration if\n * {@link config.device.ephemeral} is true. Measured in seconds.\n *\n * @type {boolean}\n */\n ephemeralDeviceTTL: 30 * 60,\n },\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAoD,IAAAC,QAAA,GAErC;EACbC,MAAM,EAAE;IACN;AACJ;AACA;AACA;AACA;IACIC,uBAAuB,EAAE,EAAE;IAE3B;AACJ;AACA;AACA;AACA;IACIC,QAAQ,EAAE;MACR;AACN;AACA;AACA;AACA;MACMC,IAAI,EAAE;QACJC,IAAI,EACF,CAAC,OAAOC,OAAO,CAACC,KAAK,KAAK,QAAQ,GAAGD,OAAO,CAACC,KAAK,CAACC,IAAI,EAAE,GAAGC,SAAS,KACpEC,iBAAS,IAAI,SAAU,IACxB,YAAY;QACdC,UAAU,EAAEA,kBAAU,CAACC,GAAG;QAC1BC,KAAK,EAAE,YAAY;QACnBC,cAAc,EAAE,cAAc;QAC9BC,UAAU,EAAE,cAAc;QAC1BC,aAAa,EAAE;MACjB;IACF,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIC,2BAA2B,EAAE,KAAK;IAElC;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,SAAS,EAAE,KAAK;IAEhB;AACJ;AACA;AACA;AACA;AACA;IACIC,kBAAkB,EAAE,EAAE,GAAG;EAC3B;AACF,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAArB,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["FEATURE_COLLECTION_DEVELOPER","exports","FEATURE_COLLECTION_ENTITLEMENT","FEATURE_COLLECTION_USER","CISCO_DEVICE_URL","FEATURE_COLLECTION_NAMES","FEATURE_TYPES","BOOLEAN","NUMBER","STRING","DEVICE_EVENT_REGISTRATION_SUCCESS","DEVICE_EVENTS"],"sources":["constants.js"],"sourcesContent":["// Feature constants.\r\nexport const FEATURE_COLLECTION_DEVELOPER = 'developer';\r\nexport const FEATURE_COLLECTION_ENTITLEMENT = 'entitlement';\r\nexport const FEATURE_COLLECTION_USER = 'user';\r\n\r\nexport const CISCO_DEVICE_URL = 'cisco-device-url';\r\n\r\nexport const FEATURE_COLLECTION_NAMES = [\r\n FEATURE_COLLECTION_DEVELOPER,\r\n FEATURE_COLLECTION_ENTITLEMENT,\r\n FEATURE_COLLECTION_USER,\r\n];\r\n\r\nexport const FEATURE_TYPES = {\r\n BOOLEAN: 'boolean',\r\n NUMBER: 'number',\r\n STRING: 'string',\r\n};\r\n\r\n// Device constants.\r\nexport const DEVICE_EVENT_REGISTRATION_SUCCESS = 'registration:success';\r\n\r\nexport const DEVICE_EVENTS = [DEVICE_EVENT_REGISTRATION_SUCCESS];\r\n"],"mappings":";;;;;;;AAAA;AACO,IAAMA,4BAA4B,GAAG,WAAW;AAACC,OAAA,CAAAD,4BAAA,GAAAA,4BAAA;AACjD,IAAME,8BAA8B,GAAG,aAAa;AAACD,OAAA,CAAAC,8BAAA,GAAAA,8BAAA;AACrD,IAAMC,uBAAuB,GAAG,MAAM;AAACF,OAAA,CAAAE,uBAAA,GAAAA,uBAAA;AAEvC,IAAMC,gBAAgB,GAAG,kBAAkB;AAACH,OAAA,CAAAG,gBAAA,GAAAA,gBAAA;AAE5C,IAAMC,wBAAwB,GAAG,CACtCL,4BAA4B,EAC5BE,8BAA8B,EAC9BC,uBAAuB,CACxB;AAACF,OAAA,CAAAI,wBAAA,GAAAA,wBAAA;AAEK,IAAMC,aAAa,GAAG;EAC3BC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE;AACV,CAAC;;AAED;AAAAR,OAAA,CAAAK,aAAA,GAAAA,aAAA;AACO,IAAMI,iCAAiC,GAAG,sBAAsB;AAACT,OAAA,CAAAS,iCAAA,GAAAA,iCAAA;AAEjE,IAAMC,aAAa,GAAG,CAACD,iCAAiC,CAAC;AAACT,OAAA,CAAAU,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["FEATURE_COLLECTION_DEVELOPER","exports","FEATURE_COLLECTION_ENTITLEMENT","FEATURE_COLLECTION_USER","CISCO_DEVICE_URL","FEATURE_COLLECTION_NAMES","FEATURE_TYPES","BOOLEAN","NUMBER","STRING","DEVICE_EVENT_REGISTRATION_SUCCESS","DEVICE_EVENTS"],"sources":["constants.js"],"sourcesContent":["// Feature constants.\nexport const FEATURE_COLLECTION_DEVELOPER = 'developer';\nexport const FEATURE_COLLECTION_ENTITLEMENT = 'entitlement';\nexport const FEATURE_COLLECTION_USER = 'user';\n\nexport const CISCO_DEVICE_URL = 'cisco-device-url';\n\nexport const FEATURE_COLLECTION_NAMES = [\n FEATURE_COLLECTION_DEVELOPER,\n FEATURE_COLLECTION_ENTITLEMENT,\n FEATURE_COLLECTION_USER,\n];\n\nexport const FEATURE_TYPES = {\n BOOLEAN: 'boolean',\n NUMBER: 'number',\n STRING: 'string',\n};\n\n// Device constants.\nexport const DEVICE_EVENT_REGISTRATION_SUCCESS = 'registration:success';\n\nexport const DEVICE_EVENTS = [DEVICE_EVENT_REGISTRATION_SUCCESS];\n"],"mappings":";;;;;;;AAAA;AACO,IAAMA,4BAA4B,GAAG,WAAW;AAACC,OAAA,CAAAD,4BAAA,GAAAA,4BAAA;AACjD,IAAME,8BAA8B,GAAG,aAAa;AAACD,OAAA,CAAAC,8BAAA,GAAAA,8BAAA;AACrD,IAAMC,uBAAuB,GAAG,MAAM;AAACF,OAAA,CAAAE,uBAAA,GAAAA,uBAAA;AAEvC,IAAMC,gBAAgB,GAAG,kBAAkB;AAACH,OAAA,CAAAG,gBAAA,GAAAA,gBAAA;AAE5C,IAAMC,wBAAwB,GAAG,CACtCL,4BAA4B,EAC5BE,8BAA8B,EAC9BC,uBAAuB,CACxB;AAACF,OAAA,CAAAI,wBAAA,GAAAA,wBAAA;AAEK,IAAMC,aAAa,GAAG;EAC3BC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE;AACV,CAAC;;AAED;AAAAR,OAAA,CAAAK,aAAA,GAAAA,aAAA;AACO,IAAMI,iCAAiC,GAAG,sBAAsB;AAACT,OAAA,CAAAS,iCAAA,GAAAA,iCAAA;AAEjE,IAAMC,aAAa,GAAG,CAACD,iCAAiC,CAAC;AAACT,OAAA,CAAAU,aAAA,GAAAA,aAAA"}