npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sugarcrm-sdk

v1.1.17

Published

Unofficial SugarCRM SDK

Downloads

36

Readme

sugarcrm-sdk

An UNOFFICIAL module for integrating with SugarCRM. This SDK helps you initialize and communicate with SugarCRM through the Sugar REST API.

Installation

npm install sugarcrm-sdk

Features

  • Seamless configuration setup using .env or direct configuration.
  • Initialization and test pinging to ensure correct configurations.
  • Authentication handling and setup.
  • Provides interfaces for SugarAPI calls.
  • Queue management for API requests with options for concurrency and size limitations.
  • Supports GET, POST, PUT, and DELETE requests.
  • Concurrent request handling.

Quick Start

  1. First, ensure your configurations are set up. Use .env or provide them directly.

  2. Import the SDK and Execute:

Using CommonJS:
const sugarSdk = require('sugarcrm-sdk');
Using ES6:
import sugarSdk from 'sugarcrm-sdk';

Configurations

The SDK expects the following configurations:

These configurations can be stored in a .env file or passed directly.

Methods

Sugar

The main class that initializes and manages the communication with SugarCRM.

Methods

  • initialize(): Initializes the SDK, setting up the SugarAPI URL, authentication, and tests the connection.

  • testPing(): Pings the SugarAPI to test the connection.

  • addToQueue(method, path, data?): Add an API request (GET, POST, PUT, DELETE) to a managed queue for processing.

  • processQueue(): Process the queued API requests concurrently.

  • setMaxQueueSize(size): Set the maximum size of the API request queue.

  • setConcurrencyLevel(concurrency): Set the number of API requests to be processed concurrently.

  • getQueueSize(): Returns the current number of items in the queue.

  • getQueue(): Returns the entire array of queued requests.

  • toggleQueueProcessing(): Pause or restart the processing of the queue.

  • clearQueue(n?): Delete all or n-amount of items from the queue.

  • get(path): Make a GET request to the specified path.

  • post(path, data): Make a POST request to the specified path.

  • put(path, data): Make a PUT request to the specified path.

  • delete(path): Make a DELETE request to the specified path.

Usage

To start using the SDK:

  1. Import and initialize:
const sugarSdk = require('sugarcrm-sdk');
  1. Create an instance of Sugar:
const sugarConfigs = {
  username: 'USERNAME',
  password: 'PASSWORD',
  client_id: 'CLIENT_ID',
  client_secret: 'CLIENT_SECRET',
  platform: 'PLATFORM', 
  host: 'HOST_URL',
  version: 'VERSION', 
};
const sugar = new sugarSdk.Sugar(sugarConfigs);
  1. Initialize and test:
await sugar.initialize();
  1. Making API Calls to Sugar:
//  GET
const get_account = await sugar.get('/Accounts/aaaaaaaa-bbbb-cccc-dddddddddddd')

//  PUT
const put_account = await sugar.put('/Accounts/aaaaaaaa-bbbb-cccc-dddddddddddd',
{
  first_name:"hello", 
  last_name:"world"
})

//  POST
const post_account = await sugar.post('/Accounts',
{
  first_name:"hello", 
  last_name:"world",
})

//  DELETE
const delete_account = await sugar.delete('/Accounts/aaaaaaaa-bbbb-cccc-dddddddddddd')

Contributing

We welcome contributions! If you find a bug or have a feature request, please open an issue. If you'd like to contribute code, please fork the repository and submit a pull request.

License

ISC License (ISC)

Copyright (c) 2023, J. Horst

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.