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

jfrog-client-js

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jfrog-client-js

JFrog Javascript Client is a javascript library, which wraps some of the REST APIs exposed by JFrog Services's different services.

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-32.51%
Maintainers
1
Weekly downloads
 
Created
Source

Build status

JFrog Javascript Client

JFrog Javascript Client is a Javascript library, which wraps some REST APIs exposed by JFrog's different services.

Getting started

Add jfrog-client-js as a dependency to your package.json file:

"dependencies": {
  "jfrog-client-js": "^2.0.0"
}

APIs

Setting up JFrog client

let jfrogClient = new JfrogClient({
    platformUrl: 'my-platform-url.jfrog.io/',
    // artifactoryUrl - Set to use a custom Artifactory URL.
    // xrayUrl - Set to use a custom Xray URL.
    username: 'username',
    password: 'password',
    proxy: {host: '<organization>-xray.jfrog.io', port: 8081, protocol: 'https'},
    headers: {'key1': 'value1', 'key2': 'value2'}
});

Xray

Pinging Xray
jfrogClient.xray().system().ping()
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error(error);
  });
Getting Xray version
jfrogClient.xray().system().version()
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error(error);
  });
Scanning bulk of dependencies
let express = new ComponentDetails('npm://express:4.0.0');
let request = new ComponentDetails('npm://request:2.0.0');
jfrogClient.xray().summary().component({
    component_details: [express, request]
  })
  .then(result => {
    console.log(JSON.stringify(result));
  })
  .catch(error => {
    console.error(error);
  });
Retrieving Xray Build Details
jfrogClient.xray().details().build('Build Name', '1')
  .then(result => {
    console.log(JSON.stringify(result));
  })
  .catch(error => {
    console.error(error);
  });

Artifactory

Pinging Artifactory
jfrogClient.artifactory().system().ping()
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error(error);
  });
Getting Artifactory version
jfrogClient.artifactory().system().version()
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error(error);
  });
Downloading an artifact
jfrogClient.artifactory().download().downloadArtifact('path/to/artifact')
  .then(result => {
    console.log(JSON.stringify(result));
  })
  .catch(error => {
    console.error(error);
  });
Searching by AQL
jfrogClient.artifactory()
    .search()
    .aqlSearch(
        'items.find({' +
        '"repo":"my-repo-name",' +
        '"path":{"$match":"*"}}' +
        ').include("name","repo","path","created").sort({"$desc":["created"]}).limit(10)'
    );
  .then(result => {
    console.log(JSON.stringify(result));
  })
  .catch(error => {
    console.error(error);
  });

Building and testing the sources

To build the plugin sources, please follow these steps:

  • Clone the code from git.

  • Install and pack the jfrog-client-js dependency locally, by running the following npm commands:

npm i && npm pack

If you'd like run the jfrog-client-js integration tests, follow these steps:

  • Make sure your JFrog platform is up and running.
  • Set the CLIENTTESTS_PLATFORM_URL, CLIENTTESTS_PLATFORM_USERNAME and CLIENTTESTS_PLATFORM_PASSWORD environment variables with your JFrog platform URL, username and password.
  • Run the following command:
npm t

Important: The tests use port 9090 to set up an HTTP proxy server. If this port is already used on the machines which runs the tests, please replace it in the tests code with a different port.

Pull requests

We welcome pull requests from the community.

Guidelines

  • If the existing tests do not already cover your changes, please add tests.
  • Pull requests should be created on the master branch.
  • Please run npm run format for formatting the code before submitting the pull request.

Keywords

FAQs

Package last updated on 04 Jul 2021

Did you know?

Socket

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.

Install

Related posts

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