
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@mitre/emass_client
Advanced tools
The @mitre/emass_client@3.22.0
is a TypeScript/JavaScript client that utilizes axios
to implement the Enterprise Mission Assurance Support Service (eMASS)
Representational State Transfer (REST) Application Programming Interface (API) specifications
The generated Node module can be used in the following environments: Environment
Language level
Module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via package.json
. (Reference)
To build and compile the typescript sources to javascript use:
npm install
npm run build
First build the package then run npm publish
navigate to the folder of your consuming project and run one of the following commands.
published:
npm install @mitre/emass_client@3.22.0 --save
unPublished (not recommended):
npm install PATH_TO_GENERATED_PACKAGE --save
Before accessing any of the endpoints provided by the @mitre/emass_client, we need to configure common axios settings.
All calls utilizing the @mitre/emass_client@3.22.0 need to initialize axios as follows:
// Load the necessary modules
import * as fs from 'fs';
import * as https from 'https';
import { Configuration } from "@mitre/emass_client/dist/configuration"
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from '@mitre/emass_client/node_modules/axios';
// Initialize the configuration interface. The apikey is initialized via axios default headers.
const configuration = new Configuration({
basePath: 'https://emass-url-instances.com',
});
// Initialize the axios request configuration
const axiosRequestConfig: AxiosRequestConfig = {
httpsAgent: new https.Agent({
keepAlive: true,
rejectUnauthorized: false,
key: fs.readFileSync("path/to/the/key.pem"),
cert: fs.readFileSync("path/to/the/client.pem"),
passphrase: "certificate passphrase",
port: 443,
})
}
// Create an axios instances
const axiosInstances: AxiosInstance = globalAxios.create(axiosRequestConfig);
// Configure the necessary keys (api-key and user-uid)
axiosInstances.defaults.headers.common = {
"api-key": "the-proper-api-key-value",
"user-uid": 'the.use.id.information'
};
// Load the TestApi module
import { TestApi } from '@mitre/emass_client/dist/api';
// Create and initialize a TestApi instances (references code snippet above for proper parameters configurations)
const testApi = new TestApi(configuration, configuration.basePath, axiosInstances);
// Invoke the endpoint
testApi.testConnection().then((data:any) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data.data, null,2));
}).catch((error:any) => console.error(error));
This example uses the colorize module to color format the output to the command line.
// Load the TestApi module
import { ArtifactsExportApi } from '@mitre/emass_client/dist/api';
import colorize from 'json-colorizer';
// Create and initialize a ArtifactsExportApi instances (references Axios Configuration for proper parameters configurations)
const exportArtifacts = new ArtifactsExportApi(configuration, configuration.basePath, axiosInstances);
// Invoke the endpoint
exportArtifacts.getSystemArtifactsExport(34, "artifact.txt").then((response:any) => {
console.log(colorize(JSON.stringify(response.data, null,2)));
}).catch((error:any) => console.error(colorize(JSON.stringify(error.response.data,null,2))));
FAQs
OpenAPI client for @mitre/emass_client
The npm package @mitre/emass_client receives a total of 4,364 weekly downloads. As such, @mitre/emass_client popularity was classified as popular.
We found that @mitre/emass_client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.