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

@ndustrial/contxt-sdk

Package Overview
Dependencies
Maintainers
16
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.2.2 to 1.2.3

.idea/contxt-sdk-js.iml

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## [v1.2.3](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.2.3) (2019-06-05)
**Fixed**
- Updated internal config builder to include `webSocket` key
## [v1.2.2](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.2.2) (2019-06-03)

@@ -2,0 +8,0 @@

2

docs/Typedefs.md

@@ -195,2 +195,3 @@ <a name="Asset"></a>

| config.host | <code>string</code> | Hostname for the API that corresponds with the clientId provided |
| [config.webSocket] | <code>string</code> | WebSocket URL for the API that corresponds with the clientId provided |

@@ -470,2 +471,3 @@ <a name="Auth0WebAuthSessionInfo"></a>

| [config.host] | <code>string</code> | Hostname for the API that corresponds with the clientId provided |
| [config.webSocket] | <code>string</code> | WebSocket URL for the API that corresponds with the clientId provided |

@@ -472,0 +474,0 @@ <a name="EdgeNode"></a>

@@ -17,2 +17,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

* @param {string} config.host Hostname for the API that corresponds with the clientId provided
* @param {string} [config.webSocket] WebSocket URL for the API that corresponds with the clientId provided
*/

@@ -30,2 +31,3 @@

* @param {string} [config.host] Hostname for the API that corresponds with the clientId provided
* @param {string} [config.webSocket] WebSocket URL for the API that corresponds with the clientId provided
*/

@@ -122,2 +124,3 @@

* @param {CustomAudience} config A custom audience configuration to parse
* @param {Object.<string, Audience>} audiences An object with keys for environment names and values of Audience information
*

@@ -135,6 +138,12 @@ * @returns {Audience}

if (config.clientId && config.host) {
return {
var audience = {
clientId: config.clientId,
host: config.host
};
if (config.webSocket) {
audience.webSocket = config.webSocket;
}
return audience;
} else if (config.env) {

@@ -141,0 +150,0 @@ return audiences[config.env];

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

* @param {string} config.host Hostname for the API that corresponds with the clientId provided
* @param {string} [config.webSocket] WebSocket URL for the API that corresponds with the clientId provided
*/

@@ -43,2 +44,3 @@

* @param {string} [config.host] Hostname for the API that corresponds with the clientId provided
* @param {string} [config.webSocket] WebSocket URL for the API that corresponds with the clientId provided
*/

@@ -134,2 +136,3 @@

* @param {CustomAudience} config A custom audience configuration to parse
* @param {Object.<string, Audience>} audiences An object with keys for environment names and values of Audience information
*

@@ -147,6 +150,12 @@ * @returns {Audience}

if (config.clientId && config.host) {
return {
var audience = {
clientId: config.clientId,
host: config.host
};
if (config.webSocket) {
audience.webSocket = config.webSocket;
}
return audience;
} else if (config.env) {

@@ -153,0 +162,0 @@ return audiences[config.env];

2

package.json
{
"name": "@ndustrial/contxt-sdk",
"version": "1.2.2",
"version": "1.2.3",
"description": "",

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

@@ -11,2 +11,3 @@ import defaultAudiences from './audiences';

* @param {string} config.host Hostname for the API that corresponds with the clientId provided
* @param {string} [config.webSocket] WebSocket URL for the API that corresponds with the clientId provided
*/

@@ -24,2 +25,3 @@

* @param {string} [config.host] Hostname for the API that corresponds with the clientId provided
* @param {string} [config.webSocket] WebSocket URL for the API that corresponds with the clientId provided
*/

@@ -119,2 +121,3 @@

* @param {CustomAudience} config A custom audience configuration to parse
* @param {Object.<string, Audience>} audiences An object with keys for environment names and values of Audience information
*

@@ -128,6 +131,12 @@ * @returns {Audience}

if (config.clientId && config.host) {
return {
const audience = {
clientId: config.clientId,
host: config.host
};
if (config.webSocket) {
audience.webSocket = config.webSocket;
}
return audience;
} else if (config.env) {

@@ -134,0 +143,0 @@ return audiences[config.env];

@@ -122,2 +122,65 @@ import times from 'lodash.times';

context(
'when providing a custom host, clientId, and webSocket for a module',
function() {
let audiences;
let expectedAudience;
beforeEach(function() {
const env = faker.hacker.adjective();
expectedAudience = fixture.build('audience', {
webSocket: faker.internet.url()
});
const config = { ...expectedAudience, env };
const initialAudiences = {
[env]: fixture.build('audience'),
[faker.hacker.verb()]: fixture.build('audience')
};
audiences = Config.prototype._getAudienceFromCustomConfig(
config,
initialAudiences
);
});
it('provides audience information that matches the custom information provided', function() {
expect(audiences).to.deep.equal(expectedAudience);
expect(audiences).to.have.property('webSocket');
});
}
);
context(
'when providing a custom host and clientId with a property we do not use',
function() {
let audiences;
let expectedAudience;
let invalidPropertyName;
beforeEach(function() {
const env = faker.hacker.adjective();
invalidPropertyName = 'invalid';
expectedAudience = fixture.build('audience', {
[invalidPropertyName]: faker.internet.url()
});
const config = { ...expectedAudience, env };
const initialAudiences = {
[env]: fixture.build('audience'),
[faker.hacker.verb()]: fixture.build('audience')
};
audiences = Config.prototype._getAudienceFromCustomConfig(
config,
initialAudiences
);
});
it('provides audience information that has the host and clientId but no unused property', function() {
expect(audiences.host).to.equal(expectedAudience.host);
expect(audiences.clientId).to.equal(expectedAudience.clientId);
expect(audiences).to.not.have.property(invalidPropertyName);
});
}
);
context('when providing an environment for a module', function() {

@@ -124,0 +187,0 @@ let audiences;

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

const faker = require('faker');
const times = require('lodash.times');

@@ -17,3 +18,3 @@ factory

)
.map(({ id }) => id),
.map(({ id }) => ({ id })),
applicationsImplicit: () =>

@@ -25,15 +26,21 @@ factory

)
.map(({ id }) => id),
.map(({ id }) => ({ id })),
roles: () =>
factory
.buildList('contxtRole', faker.random.number({ min: 0, max: 15 }))
.map(({ id }) => id),
.map(({ id }) => ({ id })),
stacksExplicit: () =>
factory
.buildList('contxtStack', faker.random.number({ min: 0, max: 15 }))
.map(({ id }) => id),
times(faker.random.number({ min: 0, max: 15 }), () => {
return {
id: factory.build('contxtStack').id,
accessType: factory.build('contxtUserStack').accessType
};
}),
stacksImplicit: () =>
factory
.buildList('contxtStack', faker.random.number({ min: 0, max: 15 }))
.map(({ id }) => id),
times(faker.random.number({ min: 0, max: 15 }), () => {
return {
id: factory.build('contxtStack').id,
accessType: factory.build('contxtUserStack').accessType
};
}),
userId: () => factory.build('contxtUser').id

@@ -51,6 +58,12 @@ })

permission.stacks_explicit = permission.stacksExplicit;
permission.stacks_explicit = permission.stacksExplicit.map((s) => ({
id: s.id,
access_type: s.accessType
}));
delete permission.stacksExplicit;
permission.stacks_implicit = permission.stacksImplicit;
permission.stacks_implicit = permission.stacksImplicit.map((s) => ({
id: s.id,
access_type: s.accessType
}));
delete permission.stacksImplicit;

@@ -57,0 +70,0 @@

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