open-index/open-npm huggingface dataset:
npm package: @heartreup/prettier-config
Description: A prettier config for heart-re-up's projects.
Author: heart-re-up
Latest version: 1.0.0

# Prettier Config

## Install

```bash
pnpm add -D @heartreup/prettier-config
```

## Usage

```javascript
// .prettierrc.js
module.exports = '@heartreup/prettier-config';
```

## configure with eslint (optional)

-   extends `eslint-config-prettier`
-   plugins `eslint-plugin-prettier`
-   rules `prettier/prettier` to `error`

```bash
pnpm add -D eslint-config-prettier eslint-plugin-prettier
```

then add to eslint config.

```javascript
// .eslintrc.js
module.exports = {
    extends: [
        // ... other extends(config)
        'prettier',
    ],
    plugins: [
        // ... other plugins
        'prettier',
    ],
    rules: {
        'prettier/prettier': 'error',
        // ... other rules for overriding
    },
};
```
npm package: @heartreup/script-loader
Description: A async javascript loader
Author: heart.re.up
Latest version: 0.0.4

# @heartreup/script-loader

# How to install.

```shell
# npm
npm i @heartreup/script-loader

# yarn
yarn add @heartreup/script-loader

# pnpm
pnpm add @heartreup/script-loader
```

Load a script synchronously or asynchronously.

# Usages.

Use with callbacks.

```ts
import { loadScriptSync } from "@heartreup/script-loader";

loadScriptSync(
    'https://something.com/something/path/javascript-file.js',
    (el: HTMLScriptElement) => console.log(el),
    (ev: ErrorEvent) => console.error(ev),
);
```

Use with a promise.

```ts
import { loadScript } from "@heartreup/script-loader";

const load = async () => {
    const el = await loadScript('https://something.com/something/path/javascript-file.js');
}
```
npm package: @heartreup/tsconfig
Description: A base tsconfig for heart-re-up's projects.
Author: heart-re-up
Latest version: 1.0.1

# tsconfig

## Installation

```bash
pnpm add -D @heartreup/tsconfig
```

## Default Usage

```
// tsconfig.json
{
    "extends": ["@heartreup/tsconfig/tsconfig.default.json"], // Extend the default tsconfig.
    "include": ["src/**/*.ts"], // Optional: Specify the files to include.
    "exclude": ["node_modules", "dist"] // Optional: Specify the files to exclude.
}
```
npm package: @heartsradiant/pluginus
Description: Dependency injection with promise support. - Heartsradiant's fork
Author: Andrei Dumitrescu
Latest version: 3.1.3

<!-- markdownlint-disable first-line-h1 line-length -->

