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

@utaba/deep-memory-storage-sqlserver

v0.3.0

Published

SQL Server storage provider for @utaba/deep-memory

Readme

@utaba/deep-memory-storage-sqlserver

SQL Server storage provider for @utaba/deep-memory.

Installation

pnpm add @utaba/deep-memory @utaba/deep-memory-storage-sqlserver

Usage

import { DeepMemory } from '@utaba/deep-memory';
import { SqlServerStorageProvider } from '@utaba/deep-memory-storage-sqlserver';

const provider = new SqlServerStorageProvider({
  connection: {
    server: 'localhost',
    port: 1434,
    database: 'deep-memory',
    user: 'sa',
    password: 'YourPassword',
    options: { trustServerCertificate: true },
  },
  schema: 'dbo',       // optional, default 'dbo'
});

const dm = new DeepMemory({ storage: provider });

// Call once at startup / deployment to create or migrate tables
await dm.ensureSchema();

You can also pass a connection string:

const provider = new SqlServerStorageProvider({
  connection: {
    connectionString: 'Server=localhost,1434;Database=deep-memory;User Id=sa;Password=YourPassword;TrustServerCertificate=true',
  },
});

Or an existing mssql.ConnectionPool:

import sql from 'mssql';

const pool = new sql.ConnectionPool({ /* your config */ });
await pool.connect();

const provider = new SqlServerStorageProvider({ connection: pool });

Database Schema

Automatic creation

Call ensureSchema() once at startup or deployment to create tables if they don't exist. This is not called automatically — the consuming application decides when to run it.

Manual creation

If you manage your own migrations, export the DDL and run it yourself.

From code:

import { getSchemaSQL } from '@utaba/deep-memory-storage-sqlserver';

// Default schema (dbo)
const ddl = getSchemaSQL();

// Custom schema
const ddl = getSchemaSQL('my_schema');

From the command line (after building):

cd packages/storage-sqlserver
node -e "import('./dist/index.js').then(m => console.log(m.getSchemaSQL()))"

Pipe to a file for SSMS:

node -e "import('./dist/index.js').then(m => console.log(m.getSchemaSQL()))" > schema.sql

Schema versioning

A dm_meta table tracks the schema version. On initialise(), the provider checks this version and warns if the database is newer than the provider. The provider does not auto-migrate — update the schema manually using the DDL output from getSchemaSQL().

Tables

All tables are prefixed with dm_ to avoid collisions when co-located with other schemas.

| Table | Description | |-------|-------------| | dm_meta | Schema version tracking | | dm_repositories | Repository definitions and governance config | | dm_vocabularies | Vocabulary JSON document per repository | | dm_vocabulary_change_log | Vocabulary change audit trail | | dm_entities | Graph nodes with provenance and optional embeddings | | dm_relationships | Graph edges with provenance |

Naming conventions

  • Tables: plural snake_case (dm_entities, dm_relationships)
  • Columns: snake_case (entity_id, created_at)
  • Primary keys: pk_{table}
  • Foreign keys: fk_{table}_{referenced_table}
  • Indexes: ix_{table}_{columns}

Testing

The conformance test suite requires a running SQL Server instance:

MSSQL_CONNECTION_STRING="Server=localhost,1434;Database=deep-memory;User Id=sa;Password=YourPassword;TrustServerCertificate=true" \
  pnpm --filter @utaba/deep-memory-storage-sqlserver test

Without MSSQL_CONNECTION_STRING, tests are skipped.