@ndustrial/contxt-sdk 4.3.6 → 5.2.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.
Files changed (167) hide show
  1. package/.gitattributes +1 -0
  2. package/CHANGELOG.md +8 -0
  3. package/CODEOWNERS +1 -0
  4. package/docs/Facilities.md +0 -144
  5. package/docs/FacilityGroupings.md +0 -160
  6. package/docs/Nionic.md +63 -0
  7. package/docs/README.md +3 -29
  8. package/docs/Typedefs.md +0 -101
  9. package/esm/config/audiences.js +13 -13
  10. package/esm/config/audiences.js.map +1 -1
  11. package/esm/index.js +4 -6
  12. package/esm/index.js.map +1 -1
  13. package/esm/nionic/index.js +126 -0
  14. package/esm/nionic/index.js.map +1 -0
  15. package/lib/config/audiences.js +13 -13
  16. package/lib/config/audiences.js.map +1 -1
  17. package/lib/index.js +10 -15
  18. package/lib/index.js.map +1 -1
  19. package/lib/nionic/index.js +130 -0
  20. package/lib/nionic/index.js.map +1 -0
  21. package/meta.yaml +11 -0
  22. package/package.json +9 -10
  23. package/src/bus/index.spec.js +3 -2
  24. package/src/bus/webSocketConnection.spec.js +31 -31
  25. package/src/config/audiences.js +13 -13
  26. package/src/config/index.spec.js +6 -6
  27. package/src/coordinator/applications.spec.js +8 -8
  28. package/src/coordinator/consent.spec.js +1 -1
  29. package/src/coordinator/edgeNodes.spec.js +3 -3
  30. package/src/coordinator/organizations.spec.js +4 -4
  31. package/src/coordinator/permissions.spec.js +4 -4
  32. package/src/coordinator/roles.spec.js +3 -3
  33. package/src/coordinator/users.spec.js +14 -15
  34. package/src/events/index.spec.js +16 -16
  35. package/src/files/index.spec.js +7 -7
  36. package/src/index.js +4 -6
  37. package/src/index.spec.js +8 -22
  38. package/src/iot/feeds.spec.js +4 -4
  39. package/src/iot/fieldCategories.spec.js +4 -4
  40. package/src/iot/fieldGroupings.spec.js +5 -5
  41. package/src/iot/outputs.spec.js +6 -6
  42. package/src/nionic/index.js +151 -0
  43. package/src/request.spec.js +3 -3
  44. package/src/sessionTypes/auth0WebAuth.spec.js +2 -2
  45. package/src/sessionTypes/index.spec.js +3 -3
  46. package/src/sessionTypes/machineAuth.spec.js +3 -3
  47. package/src/sessionTypes/passwordGrantAuth.spec.js +1 -1
  48. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +6 -6
  49. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.spec.js +2 -2
  50. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +2 -2
  51. package/src/utils/url/stringifyParams.spec.js +2 -3
  52. package/support/fixtures/factories/IOSDevice.js +3 -3
  53. package/support/fixtures/factories/applicationGrouping.js +4 -4
  54. package/support/fixtures/factories/applicationModule.js +2 -2
  55. package/support/fixtures/factories/asset.js +1 -1
  56. package/support/fixtures/factories/assetAttribute.js +2 -2
  57. package/support/fixtures/factories/assetAttributeValue.js +2 -2
  58. package/support/fixtures/factories/assetMetric.js +1 -1
  59. package/support/fixtures/factories/assetMetricValue.js +3 -3
  60. package/support/fixtures/factories/assetMetricValueCompact.js +2 -2
  61. package/support/fixtures/factories/assetType.js +1 -1
  62. package/support/fixtures/factories/authResults.js +3 -3
  63. package/support/fixtures/factories/channel.js +1 -1
  64. package/support/fixtures/factories/contxtApplication.js +5 -5
  65. package/support/fixtures/factories/contxtOrganization.js +2 -2
  66. package/support/fixtures/factories/contxtOrganizationFeaturedApplication.js +3 -3
  67. package/support/fixtures/factories/contxtProject.js +2 -2
  68. package/support/fixtures/factories/contxtProjectEnvironment.js +2 -2
  69. package/support/fixtures/factories/contxtRole.js +3 -3
  70. package/support/fixtures/factories/contxtRoleApplication.js +1 -1
  71. package/support/fixtures/factories/contxtRoleProjectEnvironment.js +1 -1
  72. package/support/fixtures/factories/contxtUser.js +2 -2
  73. package/support/fixtures/factories/contxtUserApplication.js +1 -1
  74. package/support/fixtures/factories/contxtUserFavoriteApplication.js +2 -2
  75. package/support/fixtures/factories/contxtUserPermissions.js +5 -5
  76. package/support/fixtures/factories/contxtUserProjectEnvironment.js +1 -1
  77. package/support/fixtures/factories/contxtUserRole.js +2 -2
  78. package/support/fixtures/factories/costCenter.js +2 -2
  79. package/support/fixtures/factories/costCenterFacility.js +3 -3
  80. package/support/fixtures/factories/edgeNode.js +1 -1
  81. package/support/fixtures/factories/event.js +5 -5
  82. package/support/fixtures/factories/eventType.js +4 -4
  83. package/support/fixtures/factories/eventUser.js +5 -5
  84. package/support/fixtures/factories/facility.js +4 -4
  85. package/support/fixtures/factories/facilityGrouping.js +3 -3
  86. package/support/fixtures/factories/facilityGroupingFacility.js +3 -3
  87. package/support/fixtures/factories/facilityInfo.js +2 -2
  88. package/support/fixtures/factories/facilityTag.js +1 -1
  89. package/support/fixtures/factories/feedStatus.js +1 -1
  90. package/support/fixtures/factories/feedType.js +1 -1
  91. package/support/fixtures/factories/feeds.js +5 -5
  92. package/support/fixtures/factories/fieldCategory.js +3 -3
  93. package/support/fixtures/factories/fieldGrouping.js +4 -4
  94. package/support/fixtures/factories/fieldGroupingField.js +3 -3
  95. package/support/fixtures/factories/fieldGroupingStatus.js +1 -1
  96. package/support/fixtures/factories/file.js +1 -1
  97. package/support/fixtures/factories/fileUploadInfo.js +1 -1
  98. package/support/fixtures/factories/organization.js +1 -1
  99. package/support/fixtures/factories/outputField.js +10 -10
  100. package/support/fixtures/factories/outputFieldData.js +1 -1
  101. package/support/fixtures/factories/owner.js +2 -2
  102. package/support/fixtures/factories/paginationMetadata.js +2 -2
  103. package/support/fixtures/factories/triggeredEvent.js +4 -4
  104. package/support/fixtures/factories/userEventSubscription.js +1 -1
  105. package/support/fixtures/factories/userMobileNumber.js +1 -1
  106. package/support/fixtures/factories/userPermissionsMap.js +2 -2
  107. package/.huskyrc.js +0 -11
  108. package/.nycrc +0 -12
  109. package/esm/assets/assetAttributes.js +0 -574
  110. package/esm/assets/assetAttributes.js.map +0 -1
  111. package/esm/assets/assetMetrics.js +0 -690
  112. package/esm/assets/assetMetrics.js.map +0 -1
  113. package/esm/assets/assetTypes.js +0 -273
  114. package/esm/assets/assetTypes.js.map +0 -1
  115. package/esm/assets/index.js +0 -283
  116. package/esm/assets/index.js.map +0 -1
  117. package/esm/facilities/costCenters.js +0 -306
  118. package/esm/facilities/costCenters.js.map +0 -1
  119. package/esm/facilities/groupings.js +0 -323
  120. package/esm/facilities/groupings.js.map +0 -1
  121. package/esm/facilities/index.js +0 -343
  122. package/esm/facilities/index.js.map +0 -1
  123. package/esm/health/index.js +0 -229
  124. package/esm/health/index.js.map +0 -1
  125. package/esm/utils/facilities/formatFacilityWithInfoFromServer.js +0 -65
  126. package/esm/utils/facilities/formatFacilityWithInfoFromServer.js.map +0 -1
  127. package/esm/utils/facilities/index.js +0 -4
  128. package/esm/utils/facilities/index.js.map +0 -1
  129. package/lib/assets/assetAttributes.js +0 -588
  130. package/lib/assets/assetAttributes.js.map +0 -1
  131. package/lib/assets/assetMetrics.js +0 -705
  132. package/lib/assets/assetMetrics.js.map +0 -1
  133. package/lib/assets/assetTypes.js +0 -287
  134. package/lib/assets/assetTypes.js.map +0 -1
  135. package/lib/assets/index.js +0 -302
  136. package/lib/assets/index.js.map +0 -1
  137. package/lib/facilities/costCenters.js +0 -316
  138. package/lib/facilities/costCenters.js.map +0 -1
  139. package/lib/facilities/groupings.js +0 -333
  140. package/lib/facilities/groupings.js.map +0 -1
  141. package/lib/facilities/index.js +0 -360
  142. package/lib/facilities/index.js.map +0 -1
  143. package/lib/health/index.js +0 -232
  144. package/lib/health/index.js.map +0 -1
  145. package/lib/utils/facilities/formatFacilityWithInfoFromServer.js +0 -71
  146. package/lib/utils/facilities/formatFacilityWithInfoFromServer.js.map +0 -1
  147. package/lib/utils/facilities/index.js +0 -15
  148. package/lib/utils/facilities/index.js.map +0 -1
  149. package/src/assets/assetAttributes.js +0 -619
  150. package/src/assets/assetAttributes.spec.js +0 -1143
  151. package/src/assets/assetMetrics.js +0 -736
  152. package/src/assets/assetMetrics.spec.js +0 -1180
  153. package/src/assets/assetTypes.js +0 -260
  154. package/src/assets/assetTypes.spec.js +0 -556
  155. package/src/assets/index.js +0 -271
  156. package/src/assets/index.spec.js +0 -515
  157. package/src/facilities/costCenters.js +0 -295
  158. package/src/facilities/costCenters.spec.js +0 -529
  159. package/src/facilities/groupings.js +0 -320
  160. package/src/facilities/groupings.spec.js +0 -567
  161. package/src/facilities/index.js +0 -343
  162. package/src/facilities/index.spec.js +0 -551
  163. package/src/health/index.js +0 -200
  164. package/src/health/index.spec.js +0 -501
  165. package/src/utils/facilities/formatFacilityWithInfoFromServer.js +0 -62
  166. package/src/utils/facilities/formatFacilityWithInfoFromServer.spec.js +0 -73
  167. package/src/utils/facilities/index.js +0 -3
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+
11
+ /**
12
+ * Module that provides access to Nionic platform.
13
+ *
14
+ * @typicalname contxtSdk.nionic
15
+ */
16
+ var Nionic = function () {
17
+ /**
18
+ * @param {Object} sdk An instance of the SDK so the module can communicate with other modules.
19
+ * @param {Object} request An instance of the request module tied to this module's audience.
20
+ */
21
+ function Nionic(sdk, request) {
22
+ _classCallCheck(this, Nionic);
23
+
24
+ this._baseUrl = '' + sdk.config.audiences.nionic.host;
25
+ this._request = request;
26
+ this._sdk = sdk;
27
+
28
+ // Backwards compatibility for legacy uuid's
29
+ this._orgIdToTenantId = {
30
+ '18d8b68e-3e59-418e-9f23-47b7cd6bdd6b': 'genan',
31
+ '02efa741-a96f-4124-a463-ae13a704b8fc': 'lineage',
32
+ '5209751f-ea46-4b3e-a5dd-b8d03311b791': 'ndustrial',
33
+ '2fe29680-fc3d-4888-9e9b-44be1e59c22c': 'sfnt',
34
+ 'b2c6705d-1727-467f-a450-207f110c9966': 'trenton'
35
+ };
36
+ this._tenants = new Set(Object.values(this._orgIdToTenantId));
37
+ }
38
+
39
+ _createClass(Nionic, [{
40
+ key: '_getTenantId',
41
+ value: function _getTenantId(orgOrTenantId) {
42
+ if (!orgOrTenantId) throw Error('Tenant is required');
43
+ if (!(orgOrTenantId in this._orgIdToTenantId) && !this._tenants.has(orgOrTenantId)) {
44
+ throw Error('Tenant is either unrecognized or not yet supported: ' + orgOrTenantId);
45
+ }
46
+ return this._orgIdToTenantId[orgOrTenantId] || orgOrTenantId;
47
+ }
48
+ }, {
49
+ key: '_query',
50
+ value: function _query(orgOrTenantId, options) {
51
+ var tenantId = this._getTenantId(orgOrTenantId);
52
+ var url = this._baseUrl.replace('<tenant>', tenantId) + '/graphql';
53
+ return this._request.post(url, options).then(function (resp) {
54
+ if (resp.data && resp.data.errors) {
55
+ return Promise.reject(Error(resp.data.errors));
56
+ }
57
+ return Promise.resolve(resp.data);
58
+ });
59
+ }
60
+ }, {
61
+ key: 'executeQuery',
62
+ value: function executeQuery(orgOrTenantId, query) {
63
+ var variables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
64
+
65
+ return this._query(orgOrTenantId, { query: query, variables: variables });
66
+ }
67
+ }, {
68
+ key: 'getAllFacilities',
69
+ value: function getAllFacilities(orgOrTenantId) {
70
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Nionic.queryDefaults;
71
+ var additionalFields = options.additionalFields;
72
+
73
+ return this._query(orgOrTenantId, {
74
+ query: '\n query {\n facilities {\n nodes {\n id\n name\n slug\n address\n city\n state\n zip\n timezone: timezoneName\n createdAt\n updatedAt\n ' + additionalFields.join('\n') + '\n }\n }\n }\n '
75
+ }).then(function (data) {
76
+ return data.facilities.nodes;
77
+ });
78
+ }
79
+ }, {
80
+ key: 'getFacility',
81
+ value: function getFacility(orgOrTenantId, facilityId) {
82
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Nionic.queryDefaults;
83
+ var additionalFields = options.additionalFields;
84
+
85
+ return this._query(orgOrTenantId, {
86
+ query: '\n query($facilityId: Int!) {\n facility(id: $facilityId) {\n id\n name\n slug\n address\n city\n state\n zip\n timezone: timezoneName\n createdAt\n updatedAt\n ' + additionalFields.join('\n') + '\n }\n }\n ',
87
+ variables: { facilityId: parseInt(facilityId) }
88
+ }).then(function (resp) {
89
+ return resp.facility;
90
+ });
91
+ }
92
+ }, {
93
+ key: 'getFacilityMetricLabels',
94
+ value: function getFacilityMetricLabels(orgOrTenantId, _ref) {
95
+ var facilityId = _ref.facilityId;
96
+
97
+ return this._query(orgOrTenantId, {
98
+ query: '\n query($facilityId: Int!) {\n facility(id: $facilityId) {\n metricLabels {\n sourceId\n label\n }\n }\n }\n ',
99
+ variables: { facilityId: parseInt(facilityId) }
100
+ }).then(function (resp) {
101
+ return resp.facility.metricLabels;
102
+ });
103
+ }
104
+ }, {
105
+ key: 'getFacilityMetrics',
106
+ value: function getFacilityMetrics(orgOrTenantId, _ref2) {
107
+ var facilityId = _ref2.facilityId,
108
+ metricLabel = _ref2.metricLabel,
109
+ _ref2$mutableOnly = _ref2.mutableOnly,
110
+ mutableOnly = _ref2$mutableOnly === undefined ? false : _ref2$mutableOnly;
111
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Nionic.queryDefaults;
112
+ var additionalFields = options.additionalFields;
113
+
114
+ return this._query(orgOrTenantId, {
115
+ query: '\n query($facilityId: Int!, $metricLabel: String!, $mutableOnly: Boolean) {\n facility(id: $facilityId) {\n metricData(label: $metricLabel, mutableOnly: $mutableOnly) {\n nodes {\n time\n sourceId\n label\n data\n ' + additionalFields.join('\n') + '\n }\n }\n }\n }\n ',
116
+ variables: { facilityId: parseInt(facilityId), metricLabel: metricLabel, mutableOnly: mutableOnly }
117
+ }).then(function (resp) {
118
+ return resp.facility.metricData.nodes;
119
+ });
120
+ }
121
+ }]);
122
+
123
+ return Nionic;
124
+ }();
125
+
126
+ Nionic.queryDefaults = {
127
+ additionalFields: []
128
+ };
129
+ exports.default = Nionic;
130
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["nionic/index.js"],"names":["Nionic","sdk","request","_baseUrl","config","audiences","nionic","host","_request","_sdk","_orgIdToTenantId","_tenants","Set","Object","values","orgOrTenantId","Error","has","options","tenantId","_getTenantId","url","replace","post","then","resp","data","errors","Promise","reject","resolve","query","variables","_query","queryDefaults","additionalFields","join","facilities","nodes","facilityId","parseInt","facility","metricLabels","metricLabel","mutableOnly","metricData"],"mappings":"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","file":"index.js","sourcesContent":["/**\n * Module that provides access to Nionic platform.\n *\n * @typicalname contxtSdk.nionic\n */\nclass Nionic {\n /**\n * @param {Object} sdk An instance of the SDK so the module can communicate with other modules.\n * @param {Object} request An instance of the request module tied to this module's audience.\n */\n constructor(sdk, request) {\n this._baseUrl = `${sdk.config.audiences.nionic.host}`;\n this._request = request;\n this._sdk = sdk;\n\n // Backwards compatibility for legacy uuid's\n this._orgIdToTenantId = {\n '18d8b68e-3e59-418e-9f23-47b7cd6bdd6b': 'genan',\n '02efa741-a96f-4124-a463-ae13a704b8fc': 'lineage',\n '5209751f-ea46-4b3e-a5dd-b8d03311b791': 'ndustrial',\n '2fe29680-fc3d-4888-9e9b-44be1e59c22c': 'sfnt',\n 'b2c6705d-1727-467f-a450-207f110c9966': 'trenton'\n };\n this._tenants = new Set(Object.values(this._orgIdToTenantId));\n }\n\n static queryDefaults = {\n additionalFields: []\n };\n\n _getTenantId(orgOrTenantId) {\n if (!orgOrTenantId) throw Error('Tenant is required');\n if (\n !(orgOrTenantId in this._orgIdToTenantId) &&\n !this._tenants.has(orgOrTenantId)\n ) {\n throw Error(\n `Tenant is either unrecognized or not yet supported: ${orgOrTenantId}`\n );\n }\n return this._orgIdToTenantId[orgOrTenantId] || orgOrTenantId;\n }\n\n _query(orgOrTenantId, options) {\n const tenantId = this._getTenantId(orgOrTenantId);\n const url = `${this._baseUrl.replace('<tenant>', tenantId)}/graphql`;\n return this._request.post(url, options).then((resp) => {\n if (resp.data && resp.data.errors) {\n return Promise.reject(Error(resp.data.errors));\n }\n return Promise.resolve(resp.data);\n });\n }\n\n executeQuery(orgOrTenantId, query, variables = {}) {\n return this._query(orgOrTenantId, { query, variables });\n }\n\n getAllFacilities(orgOrTenantId, options = Nionic.queryDefaults) {\n const { additionalFields } = options;\n return this._query(orgOrTenantId, {\n query: `\n query {\n facilities {\n nodes {\n id\n name\n slug\n address\n city\n state\n zip\n timezone: timezoneName\n createdAt\n updatedAt\n ${additionalFields.join('\\n')}\n }\n }\n }\n `\n }).then((data) => data.facilities.nodes);\n }\n\n getFacility(orgOrTenantId, facilityId, options = Nionic.queryDefaults) {\n const { additionalFields } = options;\n return this._query(orgOrTenantId, {\n query: `\n query($facilityId: Int!) {\n facility(id: $facilityId) {\n id\n name\n slug\n address\n city\n state\n zip\n timezone: timezoneName\n createdAt\n updatedAt\n ${additionalFields.join('\\n')}\n }\n }\n `,\n variables: { facilityId: parseInt(facilityId) }\n }).then((resp) => resp.facility);\n }\n\n getFacilityMetricLabels(orgOrTenantId, { facilityId }) {\n return this._query(orgOrTenantId, {\n query: `\n query($facilityId: Int!) {\n facility(id: $facilityId) {\n metricLabels {\n sourceId\n label\n }\n }\n }\n `,\n variables: { facilityId: parseInt(facilityId) }\n }).then((resp) => resp.facility.metricLabels);\n }\n\n getFacilityMetrics(\n orgOrTenantId,\n { facilityId, metricLabel, mutableOnly = false },\n options = Nionic.queryDefaults\n ) {\n const { additionalFields } = options;\n return this._query(orgOrTenantId, {\n query: `\n query($facilityId: Int!, $metricLabel: String!, $mutableOnly: Boolean) {\n facility(id: $facilityId) {\n metricData(label: $metricLabel, mutableOnly: $mutableOnly) {\n nodes {\n time\n sourceId\n label\n data\n ${additionalFields.join('\\n')}\n }\n }\n }\n }\n `,\n variables: { facilityId: parseInt(facilityId), metricLabel, mutableOnly }\n }).then((resp) => resp.facility.metricData.nodes);\n }\n}\n\nexport default Nionic;\n"]}
package/meta.yaml ADDED
@@ -0,0 +1,11 @@
1
+ ndustrial:
2
+ project: sdk
3
+ name: contxt-sdk-js
4
+ type: SDK,CLI
5
+
6
+ organization: ndustrial
7
+ owner: csi
8
+ managed_by: n/a
9
+
10
+ depends: []
11
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndustrial/contxt-sdk",
3
- "version": "4.3.6",
3
+ "version": "5.2.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -14,15 +14,10 @@
14
14
  "./lib/bus/webSocketConnection.js": "./lib/bus/webSocketConnection.browser.js"
15
15
  },
16
16
  "scripts": {
17
- "add:docs": "git add docs/",
18
- "build": "npm run build:js && npm run build:docs",
19
- "build:docs": "node ./support/docs",
20
- "build:js": "gulp build",
21
- "coverage": "nyc npm run test:js",
17
+ "build": "gulp build",
22
18
  "lint": "eslint --format 'node_modules/eslint-friendly-formatter' '+(src|support)/**/*.js'",
23
19
  "prepare": "npm run build",
24
- "report": "nyc report",
25
- "test": "npm run lint && npm run coverage",
20
+ "test": "npm run lint && npm run test:js",
26
21
  "test:js": "NODE_ENV=test mocha --opts 'support/mocha.opts' 'src/**/*.spec.js'",
27
22
  "test:js:dev": "npm run test:js -- --watch",
28
23
  "test:js:inspect": "npm run test:js -- --inspect-brk",
@@ -31,6 +26,11 @@
31
26
  "author": "ndustrial.io <dev@ndustrial.io> (ndustrial.io)",
32
27
  "license": "ISC",
33
28
  "repository": "github:ndustrialio/contxt-sdk-js",
29
+ "husky": {
30
+ "hooks": {
31
+ "pre-commit": "pretty-quick --staged"
32
+ }
33
+ },
34
34
  "babel": {
35
35
  "env": {
36
36
  "test": {
@@ -84,7 +84,7 @@
84
84
  "eslint-config-prettier": "^2.9.0",
85
85
  "eslint-friendly-formatter": "^4.0.1",
86
86
  "eslint-plugin-node": "^5.2.1",
87
- "faker": "^5.1.0",
87
+ "faker": "^5.5.3",
88
88
  "fast-glob": "^3.2.4",
89
89
  "gulp": "^4.0.2",
90
90
  "gulp-babel": "^7.0.1",
@@ -97,7 +97,6 @@
97
97
  "lodash.times": "^4.3.2",
98
98
  "mocha": "^6.2.3",
99
99
  "mock-socket": "^8.0.5",
100
- "nyc": "^14.1.1",
101
100
  "prettier": "^1.14.3",
102
101
  "pretty-quick": "^1.4.1",
103
102
  "proxyquire": "^2.1.0",
@@ -1,6 +1,5 @@
1
1
  import { Server, WebSocket } from 'mock-socket';
2
2
  import proxyquire from 'proxyquire';
3
-
4
3
  import Channels from './channels';
5
4
  import WebSocketConnection from './webSocketConnection';
6
5
 
@@ -332,7 +331,9 @@ describe('Bus', function() {
332
331
  let webSocketConnection;
333
332
 
334
333
  beforeEach(function() {
335
- webSocketConnection = bus.getWebSocketConnection(faker.random.uuid());
334
+ webSocketConnection = bus.getWebSocketConnection(
335
+ faker.datatype.uuid()
336
+ );
336
337
  });
337
338
 
338
339
  it('returns undefined', function() {
@@ -318,7 +318,7 @@ describe('Bus/WebSocketConnection', function() {
318
318
  ws = new WebSocketConnection(expectedWebSocket, expectedOrganization.id);
319
319
 
320
320
  ws._messageHandlers = {
321
- [faker.random.uuid()]: sinon.stub()
321
+ [faker.datatype.uuid()]: sinon.stub()
322
322
  };
323
323
 
324
324
  ws._onError(expectedError);
@@ -340,7 +340,7 @@ describe('Bus/WebSocketConnection', function() {
340
340
 
341
341
  beforeEach(function() {
342
342
  expectedOrganization = fixture.build('organization');
343
- expectedUUID = faker.random.uuid();
343
+ expectedUUID = faker.datatype.uuid();
344
344
  expectedMessage = {
345
345
  jsonrpc: '2.0',
346
346
  id: expectedUUID,
@@ -376,7 +376,7 @@ describe('Bus/WebSocketConnection', function() {
376
376
  beforeEach(function() {
377
377
  expectedMessage = {
378
378
  jsonrpc: '2.0',
379
- id: faker.random.uuid(),
379
+ id: faker.datatype.uuid(),
380
380
  result: null
381
381
  };
382
382
  expectedOrganization = fixture.build('organization');
@@ -407,11 +407,11 @@ describe('Bus/WebSocketConnection', function() {
407
407
  beforeEach(function() {
408
408
  expectedMessage = {
409
409
  jsonrpc: '2.0',
410
- id: faker.random.uuid(),
410
+ id: faker.datatype.uuid(),
411
411
  result: null
412
412
  };
413
413
  expectedOrganization = fixture.build('organization');
414
- expectedUUID = faker.random.uuid();
414
+ expectedUUID = faker.datatype.uuid();
415
415
  expectedMessageHandlers = {
416
416
  [expectedUUID]: sinon.stub()
417
417
  };
@@ -453,7 +453,7 @@ describe('Bus/WebSocketConnection', function() {
453
453
  example: 1
454
454
  };
455
455
  send = sinon.spy(expectedWebSocket, 'send');
456
- serviceId = faker.random.uuid();
456
+ serviceId = faker.datatype.uuid();
457
457
 
458
458
  ws = new WebSocketConnection(
459
459
  expectedWebSocket,
@@ -544,11 +544,11 @@ describe('Bus/WebSocketConnection', function() {
544
544
  clock = sinon.useFakeTimers();
545
545
  expectedMessage = {
546
546
  jsonrpc: '2.0',
547
- id: faker.random.uuid(),
547
+ id: faker.datatype.uuid(),
548
548
  result: null
549
549
  };
550
550
  resolvedIndicator = Symbol(faker.hacker.noun());
551
- serviceId = faker.random.uuid();
551
+ serviceId = faker.datatype.uuid();
552
552
  waitTime = 1 * 60 * 1000; // 1 minute
553
553
 
554
554
  promise = Promise.race([
@@ -560,7 +560,7 @@ describe('Bus/WebSocketConnection', function() {
560
560
 
561
561
  ws._messageHandlers[jsonRpcId]({
562
562
  jsonrpc: '2.0',
563
- id: faker.random.uuid(),
563
+ id: faker.datatype.uuid(),
564
564
  result: null
565
565
  });
566
566
  });
@@ -607,7 +607,7 @@ describe('Bus/WebSocketConnection', function() {
607
607
  example: 1
608
608
  };
609
609
  send = sinon.spy(expectedWebSocket, 'send');
610
- serviceId = faker.random.uuid();
610
+ serviceId = faker.datatype.uuid();
611
611
 
612
612
  ws = new WebSocketConnection(null, expectedOrganization.id);
613
613
 
@@ -652,7 +652,7 @@ describe('Bus/WebSocketConnection', function() {
652
652
  example: 1
653
653
  };
654
654
  send = sinon.spy(expectedWebSocket, 'send');
655
- serviceId = faker.random.uuid();
655
+ serviceId = faker.datatype.uuid();
656
656
 
657
657
  ws = new WebSocketConnection(
658
658
  expectedWebSocket,
@@ -752,7 +752,7 @@ describe('Bus/WebSocketConnection', function() {
752
752
  example: 1
753
753
  };
754
754
  send = sinon.spy(expectedWebSocket, 'send');
755
- serviceId = faker.random.uuid();
755
+ serviceId = faker.datatype.uuid();
756
756
 
757
757
  ws = new WebSocketConnection(
758
758
  expectedWebSocket,
@@ -798,7 +798,7 @@ describe('Bus/WebSocketConnection', function() {
798
798
  expectedOrganization = fixture.build('organization');
799
799
  message = null;
800
800
  send = sinon.spy(expectedWebSocket, 'send');
801
- serviceId = faker.random.uuid();
801
+ serviceId = faker.datatype.uuid();
802
802
 
803
803
  ws = new WebSocketConnection(
804
804
  expectedWebSocket,
@@ -849,7 +849,7 @@ describe('Bus/WebSocketConnection', function() {
849
849
  group = faker.random.word();
850
850
  expectedOrganization = fixture.build('organization');
851
851
  send = sinon.spy(expectedWebSocket, 'send');
852
- serviceId = faker.random.uuid();
852
+ serviceId = faker.datatype.uuid();
853
853
 
854
854
  ws = new WebSocketConnection(
855
855
  expectedWebSocket,
@@ -885,7 +885,7 @@ describe('Bus/WebSocketConnection', function() {
885
885
  let subscription;
886
886
 
887
887
  beforeEach(function() {
888
- subscription = faker.random.uuid();
888
+ subscription = faker.datatype.uuid();
889
889
  ws._messageHandlers[jsonRpcId]({
890
890
  jsonrpc: '2.0',
891
891
  id: jsonRpcId,
@@ -949,9 +949,9 @@ describe('Bus/WebSocketConnection', function() {
949
949
 
950
950
  beforeEach(function() {
951
951
  clock = sinon.useFakeTimers();
952
- subscription = faker.random.uuid();
952
+ subscription = faker.datatype.uuid();
953
953
  resolvedIndicator = Symbol(faker.hacker.noun());
954
- serviceId = faker.random.uuid();
954
+ serviceId = faker.datatype.uuid();
955
955
  waitTime = 1 * 60 * 1000; // 1 minute
956
956
 
957
957
  promise = Promise.race([
@@ -963,7 +963,7 @@ describe('Bus/WebSocketConnection', function() {
963
963
 
964
964
  ws._messageHandlers[jsonRpcId]({
965
965
  jsonrpc: '2.0',
966
- id: faker.random.uuid(),
966
+ id: faker.datatype.uuid(),
967
967
  result: {
968
968
  subscription
969
969
  }
@@ -1010,7 +1010,7 @@ describe('Bus/WebSocketConnection', function() {
1010
1010
  expectedOrganization = fixture.build('organization');
1011
1011
  group = faker.random.word();
1012
1012
  send = sinon.spy(expectedWebSocket, 'send');
1013
- serviceId = faker.random.uuid();
1013
+ serviceId = faker.datatype.uuid();
1014
1014
 
1015
1015
  ws = new WebSocketConnection(null, expectedOrganization.id);
1016
1016
 
@@ -1053,7 +1053,7 @@ describe('Bus/WebSocketConnection', function() {
1053
1053
  expectedOrganization = fixture.build('organization');
1054
1054
  group = faker.random.word();
1055
1055
  send = sinon.spy(expectedWebSocket, 'send');
1056
- serviceId = faker.random.uuid();
1056
+ serviceId = faker.datatype.uuid();
1057
1057
 
1058
1058
  ws = new WebSocketConnection(
1059
1059
  expectedWebSocket,
@@ -1149,7 +1149,7 @@ describe('Bus/WebSocketConnection', function() {
1149
1149
  expectedOrganization = fixture.build('organization');
1150
1150
  group = faker.random.word();
1151
1151
  send = sinon.spy(expectedWebSocket, 'send');
1152
- serviceId = faker.random.uuid();
1152
+ serviceId = faker.datatype.uuid();
1153
1153
 
1154
1154
  ws = new WebSocketConnection(
1155
1155
  expectedWebSocket,
@@ -1195,7 +1195,7 @@ describe('Bus/WebSocketConnection', function() {
1195
1195
  expectedOrganization = fixture.build('organization');
1196
1196
  group = null;
1197
1197
  send = sinon.spy(expectedWebSocket, 'send');
1198
- serviceId = faker.random.uuid();
1198
+ serviceId = faker.datatype.uuid();
1199
1199
 
1200
1200
  ws = new WebSocketConnection(
1201
1201
  expectedWebSocket,
@@ -1235,7 +1235,7 @@ describe('Bus/WebSocketConnection', function() {
1235
1235
  channel = faker.random.word();
1236
1236
  expectedOrganization = fixture.build('organization');
1237
1237
  group = null;
1238
- serviceId = faker.random.uuid();
1238
+ serviceId = faker.datatype.uuid();
1239
1239
 
1240
1240
  ws = new WebSocketConnection(
1241
1241
  expectedWebSocket,
@@ -1257,7 +1257,7 @@ describe('Bus/WebSocketConnection', function() {
1257
1257
  channel = faker.random.word();
1258
1258
  expectedOrganization = fixture.build('organization');
1259
1259
  group = null;
1260
- serviceId = faker.random.uuid();
1260
+ serviceId = faker.datatype.uuid();
1261
1261
 
1262
1262
  ws = new WebSocketConnection(
1263
1263
  expectedWebSocket,
@@ -1288,7 +1288,7 @@ describe('Bus/WebSocketConnection', function() {
1288
1288
  channel = faker.random.word();
1289
1289
  expectedOrganization = fixture.build('organization');
1290
1290
  group = null;
1291
- serviceId = faker.random.uuid();
1291
+ serviceId = faker.datatype.uuid();
1292
1292
 
1293
1293
  ws = new WebSocketConnection(
1294
1294
  expectedWebSocket,
@@ -1310,7 +1310,7 @@ describe('Bus/WebSocketConnection', function() {
1310
1310
  channel = faker.random.word();
1311
1311
  expectedOrganization = fixture.build('organization');
1312
1312
  group = null;
1313
- serviceId = faker.random.uuid();
1313
+ serviceId = faker.datatype.uuid();
1314
1314
 
1315
1315
  ws = new WebSocketConnection(
1316
1316
  expectedWebSocket,
@@ -1346,9 +1346,9 @@ describe('Bus/WebSocketConnection', function() {
1346
1346
  expectedOrganization = fixture.build('organization');
1347
1347
  group = null;
1348
1348
  handler = sinon.stub().returns(null);
1349
- serviceId = faker.random.uuid();
1349
+ serviceId = faker.datatype.uuid();
1350
1350
  message = faker.random.word();
1351
- subscription = faker.random.uuid();
1351
+ subscription = faker.datatype.uuid();
1352
1352
 
1353
1353
  ws = new WebSocketConnection(
1354
1354
  expectedWebSocket,
@@ -2135,7 +2135,7 @@ describe('Bus/WebSocketConnection', function() {
2135
2135
  beforeEach(function() {
2136
2136
  expectedOrganization = fixture.build('organization');
2137
2137
  send = sinon.spy(expectedWebSocket, 'send');
2138
- messageId = faker.random.uuid();
2138
+ messageId = faker.datatype.uuid();
2139
2139
 
2140
2140
  ws = new WebSocketConnection(
2141
2141
  expectedWebSocket,
@@ -2174,7 +2174,7 @@ describe('Bus/WebSocketConnection', function() {
2174
2174
  beforeEach(function() {
2175
2175
  expectedOrganization = fixture.build('organization');
2176
2176
  send = sinon.spy(expectedWebSocket, 'send');
2177
- messageId = faker.random.uuid();
2177
+ messageId = faker.datatype.uuid();
2178
2178
 
2179
2179
  ws = new WebSocketConnection(
2180
2180
  expectedWebSocket,
@@ -2210,7 +2210,7 @@ describe('Bus/WebSocketConnection', function() {
2210
2210
  beforeEach(function() {
2211
2211
  expectedOrganization = fixture.build('organization');
2212
2212
  send = sinon.spy(expectedWebSocket, 'send');
2213
- messageId = faker.random.uuid();
2213
+ messageId = faker.datatype.uuid();
2214
2214
 
2215
2215
  ws = new WebSocketConnection(
2216
2216
  expectedWebSocket,
@@ -17,8 +17,8 @@ export default {
17
17
  host: 'https://contxtauth.com'
18
18
  },
19
19
  staging: {
20
- clientId: 'XzgumXUg5U57015haylz4zaJsiQqZy4l',
21
- host: 'https://contxt-auth-staging.api.ndustrial.io'
20
+ clientId: '7TceUsM1eC4nKmdoC717383DWyfc9QoY',
21
+ host: 'https://contxt-auth-service.staging.ndustrial.io'
22
22
  }
23
23
  },
24
24
  coordinator: {
@@ -28,7 +28,7 @@ export default {
28
28
  },
29
29
  staging: {
30
30
  clientId: 'qGzdTXcmB57zlTp86rYsivG9qEss1lbF',
31
- host: 'https://contxt-api.staging.ndustrial.io'
31
+ host: 'https://contxt.api.staging.ndustrial.io'
32
32
  }
33
33
  },
34
34
  events: {
@@ -61,16 +61,6 @@ export default {
61
61
  host: 'https://files.api.staging.ndustrial.io'
62
62
  }
63
63
  },
64
- health: {
65
- staging: {
66
- clientId: '1zQ2YXbHXotrf2dDKgySqEjlJBz465qq',
67
- host: 'https://health-staging.api.ndustrial.io'
68
- },
69
- production: {
70
- clientId: '6uaQIV1KnnWhXiTm09iGDvy2aQaz2xVI',
71
- host: 'https://health.api.ndustrial.io'
72
- }
73
- },
74
64
  iot: {
75
65
  staging: {
76
66
  clientId: 'm35AEcxD8hf65sq04ZU7yFxqpqVkKzES',
@@ -80,5 +70,15 @@ export default {
80
70
  clientId: 'iznTb30Sfp2Jpaf398I5DN6MyPuDCftA',
81
71
  host: 'https://feeds.api.ndustrial.io'
82
72
  }
73
+ },
74
+ nionic: {
75
+ staging: {
76
+ clientId: 'vhGxildn8hRRWZj49y18BGtbjTkFHcTG',
77
+ host: 'https://<tenant>.api.staging.ndustrial.io'
78
+ },
79
+ production: {
80
+ clientId: 'vtiZlMRo4apDvThTRiH7kLifQXWUdi9j',
81
+ host: 'https://<tenant>.api.ndustrial.io'
82
+ }
83
83
  }
84
84
  };
@@ -1,8 +1,8 @@
1
1
  import omit from 'lodash.omit';
2
2
  import times from 'lodash.times';
3
- import Config from './index';
4
3
  import defaultAudiences from './audiences';
5
4
  import defaultConfigs from './defaults';
5
+ import Config from './index';
6
6
 
7
7
  describe('Config', function() {
8
8
  afterEach(function() {
@@ -112,7 +112,7 @@ describe('Config', function() {
112
112
  audienceName = faker.hacker.adjective();
113
113
 
114
114
  existingDynamicAudiences = times(
115
- faker.random.number({ min: 1, max: 3 })
115
+ faker.datatype.number({ min: 1, max: 3 })
116
116
  ).reduce((memo, index) => {
117
117
  memo[`${faker.lorem.word()}-${index}`] = fixture.build('audience');
118
118
 
@@ -258,7 +258,7 @@ describe('Config', function() {
258
258
  expectedReaddedAudience = fixture.build('audience');
259
259
  expectedRemovedAudience = fixture.build('audience');
260
260
  remainingDynamicAudiences = times(
261
- faker.random.number({ min: 1, max: 3 })
261
+ faker.datatype.number({ min: 1, max: 3 })
262
262
  ).reduce((memo, index) => {
263
263
  memo[`${faker.hacker.adjective()}-${index}`] = fixture.build(
264
264
  'audience'
@@ -331,7 +331,7 @@ describe('Config', function() {
331
331
 
332
332
  beforeEach(function() {
333
333
  dynamicAudiences = times(
334
- faker.random.number({ min: 1, max: 3 })
334
+ faker.datatype.number({ min: 1, max: 3 })
335
335
  ).reduce((memo, index) => {
336
336
  memo[`${faker.hacker.adjective()}-${index}`] = fixture.build(
337
337
  'audience'
@@ -667,7 +667,7 @@ describe('Config', function() {
667
667
  const externalModules = {};
668
668
  expectedAudiences = {};
669
669
 
670
- times(faker.random.number({ min: 1, max: 10 }))
670
+ times(faker.datatype.number({ min: 1, max: 10 }))
671
671
  .map(() => faker.hacker.adjective())
672
672
  .forEach((moduleName) => {
673
673
  const audience = fixture.build('audience');
@@ -699,7 +699,7 @@ describe('Config', function() {
699
699
  const externalModules = {};
700
700
  expectedAudiences = {};
701
701
 
702
- times(faker.random.number({ min: 1, max: 10 }))
702
+ times(faker.datatype.number({ min: 1, max: 10 }))
703
703
  .map(() => faker.hacker.adjective())
704
704
  .forEach((moduleName) => {
705
705
  const audience = fixture.build('audience', {
@@ -1,5 +1,5 @@
1
- import Applications from './applications';
2
1
  import * as objectUtils from '../utils/objects';
2
+ import Applications from './applications';
3
3
 
4
4
  describe('Coordinator/Applications', function() {
5
5
  let baseRequest;
@@ -163,7 +163,7 @@ describe('Coordinator/Applications', function() {
163
163
  let toCamelCase;
164
164
 
165
165
  beforeEach(function() {
166
- const numberOfApplications = faker.random.number({
166
+ const numberOfApplications = faker.datatype.number({
167
167
  min: 1,
168
168
  max: 10
169
169
  });
@@ -219,7 +219,7 @@ describe('Coordinator/Applications', function() {
219
219
  beforeEach(function() {
220
220
  expectedFavoriteApplications = fixture.buildList(
221
221
  'contxtUserFavoriteApplication',
222
- faker.random.number({
222
+ faker.datatype.number({
223
223
  min: 1,
224
224
  max: 10
225
225
  })
@@ -270,10 +270,10 @@ describe('Coordinator/Applications', function() {
270
270
  let toCamelCase;
271
271
 
272
272
  beforeEach(function() {
273
- expectedApplicationId = faker.random.uuid();
273
+ expectedApplicationId = faker.datatype.uuid();
274
274
  expectedGroupings = fixture.buildList(
275
275
  'applicationGrouping',
276
- faker.random.number({ min: 1, max: 10 })
276
+ faker.datatype.number({ min: 1, max: 10 })
277
277
  );
278
278
  groupingsFromServer = expectedGroupings.map((grouping) =>
279
279
  fixture.build('applicationGrouping', grouping, { fromServer: true })
@@ -321,10 +321,10 @@ describe('Coordinator/Applications', function() {
321
321
  let toCamelCase;
322
322
 
323
323
  beforeEach(function() {
324
- expectedOrganizationId = faker.random.uuid();
324
+ expectedOrganizationId = faker.datatype.uuid();
325
325
  expectedFeaturedApplications = fixture.buildList(
326
326
  'contxtOrganizationFeaturedApplication',
327
- faker.random.number({
327
+ faker.datatype.number({
328
328
  min: 1,
329
329
  max: 10
330
330
  }),
@@ -401,7 +401,7 @@ describe('Coordinator/Applications', function() {
401
401
  expectedOrganizationId = fixture.build('organization').id;
402
402
  expectedFeaturedApplications = fixture.buildList(
403
403
  'contxtOrganizationFeaturedApplication',
404
- faker.random.number({
404
+ faker.datatype.number({
405
405
  min: 1,
406
406
  max: 10
407
407
  }),
@@ -95,7 +95,7 @@ describe('Coordinator/Consent', function() {
95
95
  let expectedConsentId;
96
96
 
97
97
  beforeEach(function() {
98
- expectedConsentId = faker.random.uuid();
98
+ expectedConsentId = faker.datatype.uuid();
99
99
  consent = new Consent(baseSdk, baseRequest, expectedHost);
100
100
  });
101
101