[![CircleCI](https://circleci.com/gh/asd-xiv/pluginus.svg?style=svg)](https://circleci.com/gh/asd-xiv/pluginus)
[![npm version](https://badge.fury.io/js/%40asd14%2Fpluginus.svg)](https://www.npmjs.com/package/%40asd14%2Fpluginus)
[![Coverage Status](https://coveralls.io/repos/github/asd-xiv/pluginus/badge.svg)](https://coveralls.io/github/asd-xiv/pluginus)

# pluginus

Dependency injection with promise support for Node.js.

This is Heartsradiant's fork.

<!-- vim-markdown-toc GFM -->

- [Install](#install)
- [Use](#use)
- [Develop](#develop)
- [Changelog](#changelog)

<!-- vim-markdown-toc -->

## Install

```bash
npm install @asd14/pluginus
```

## Use

`plugin-1.js`

```js
exports default {
  /**
   * Which plugins need loading before this one
   *
   * @type {string[]}
   */
  depend: [],

  /**
   * Name other plugins can use to reference and use this plugin
   *
   * @type {string}
   */
  name: "PluginOne",

  /**
   * Factory function, only runs once when ititialized. The value this function
   * returns or resolves to will be passed to other plugins depending on it.
   *
   * @param {any} ...dependentPlugins
   *
   * @returns {* | Promise<*>}
   */
  create: () => {
    return new Promise(resolve => {
      setTimeout(() => {
        resolve({
          foo: "bar",
        })
      }, 50)
    })
  },
}
```

`plugin-2.js`

```js
export default {
  depend: ["PluginOne"],

  name: "Plugin2",

  create: PluginOne => ({
    lorem: `ipsum ${PluginOne.foo}`,
  }),
}
```

`index.js`

```js
import { pluginus } from "@asd14/pluginus"

pluginus({
  source: ["path-to-plugin1", "path-to-plugin2"],
}).then(({ PluginOne, Plugin2 }) => {
  // PluginOne
  // => {
  //   foo: "bar",
  // }
  // Plugin2
  // => {
  //   lorem: "ipsum bar",
  // }
})
```

## Develop

```bash
git clone git@github.com:asd-xiv/pluginus.git && \
  cd pluginus && \
  npm run setup
```

Run all `*.test.js` in `src` folder

```bash
npm test
```

Watch `src` and `examples` folder for changes and re-run tests

```bash
npm run tdd
```

## Changelog

See the [releases section](https://github.com/asd-xiv/pluginus/releases) for
details.
npm package: @heat/coffeescript-jest-preset
Description: Jest preset for Coffeescript
Author: Rodrigo Fernandes da Costa
Latest version: 0.0.9
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Coffeescript jest preset

Jest preset for Coffeescript.

## How to use

```bash
npm install coffeescript-jest-preset --save-dev
```

In your jest settings add `coffeescript-jest-preset` preset.

```json
{
  "preset": "coffeescript-jest-preset"
}
```

## Known issues

I still don't have code coverage working. If you manage to get it working, feel
free to create a pull request.

## License

[MIT License](http://www.opensource.org/licenses/mit-license.php)
npm package: @heat/cognito
Description: Lightweight AWS Cognito client for the browser.
Latest version: 0.0.42

# @heat/cognito [![NPM Version](https://img.shields.io/npm/v/@heat/cognito.svg)](https://www.npmjs.com/package/@heat/cognito)

Super lightweight AWS Cognito client for both the browser & nodejs. Uses the native web crypto & BigInt features in the browser & we designed the API to be tree shakable to keep the package as small as possible.

_GZip Size: ~12kB_

## Installation

```sh
npm install --save @heat/cognito

# using yarn:
yarn add @heat/cognito
```

# NodeJS

In nodejs you should polyfill both the webcrypto & fetch API if nodejs doesn't already support it.

```js
import { webcrypto } from 'node:crypto';
import fetch from 'node-fetch';

globalThis.crypto = webcrypto;
globalThis.fetch = fetch;
```

# Stores

Depending on your use case you might want to use one of the following stores.

- __MemoryStore__ - Mostly used for debugging and when you don't want to persist the login token.

- __LocalStore__ - Used to store the login token on the client only.

- __CookieStore__ - The CookieStore is useful in scenarios like SSR, when you need access to the login token on the client as well as on the server. (The server will need to polyfill the fetch & web crypto API)

# Examples

## Setup

```js
import { Client, LocalStore } from '@heat/cognito';

const client = new Client({
  clientId: 'CLIENT_ID',
  userPoolId: 'USER_POOL_ID',
  store: new LocalStore()
});
```

## Sign Up

```js
import { signUpCommand, confirmSignUpCommand } from '@heat/cognito';

await signUpCommand(client, {
  email: 'EMAIL',
  username: 'USER',
  password: 'PASS',
});

// Let the user fill in his confirmation code.
await confirmSignUpCommand(client, {
  username: 'USER',
  code: 'SIGN_UP_CONFIRMATION_CODE'
})
```

## Sign In

```js
const session = await signInCommand(client, {
  username: 'USER',
  password: 'PASS',
});

// Log logged in user.
console.log(session.getUser());
```

## Sign Out

```js
await signOutCommand(client);
```

## Get Active Login Session

```js
const session = await sessionCommand(client);

// Log access token
console.log(session.accessToken.toString());

// Log ID token
console.log(session.idToken.toString());
```

## Change Password

```js
await changePasswordCommand(client, {
  previousPassword: 'PREV_PASS',
  proposedPassword: 'NEW_PASS',
});
```

## Custom Call

```js
const response = await client.call('API_NAME', {
  ...
});
```

## License

MIT
npm package: @heat/container
Description: A badly done DI container
Latest version: 0.0.1

# emerald-js Container

A badly done DI container

# Usage

```js
const {Container, add, factory} = require("@emerald-js/container");
const c = new Container();

c.configure({
  'options': ['fireworks', 'cake'],
  // All functions are implied singletons
  'singleton': c => c.get('options'),
  // Factories will be executed everytime
  'factory': factory(c => c.get('options')),
});

console.log(c.get('options')); // => ['fireworks', 'cake']
console.log(c.get('singleton')); // => ['fireworks', 'cake']
console.log(c.get('factory')); // => ['fireworks', 'cake']

c.configure({
  'options': add('shaved ice')
});

console.log(c.get('options')); // => ['fireworks', 'cake', 'shaved ice']
console.log(c.get('singleton')); // => ['fireworks', 'cake']
console.log(c.get('factory')); // => ['fireworks', 'cake', 'shaved ice']

c.configure({
  'options': []
});

console.log(c.get('options')); // => []
console.log(c.get('singleton')); // => ['fireworks', 'cake']
console.log(c.get('factory')); // => []
```

# API

## `Container`

### `.add(name, values)`

Add values to array located on `name`, or will create a new array

Shorthand for `Container.define(name, add(values))`

### `.factory(name, factoryFunc)`

Add factory to Container

Shorthand for `Container.define(name, factory(factoryFunc))`

### `.singleton(name, factoryFunc)`

Add singleton factory to Container

### `.configure(keyValueObj)`

Adds all items in object to container, accepts modifiers like `.define`

### `.define(name, value)`

Add items to container by name, accepts modifiers

### `.get(name, ...args)` or `.make(name, ...args)`

Retrieve item from Container, args is also given to the factory function if applies

### `.g`

An object on which you can receive all items by a getter e.g.

```js
c.define('hello-world', 'yes')

c.g.helloWorld // => 'yes'
c.g['hello-world'] // => 'yes
```

## Modifiers

### `get(name, ...args)`

Will always fetch name from container with given args for this item

```js
c.define('test', factory((c, ...args) => console.log({ args })));
c.define('get_test', get('test', 'no no no'));

c.get('test', 'yes'); // => { args: ['no no no'] }
```

### `add(...items)`

If an array already exists, items will be added to it

### `alias(name)`

Will fetch `name` instead and keep arguments intact

### `factory(func)`

Will create a non-singleton factory

### `value(val)`

Will keep given value intact, helpful when you want to provide a function via the Container
npm package: @heat/redis-token-bucket-ratelimiter
Description: Rolling rate limit in redis via a lua script
Latest version: 0.0.1

# node-redis-token-bucket-ratelimiter #

A rolling rate limit using Redis. Original idea from [Peter Hayes](https://engineering.classdojo.com/blog/2015/02/06/rolling-rate-limiter/).
Uses a lua script for atomic operations and to prevent blocked actions from substracting
from the bucket.

Compatible with Redis Cluster.

### Usage ###

```JS
const RollingLimit = require('redis-token-bucket-ratelimiter');
const Redis = require('ioredis');
const redisClient = new Redis({port});
const defaultLimiter = new RollingLimit({
  interval: 5000,
  limit: 3,
  redis: redisClient,
});
```

## RollingLimit Methods ##

### limiter = new RollingLimit(options) ###

Creates a new RollingLimit instance.

Options:
* `limit`: (required) maximum of allowed uses in `interval`
* `interval`: (required) millisecond duration for the `limit`
* `redis`: (required) an [ioredis](https://www.npmjs.com/package/ioredis) or [node-redis](https://www.npmjs.com/package/ioredis) client instance
* `prefix`: (optional) a string to prepend before `id` for each key
  * Useful for avoiding collisions between applications or versions of an application
* `force`: (optional) a boolean to force an accept, but draining the bucket if necessary
  * This allows the limiter to go negative. Use for instances where an action must be allowed, but you still want to deduct from the limit.

### limiter.use(id: string): Promise ###
### limiter.use(id: string, amount?: number): Promise ###

Takes a token from the limit's bucket for `id` in redis and returns a promise with
the limit response object:
* `numLeft`: (number >= 0) the number of tokens left in the bucket
* `rejected`: (boolean) whether or not the request was rejected
* `retryDelta`
* `amount`: the number of tokens to take from the bucket and defaults to `1`.

If you want to get the count of tokens left, send in an `amount` of `0`.

### static RateLimiter.stubLimit(max) ###

Synchronously returns a fake-but-complete response object, with the supplied max for a limit
npm package: @heat/step-functions-local
Description: **A wrapper around Amazon's StepFunctions Local to start and stop it from Node.js.**
Latest version: 0.0.6

# @heat/step-functions-local

**A wrapper around Amazon's StepFunctions Local to start and stop it from Node.js.**

[![version](https://img.shields.io/npm/v/@heat/step-functions-local.svg?style=flat-square)](https://www.npmjs.com/package/@heat/step-functions-local)

This module wraps Amazon's
[StepFunctions Local](https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local.html).
It just exposes one method called `spawn()` which does not much more than calling
[`child_process.spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)
and returning it's result.

```js
const stepFunctionsLocalProcess = dynamoDbLocal.spawn();
// ...
stepFunctionsLocalProcess.kill();
```

A property the options object could have is port. It specifies the port number that the
process will run on. In absence of the port property, 8083 is used as the port number.

```js
const port = 8083;
const stepFunctionsLocalProcess = stepFunctionsLocal.spawn(port);
// ...
stepFunctionsLocalProcess.kill();
```
npm package: @heathbar/home-assistant-rxjs
Description: RxJs wrapper for home assistant state changes
Author: Heath Paddock
Latest version: 1.0.0

# home-assistant-rxjs
A simple service that exposes Home Assistant events as an RxJs stream (with TypeScript support).

## Usage

### Subscribe to all changes of all entities

```TypeScript
const hass = new HomeAssistant('http://192.168.0.101:8123');

hass.entities$.subscribe(entities => console.log(entities));
hass.config$.subscribe(entities => console.log(entities));
hass.services$.subscribe(entities => console.log(entities));
```

### callService

Call any Home Assistant service

```TypeScript
await hass.callService('light', 'turn_on', { entity_id: 'light.my_light', brightness_pct: 50, color_name: 'blue' });

await hass.callService('media_player', 'media_play_pause', { entity_id: 'media_player.my_music_player'});

await hass.callService('script', 'party_time');
```
### selectEntity

Filters out all events except for the specified entity

```TypeScript
hass.entities$.pipe(
    selectEntity('sensor.temperature')
).subscribe(temperatureEntity => console.log(temperatureEntity));

// Emits HassEntity instances 

{
    attributes: { 
        device_class: "temperature"
        friendly_name: "Outdoor Temperature"
        icon: "mdi:thermometer"
        unit_of_measurement: "°F"
    },
    context: { ... },
    entity_id: 'sensor.temperature',
    last_changed: "2021-09-25T05:18:10.850272+00:00"
    last_updated: "2021-09-25T05:18:10.850272+00:00",
    state: '47.4'
}

```

### selectEntityState

Filters out all events except for the specified entity and emit only the current state of the given entity

```TypeScript
hass.entities$.pipe(
    selectEntityState('sensor.temperature')
).subscribe(temperatureState => console.log(temperatureState));

// Emits strings

'47.4'
```

## Additional Information

This library was designed with the browser in mind, although it would not be much work to make it work in node. 

This library relies on the official [home-assistant-js-websocket](https://github.com/home-assistant/home-assistant-js-websocket) library to provide OAuth authorization to your Home Assistant instance.

On first launch, the library will forward the browser to the specified Home Assistant host to initiate an OAuth session. On success, the library will store the auth token it receives in sessionStorage.

#### autoConnect

By default, the library will initiate a connection when you create a new `HomeAssistant` instance. This can be disabled as follows

```TypeScript
const hass = new HomeAssistant('http://192.168.0.101:8123', { autoConnect: false });

// and later...

await hass.connect()
```

#### tokenKey

By default, the library will store its auth token in session storage under the key `hass-token`. This can be changed as follows

```TypeScript
const hass = new HomeAssistant('http://192.168.0.101:8123', { tokenKey: 'some-other-key' });
```