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

aif-core-compliance

v0.1.1

Published

AIF Core compliance validator for AIF.sql-shaped JSON with strict Upper Ontology and Forms fulfilment checks.

Readme

aif-core-compliance

AIF Core (Definition 1.1) compliance validator for AIF.sql-shaped JSON.

This package validates:

  • Input shape with JSON Schema (aif-sql-core-strict profile)
  • Reference integrity (REF_*)
  • Simple digraph constraints (NO_SELF_LOOPS, NO_DUPLICATE_EDGES)
  • Upper Ontology constraints
  • Forms Ontology fulfilment (strict)

Scope

  • Target specification: AIF Core (Definition 1.1)
  • Input format: AIF.sql-homomorphic JSON (table arrays)
  • Validation mode: strict
  • Entry points: library API and CLI (aif-core-compliance)

Input Format Contract

validate(doc) expects one JSON object with all of the following required top-level keys:

  • nodes
  • edges
  • schemes
  • schemeFulfillment
  • descriptors
  • descriptorFulfillment
  • formEdges
  • formEdgeTypes

Top-level additional keys are not allowed by schema.

Row Shapes

nodes[]

  • nodeID: integer (>=1)
  • text: string
  • type: "I" | "RA" | "CA" | "PA"
  • timestamp?: string

edges[]

  • edgeID: integer (>=1)
  • fromID: integer (>=1)
  • toID: integer (>=1)
  • formEdgeID: integer (>=1) | null

schemes[]

  • schemeID: integer (>=1)
  • name: string
  • schemeTypeID: integer (>=1)

schemeFulfillment[]

  • nodeID: integer (>=1)
  • schemeID: integer (>=1)

descriptors[]

  • descriptorID: integer (>=1)
  • text: string

descriptorFulfillment[]

  • nodeID: integer (>=1)
  • descriptorID: integer (>=1)

formEdges[]

  • formEdgeID: integer (>=1)
  • schemeID: integer (>=1)
  • formEdgeTypeID: integer (>=1)
  • name: string
  • descriptorID: integer (>=1) | null
  • schemeTarget: integer (>=1) | null

formEdgeTypes[]

  • formEdgeTypeID: integer (>=1)
  • name: string
  • direction: "IN" | "OUT"

Strict Semantics Notes

  • edges.formEdgeID may be null in schema, but strict validation raises EDGE_ROLE_REQUIRED when that edge is incident to an S-node (RA/CA/PA).
  • formEdges.descriptorID and formEdges.schemeTarget may be null in schema and are checked by strict fulfilment rules when present.

Minimal Input Example

See examples/valid/minimal.json.

{
  "nodes": [
    { "nodeID": 1, "text": "Premise", "type": "I" },
    { "nodeID": 2, "text": "Apply RA", "type": "RA" },
    { "nodeID": 3, "text": "Conclusion", "type": "I" }
  ],
  "edges": [
    { "edgeID": 1, "fromID": 1, "toID": 2, "formEdgeID": 1 },
    { "edgeID": 2, "fromID": 2, "toID": 3, "formEdgeID": 2 }
  ],
  "schemes": [{ "schemeID": 1, "name": "Basic Inference", "schemeTypeID": 1 }],
  "schemeFulfillment": [{ "nodeID": 2, "schemeID": 1 }],
  "descriptors": [],
  "descriptorFulfillment": [],
  "formEdges": [
    {
      "formEdgeID": 1,
      "schemeID": 1,
      "formEdgeTypeID": 1,
      "name": "premise",
      "descriptorID": null,
      "schemeTarget": null
    },
    {
      "formEdgeID": 2,
      "schemeID": 1,
      "formEdgeTypeID": 2,
      "name": "conclusion",
      "descriptorID": null,
      "schemeTarget": null
    }
  ],
  "formEdgeTypes": [
    { "formEdgeTypeID": 1, "name": "incoming", "direction": "IN" },
    { "formEdgeTypeID": 2, "name": "outgoing", "direction": "OUT" }
  ]
}

Install

npm install aif-core-compliance

Library API

import { validate, type AifSqlDocument } from "aif-core-compliance";

const doc: AifSqlDocument = /* your input */;
const result = validate(doc);
// { compliant: boolean, issues: Issue[] }

Issue minimum fields:

  • id
  • severity
  • message
  • path (when available)

CLI

aif-core-compliance examples/valid/minimal.json
aif-core-compliance --json examples/invalid/edge_role_required.json

Exit codes:

  • 0: compliant
  • 1: non-compliant
  • 2: input/runtime error (read/parse/exception)

Profile Schema

schemas/aif-sql-core-strict.schema.json

Installed package path example:

  • node_modules/aif-core-compliance/schemas/aif-sql-core-strict.schema.json

Rule Catalog

Rule IDs and descriptions are in rules/catalog.json.

Examples

  • examples/valid/
  • examples/invalid/

Each invalid example has a paired expectation file:

  • examples/invalid/<name>.expected.json

Development

npm install
npm test
npm run build