New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sigilium

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sigilium

Sigilium is a library for defining complex dependency hierarchies through smart identifiers. It provides factory functions for creating extension points with different composition patterns.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
0
Created
Source

Sigilium 🔮

Sigilium is a library for defining complex dependency hierarchies through smart identifiers. It provides factory functions for creating extension points with different composition patterns.

Purpose 🧠

When building modular systems, we often need ways to:

  • Define clear extension points for functionality
  • Support multiple implementations of the same interface
  • Compose implementations through decoration and aggregation
  • Maintain clean separation between components

Sigilium helps solve these problems by providing smart identifiers that know how to compose their implementations.

Usage 🪄

First, import the sigilium factory functions:

import sigilium from 'sigilium';

Basic Extension Points 📍

Create a basic extension point when you need a simple implementation:

const log = sigilium.sigil('log');

// Register an implementation
container.install(log.provider([], () => console.log));

Optional Extension Points 🔌

Create an optional extension point when you want at-most-one implementation:

const logger = sigilium.optional('logger');

// Will throw if multiple implementations try to register
container.install(logger.provider([], () => new StdoutLogger()));

Singleton Extension Points ☝️

Create a singleton extension point when you need exactly one implementation:

const database = sigilium.singleton('database');

// Will throw if multiple implementations try to register
container.install(database.provider([], () => new SQLDatabase()));

Composite Extension Points 🎭

Create a composite extension point when you need decoration or aggregation:

const search = sigilium.composite('search');

// Register multiple implementations
container.install(search.provider([], () => 
  query => ['result1', 'result2']
));

// Decorate with logging
container.install(search.decorator([log.resolve], ([logger]) => (fn) => 
  query => {
    logger(`Searching for: ${query}`);
    return fn(query);
  }
));

// Aggregate results
container.install(search.aggregator([], () => (providers) =>
  query => providers.flatMap(p => p()(query))
));

Contributing 🦄

We welcome contributions to the Sigilium project! If you have any ideas, bug reports, or pull requests, please feel free to submit them on the Sigilium GitHub repository.

License 🔒

Sigilium is licensed under the MIT License.

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts