Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aliksend/module

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aliksend/module

Declare modules in your services

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

modules-for-services

Used to declare modules in your services

Usage example:

// db/knex.ts
const m = Module.declare('knex', 'input', {
  configSchema: z.object({}).passthrough(),
  startArg: null,
  start: async (config, startArg) => {
    return knex(config)
  },
  stop: async (db) => {
    await db.destroy()
  },
})

// now you can use `m`, even while module isn't started
// you can use `m.value` in http-handlers that will be called after module is started

// then you can call `startAll` with config to start all modules, declared in your service
await Module.startAll({
  db: {
    client: 'pg',
    connection: 'TODO'
  }
})

Keywords

FAQs

Package last updated on 12 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc