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

collmex-client

v1.14.8

Published

a node client to communicate with Collmex API.

Downloads

97

Readme

GitHub Actions workflows status

Build workflow status Publish workflow status Data sync workflow status

CodeClimate


collmex-client

A Node client to communicate with Collmex API. This was inspired by our co-collmex package but rewritten with modern Javascript (removing deprecated dependencies in the process).

Note: this package uses a GitHub Action sync-data (see here and there) to scrap Collmex API documentation daily to check that the CSV mapping (stored here) used is still up to date. This mapping could have been stored into a public CDN and fetched on client instanciation (& then on daily basis for persistent clients) but that would slow down performances and introduce a potential failure point (CDN down -> no data). Please make sure you always use the latest version of this package to ensure the answer you get from Collmex API is the correct one.

New in 1.14.0: when instanciating a new client, a check will be performed to compare your locally installed version of collmex-client with the latest one available on npm. If the version you use is not the latest one, a warning will be printed in stdout.

Installation

npm i collmex-client

API documentation

Modules

Module | Description ------ | ----------- collmex-client | Creates a new client to communicate with Collmex API.

Typedefs

Name | Description ------ | ----------- Options | Options for the new Collmex client instanciation

collmex-client

Creates a new client to communicate with Collmex API.

Returns: Collmex - Collmex client

| Param | Type | Description | | --- | --- | --- | | opts | Options | Options to be passed to instanciate a new client |

Example

const collmex = require('collmex-client')({
  User: 'username',
  Password: 'password',
  CMXKundennummer: 123456,
  Firma_Nr: 1,
  Systemname: 'collmex-test'
})

collmex.get(data, [output_format])

Calls Collmex API.

Kind: static method of collmex-client
Returns: Promise.<(Array.<object>|Array.<array>|Array.<string>)> - The fulfilled promise(s) value type depends on the output_format provided when using get or on the Output option used when instanciating a new client

| Param | Type | Default | Description | | --- | --- | --- | --- | | data | object | Array.<object> | | Data for the request to send to Collmex. Use an array if you would like to send multiple requests at once. | | [output_format] | string | 'object' | Desired output type (set only for that specific call). See here for output_format valid values |

Example

// retrieve a given product from Collmex

const data = await collmex.get({ Satzart: 'PRODUCT_GET', Produktnummer: 12345 })

// you can also retrieve a given product
// AND the available stocks for that product (multiple requests)

const data = await collmex.get([
 { Satzart: 'PRODUCT_GET', Produktnummer: 12345 },
 { Satzart: 'STOCK_AVAILABLE_GET', Produktnummer: 12345 }
])

Options

Options for the new Collmex client instanciation

Kind: global typedef
Properties

| Name | Type | Default | Description | | --- | --- | --- | --- | | User | string | | Collmex user | | Password | string | | Collmex password for given user | | CMXKundennummer | number | | Collmex Customer Number | | Firma_Nr | number | | Company Number (as registered with Collmex) | | [Systemname] | string | 'collmex-client' | User-agent you would like to use for your client | | [Output] | string | 'object' | Desired output type. Will be set for any further get calls except if reassigned or overwritten via get output_format parameter. |

Details

Output formats

| Value | Description | | --- | --- | | object | default turns the response into an array of objects with named properties according to the collmex api documentation. numeric values are converted to js notation (dezimal point). Dates are turned to js/mysql compatible dates.| | array | turns the response into an array of arrays. useful for bulk inserts into mysql for example. numeric values are converted to js notation (dezimal point). Dates are turned to js/mysql compatible dates.| | raw | the raw response (CSV with ";" as the seperator). no conversion is performed. |

Notes

  • all outputs are automatically converted to utf-8
  • posting data can be performed via the get method as well