open-index/open-npm huggingface dataset:
npm package: @loke/di-ioc
Description: Node.js dependency injection.
Author: Anthony Foster + LOKE
Latest version: 2.2.1

# di-ioc

[![NPM Version](https://img.shields.io/npm/v/di-ioc.svg)](https://www.npmjs.com/package/di-ioc)
[![Build Status](https://img.shields.io/travis/aantthony/di-ioc/master.svg)](https://travis-ci.org/aantthony/di-ioc)
[![Coverage Status](https://img.shields.io/coveralls/aantthony/di-ioc/master.svg)](https://coveralls.io/r/aantthony/di-ioc?branch=master)
[![NPM Downloads](https://img.shields.io/npm/dm/di-ioc.svg)](https://www.npmjs.com/package/di-ioc)
[![License](https://img.shields.io/npm/l/di-ioc.svg)](https://www.npmjs.com/package/di-ioc)

Dependency injection.

## Installation

`npm install --save di-ioc`

## Example

### util/index.js

```js
module.exports = require('di-ioc').create()

// Start defining a `random` service:
.define('random', function () {
  var pseudoRandomBytes = require('crypto').pseudoRandomBytes;

  // The `random` service has one function:
  return {
    base64: function () {
      return pseudoRandomBytes(20).toString('base64');
    }
  };
});
```

### app/index.js

```js
module.exports = require('di-ioc').create()

// Greeting service which uses the random service: (arguments are detected)
.define('greet', function (random) {
  return function (name) {
    console.log('Hello ' + name + '! Here is a random string: ' + random.base64());
  };
});
```


### index.js

```js
module.exports = require('di-ioc').create(require)
.use('./util')
.use('./app')

.init();

var randomService = module.exports.util.random;

// eQ/NZnl7qusVN9hB/3nCn3wFKfY=
console.log(randomService.base64());

// Hello World! Here is a random string: dfLGC20CpCJxAZSu+uFp57dlJl0=
module.exports.app.greet();
```

## Features

- Export to a standard object which automatically initialises dependencies as needed. This is the object `.init()` creates.
- Enforce that dependency graph divides into layers. For example, nothing in the 'util' submodule can depend on services in the 'app' submodule, due to the order of definition.
- Nest components in to hierarchial modules and folders.
- Instantiate one sub-tree of the hierarchy for testing.
- Instantiate objects with injected dependencies for unit testing.
- Define transient objects, using `require('di-ioc').create().transient('serviceName', ...);`.
npm package: @loke/duration
Description: ## Examples
Author: Dominic Smith
Latest version: 1.0.1

# duration

## Examples

Good for more readable durations

```js
const { MINUTE } = require("@loke/duration");

setTimeout(() => console.log("yay"), 30 * MINUTE);
```

Parsing more human durations from configs

```js
const duration = require("@loke/duration");

// config, could be loaded form file etc
const config = {
  timeoutDuration: "30s"
};

const timeout = duration.parse(config.timeoutDuration); // 30000
```

Format durations for logging and metrics

```js
const duration = require("@loke/duration");
const { Histogram } = require("prom-client");

async function handler() {
  const startTime = process.hrtime();

  await slowThing();

  const dur = duration.fromHR(process.hrtime(startTime));

  console.log(`completed slow thing, duration=${duration.format(dur)}`);
  // completed slow thing, duration=156ms
}
```
npm package: @loke/http-kit
Description: A set of helpers and middleware for making http servers in node
Author: LOKE Engineering
Latest version: 1.4.0

# LOKE HTTP Kit

A set of helpers and middleware for making http servers in node

## Usage

Middleware are most easily used with express

```js
const express = require("express");

const app = express();
```

### createLoggingMiddleware(logger: Logger)

Add http logging, can be used with loke-logger v3 or just console;

```js
const { createLoggingMiddleware } = require("@loke/http-kit");

app.use(createLoggingMiddleware(console));
```

### createErrorMiddleware(logger: Logger)

Add basic error formatting and logging, can be used with loke-logger v3 or just console;

```js
const { createErrorMiddleware } = require("@loke/http-kit");

app.use(createErrorMiddleware(console));
```

### createMetricsMiddleware()

You need to register all metrics before hand using `registerMetrics`

The `path` label will be populated based on the `req.routePath`, the `Router`
class will automatically populate this for you. Or you can manually set it if
you are using a different router.

Alternatively you can use the `trackAllFoundPaths` option to track the path of
all requests that don't result in a 404. This must be used with caution as
unconstrained labels can explode the number of metrics.

```js
const { createMetricsMiddleware, registerMetrics } = require("@loke/http-kit");
const promClient = require("prom-client");

registerMetrics(promClient.register);

app.use(createMetricsMiddleware());
```

### Class: Router

A basic router similar to the one provided by express

key differences are:

- handles async errors
- can't be nested, (can be nested inside a express `use` though)
- supports metrics

```js
const { Router } = require("@loke/http-kit");

const router = new Router();

router.get("/foo/:bar", async ({ req, res, params }) => {
  // get a path param
  const foo = params.foo;

  // req, res are just the standard node/express objects
  // so this could also be `res.json({ foo })`
  res.send(`Hello, ${foo}`);
});

app.use(router.createHandler());
```

### graceful

```js
const { graceful } = require("@loke/http-kit");

const PORT = 8000;

async function main() {
  const server = http.createServer(app);

  const { shutdown } = graceful(server);

  server.listen(PORT);

  // Await stop signal
  await stopSignal();

  // Finish current requests then stop http server
  await shutdown();
}

const stopSignal = () =>
  new Promise((resolve) => {
    process.once("SIGINT", resolve);
    process.once("SIGTERM", resolve);
  });

main();
```
npm package: @loke/logger
Description: Logger module for LOKE applications. Supports syslog and console output.
Author: LOKE Engineering
Latest version: 3.5.1

# LOKE Logger

[![NPM Version](https://img.shields.io/npm/v/@loke/logger.svg)](https://www.npmjs.com/package/@loke/logger)
[![Build Status](https://img.shields.io/travis/LOKE/loke-logger/master.svg)](https://travis-ci.org/LOKE/loke-logger)

A multi-target logger tailored for LOKE Group and based around LOKE standards.

Currently supports console output and syslog.

## Overview

In version 3.x the api is a subset of `console`

it includes `.debug()`, `.log()`, `.info()`, `.warn()` and `.error()`.

in addition is a withPrefix method that creates a logger child logger with a prefix;

```js
const logger = require("@loke/logger").create();

logger.error("Lorem ipsum");
logger.warn("dolor sit amet consectetur");

const httpLogger = logger.withPrefix("HTTP");

httpLogger.info("eiusmod tempor incididunt ut");
httpLogger.debug("labore et dolore magna aliqua");
```

## `create()` Options

There are a number of options when configuring the logger;

### showDebug

Type: `boolean`<br>
Default: `false` when `NODE_ENV=production`, otherwise `true`

Whether or not debug level logs should be emitted.

### syslog

Type: `boolean`<br>
Default: `false`

This option adds syslog udp messages to the output streams, console messages will still be emitted.

### systemdPrefix

Type: `boolean`<br>
Default: `true` when `JOURNAL_STREAM` set, otherwise `false`

This option prefixes stdout with systemd's severity syntax

### metricsRegistry

Type: `Object`

A [prom-client](https://github.com/siimon/prom-client) register to add metrics to.

```js
const { register } = require("prom-client");
const logger = require("@loke/logger").create({
  metricsRegistry: register,
});

logger.error("Lorem ipsum");
```

This adds the metric `log_messages_total` with the labels `prefix` and `severity`.
npm package: @loke/mysql-orm
Description: MySQL Data Mapper
Author: LOKE
Latest version: 2.0.0-beta2

# @loke/mysql-orm

[![NPM Version](https://img.shields.io/npm/v/loke-mysql-orm.svg)](https://www.npmjs.com/package/@loke/mysql-orm)
[![NPM Downloads](https://img.shields.io/npm/dm/loke-mysql-orm.svg)](https://www.npmjs.com/package/@loke/mysql-orm)
[![License](https://img.shields.io/npm/l/loke-mysql-orm.svg)](https://www.npmjs.com/package/@loke/mysql-orm)

## Breaking Changes

1) You must now import Connection from the module.

Before: `const Connection = require("@loke/mysql-orm");`

After: `const { Connection } = require("@loke/mysql-orm");`

2) `create` and `createConnection` are gone. Please use `Connection`.

3) `$` operators are gone, as per underlying Sequelize update. You should import `Op` instead.

Before: `myRepo.find({ age: {$gt: 18} })`

After:

```js
const { Op } = require("@loke/mysql-orm");
myRepo.find({ age: {[Op.gt]: 18} })
```

1) You can still use `$` operators by declaring them in the connection options using the field `operatorsAliases`. See sequelize documentation for more details.
## Install

`npm install @loke/mysql-orm`

## Example

```js
const { Connection } = require('@loke/mysql-orm');
const db = new Connection('mysql://root@localhost/demo');
const petRepository = db.table('Pets', {
  name: { type: String, defaultValue: () => 'Untitled' },
  description: db.Text
});
const userRepository = db.table('Users', {
  firstName: db.String,
  lastName: db.String,
  pets: [petRepository]
});

userRepository.find({firstName: 'Testing'})
  .then(function (users) {
    users[0].pets[0].description = 'Hello World!';
    // Save changes:
    return userRepository.persist(users[0]);
  });
```

# [View Documentation](http://loke.github.io/mysql-orm).

## Tests

`npm test`

## Coverage

`npm run coverage`
npm package: @loke/orm
Description: Sequelize based ORM for MySql and Postgres
Author: LOKE
Latest version: 2.0.0

# @loke/orm

This package is only used in some legacy systems at LOKE, and as such is deprecated.

Dependency updates and changes will be limited to security and features to transition away from the system.

## Breaking Changes

1) You must now import Connection from the module.

Before: `const Connection = require("@loke/orm");`

After: `const { Connection } = require("@loke/orm");`

2) `create` and `createConnection` are gone. Please use `Connection`.

3) `$` operators are gone, as per underlying Sequelize update. You should import `Op` instead.

Before: `myRepo.find({ age: {$gt: 18} })`

After:

```js
const { Op } = require("@loke/orm");
myRepo.find({ age: {[Op.gt]: 18} })
```

4) You can still use `$` operators by declaring them in the connection options using the field `operatorsAliases`. See sequelize documentation for more details.

5) `sequelize`, `pg` and `mysql2` are now peer dependencies. You must install them yourself.


## Install

`npm install @loke/orm`

## Example

```js
const { Connection } = require('@loke/orm');
const db = new Connection('mysql://root@localhost/demo');
const petRepository = db.table('Pets', {
  name: { type: String, defaultValue: () => 'Untitled' },
  description: db.Text
});
const userRepository = db.table('Users', {
  firstName: db.String,
  lastName: db.String,
  pets: [petRepository]
});

userRepository.find({firstName: 'Testing'})
  .then(function (users) {
    users[0].pets[0].description = 'Hello World!';
    // Save changes:
    return userRepository.persist(users[0]);
  });
```

# [View Documentation](http://loke.github.io/orm).

## Tests

`npm test`

## Coverage

`npm run coverage`
npm package: @loke/react-native-notifications
Description: Advanced Push Notifications (Silent, interactive notifications) for iOS & Android
Author: Lidan Hifi
Latest version: 3.1.0

# React Native Notifications
![npm](https://img.shields.io/npm/dw/react-native-notifications.svg)
[![Build Status](https://img.shields.io/jenkins/s/http/jenkins-oss.wixpress.com:8080/job/multi-react-native-notifications-master.svg)](https://jenkins-oss.wixpress.com/job/multi-react-native-notifications-master/)
[![npm (tag)](https://img.shields.io/npm/v/react-native-notifications/snapshot.svg)](https://github.com/wix/react-native-navigation/tree/master)

Handle all the aspects of push notifications for your app, including remote and local notifications, interactive notifications, silent notifications, and more.

**All the native iOS notifications features are supported!** 

_For information regarding proper integration with [react-native-navigation](https://github.com/wix/react-native-navigation), follow [this wiki](https://github.com/wix/react-native-notifications/wiki/Android:-working-with-RNN)._


### iOS

<img src="https://s3.amazonaws.com/nrjio/interactive.gif" alt="Interactive notifications example" width=350/>

- Remote (push) notifications
- Local notifications
- Background/Managed notifications (notifications that can be cleared from the server, like Facebook messenger and Whatsapp web)
- PushKit API (for VoIP and other background messages)
- Interactive notifications (allows you to provide additional functionality to your users outside of your application such as action buttons)

### Android

- Receiving notifications in any App state (foreground, background, "dead")
- Built-in notification drawer management
- High degree of code extensibility to allow for advanced custom layouts and any specific notifications behavior as available by [Android's API](https://developer.android.com/training/notify-user/build-notification.html)
- Android equivalent of React-Native's implementation of [`PushNotificationsIOS.getInitialNotification()`](https://facebook.github.io/react-native/docs/pushnotificationios.html#getinitialnotification).

_Upcoming: local notifications, background-state Rx queue (iOS equivalent)_


# Quick Links
- [Getting Started](https://wix.github.io/react-native-notifications/docs/getting-started)
- [API](https://wix.github.io/react-native-notifications/docs/general-api)
- [Documentation](https://wix.github.io/react-native-notifications/)

# License
The MIT License.

See [LICENSE](LICENSE)
npm package: @loke/redis-cache
Description: Redis Cache
Author: Dominic Smith
Latest version: 2.3.0

# @loke/redis-cache

**Please note v2 has breaking changes in that it now uses milliseconds not seconds**

## Examples

```js
import promClient from "prom-client";
import { create as createCache, cacheKey } from "@loke/redis-cache";
import redis from "redis";
import { MINUTE } from "@loke/duration";

import { fetchUser } from "./user";

redisCache.registerMetrics(promClient.register);

const redisClient = redis.createClient();
const cache = createCache({ redisClient, prefix: "some-service:" });

function getUser(userId) {
  return cache.apply(cacheKey`user:${userId}`, 5 * MINUTE, () =>
    fetchUser(userId)
  );
}
```

## API

### create(options)

#### options

##### redisClient

A redis client from the [redis](https://www.npmjs.com/package/redis) package

##### prefix

A string prefix for the keys used by this client, usually the name of the service followed by a colon eg. `"tidy-api"`

### cache.get(key[, reviver])

Gets a value in the cache, optionally can be run through a json `reviver` to apply things like the `Date` type

### cache.put(key, value, ttl[, reviver])

Puts a value into the cache, the value will expire from the cache after `ttl` (milliseconds) has elapsed

Also returns a promise of the value that has been run through the json `reviver`, this can be useful for getting consistent value types from get and put

### cache.clear(key)

Removes a key from the cache

### cache.apply(key, ttl, promiseFn[, reviver])

Applies caching to a promise function

### cacheKey

Creates a cache key used with template strings, creates a key object that has two functions

**getString(prefix)**: returns the templated string with the supplied prefix

**getMetaString(prefix)**: returns a version of the string with the dynamic values stripped out. This is used when recording metrics.

Example

```js
const prefix = "foo:";
const userId = 5;
const userToken = "a42799b8";
const key = cacheKey`user:${userId}:session:${userToken}`;

key.getString(prefix) === "foo:user:5:session:a42799b8";
key.getMetaString(prefix) === "foo:user:{0}:session:{1}";
```

### registerMetrics(registry)

register the metrics provided by this package with [prom-client](https://www.npmjs.com/package/prom-client) registry
npm package: @lokendras1/ecg
Description: Generates named components for an express app
Author: Lokendra Soni
Latest version: 1.0.0

# Express Component Generator

A simple package to generate named components for your express app.

Installation:

```
npm i @lokendras1/ecg -g
```

To create an express component in your app, follow the steps:

- Move to the directory in which you'd like to create the component.
- Run the command to initialize the components:
  
  ```
  ecg COMPONENT_NAME
  ```

- This would create `controllers`, `routes`, `services` and `tests` components in the respective directories.
npm package: @lokendrasurya/blackhole-sdk
Description: nvm use pnpm install
Author: lokendrasurya
Latest version: 4.2.2026-sepolia

# Algebra Integral SDK
nvm use
pnpm install

change POOL_DEPLOYER_ADDRESSES and POOL_INIT_CODE_HASH in addresses.ts

rm -rf dist
change version in package.json

pnpm run build
pnpm publish
npm package: @lokesh.dhakar/quantize
Description: A node.js module for color quantization, based on Leptonica.
Author: Olivier Lesnicki
Latest version: 1.4.0

quantize
========

Node.js module for color quantization, based on Leptonica.


Install
-------

	npm install quantize

Quick Overview
--------------

### Usage

```javascript
var quantize = require('quantize');

var arrayOfPixels = [[190,197,190], [202,204,200], [207,214,210], [211,214,211], [205,207,207]];
var maximumColorCount = 4;

var colorMap = quantize(arrayOfPixels, maximumColorCount);
```

* `arrayOfPixels` - An array of pixels (represented as [R,G,B arrays]) to quantize
* `maxiumColorCount` - The maximum number of colours allowed in the reduced palette

##### Reduced Palette

The `.palette()` method returns an array that contains the reduced color palette.

```javascript
// Returns the reduced palette
colorMap.palette(); 
// [[204, 204, 204], [208,212,212], [188,196,188], [212,204,196]]
```

##### Reduced pixel

The `.map(pixel)` method maps an individual pixel to the reduced color palette.

```javascript
// Returns the reduced pixel
colorMap.map(arrayOfPixels[0]);
// [188,196,188]
```

Author
------

* [Olivier Lesnicki](https://github.com/olivierlesnicki)

Contributors
------------

* [Nick Rabinowitz](https://github.com/nrabinowitz)
* [Mike Bostock](https://github.com/mbostock)

License
-------

Licensed under the MIT License.