@ndustrial/contxt-sdk
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,3 +0,9 @@ | ||
## [v1.0.0](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.0.0) (2019-xx-xx) | ||
## [v1.1.0](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.1.0) (2019-05-29) | ||
**Added** | ||
- Added `Coordinator.applications#getGroupings` for getting all application groupings and modules for an application that a user has access to | ||
## [v1.0.0](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.0.0) (2019-05-28) | ||
**Changed** | ||
@@ -4,0 +10,0 @@ |
@@ -14,2 +14,3 @@ <a name="Applications"></a> | ||
* [.getFeatured(organizationId)](#Applications+getFeatured) ⇒ <code>Promise</code> | ||
* [.getGroupings(applicationId)](#Applications+getGroupings) ⇒ <code>Promise</code> | ||
* [.removeFavorite(applicationId)](#Applications+removeFavorite) ⇒ <code>Promise</code> | ||
@@ -115,2 +116,26 @@ | ||
``` | ||
<a name="Applications+getGroupings"></a> | ||
### contxtSdk.coordinator.applications.getGroupings(applicationId) ⇒ <code>Promise</code> | ||
Gets the application groupings (and application modules) of an application | ||
that are available to the currently authenticated user. | ||
API Endpoint: '/applications/:applicationId/groupings' | ||
Method: GET | ||
**Kind**: instance method of [<code>Applications</code>](#Applications) | ||
**Fulfill**: <code>ContxtApplicationGrouping[]</code> | ||
**Reject**: <code>Error</code> | ||
| Param | Type | | ||
| --- | --- | | ||
| applicationId | <code>number</code> | | ||
**Example** | ||
```js | ||
contxtSdk.coordinator.applications | ||
.getGroupings(31) | ||
.then((applicationGroupings) => console.log(applicationGroupings)) | ||
.catch((err) => console.log(err)); | ||
``` | ||
<a name="Applications+removeFavorite"></a> | ||
@@ -117,0 +142,0 @@ |
@@ -172,2 +172,6 @@ ## Classes | ||
<dd></dd> | ||
<dt><a href="./Typedefs.md#ContxtApplicationGrouping">ContxtApplicationGrouping</a> : <code>Object</code></dt> | ||
<dd></dd> | ||
<dt><a href="./Typedefs.md#ContxtApplicationModule">ContxtApplicationModule</a> : <code>Object</code></dt> | ||
<dd></dd> | ||
<dt><a href="./Typedefs.md#ContxtOrganization">ContxtOrganization</a> : <code>Object</code></dt> | ||
@@ -174,0 +178,0 @@ <dd></dd> |
@@ -240,2 +240,32 @@ <a name="Asset"></a> | ||
<a name="ContxtApplicationGrouping"></a> | ||
## ContxtApplicationGrouping : <code>Object</code> | ||
**Kind**: global typedef | ||
**Properties** | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
| applicationId | <code>number</code> | | | ||
| applicationModules | [<code>Array.<ContxtApplicationModule></code>](#ContxtApplicationModule) | | | ||
| id | <code>string</code> | | | ||
| index | <code>number</code> | The position of the grouping within the list of all groupings of a the parent application | | ||
| label | <code>string</code> | | | ||
<a name="ContxtApplicationModule"></a> | ||
## ContxtApplicationModule : <code>Object</code> | ||
**Kind**: global typedef | ||
**Properties** | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
| applicationGroupingId | <code>string</code> | | | ||
| [externalLink] | <code>string</code> | A URI pointing to an external application | | ||
| [iconUrl] | <code>string</code> | A URI pointing to an icon/image representing the application module | | ||
| id | <code>string</code> | | | ||
| index | <code>number</code> | The position of the module within the list of all modules of a the parent application grouping | | ||
| label | <code>string</code> | | | ||
| slug | <code>string</code> | String that corresponds with a front-end package name (e.g. the `@ndustrial/nsight-example` example application) | | ||
<a name="ContxtOrganization"></a> | ||
@@ -242,0 +272,0 @@ |
@@ -17,2 +17,4 @@ 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; }; }(); | ||
/** | ||
* @alias BrowserBus | ||
* | ||
* @param {Object} sdk An instance of the SDK so the module can communicate with other modules | ||
@@ -19,0 +21,0 @@ * @param {Object} request An instance of the request module tied to this module's audience. |
@@ -11,3 +11,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
*/ | ||
var WebSocketConnection = function WebSocketConnection(webSocket, organizationId) { | ||
var WebSocketConnection = | ||
/** | ||
* @alias BrowserWebSocketConnection | ||
*/ | ||
function WebSocketConnection(webSocket, organizationId) { | ||
_classCallCheck(this, WebSocketConnection); | ||
@@ -14,0 +18,0 @@ |
@@ -23,2 +23,26 @@ 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; }; }(); | ||
/** | ||
* @typedef {Object} ContxtApplicationGrouping | ||
* @property {number} applicationId | ||
* @property {ContxtApplicationModule[]} applicationModules | ||
* @property {string} id | ||
* @property {number} index The position of the grouping within the list of all | ||
* groupings of a the parent application | ||
* @property {string} label | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtApplicationModule | ||
* @property {string} applicationGroupingId | ||
* @property {string} [externalLink] A URI pointing to an external application | ||
* @property {string} [iconUrl] A URI pointing to an icon/image representing the | ||
* application module | ||
* @property {string} id | ||
* @property {number} index The position of the module within the list of all | ||
* modules of a the parent application grouping | ||
* @property {string} label | ||
* @property {string} slug String that corresponds with a front-end package | ||
* name (e.g. the `@ndustrial/nsight-example` example application) | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtOrganizationFeaturedApplication | ||
@@ -183,2 +207,30 @@ * @property {number} applicationId | ||
/** | ||
* Gets the application groupings (and application modules) of an application | ||
* that are available to the currently authenticated user. | ||
* | ||
* API Endpoint: '/applications/:applicationId/groupings' | ||
* Method: GET | ||
* | ||
* @param {number} applicationId | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtApplicationGrouping[]} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.applications | ||
* .getGroupings(31) | ||
* .then((applicationGroupings) => console.log(applicationGroupings)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'getGroupings', | ||
value: function getGroupings(applicationId) { | ||
return this._request.get(this._baseUrl + '/applications/' + applicationId + '/groupings').then(function (groupings) { | ||
return toCamelCase(groupings); | ||
}); | ||
} | ||
/** | ||
* Removes an application from the current user's list of favorited applications | ||
@@ -185,0 +237,0 @@ * |
@@ -26,2 +26,4 @@ 'use strict'; | ||
/** | ||
* @alias BrowserBus | ||
* | ||
* @param {Object} sdk An instance of the SDK so the module can communicate with other modules | ||
@@ -28,0 +30,0 @@ * @param {Object} request An instance of the request module tied to this module's audience. |
@@ -17,3 +17,7 @@ 'use strict'; | ||
*/ | ||
var WebSocketConnection = function WebSocketConnection(webSocket, organizationId) { | ||
var WebSocketConnection = | ||
/** | ||
* @alias BrowserWebSocketConnection | ||
*/ | ||
function WebSocketConnection(webSocket, organizationId) { | ||
_classCallCheck(this, WebSocketConnection); | ||
@@ -20,0 +24,0 @@ |
@@ -29,2 +29,26 @@ 'use strict'; | ||
/** | ||
* @typedef {Object} ContxtApplicationGrouping | ||
* @property {number} applicationId | ||
* @property {ContxtApplicationModule[]} applicationModules | ||
* @property {string} id | ||
* @property {number} index The position of the grouping within the list of all | ||
* groupings of a the parent application | ||
* @property {string} label | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtApplicationModule | ||
* @property {string} applicationGroupingId | ||
* @property {string} [externalLink] A URI pointing to an external application | ||
* @property {string} [iconUrl] A URI pointing to an icon/image representing the | ||
* application module | ||
* @property {string} id | ||
* @property {number} index The position of the module within the list of all | ||
* modules of a the parent application grouping | ||
* @property {string} label | ||
* @property {string} slug String that corresponds with a front-end package | ||
* name (e.g. the `@ndustrial/nsight-example` example application) | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtOrganizationFeaturedApplication | ||
@@ -188,2 +212,30 @@ * @property {number} applicationId | ||
/** | ||
* Gets the application groupings (and application modules) of an application | ||
* that are available to the currently authenticated user. | ||
* | ||
* API Endpoint: '/applications/:applicationId/groupings' | ||
* Method: GET | ||
* | ||
* @param {number} applicationId | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtApplicationGrouping[]} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.applications | ||
* .getGroupings(31) | ||
* .then((applicationGroupings) => console.log(applicationGroupings)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'getGroupings', | ||
value: function getGroupings(applicationId) { | ||
return this._request.get(this._baseUrl + '/applications/' + applicationId + '/groupings').then(function (groupings) { | ||
return (0, _objects.toCamelCase)(groupings); | ||
}); | ||
} | ||
/** | ||
* Removes an application from the current user's list of favorited applications | ||
@@ -190,0 +242,0 @@ * |
{ | ||
"name": "@ndustrial/contxt-sdk", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -12,2 +12,4 @@ import Channels from './channels'; | ||
/** | ||
* @alias BrowserBus | ||
* | ||
* @param {Object} sdk An instance of the SDK so the module can communicate with other modules | ||
@@ -14,0 +16,0 @@ * @param {Object} request An instance of the request module tied to this module's audience. |
@@ -10,2 +10,5 @@ /** | ||
class WebSocketConnection { | ||
/** | ||
* @alias BrowserWebSocketConnection | ||
*/ | ||
constructor(webSocket, organizationId) { | ||
@@ -12,0 +15,0 @@ throw new Error( |
@@ -19,2 +19,26 @@ import { toCamelCase } from '../utils/objects'; | ||
/** | ||
* @typedef {Object} ContxtApplicationGrouping | ||
* @property {number} applicationId | ||
* @property {ContxtApplicationModule[]} applicationModules | ||
* @property {string} id | ||
* @property {number} index The position of the grouping within the list of all | ||
* groupings of a the parent application | ||
* @property {string} label | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtApplicationModule | ||
* @property {string} applicationGroupingId | ||
* @property {string} [externalLink] A URI pointing to an external application | ||
* @property {string} [iconUrl] A URI pointing to an icon/image representing the | ||
* application module | ||
* @property {string} id | ||
* @property {number} index The position of the module within the list of all | ||
* modules of a the parent application grouping | ||
* @property {string} label | ||
* @property {string} slug String that corresponds with a front-end package | ||
* name (e.g. the `@ndustrial/nsight-example` example application) | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtOrganizationFeaturedApplication | ||
@@ -171,2 +195,27 @@ * @property {number} applicationId | ||
/** | ||
* Gets the application groupings (and application modules) of an application | ||
* that are available to the currently authenticated user. | ||
* | ||
* API Endpoint: '/applications/:applicationId/groupings' | ||
* Method: GET | ||
* | ||
* @param {number} applicationId | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtApplicationGrouping[]} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.applications | ||
* .getGroupings(31) | ||
* .then((applicationGroupings) => console.log(applicationGroupings)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
getGroupings(applicationId) { | ||
return this._request | ||
.get(`${this._baseUrl}/applications/${applicationId}/groupings`) | ||
.then((groupings) => toCamelCase(groupings)); | ||
} | ||
/** | ||
* Removes an application from the current user's list of favorited applications | ||
@@ -173,0 +222,0 @@ * |
@@ -228,2 +228,51 @@ import Applications from './applications'; | ||
describe('getGroupings', function() { | ||
let expectedApplicationId; | ||
let expectedGroupings; | ||
let groupingsFromServer; | ||
let promise; | ||
let request; | ||
let toCamelCase; | ||
beforeEach(function() { | ||
expectedApplicationId = faker.random.uuid(); | ||
expectedGroupings = fixture.buildList( | ||
'applicationGrouping', | ||
faker.random.number({ min: 1, max: 10 }) | ||
); | ||
groupingsFromServer = expectedGroupings.map((grouping) => | ||
fixture.build('applicationGrouping', grouping, { fromServer: true }) | ||
); | ||
request = { | ||
...baseRequest, | ||
get: this.sandbox.stub().resolves(groupingsFromServer) | ||
}; | ||
toCamelCase = this.sandbox | ||
.stub(objectUtils, 'toCamelCase') | ||
.returns(expectedGroupings); | ||
const applications = new Applications(baseSdk, request, expectedHost); | ||
promise = applications.getGroupings(expectedApplicationId); | ||
}); | ||
it('gets the list of application groupings', function() { | ||
expect(request.get).to.be.calledWith( | ||
`${expectedHost}/applications/${expectedApplicationId}/groupings` | ||
); | ||
}); | ||
it('formats the list of application groupings', function() { | ||
return promise.then(() => { | ||
expect(toCamelCase).to.be.calledWith(groupingsFromServer); | ||
}); | ||
}); | ||
it('returns a fulfilled promise with the application groupings', function() { | ||
return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal( | ||
expectedGroupings | ||
); | ||
}); | ||
}); | ||
describe('getFeatured', function() { | ||
@@ -230,0 +279,0 @@ context('when the organization ID is provided', function() { |
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const factory = require('rosie').Factory; | ||
require('./asset'); | ||
require('./assetAttribute'); | ||
require('./assetAttributeValue'); | ||
require('./assetMetric'); | ||
require('./assetMetricValue'); | ||
require('./assetType'); | ||
require('./audience'); | ||
require('./channel'); | ||
require('./contxtApplication'); | ||
require('./contxtOrganization'); | ||
require('./contxtOrganizationFeaturedApplication'); | ||
require('./contxtRole'); | ||
require('./contxtStack'); | ||
require('./contxtUser'); | ||
require('./contxtUserApplication'); | ||
require('./contxtUserFavoriteApplication'); | ||
require('./contxtUserPermissions'); | ||
require('./contxtUserRole'); | ||
require('./contxtUserStack'); | ||
require('./costCenter'); | ||
require('./costCenterFacility'); | ||
require('./defaultAudiences'); | ||
require('./edgeNode'); | ||
require('./event'); | ||
require('./eventType'); | ||
require('./facility'); | ||
require('./facilityGrouping'); | ||
require('./facilityGroupingFacility'); | ||
require('./facilityInfo'); | ||
require('./facilityTag'); | ||
require('./fieldCategory'); | ||
require('./fieldGrouping'); | ||
require('./fieldGroupingField'); | ||
require('./file'); | ||
require('./fileToDownload'); | ||
require('./fileUploadInfo'); | ||
require('./outputField'); | ||
require('./outputFieldData'); | ||
require('./organization'); | ||
require('./owner'); | ||
require('./paginationMetadata'); | ||
require('./userPermissionsMap'); | ||
require('./userProfile'); | ||
const basename = path.basename(__filename); | ||
fs.readdirSync(__dirname) | ||
.filter( | ||
(filename) => | ||
filename.indexOf('.') !== 0 && | ||
filename !== basename && | ||
filename.slice(-3) === '.js' | ||
) | ||
.forEach((filename) => require(`./${filename}`)); | ||
module.exports = factory; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2321273
383
37342
6