
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@devopness/sdk-js
Advanced tools
The official Devopness SDK for JavaScript, available for browsers, mobile devices and Node.js backends.
Devopness SDK includes a pre-defined set of classes that provide convenient access to Devopness platform data. This SDK aims to make it easy and fun to consume Devopness API resources from web, Node.js or mobile apps written in the JavaScript programming language.
Use your favourite package manager to install Devopness SDK as a dependency of your project:
# Using npm
npm install @devopness/sdk-js
# Using yarn
yarn add @devopness/sdk-js
To initialize the usage of Devopness SDK, just import it and create a new instance of DevopnessApiClient class.
Here is a generic simple example that can be used from Node.js, TypeScript or Javascript applications:
import { DevopnessApiClient } from '@devopness/sdk-js'
const devopnessApi = new DevopnessApiClient();
The instance of DevopnessApiClient has properties to all services provided by the API.
The name of the methods at services is the same as the operation name in the documentation of the
Devopness API. You can consult the URL of an endpoint to see the operation name. For instance,
the URL to endpoint POST /users/login in the documentation is: /#operation/login
To authenticate, just invoke the login method on the users service:
async function authenticate(email, pass) {
const userTokens = await devopnessApi.users.loginUser({ email: email, password: pass });
// The `accessToken` must be set every time a token is obtained or refreshed.
devopnessApi.accessToken = userTokens.data.access_token;
}
// invoke the authentication method
authenticate('user@email.com', 'secret-password');
In the example above, userTokens is an instance of ApiResponse and the data property has the data requested from the API. See ApiResponse.ts for reference.
Once an authentication token is set, any protected endpoint can be invoked. Example retrieving current user details:
async function getUserProfile() {
// invoke the authentication method to ensure an auth token
// is retrieved and set to the SDK instance
await authenticate('user@email.com', 'secret-password');
// Now that we're authenticated, we can invoke methods on any services.
// Here we're invoking the `getUserMe()` method on the `users` service
const currentUser = await devopnessApi.users.getUserMe();
console.log('Successfully retrieved user profile: ', currentUser);
}
getUserProfile();
This package includes TypeScript declarations for every method.
TypeScript versions >= 4.4 are supported.
Some methods in
Devopness SDK JavaScriptaccept and return objects from the Devopness API. The type declarations for these objects will always track the latest version of the API. Therefore, if you're using the latest version of this package, you can rely on the Devopness API documentation for checking the input and return types of each API endpoint.
To build and test the SDK locally, fork this repository and follow these steps:
make is pre-installed in most Linux systems.macOS it is included as part of the Xcode command line utils. It can be installed with the following command:xcode-select --install
cd packages/sdks/javascript/
make build-image
make npm-ci
make build-sdk-js
make test
Installing on Linux or macOS systems.
cd packages/sdks/javascript/
This command will install all modules listed as dependencies in package.json. A working Java Runtime Environment is also required. Please, check out the installation instructions for your operating system.
npm install
npm run build
npm run test
FAQs
Devopness API JS/TS SDK - Painless essential DevOps to everyone
The npm package @devopness/sdk-js receives a total of 1,011 weekly downloads. As such, @devopness/sdk-js popularity was classified as popular.
We found that @devopness/sdk-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.