Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@ndustrial/contxt-sdk
Advanced tools
The contxt-sdk
can be installed with NPM:
npm install --save @ndustrial/contxt-sdk
There are two peer dependencies for contxt-sdk
, auth0-js
and axios
. If you don't already have a compatible version installed, run:
npm install --save auth0-js@^9.0.0 axios@~0.17.0
Once installed, the minimum configuration you need to get going is to include the clientId
of your application (from Auth0) and a string with the type of authentication you want to use (auth0WebAuth
or machineAuth
).
import ContxtSdk from '@ndustrial/contxt-sdk';
const contxtSdk = new ContxtSdk({
config: {
auth: {
clientId: 'example clientId from auth0'
}
},
sessionType: 'auth0WebAuth'
});
contxtSdk.facilities.getAll().then((facilities) => {
console.log(`all of my facilities: ${JSON.stringify(facilities)}`);
});
Information about using the auth0WebAuth and machineAuth modules is available in the API docs here (auth0WebAuth) and here (machineAuth). Additional information about configuration options can also be found in the API docs.
At times when building your application, there might be a Contxt API that you need to reach that is not currently included in the contxt-sdk
package. To help out with this, we've created a way to include an external module into the SDK when creating an SDK instance that allows the external module to act as a first class extension of the SDK's API.
To do this, just include information about the module when creating your contxt-sdk
instance:
import ContxtSdk from 'contxt-sdk';
import NewModule from './NewModule';
const contxtSdk = new ContxtSdk({
config: {
auth: {
clientId: 'example clientId from auth0'
}
},
externalModules: {
newModule: {
clientId: 'The Auth0 Id of the API you are communicated with',
host: 'http://newModule.example.com',
module: NewModule
}
},
sessionType: 'auth0WebAuth'
});
contxtSdk.newModule.doWork();
When we decorate your external module into your SDK instance, it is treated just like one of the native, internal modules and is provided with the SDK instance (so you can use other parts of the SDK from your new module) and its own request module, which will handle API tokens if you are working with a Contxt API.
class NewModule {
constructor(sdk, request) {
this._baseUrl = `${sdk.config.audiences.newModule.host}/v1`;
this._request = request;
this._sdk = sdk;
}
doWork() {
return this._request.patch(`${this._baseUrl}/data`, { work: 'finished' });
}
}
export default NewModule;
rollup.js is used to build the source code into CommonJS and ES6 modules that can be used for distribution. These modules are both built by running one command: npm run build
. If you'd like to continuously create builds as files are changed (i.e. if you are developing new features and have set things up correctly with npm link
to serve the newly updated files to your app), you can run npm run watch
.
Some important NPM tasks for running the test suite:
npm test
- Lints, sets up tracking for Istanbul coverage reports, and runs the test suitenpm run test:js
- Runs the test suitenpm run test:js:dev
- Runs the test suite in watch mode, where the tests are re-run whenever a file changesnpm run test:js:inspect
- Runs the test suite in inspect/inspect-brk mode. Insert a debugger
somewhere in your code and connect to the debugger with this command. (Node 8: visit chrome://inspect
to connect. Node 6: Copy and paste the blob provided in the terminal into Chrome to connect. Older versions also have ways to connect.)npm run lint
- Lints the source codenpm run coverage
- Sets up tracking for Istanbul coverage reports and runs the test suitenpm run report
- Parses the Istanbul coverage reports and writes them to file (in ./coverage
) and displays them in terminalSome tools used for testing and ensuring code quality include:
expect
syntax)Additionally, some globals have been added to the testing environment to streamline the process slightly:
v0.0.18 (2018-07-06)
Changed
clientId
or host
set to null
if the values are not needed for the module. (NOTE: Some SessionType adapters, like the MachineAuth adapter, require a clientId
if the built-in request
module is used since contxt auth tokens for those adapters are generated on a per-clientId basis).FAQs
## Installation
The npm package @ndustrial/contxt-sdk receives a total of 0 weekly downloads. As such, @ndustrial/contxt-sdk popularity was classified as not popular.
We found that @ndustrial/contxt-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 24 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.