AbsoluteJS

Collectibles

@absolutejs/collectiblesv0.1.2betaCommerce & Growth

Deterministic collectible sets, editions, shuffled serials, weighted traits, rarity explanations, and population reports for AbsoluteJS apps.

#Installation

BASH
bun add @absolutejs/collectibles

#Capabilities

Overview

Deterministic collectible primitives for sets, subjects, editions, individual copies, weighted traits, transparent rarity, shuffled serials, and population reports.

The package separates four identities that collectible systems often blur:

a set is a release;

Show 5 more

a subject is the recognizable thing collectors chase;

a printing is one supply-capped edition of that subject;

a copy is an individually owned serial from that printing.

Serial allocation uses a deterministic full permutation. Mint 1 does not automatically receive serial 1, but every serial from 1..supply can occur exactly once. Applications can preserve historical output by pinning their recipe version and permutation namespace.

The library contains no pet artwork, game tiers, or database assumptions. Those remain application policy.

Deterministic editions and traits

The same seed, recipe version, and namespace always produce the same result. populationReport() explains issued, remaining, discovered, listed, and unavailable supply without requiring a particular marketplace or database.

Outcomes

What you can build

Overview

Deterministic collectible primitives for sets, subjects, editions, individual copies, weighted traits, transparent rarity, shuffled serials, and population reports.

Deterministic editions and traits

The same seed, recipe version, and namespace always produce the same result. populationReport() explains issued, remaining, discovered, listed, and unavailable supply without requiring a particular marketplace or database.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/collectibles version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/collectibles example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Deterministic editions and traits

Partial snippet

Working example for Deterministic editions and traits.

TS
import {
  chooseWeightedEdition,
  generateWeightedTraits,
  printingId,
  shuffledSerial,
} from "@absolutejs/collectibles";

const editions = [
  { key: "standard", label: "Standard", supply: 900, weight: 90 },
  { key: "rare", label: "Rare", supply: 100, weight: 10 },
] as const;

const edition = chooseWeightedEdition("subject:42", editions);
const printing = printingId("set-1", "subject:42", edition);
const serial = shuffledSerial(
  printing,
  1,
  editions.find((row) => row.key === edition)!.supply,
);

const traits = generateWeightedTraits("subject:42", [
  {
    key: "background",
    options: [
      { value: "blue", weight: 80 },
      { value: "gold", weight: 20 },
    ],
  },
]);

#Public entry points

Supported entry points declared by this project’s package manifest. Internal dist paths are not part of the package contract.

Public package entry point declared in package.json.

@absolutejs/collectibles@absolutejs/collectibles/manifest@absolutejs/collectibles/manifest.json

#Package commands

Scripts declared by this project’s package manifest.

bun run buildrm -rf dist && bun build src/index.ts src/manifest.ts --root ./src --outdir dist --sourcemap --target=bun && tsc --project tsconfig.build.json && absolute-manifest emit
bun run check:packagebun run typecheck && bun run test && bun run build
bun run testbun test
bun run typechecktsc --noEmit

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

22 symbols
SeededRngtypePermalink
TS
type SeededRng = () => number;
Exported from @absolutejs/collectibles