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

@orieken/saturday-core

v0.1.3

Published

Core abstractions and utilities for the Saturday automation framework.

Readme

@orieken/saturday-core

Core abstractions and utilities for the Saturday automation framework. This package provides the foundational classes for building scalable, site-centric test automation architectures and integrating advanced Machine Learning capabilities.

Architecture

The framework follows a Site-Centric architecture pattern:

  1. Site: The entry point (Facade) for your application. It holds references to Pages, Flows, and ML tools.
  2. Pages: represent specific views or pages in your app.
  3. Elements: represent interactive parts of a page (buttons, inputs).
  4. Flows: represent complex business logic spanning multiple pages (e.g., "Login Flow", "Checkout Flow").
  5. Filters: represent state-dependent conditions (e.g., "User is logged in").

Installation

pnpm add @orieken/saturday-core

Usage

1. Creating a Site

Extend BaseSite to create your application's entry point.

import { BaseSite } from '@orieken/saturday-core';
import { HomePage } from './pages/home.page';
import { LoginFlow } from './flows/login.flow';

export class MySite extends BaseSite {
  // Public properties for easy access
  public homePage: HomePage;
  public loginFlow: LoginFlow;

  constructor(page: Page) {
    super(page, 'https://mysite.com'); // Base URL is optional but recommended
    
    // Initialize components
    this.homePage = new HomePage(page, this);
    this.loginFlow = new LoginFlow(this);
  }

  // Optional: Override lifecycle methods
  protected initializePages(): void {
    // efficient lazy-loading can be implemented here if needed
  }
}

2. Creating a Page

Extend BasePage and register your elements.

import { BasePage, InputElement, ButtonElement } from '@orieken/saturday-core';

export class LoginPage extends BasePage {
  public usernameInput: InputElement;
  public passwordInput: InputElement;
  public submitButton: ButtonElement;

  constructor(page: Page, site: BaseSite) {
    super(page, site);
    
    this.usernameInput = new InputElement(page, '#username');
    this.passwordInput = new InputElement(page, '#password');
    this.submitButton = new ButtonElement(page, 'button[type="submit"]');
  }

  async visit() {
    await this.page.goto('/login');
    await this.waitForLoad();
  }
}

3. Creating Elements

Use built-in elements (ButtonElement, InputElement, LinkElement) or creating custom ones by extending BaseElement.

import { BaseElement } from '@orieken/saturday-core';

export class DropdownElement extends BaseElement {
  async select(value: string) {
    await this.click();
    await this.page.click(`text=${value}`);
  }
}

4. Creating Flows

Flows encapsulate multi-page business logic.

import { BaseFlow } from '@orieken/saturday-core';

export class LoginFlow extends BaseFlow {
  async execute(user: string, pass: string) {
    await this.site.loginPage.visit();
    await this.site.loginPage.usernameInput.fill(user);
    await this.site.loginPage.passwordInput.fill(pass);
    await this.site.loginPage.submitButton.click();
  }
}

5. Machine Learning Integration

BaseSite provides built-in tools for AI-driven visual validation and anomaly detection.

Visual Baselines

Capture the current state of a page as a "golden master".

// In your test setup or a dedicated training script
await site.establishPageBaseline('home_page_v1');

Visual Validation

Validate the current page against the trained baseline.

const result = await site.validatePageAgainstBaseline('home_page_v1');

if (!result.isValid) {
  console.log('Anomalies detected:', result.anomalies);
}

Advanced ML Access

You can access granular ML tools via the site's facades:

// Access trainer directly
await site.trainers.trainCurrentPage('custom_model_label');

// Access detectors
const anomalies = await site.detectors.detectAnomalies(screenshot);

6. Conditional Element Access (Filters)

Use the @RequiresFilter decorator to protect elements that require a specific state (like being logged in).

import { BasePage, RequiresFilter } from '@orieken/saturday-core';

export class HomePage extends BasePage {
  
  // 1. Define the condition
  async isLoggedIn(): Promise<boolean> {
     return await this.page.isVisible('#user-avatar');
  }

  // 2. Protect the element
  @RequiresFilter('isLoggedIn')
  public accountSettings: ButtonElement;

  constructor(page: Page, site: BaseSite) {
    super(page, site);
    this.accountSettings = new ButtonElement(page, '#settings');
  }
}

If you try to access accountSettings when isLoggedIn() is false, a FilterError will be thrown.

Utilities

ConsoleLogger

A helper to neatly format and capture browser console logs during tests.

import { ConsoleLogger } from '@orieken/saturday-core';

const logger = new ConsoleLogger(page);
// ... run test ...
const logs = logger.getFormattedLogs();