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

@vitra/image-creator-test

v0.1.1

Published

Deterministic local mock of the Vitra Image Creation Platform. Offline integration testing, stripe-mock pattern.

Readme

@vitra/image-creator-test

Deterministic local mock of the Vitra Image Creation Platform. Stripe-mock pattern: offline, same input → same output, wire-compatible with the real server.

Use this as a dev-dep to build and test your Vitra integration before touching Vitra staging — or to run your CI without network access.

Install

npm install --save-dev @vitra/image-creator-test

CLI

npx vitra-mock

Starts on port 4321 (override with PORT=...). Default fixture:

| Field | Value | |-------|-------| | tenant slug | test-app | | shared secret | vitra_sk_test_secret_for_local_integration_testing_only | | allowed origins | https://app.test, http://localhost:5173 | | initial balance | 1000 credits per user |

Point your SDK at it:

const vitra = new VitraClient({
  appId: "test-app",
  sharedSecret: "vitra_sk_test_secret_for_local_integration_testing_only",
  baseUrl: "http://localhost:4321",
});

Programmatic use (Vitest / Jest)

import { createMockServer, DEFAULT_TEST_APP } from "@vitra/image-creator-test";
import { VitraClient } from "@vitra/image-creator-node";

describe("my integration", () => {
  let mock: ReturnType<typeof createMockServer>;
  let baseUrl: string;

  beforeAll(async () => {
    mock = createMockServer();
    ({ url: baseUrl } = await mock.listen(0));
  });
  afterAll(() => mock.close());
  afterEach(() => mock.reset()); // fresh state per test

  it("reserves and captures", async () => {
    const client = new VitraClient({
      appId: "test-app",
      sharedSecret: DEFAULT_TEST_APP.sharedSecret,
      baseUrl,
    });
    // ...do your flow, then assert on mock state
    expect(mock.state.reservations()).toHaveLength(1);
    expect(mock.state.balance("test-app", "user-1")).toBe(990);
  });
});

Custom fixtures

const mock = createMockServer({
  apps: [
    {
      slug: "translate-photo",
      sharedSecret: "vitra_sk_test_abc",
      allowedOrigins: ["https://app.translate.photo"],
      initialBalance: 50,
    },
    {
      slug: "cosmos",
      sharedSecret: "vitra_sk_test_xyz",
      allowedOrigins: ["https://cosmos.vitra.ai"],
      // Simulate a user with no credits
      insufficientCredits: true,
    },
  ],
});

Rotation overlap is also supported:

const mock = createMockServer({
  apps: [
    {
      slug: "test-app",
      sharedSecret: "new-current-secret",
      previousSecret: "old-rotated-secret", // valid for 24h in the real server
      allowedOrigins: ["https://app.test"],
    },
  ],
});

Introspection routes

Mock-only, under /_mock. Never used by production clients.

| Route | Returns | |-------|---------| | GET /_mock/reservations | All reservations in memory | | GET /_mock/balance/:slug/:userId | Current balance | | POST /_mock/reset | Reset state (keeps tenant config) | | POST /_mock/sign | { app_id, body }{ header } for hand-rolling test requests |

Wire coverage

Implemented:

  • POST /api/embed/session (HMAC-verified, origin-checked)
  • POST /api/credits/reserve (idempotent on job_id)
  • POST /api/credits/capture
  • POST /api/credits/release
  • GET /api/status

Not yet implemented (coming as Week 2/3 lands):

  • POST /api/embed/exchange and /refresh (the iframe-side flow)
  • POST /api/jobs (image generation)
  • POST /assets/ingest webhook-to-host direction

License

Apache-2.0.