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

@10d3/printflow

v1.0.3

Published

[![npm version](https://img.shields.io/npm/v/@10d3/printflow.svg?style=flat-square)](https://www.npmjs.com/package/@10d3/printflow) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE) [![GitHub Repository](https:

Downloads

30

Readme

@10d3/printflow

npm version MIT License GitHub Repository

Modern TypeScript SDK for integrating with Apliiq's Print-on-Demand API. Handle product catalog management, order processing, and inventory tracking with full type safety and caching support.

Features

  • Full TypeScript Support - Built with TypeScript 5 and Zod validation
  • Intelligent Caching - LRU caching with customizable TTL strategies
  • Security - HMAC authentication for API requests
  • Error Handling - Structured error classes with context details
  • ESM Support - Modern module system for better tree-shaking

Installation

npm install @10d3/printflow
# or
bun add @10d3/printflow

Configuration

Create a client instance with your Apliiq credentials:

import { ApliiqClient } from '@10d3/printflow';

const client = new ApliiqClient({
  appId: 'YOUR_APP_ID',
  sharedSecret: 'YOUR_SHARED_SECRET',
  endpoint: 'https://api.apliiq.com/v1', // Optional
  timeout: 15000, // 15 seconds
  cache: {
    enabled: true,
    max: 1000,
    ttl: 300000, // 5 minutes
    products: {
      ttl: 60000, // 1 minute per product
      batchTTL: 180000 // 3 minutes for product lists
    }
  }
});

Usage

Product API

async function listProducts() {
  try {
    const products = await client.getProducts();
    console.log('Available products:', products);
  } catch (error) {
    console.error('Failed to fetch products:', error.message);
  }
}

async function listProducts() {
  try {
    const products = await client.getProducts();
    console.log('Available products:', products);
  } catch (error) {
    console.error('Failed to fetch products:', error.message);
  }
}

Order API

Create Order

try {
  const orderResponse = await client.createOrder({
    number: 1006,
    name: "#1006",
    order_number: 1006,
    line_items: [
      {
        id: "1511138222",
        title: "cotton heritage polly pocket",
        quantity: 1,
        price: "45.50",
        sku: "APQ-1998244S7A1",
      },
    ],
    shipping_address: {
      first_name: "john",
      last_name: "smith",
      address1: "1692 Avenue du Mont-Royal Est",
      city: "los angeles",
      zip: "90013",
      province: "California",
      country: "United States",
      country_code: "US",
      province_code: "CA",
    },
  });
  console.log("Order created:", orderResponse.id);
} catch (error) {
  if (error instanceof ApliiqError) {
    console.error(`Order failed: ${error.message}`);
  }
}

Caching

The client includes built-in LRU caching support for product data:

const client = new ApliiqClient({
  appId: "your-app-id",
  sharedSecret: "your-shared-secret",
  cache: {
    enabled: true, // Enable caching
    max: 1000, // Maximum number of items (default: 1000)
    ttl: 300000, // Time-to-live in ms (default: 5 minutes)
  },
});

// Get cache statistics
const stats = client.getCacheStats(); // Returns: { size: number }

// Clear entire cache
client.clearCache();

// Clear specific product
client.clearProductCache(123);

// Clear all products
client.clearProductsCache();

TypeScript Types

The client provides built-in type definitions for all API operations:

import {
  ApliiqConfig,
  Product,
  ApliiqOrder,
  ApliiqOrderResponse,
} from "apliiq-client";

// Configuration type
const config: ApliiqConfig = {
  appId: "your-app-id",
  sharedSecret: "your-shared-secret",
  cache: {
    enabled: true,
    max: 1000,
    ttl: 300000,
  },
};

// Product type
const product: Product = await client.getProduct(162);
// {
//   Id: number;
//   Name: string;
//   SKU: string;
//   Colors: Array<{ Id: number; Name: string }>;
//   Sizes: Array<{ Id: number; Name: string; Weight: string; PlusSize_Fee: number }>;
//   // ... other properties
// }

// Order type
const order: ApliiqOrder = {
  number: 1006,
  name: "#1006",
  order_number: 1006,
  line_items: [
    {
      id: "1511138222",
      title: "cotton heritage polly pocket",
      quantity: 1,
      price: "45.50",
      sku: "APQ-1998244S7A1",
    },
  ],
  shipping_address: {
    first_name: "john",
    last_name: "smith",
    address1: "1692 Avenue du Mont-Royal Est",
    city: "los angeles",
    zip: "90013",
    province: "California",
    country: "United States",
    country_code: "US",
    province_code: "CA",
  },
};

// Order response type
const response: ApliiqOrderResponse = await client.createOrder(order);
// { id: number }

All types include full TypeScript intellisense support and runtime validation through Zod schemas.

Error Handling

try {
  await client.createOrder(/* ... */);
} catch (error) {
  if (error instanceof ApliiqError) {
    console.error(`API Error (${error.statusCode}): ${error.message}`);
    if (error.details) console.error("Details:", error.details);
  }
}

Common Error Scenarios

  • Validation Errors: Zod schema validation failures
  • 401 Unauthorized: Invalid HMAC signature
  • 202 Accepted: Order received but not yet processed

Response Examples

Product Response

{
  "Id": 162,
  "Name": "womens t shirt",
  "SKU": "6004",
  "Price": 6,
  "Sizes": [
    {
      "Id": 6,
      "Name": "s",
      "Weight": "16 oz",
      "PlusSize_Fee": 0
    }
  ],
  "Colors": [
    {
      "Id": 50,
      "Name": "black"
    }
  ]
}

Order Response

{
  "id": 567890
}

Rate Limiting

The API currently doesn't specify rate limits. It's recommended to implement retry logic for production use.

Development

# Install dependencies
npm install

# Build project
npm run build

# Run tests
npm test

Contribution

  • Clone repository
git clone https://github.com/10d3/printflow.git
  • Install dep
bun install
  • Build the project
bun run build
  • Submit PR with tests

License

MIT - See LICENSE © 10d3

Documentation

For complete API documentation, visit Apliiq API Docs