Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ndustrial/contxt-sdk

Package Overview
Dependencies
Maintainers
13
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndustrial/contxt-sdk - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0-beta.4

support/fixtures/factories/contxtOrganizationFeaturedApplication.js

6

CHANGELOG.md

@@ -16,2 +16,8 @@ ## [v1.0.0](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.0.0) (2019-xx-xx)

## [v0.0.47](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.45) (2019-04-02)
**Added**
- Added `Coordinator#getFeaturedApplications` for getting an organization's list of featured applications
## [v0.0.46](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.46) (2019-04-01)

@@ -18,0 +24,0 @@

@@ -15,2 +15,3 @@ <a name="Coordinator"></a>

* [.getFavoriteApplications()](#Coordinator+getFavoriteApplications) ⇒ <code>Promise</code>
* [.getFeaturedApplications(organizationId)](#Coordinator+getFeaturedApplications) ⇒ <code>Promise</code>
* [.getOrganizationById(organizationId)](#Coordinator+getOrganizationById) ⇒ <code>Promise</code>

@@ -134,2 +135,27 @@ * [.getUser(userId)](#Coordinator+getUser) ⇒ <code>Promise</code>

```
<a name="Coordinator+getFeaturedApplications"></a>
### contxtSdk.coordinator.getFeaturedApplications(organizationId) ⇒ <code>Promise</code>
Gets an organization's list of featured applications
API Endpoint: '/organizations/:organizationId/applications/featured'
Method: GET
Note: Only valid for web users using auth0WebAuth session type
**Kind**: instance method of [<code>Coordinator</code>](#Coordinator)
**Fulfill**: <code>ContxtOrganizationFeaturedApplication[]</code> A list of featured applications
**Reject**: <code>Error</code>
| Param | Type | Description |
| --- | --- | --- |
| organizationId | <code>string</code> | The ID of the organization |
**Example**
```js
contxtSdk.coordinator
.getFeaturedApplications('36b8421a-cc4a-4204-b839-1397374fb16b')
.then((featuredApplications) => console.log(featuredApplications))
.catch((err) => console.log(err));
```
<a name="Coordinator+getOrganizationById"></a>

@@ -136,0 +162,0 @@

2

docs/README.md

@@ -159,2 +159,4 @@ ## Classes

<dd></dd>
<dt><a href="./Typedefs.md#ContxtOrganizationFeaturedApplication">ContxtOrganizationFeaturedApplication</a> : <code>Object</code></dt>
<dd></dd>
<dt><a href="./Typedefs.md#ContxtUser">ContxtUser</a> : <code>Object</code></dt>

@@ -161,0 +163,0 @@ <dd></dd>

@@ -255,2 +255,16 @@ <a name="Asset"></a>

<a name="ContxtOrganizationFeaturedApplication"></a>
## ContxtOrganizationFeaturedApplication : <code>Object</code>
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| applicationId | <code>number</code> | |
| createdAt | <code>string</code> | ISO 8601 Extended Format date/time string |
| id | <code>string</code> | |
| organizationId | <code>string</code> | |
| updatedAt | <code>string</code> | ISO 8601 Extended Format date/time string |
<a name="ContxtUser"></a>

@@ -257,0 +271,0 @@

@@ -33,2 +33,11 @@ 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} ContxtOrganizationFeaturedApplication
* @property {number} applicationId
* @property {string} createdAt ISO 8601 Extended Format date/time string
* @property {string} id
* @property {string} organizationId
* @property {string} updatedAt ISO 8601 Extended Format date/time string
*/
/**
* @typedef {Object} ContxtUser

@@ -224,2 +233,35 @@ * @property {string} createdAt ISO 8601 Extended Format date/time string

/**
* Gets an organization's list of featured applications
*
* API Endpoint: '/organizations/:organizationId/applications/featured'
* Method: GET
*
* Note: Only valid for web users using auth0WebAuth session type
*
* @param {string} organizationId The ID of the organization
*
* @returns {Promise}
* @fulfill {ContxtOrganizationFeaturedApplication[]} A list of featured applications
* @reject {Error}
*
* @example
* contxtSdk.coordinator
* .getFeaturedApplications('36b8421a-cc4a-4204-b839-1397374fb16b')
* .then((featuredApplications) => console.log(featuredApplications))
* .catch((err) => console.log(err));
*/
}, {
key: 'getFeaturedApplications',
value: function getFeaturedApplications(organizationId) {
if (!organizationId) {
return Promise.reject(new Error('An organization ID is required for getting featured applications for an organization'));
}
return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/applications/featured').then(function (featuredApplications) {
return toCamelCase(featuredApplications);
});
}
/**
* Gets information about a contxt organization

@@ -226,0 +268,0 @@ *

@@ -44,2 +44,11 @@ 'use strict';

/**
* @typedef {Object} ContxtOrganizationFeaturedApplication
* @property {number} applicationId
* @property {string} createdAt ISO 8601 Extended Format date/time string
* @property {string} id
* @property {string} organizationId
* @property {string} updatedAt ISO 8601 Extended Format date/time string
*/
/**
* @typedef {Object} ContxtUser

@@ -234,2 +243,35 @@ * @property {string} createdAt ISO 8601 Extended Format date/time string

/**
* Gets an organization's list of featured applications
*
* API Endpoint: '/organizations/:organizationId/applications/featured'
* Method: GET
*
* Note: Only valid for web users using auth0WebAuth session type
*
* @param {string} organizationId The ID of the organization
*
* @returns {Promise}
* @fulfill {ContxtOrganizationFeaturedApplication[]} A list of featured applications
* @reject {Error}
*
* @example
* contxtSdk.coordinator
* .getFeaturedApplications('36b8421a-cc4a-4204-b839-1397374fb16b')
* .then((featuredApplications) => console.log(featuredApplications))
* .catch((err) => console.log(err));
*/
}, {
key: 'getFeaturedApplications',
value: function getFeaturedApplications(organizationId) {
if (!organizationId) {
return Promise.reject(new Error('An organization ID is required for getting featured applications for an organization'));
}
return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/applications/featured').then(function (featuredApplications) {
return (0, _objects.toCamelCase)(featuredApplications);
});
}
/**
* Gets information about a contxt organization

@@ -236,0 +278,0 @@ *

2

package.json
{
"name": "@ndustrial/contxt-sdk",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -29,2 +29,11 @@ import EdgeNodes from './edgeNodes';

/**
* @typedef {Object} ContxtOrganizationFeaturedApplication
* @property {number} applicationId
* @property {string} createdAt ISO 8601 Extended Format date/time string
* @property {string} id
* @property {string} organizationId
* @property {string} updatedAt ISO 8601 Extended Format date/time string
*/
/**
* @typedef {Object} ContxtUser

@@ -207,2 +216,38 @@ * @property {string} createdAt ISO 8601 Extended Format date/time string

/**
* Gets an organization's list of featured applications
*
* API Endpoint: '/organizations/:organizationId/applications/featured'
* Method: GET
*
* Note: Only valid for web users using auth0WebAuth session type
*
* @param {string} organizationId The ID of the organization
*
* @returns {Promise}
* @fulfill {ContxtOrganizationFeaturedApplication[]} A list of featured applications
* @reject {Error}
*
* @example
* contxtSdk.coordinator
* .getFeaturedApplications('36b8421a-cc4a-4204-b839-1397374fb16b')
* .then((featuredApplications) => console.log(featuredApplications))
* .catch((err) => console.log(err));
*/
getFeaturedApplications(organizationId) {
if (!organizationId) {
return Promise.reject(
new Error(
'An organization ID is required for getting featured applications for an organization'
)
);
}
return this._request
.get(
`${this._baseUrl}/organizations/${organizationId}/applications/featured`
)
.then((featuredApplications) => toCamelCase(featuredApplications));
}
/**
* Gets information about a contxt organization

@@ -209,0 +254,0 @@ *

@@ -321,2 +321,74 @@ import Coordinator from './index';

describe('getFeaturedApplications', function() {
context('when the organization ID is provided', function() {
let expectedFeaturedApplications;
let featuredApplicationsFromServer;
let expectedOrganizationId;
let promise;
let request;
let toCamelCase;
beforeEach(function() {
expectedOrganizationId = faker.random.uuid();
expectedFeaturedApplications = fixture.buildList(
'contxtOrganizationFeaturedApplication',
faker.random.number({
min: 1,
max: 10
}),
{
organizationId: expectedOrganizationId
}
);
featuredApplicationsFromServer = expectedFeaturedApplications.map(
(app) =>
fixture.build('contxtOrganizationFeaturedApplication', app, {
fromServer: true
})
);
request = {
...baseRequest,
get: this.sandbox.stub().resolves(featuredApplicationsFromServer)
};
toCamelCase = this.sandbox
.stub(objectUtils, 'toCamelCase')
.returns(expectedFeaturedApplications);
const coordinator = new Coordinator(baseSdk, request);
coordinator._baseUrl = expectedHost;
promise = coordinator.getFeaturedApplications(expectedOrganizationId);
});
it('gets the list of featured applications from the server', function() {
expect(request.get).to.be.calledWith(
`${expectedHost}/organizations/${expectedOrganizationId}/applications/featured`
);
});
it('formats the list of featured applications', function() {
return promise.then(() => {
expect(toCamelCase).to.be.calledWith(featuredApplicationsFromServer);
});
});
it('returns a fulfilled promise with the featured applications', function() {
return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal(
expectedFeaturedApplications
);
});
});
context('when the organization ID is not provided', function() {
it('throws an error', function() {
const coordinator = new Coordinator(baseSdk, baseRequest);
const promise = coordinator.getFeaturedApplications();
return expect(promise).to.be.rejectedWith(
'An organization ID is required for getting featured applications for an organization'
);
});
});
});
describe('getOrganizationById', function() {

@@ -323,0 +395,0 @@ context('the organization ID is provided', function() {

@@ -15,2 +15,3 @@ 'use strict';

require('./contxtOrganization');
require('./contxtOrganizationFeaturedApplication');
require('./contxtUser');

@@ -17,0 +18,0 @@ require('./contxtUserFavoriteApplication');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc