@contrast/screener-service

1.12.14 • Public • Published

@contrast/screener-service

codecov Pipeline

This module houses client code for talking to either the local or cloud provisioning services as well as RMQ interfacing.

📌 Important Note: If you are looking for documentation on how to use the Screener with the Node Agent, look into the Wiki!

Install

npm i @contrast/screener-service

API

Creating a session

  const provisioningClient = require('@contrast/screener-service').client;
  const response = await provisioningClient.createSession(
    process.env.SCREENER_AGENT_URL
  );
  const { id: sessionId } = response;
  const { hostname, port, username, password } = response.mq;

Starting an app

  const { id: appId, url: appUrl } = await provisioningClient.startApp({
    sessionId,
    'express',
    port: 3000,
    '12',
    'assess',
    agentUrl: process.env.SCREENER_AGENT_URL
  });

Polling an app

  await provisioningClient.pollApp({ appUrl });

Stopping an app

  await provisioningClient.stopApp(appId);

Interacting with Rabbit MQ

  const RmqClient = require('@contrast/screener-service').rmqClient;

  // connect
  const mq = new RmqClient(`amap://${username}:${password}@${hostname}:${port}`, exchangeName);
  await mq.connect();

  // create a queue
  await mq.createQueue(queueName);

  // poll for message
  const msg = await mq.getMessage(queueName, msgType, timeout);

/@contrast/screener-service/

    Package Sidebar

    Install

    npm i @contrast/screener-service

    Weekly Downloads

    2

    Version

    1.12.14

    License

    MIT

    Unpacked Size

    17.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • planetlevel
    • contrastsec
    • tough-griff
    • annettenugent
    • michaelwitz
    • chrisdunne
    • contrast_admin
    • jcolekaplan
    • bmacnaughton