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 🙏

© 2026 – Pkg Stats / Ryan Hefner

advanced-commerce-sdk

v1.2.12

Published

<img src="https://advancedcommerce.io/wp-content/uploads/2024/02/AC-LOGO-2022-HORIZONTAL-NOTAG.png" alt="" width="400" />

Downloads

21

Readme

AdvancedCommerce Typescript SDK

This is the typescirpt sdk for Advanced-commerce.

Installation

Install the latest version of SDK from NPM registry.

npm i advanced-commerce-sdk

Usage

The SDK can be initialised with Admin or Store Credentials individually, or with both together.

import {
  AdminCredentialBuilder,
  AdvacedCommerceConfigBuilder,
} from "advanced-commerce-sdk";
import { AuthenticationMode, SandboxEnvironment } from "advanced-commerce-sdk";
import { AdvancedCommerce } from "advanced-commerce-js-sdk";

const adminApiKey = "<accessKey>"; //admin API Key
const adminSecretKey = "<secretKey>"; //Admin Secret Key
const domainKey = "domainKey";

const config = AdvacedCommerceConfigBuilder.of()
  .withAdminCredentials(
    AdminCredentialBuilder.of()
      .withAdminApiKey(adminApiKey)
      .withAdminSecretKey(adminSecretKey)
      .build()
  )
  .withDomainKey(domainKey)
  .withAuthenticationModel(AuthenticationMode.BasicAuth)
  .withEvironemnt(SandboxEnvironment.DEV)
  .build();

/* Initalising with both admin and store credentials together

  const config2 = AdvacedCommerceConfigBuilder.of()
  .withAdminCredentials(
    AdminCredentialBuilder.of()
      .withAdminApiKey(adminApiKey)
      .withAdminSecretKey(adminSecretKey)
      .build()
  ).withStoreCredentials(StoreCredentialBuilder.of()
    .withStoreApiKey("")
    .withStoreSecretKey("").build()
  ).withDomainKey(domainKey)
  .withAuthenticationModel(AuthenticationMode.BasicAuth)
  .withEvironemnt(SandboxEnvironment.DEV)
  .build();
  */

const advancedCommerce = new AdvancedCommerce(config);
  1. The creation of credentials and all other types follows a uniform builder pattern which along with strong type support from Typescript gives enough intuitions for developers while coding.

  2. In order to initialise SDK we have to provide the environment(SandboxEnvironment) in the config so that SDK would initialize the DNS for advanced-commerce accordingly.

  3. In order to initialize we have to provide the authentication mode(AuthenticationMode) (for query APIs) to choose between basic authentication and ip whitelisting

Making first API call

In order to fetch report for a previous indexing operation, do the following

const advancedCommerce = new AdvancedCommerce(config);

const report = await advancedCommerce.operations.getReport(
  "c0a855457d6d4a06a825d735cde2d8b7"
);
console.log(report.data);

Uploading zip to advanced-commerce

const advancedCommerce = new AdvancedCommerceGateway(config);

const uploadResponse = await advancedCommerce.batch.upload(
  "./data.zip",
  UploadType.DELTA
);
console.log(uploadResponse.data);

/* console log
{
  domain: 'ayatadev',
  type: 'delta',
  operation: 'delta upload operation executed',
  receipt: '6e793b616c4d4b2b93ce40eefcf9c404',
  size: 366,
  filename: 'data.zip'
}

*/

For more information regarding file upload refer docs from advancedcommerce.

Processing uploaded zip file

const advancedCommerce = new AdvancedCommerceGateway(config);

const processResponse = await advancedCommerce.batch.process(
  uploadResponse.data.receipt,
  false
);
console.log(processResponse.data);

/* console log
{
  domain: 'ayatadev',
  operation: 'Process execution for 6e793b616c4d4b2b93ce40eefcf9c404 requested',
  receipt: '6e793b616c4d4b2b93ce40eefcf9c404'
}

*/

Contribution guidelines

  1. Clone the repository
  2. Change directory to the root of repository.
  3. npm install
  4. Create a feature branch or bug branch
  5. Make changes in the code.
  6. Before making PR, test your changes in the playground/index.ts file. You can run this file by giving the command npm run local
  7. commit your changes. (Please don't add changes in the plaground/index.ts file in your commit. This file is for testing the changes locally, we are not expeting any code changes in this file.)
  8. Push and create a PR to main branch.