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

sml-sb-api

v1.1.8

Published

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

Readme

User Guide

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use ts-node-dev, plain ts-node, or simple tsc.

If you’re new to TypeScript, checkout this handy cheatsheet

Commands

TSDX scaffolds your new library inside /src.

This builds to /dist and runs the project in watch mode so any edits you save inside src causes a rebuild to /dist.

To do a one-off build, use npm run build or yarn build.

To run tests, use npm test or yarn test.

Configuration

Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.

Jest

Jest tests are set up to run with npm test or yarn test.

Setup Files

This is the folder structure we set up for you:

/src
  index.ts
  sb-api.ts
  defines.ts
  utils.ts
/test
  sb-api.test.ts
  utils.test.ts
.gitignore
package.json
README.md
tsconfig.json

TypeScript

tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.

Using SBApi

See example code in test files

Definitions

SBApiHeader

reqType: REQUEST | RESPONSE
api (string): Mã API
priority: '1' | '2' | '3' | '4' | '5'
apiKey (string): API Key
channel (string):
subChannel (string):
location (string):
context (string):
trusted (string): true | false;
requestAPI (string): Tên Client gửi request
requestNode (string): Địa chỉ Client gửi request
userID (string): ID người dùng;
duration (string): timestamp value
zip (string): true | false \

SBApiConn

apiKey (string): API Key
xIBMClientId (string): X-IBM-Client-Id
xIBMClientSecret (string): X-IBM-Client-Secret
urls:

  • sms (string): API url for sms
  • mail (string): API url for mail
  • authen (string): API url for authen & otp

Methods

Send Mail: SBApi.sendMail(options: SendMailRequest): Promise<SendMailResponse>

export type SendMailRequestBodyParams = {
  from: string;
  to: string;
  subject: string;
  isHtmlBody: 'true' | 'false';
  priority: 'low' | 'normal' | 'high';
  fileAttachment?: {
    file: { fileName: string; fileByte64: string }[];
  };
  bodyMsg: string;
};

export type SendMailRequest = {
  header: Pick<
    SBApiHeader,
    'channel' | 'subChannel' | 'requestAPI' | 'requestNode' | 'userID'
  >;
  params: SendMailRequestBodyParams;
};

export type SendMailResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      reqID: string;
      utility?: {
        mydata?: {
          result?: 'OK';
        };
      };
    };
    error?: SBApiError;
    security: SBApiSecurity;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};

Send Mail: SBApi.sendSms(options: SendSmsRequest): Promise<SendSmsResponse>

export type SendSmsRequestBodyParams = {
  phone: string;
  servicesId: string;
  infor: string;
};

export type SendSmsRequest = {
  header: Pick<
    SBApiHeader,
    'channel' | 'subChannel' | 'requestAPI' | 'requestNode' | 'userID'
  >;
  params: SendSmsRequestBodyParams;
};

export type SendSmsResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      reqID: string;
    };
    error?: SBApiError;
    security: SBApiSecurity;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};

Send Mail: SBApi.sendSmsByTemplate(options: SendSmsByTemplateRequest): Promise<SendSmsByTemplateResponse>

export type SendSmsByTemplateRequestBodyParams = {
  phone: string;
  servicesId: string;
  templateId: string;
  bodyParam: {
    param: { paramName: string; paramValue: string }[];
  };
};

export type SendSmsByTemplateRequest = {
  header: Pick<
    SBApiHeader,
    'channel' | 'subChannel' | 'requestAPI' | 'requestNode' | 'userID'
  >;
  params: SendSmsByTemplateRequestBodyParams;
};

export type SendSmsByTemplateResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      reqID: string;
    };
    error?: SBApiError;
    security: SBApiSecurity;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};

Send Mail: SBApi.getLogin(options:GetLoginRequest): Promise<GetLoginResponse>

export type GetLoginRequestBodyParams = {
  username: string;
  password: string;
  /** Ma giao dich */
  transId: string;
};

export type GetLoginRequest = {
  header: Pick<
    SBApiHeader,
    | 'channel'
    | 'subChannel'
    | 'requestAPI'
    | 'requestNode'
    | 'userID'
    | 'trusted'
  > &
    Partial<Pick<SBApiHeader, 'location' | 'context'>>;
  params: GetLoginRequestBodyParams;
};

