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 🙏

© 2024 – Pkg Stats / Ryan Hefner

dealcloud-helper-js

v2.0.6

Published

DealCloud helper functions to allow ease of use with the dc-connector and DealCloud SOAP Api. These functions require the dc connector as a parameter.

Downloads

18

Readme

dealcloud-helper-js

Dependency

Currently all functions in dealcloud-helper-js use dealcloud-js

Install

npm install dealcloud-helper-js

Examples

Create Client

const dcHelper = require("dealcloud-helper-js");
const dealcloud = require("dealcloud-js");

let client = await dcHelper.createClientAsync({
  username: "<username>",
  password: "<password>",
  url: "<url-to-dc-site>"
});

Build Reference Files

const dcHelper = require("dealcloud-helper-js");
const dealcloud = require("dealcloud-js");
let client = await dcHelper.createClientAsync({
  username: "<username>",
  password: "<password>",
  url: "<url-to-dc-site>"
});
await dcHelper.buildReferenceFilesAsync(
  dealcloud,
  client,
  "./src/schemas/",
  "./src/models/"
);

Get Items

const dcHelper = require("dealcloud-helper-js");
const dealcloud = require("dealcloud-js");
//from the reference files we generated
const Country = require("./src/models/Country");
let client = await dcHelper.createClientAsync({
  username: "<username>",
  password: "<password>",
  url: "<url-to-dc-site>"
});

let fields = await dealcloud.getFieldsAsync(client);
let lists = await dealcloud.getListsAsync(client);
let items = await dcHelper.getItemsAsync(client, Country, fields);
//items = [{Country}, {Country}, {Country}, {Country}];

Update Item

const dcHelper = require("dealcloud-helper-js");
const dealcloud = require("dealcloud-js");
//from the reference files we generated
const Country = require("./src/models/Country");
let client = await dcHelper.createClientAsync({
  username: "<username>",
  password: "<password>",
  url: "<url-to-dc-site>"
});

let fields = await dealcloud.getFieldsAsync(client);
let lists = await dealcloud.getListsAsync(client);
let items = await dcHelper.getItemsAsync(client, Country, fields);
let myCountries = items.filter((country) => {
    return (country.country.value && country.country.value.toLowerCase().includes('united'));
});

myCountries.forEach((country, index)=> {
    country.country.value = "State of Mars #" + index;
});

let results = await dcHelper.processDCPushAsync(
  dealcloud,
  client,
  myCountries,
  Country.entryListId
);

Create Item

const dcHelper = require("dealcloud-helper-js");
const dealcloud = require("dealcloud-js");
//from the reference files we generated
const Country = require("./src/models/Country");
let client = await dcHelper.createClientAsync({
  username: "<username>",
  password: "<password>",
  url: "<url-to-dc-site>"
});
let entryId = -1;
let countries = [new Country([], entryId--)];
countries[0].country.value = "Mars";
let results = await dcHelper.processDCPushAsync(
  dealcloud,
  client,
  countries,
  Country.entryListId
);

Delete Value

const dcHelper = require("dealcloud-helper-js");
const dealcloud = require("dealcloud-js");
//from the reference files we generated
const Country = require("./src/models/Country");
let client = await dcHelper.createClientAsync({
  username: "<username>",
  password: "<password>",
  url: "<url-to-dc-site>"
});
let fields = await dealcloud.getFieldsAsync(client);
let lists = await dealcloud.getListsAsync(client);
let items = await dcHelper.getItemsAsync(client, Country, fields);
items[0].country.value = '';
//this flag allows us to send null/empty/undefined for fields. Otherwise fields with null/undefined/empty value will not be sent.
items[0].country.allowNull = true; 
let results = await dcHelper.processDCPushAsync(
  dealcloud,
  client,
  //only sending the one we modified, it accepts an array
  [items[0]], 
  Country.entryListId
);

Delete Item

  Coming Soon

Additional Properties

object.allowNull: "Allows any null value to be sent in a DCPush";
object.property.allowNull: "Allows null value to be sent in DCPush for this property only";
object.includeKeys: "When set, add jsonProperty names that you want to allow to be returned.";
object.keysToSave: "Will only save these keys.";
object.excludeKeys: "Will get everything except these keys.";