Prism · guides

How to do things with Prism.

Each guide is a file you can run, set in the theatre’s world. What it prints is what the installed package printed.

First steps.

One config, written as JSON, is evaluated over Saturday’s bookings.

Install it
pnpm add @niscorp/prism @niscorp/strata zod
Run it
npx tsx first.mts
Write first.mts
import { evaluate } from '@niscorp/prism';

const saturday = {
  play: { title: 'The Tempest', night: '2026-10-24' },
  bookings: [{ member: 'Ada', seats: 1 }, { member: 'Grace', seats: 2 }, { member: 'Linus', seats: 4 }],
};

const summary = evaluate(
  {
    night: { $join: { parts: [{ $ref: '$.play.title' }, { $ref: '$.play.night' }], sep: ', ' } },
    bookings: { $length: { $ref: '$.bookings' } },
    seats: { $sum: { over: { $pluck: { over: { $ref: '$.bookings' }, key: 'seats' } } } },
  },
  saturday,
);
console.log(summary);
It prints
{ night: 'The Tempest, 2026-10-24', bookings: 3, seats: 7 }

The config is data. It can be stored, sent and checked like any other document, which is why the rest of Nisc is built on it. Every operator in it has a page in the reference.

Then, one at a time.

Each is a file of its own and adds one thing. Read them in order, or go to the one you need.