export type GetLoginResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      enquiry: {
        transId: string;
        responseCode: string;
        sessionId: string;
        packageUser: string;
        phone: string;
        customerID: string;
        customerName: string;
        companyCode: string;
        username: string;
        aliasName: string;
      };
    };
    error?: SBApiError;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};

Send Mail: SBApi.getOtp(options: GetOtpRequest): Promise<GetOtpResponse>

export type GetOtpRequestBodyParams = {
  /** Ma session */
  sessionId: string;
  transType: 'ACCOUNT' | 'CARD' | 'USER' | string;
  /** Ten dang nhap. Bat buoc neu transType = 'ACCOUNT' */
  accountNo?: string;
  /** Bat buoc neu transType = 'CARD' */
  cardNo?: string;
  /** Bat buoc neu transType = 'USER' */
  username?: string;
  /** Bat buoc neu transType khac 'ACCOUNT', 'CARD', 'USER' */
  customerId?: string;
  transId: string;
  transInfo: string;
  smsParams: {
    tempId: string;
    content: string;
  };
};

export type GetOtpRequest = {
  header: Pick<
    SBApiHeader,
    | 'channel'
    | 'subChannel'
    | 'requestAPI'
    | 'requestNode'
    | 'userID'
    | 'trusted'
  > &
    Partial<Pick<SBApiHeader, 'location' | 'context'>>;
  params: GetOtpRequestBodyParams;
};

export type GetOtpResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      enquiry: {
        transId: string;
        responseCode: string;
      };
    };
    error?: SBApiError;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};

Send Mail: SBApi.confirmOtp(options: ConfirmOtpRequest): Promise<ConfirmOtpResponse>

export type ConfirmOtpRequestBodyParams = {
  /** Ma session */
  sessionId: string;
  /** Loai giao dich */
  transType?: 'ACCOUNT' | 'CARD' | 'USER';
  softOtp?: boolean;
  /** Ten dang nhap. Bat buoc neu transType = 'ACCOUNT' */
  accountNo?: string;
  /** Bat buoc neu transType = 'CARD' */
  cardNo?: string;
  /** Bat buoc neu transType = 'USER' hoac softOtp = true */
  username?: string;
  /** Bat buoc neu transType khac 'ACCOUNT', 'CARD', 'USER' */
  customerId?: string;
  transId: string;
  transInfo: string;
  /** Ma xac thuc OTP */
  validateCode: string;
};

export type ConfirmOtpRequest = {
  header: Pick<
    SBApiHeader,
    | 'channel'
    | 'subChannel'
    | 'requestAPI'
    | 'requestNode'
    | 'userID'
    | 'trusted'
  > &
    Partial<Pick<SBApiHeader, 'location' | 'context'>>;
  params: ConfirmOtpRequestBodyParams;
};

export type ConfirmOtpResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      enquiry: {
        responseCode: string;
      };
    };
    error?: SBApiError;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};

Send Mail: SBApi.getRegname(options: GetRegnameRequest): Promise<GetRegnameResponse>

export type GetRegnameRequestBodyParams = {
  /** Ma session */
  sessionId: string;
  /** username can doi */
  signOnName: string;
  username: string;
  softOtp?: boolean;
  /** Required if softOtp is true */
  transactionId?: string;
  /** Ma xac thuc OTP */
  validateCode: string;
};

export type GetRegnameRequest = {
  header: Pick<
    SBApiHeader,
    | 'channel'
    | 'subChannel'
    | 'requestAPI'
    | 'requestNode'
    | 'userID'
    | 'trusted'
  > &
    Partial<Pick<SBApiHeader, 'location' | 'context'>>;
  params: GetRegnameRequestBodyParams;
};

export type GetRegnameResponse = {
  success: boolean;
  data: {
    header: SBApiHeader;
    body?: {
      status: 'OK';
      enquiry: {
        responseCode: string;
      };
    };
    error?: SBApiError;
  } | null;
  error?: {
    code: string;
    msg: string;
  };
};