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

@commercetools-test-data/commons

v10.10.0

Published

Data model for commercetools platform common types

Downloads

24,851

Readme

@commercetools-test-data/commons

This package provides the data model for the commercetools platform common types

https://docs.commercetools.com/api/types

Install

$ pnpm add -D @commercetools-test-data/commons

Usage

Address

import {
  Address,
  AddressDraft,
  type TAddress,
  type TAddressDraft,
} from '@commercetools-test-data/commons';

const address = Address.random().build<TAddress>();
const addressDraft = AddressDraft.random().build<TAddressDraft>();

CentPrecisionMoney

import {
  CentPrecisionMoney,
  CentPrecisionMoneyDraft,
  type TCentPrecisionMoney,
  type TCentPrecisionMoneyDraft,
} from '@commercetools-test-data/commons';

const centPrecisionMoney =
  CentPrecisionMoney.random().build<TCentPrecisionMoney>();
const centPrecisionMoneyDraft =
  CentPrecisionMoneyDraft.random().build<TCentPrecisionMoneyDraft>();

ClientLogging

import {
  ClientLogging,
  type TClientLogging,
} from '@commercetools-test-data/commons';
const clientLogging = ClientLogging.random().build<TClientLogging>();

HighPrecisionMoney

import {
  HighPrecisionMoney,
  HighPrecisionMoneyDraft,
  type THighPrecisionMoney,
  type THighPrecisionMoneyDraft,
} from '@commercetools-test-data/commons';

const highPrecisionMoney =
  HighPrecisionMoney.random().build<THighPrecisionMoney>();
const highPrecisionMoneyDraft =
  HighPrecisionMoneyDraft.random().build<THighPrecisionMoneyDraft>();

KeyReference

import {
  KeyReference,
  KeyReferenceDraft,
  type TKeyReference,
  type TKeyReferenceDraft,
} from '@commercetools-test-data/commons';

const productKeyRef = KeyReference.random()
  .typeId('product')
  .build<TKeyReference<'product'>>();
const productKeyRefDraft = KeyReferenceDraft.random()
  .typeId('product')
  .build<TKeyReferenceDraft<'product'>>();

LocalizedString

import {
  LocalizedString,
  LocalizedStringDraft,
  type TLocalizedString,
  type TLocalizedStringDraft,
} from '@commercetools-test-data/commons';

const name = LocalizedString.random().build<TLocalizedString>();
const nameDraft = LocalizedStringDraft.random().build<TLocalizedString>();

// Presets
const emptyName = LocalizedString.presets.empty().build<TLocalizedString>();
const emptyNameDraft = LocalizedStringDraft.presets
  .empty()
  .build<TLocalizedStringDraft>();

Money

import {
  Money,
  MoneyDraft,
  type TMoney,
  type TMoneyDraft,
} from '@commercetools-test-data/money';

const Money = Money.random().build<TMoney>();
const MoneyDraft = MoneyDraft.random().build<TMoneyDraft>();

Price

import {
  Price,
  PriceDraft,
  type TPrice,
  type TPriceDraft,
} from '@commercetools-test-data/commons';

const price = Price.random().build<TPrice>();
const priceDraft = PriceDraft.random().build<TPriceDraft>();

Reference

import {
  Reference,
  ReferenceDraft,
  type TReference,
  type TReferenceDraft,
} from '@commercetools-test-data/commons';

const productRef = Reference.random()
  .typeId('product')
  .build<TReference<'product'>>();
const productRefDraft = ReferenceDraft.random()
  .typeId('product')
  .build<TReferenceDraft<'product'>>();

// Presets
const categoryRef = Reference.presets
  .category()
  .build<TReference<'category'>>();
const categoryRefDraft = ReferenceDraft.presets
  .category()
  .build<TReferenceDraft<'category'>>();

PriceTier

import { PriceTier, type TPriceTier } from '@commercetools-test-data/commons';

const productRef = PriceTier.random().build<TPriceTier>();

// Presets
const categoryRef = PriceTier.presets.build<TPriceTier>();

DiscountedPrice

import {
  DiscountedPriceRest,
  DiscountedPriceGraphql,
  DiscountedPriceDraftRest,
  DiscountedPriceDraftGraphql,
  type TDiscountedPriceRest,
  type TDiscountedPriceGraphql,
  type TDiscountedPriceDraftRest,
  type TDiscountedPriceDraftGraphql,
} from '@commercetools-test-data/commons';

const DiscountedPriceRest = DiscountedPriceRest.random().build();
const DiscountedPriceGraphql = DiscountedPriceGraphql.random().build();
const DiscountedPriceDraftRest = DiscountedPriceDraftRest.random().build();
const DiscountedPriceDraftGraphql =
  DiscountedPriceDraftGraphql.random().build();