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

@verisure-italy/coupon-code-types

v1.7.13

Published

Types for Coupon Code service

Downloads

275

Readme

@verisure-italy/coupon-code-types

Domain contracts for offers, one-time coupon batches, regex coupons, and coupon-usage events.

Installation

pnpm add @verisure-italy/coupon-code-types

Main Exports

  • codeSchema and type Code
  • couponTypeSchema and couponTypes
  • burnCouponCodeSchema
  • validateCouponCodeSchema
  • offerSchema
  • oneTimeCouponCodeSchema
  • regexCouponCode
  • couponUsageSchema

What This Package Gives You

  • reusable coupon-code validation rules
  • persistence models for static and regex-driven coupons
  • a lightweight offer contract
  • request payload schemas for coupon validation and burn flows

Schema Inventory

| Schema | Type alias | Kind | Purpose | | --- | --- | --- | --- | | codeSchema | Code | string schema | Coupon-code primitive | | couponTypeSchema | n/a | enum | Coupon-type discriminator | | burnCouponCodeSchema | BurnCouponCode | object schema | Burn request payload | | validateCouponCodeSchema | ValidateCouponCode | object schema | Validation request payload | | offerSchema | Offer | object schema | Offer contract | | oneTimeCouponCodeSchema | OneTimeCouponCode | object schema | Static coupon batch | | regexCouponCode | RegexCouponCode | object schema | Regex-driven coupon definition | | couponUsageSchema | n/a | object schema | Coupon-usage event |

Enum Reference

couponTypeSchema

Values:

  • oneTimeCoupon
  • regexCoupon

Schema Reference

codeSchema

| Rule | Value | | --- | --- | | Type | string | | Required | Yes | | Validation | Must match ^[a-zA-Z0-9_-]+$ |

burnCouponCodeSchema and validateCouponCodeSchema

| Field | Type | Required | Notes | | --- | --- | --- | --- | | offerId | string | Yes | Non-empty | | code | string | Yes | Must match ^[a-zA-Z0-9]+$ |

offerSchema

| Field | Type | Required | Notes | | --- | --- | --- | --- | | id | string | Yes | UUID | | name | string | Yes | Non-empty | | description | string | Yes | Non-empty | | validUntilAt | number | Yes | Timestamp | | createdAt | number | Yes | Shared timestamp | | updatedAt | number | Yes | Shared timestamp |

oneTimeCouponCodeSchema

| Field | Type | Required | Notes | | --- | --- | --- | --- | | id | string | Yes | UUID | | offerId | string | Yes | Non-empty | | codes | Code[] | Yes | At least one code | | createdAt | number | Yes | Shared timestamp | | updatedAt | number | Yes | Shared timestamp |

regexCouponCode

| Field | Type | Required | Notes | | --- | --- | --- | --- | | offerId | string | Yes | UUID | | regex | string | Yes | Must match /pattern/flags format | | maxUses | number | Yes | Minimum 1 | | counter | number | Yes | Current usage counter | | createdAt | number | Yes | Shared timestamp | | updatedAt | number | Yes | Shared timestamp |

couponUsageSchema

| Field | Type | Required | Notes | | --- | --- | --- | --- | | id | string | Yes | UUID | | offerId | string | Yes | Non-empty | | code | string | Yes | Non-empty | | usedAt | number | Yes | Timestamp | | type | oneTimeCoupon \| regexCoupon | Yes | Coupon-type discriminator |

Example

import { oneTimeCouponCodeSchema } from '@verisure-italy/coupon-code-types'

const batch = oneTimeCouponCodeSchema.parse({
  id: '550e8400-e29b-41d4-a716-446655440000',
  offerId: 'offer-1',
  codes: ['WELCOME10', 'SPRING20'],
  createdAt: 1,
  updatedAt: 1,
})