open-index/open-npm huggingface dataset:
npm package: @nelson030/cerebellum-test-cli
Description: <!-- toc -->
Latest version: 0.0.9

## Table of contents

<!-- toc -->

<!-- tocstop -->

## Usage

<!-- usage -->
```sh-session
$ npm install -g @nelson030/cerebellum-test-cli
$ cerebellum COMMAND
running command...
$ cerebellum (--version)
@nelson030/cerebellum-test-cli/0.0.8 darwin-x64 node-v22.2.0
$ cerebellum --help [COMMAND]
USAGE
  $ cerebellum COMMAND
...
```
<!-- usagestop -->

## Commands

<!-- commands -->
* [`cerebellum hello`](#cerebellum-hello)

## `cerebellum hello`

```
USAGE
  $ cerebellum hello [--flag]

FLAGS
  --flag
```
<!-- commandsstop -->
npm package: @nelson030/testcli
Description: <!-- toc -->
Latest version: 1.0.0

## Table of contents

<!-- toc -->

<!-- tocstop -->

## Usage

<!-- usage -->
```sh-session
$ npm install -g new-oclif-cli
$ new-oclif-cli COMMAND
running command...
$ new-oclif-cli (--version)
new-oclif-cli/1.0.0 darwin-x64 node-v22.2.0
$ new-oclif-cli --help [COMMAND]
USAGE
  $ new-oclif-cli COMMAND
...
```
<!-- usagestop -->

## Commands

<!-- commands -->
* [`new-oclif-cli hello`](#new-oclif-cli-hello)
* [`new-oclif-cli hello2 [FILE]`](#new-oclif-cli-hello2-file)
* [`new-oclif-cli hello3 [FILE]`](#new-oclif-cli-hello3-file)

## `new-oclif-cli hello`

```
USAGE
  $ new-oclif-cli hello [--flag]

FLAGS
  --flag
```

## `new-oclif-cli hello2 [FILE]`

describe the command here

```
USAGE
  $ new-oclif-cli hello2 [FILE] [-f] [-n <value>]

ARGUMENTS
  FILE  file to read

FLAGS
  -f, --force
  -n, --name=<value>  name to print

DESCRIPTION
  describe the command here

EXAMPLES
  $ new-oclif-cli hello2
```

## `new-oclif-cli hello3 [FILE]`

describe the command here

```
USAGE
  $ new-oclif-cli hello3 [FILE] [-f] [-n <value>]

ARGUMENTS
  FILE  file to read

FLAGS
  -f, --force
  -n, --name=<value>  name to print

DESCRIPTION
  describe the command here

EXAMPLES
  $ new-oclif-cli hello3
```
<!-- commandsstop -->
npm package: @nelson_echeverria/bini
Description: this is a simple package that converts a string to its binary equivalent
Author: Nelson Echeverria
Latest version: 1.0.1

# bini
this is a simple package that converts a string to its binary equivalent

[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
![NPM Version](https://img.shields.io/npm/v/%40nelson_echeverria%2Fbini)

# motivation
i have been learning about buffers and streams in Nodejs, and part of what I saw was understanding how Nodejs handles binary data for transfer between computers, and it occurred to me to put into practice what I learned about binary data and I decided to create a silly package with it which one to play

# installation
to start using bini, you can install it from npm:

```bash
npm i @nelson_echeverria/bini
```

# usage
**get started:** create index.js and call bini, like here:

```js
const bini = require('@nelson_echeverria/bini')

console.log(bini('nelson')) // output: '01101110 01100101 01101100 01110011 01101111 01101110'
```

# license
**bini** is developed under the MIT license
npm package: @nelson_echeverria/watchman
Description: watchman is a package that will reload its js file with every change you make.
Author: Nelson Echeverria
Latest version: 1.1.0

# watchman
watchman is a package that will reload its js file with every change you make.

It is worth mentioning that to carry out this project, the author was inspired by existing packages such as nodemon, restart etc...

[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![npm (scoped)](https://img.shields.io/npm/v/%40nelson_echeverria/watchman)

# installation
to start using watchman, in your projects you can use:

```bash
npm i @nelson_echeverria/watchman --save-dev
```

or with shortcuts:

```bash
npm i @nelson_echeverria/watchman -D
```

# behavior
watchman will observe the folder in which the file passed by parameter is located, ignoring everything outside of it.

# usage
to implement watchman in your project, you can call watchman as a function and pass it the file name you want to monitor.

It would look something like this from **src/index.js**:

```js
// ECMAScript modules
import watchman from '@nelson_echeverria/watchman'

if(process.env.NODE_ENV === 'developement'){
    watchman('./app.js')
}
```

```js
// commonJS modules
const watchman = require('@nelson_echeverria/watchman').default

if(process.env.NODE_ENV === 'developement'){
    watchman('./app.js')
}
```

and look like this, into package.json:

```json
{
    "scripts": {
        "start:dev": "NODE_ENV=development node ./app.js"
    }
}
```

# example - wachman in action
![watchman output](./docs/watchman-output.png)

# license
watchman was developed under the MIT license
npm package: @nelsonlaidev/eslint-plugin
Description: Custom ESLint rules for Nelson Lai projects.
Author: Nelson Lai
Latest version: 0.2.4

# @nelsonlaidev/eslint-plugin

Custom ESLint rules for Nelson Lai projects.

## Installation

```bash
npm i -D @nelsonlaidev/eslint-plugin
```

## Usage

```js
import nelsonlaidevPlugin from '@nelsonlaidev/eslint-plugin'

export default [
  {
    plugins: {
      '@nelsonlaidev': nelsonlaidevPlugin,
    },
    rules: {
      '@nelsonlaidev/lucide-icon-suffix': 'error',
    },
  },
]
```

## Rules

| Rule                                                                   | Description                                                                      | Fixable |
| ---------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------- |
| [lucide-icon-suffix](docs/rules/lucide-icon-suffix.md)                 | Enforce using the `Icon` suffixed version of `lucide-react` imports              | Yes     |
| [lucide-restrict-import](docs/rules/lucide-restrict-import.md)         | Restrict specific imports from `lucide-react` and suggest preferred alternatives | Yes     |
| [shadcn-cn-wrap-variants](docs/rules/shadcn-cn-wrap-variants.md)       | Enforce wrapping `*Variants()` calls inside `cn()`                               | Yes     |
| [shadcn-cva-variants-suffix](docs/rules/shadcn-cva-variants-suffix.md) | Enforce that variables assigned to `cva()` end with `Variants`                   | Yes     |
| [shadcn-prefer-spinner](docs/rules/shadcn-prefer-spinner.md)           | Enforce using `<Spinner />` instead of loader icons from lucide-react            | No      |
npm package: @nelsonlaidev/oxfmt-config
Description: Personal Oxfmt configurations for Nelson Lai projects.
Author: Nelson Lai
Latest version: 0.1.3

# @nelsonlaidev/oxfmt-config

Personal Oxfmt configurations for Nelson Lai projects.

## Installation

```bash
npm i -D @nelsonlaidev/oxfmt-config
```

Create an `oxfmt.config.ts` file with the following content:

```ts
import { defineConfig } from '@nelsonlaidev/oxfmt-config'

export default defineConfig({
  // Custom Oxfmt configuration options
})
```

### What's Included

This config applies the following opinionated defaults:

- Single quotes
- JSX single quotes
- No semicolons
- 120 character print width
npm package: @nelsonlaidev/oxlint-config
Description: Personal Oxlint configurations for Nelson Lai projects.
Author: Nelson Lai
Latest version: 0.2.1

# @nelsonlaidev/oxlint-config

Personal Oxlint configurations for Nelson Lai projects.

This package is synced from `eslint-config` and aims to enable every supported Oxlint rule that is also enabled in `eslint-config`.

## Installation

```bash
npm i -D @nelsonlaidev/oxlint-config oxlint
```

Create an `oxlint.config.ts` file with the following content:

```ts
import { defineConfig } from '@nelsonlaidev/oxlint-config'

export default defineConfig({
  config: {
    // Custom OxLint configuration options
  },
  custom: {
    react: true,
  },
})
```

### Notes

This package follows `eslint-config` as the source of truth. When a rule is enabled there, we enable the corresponding Oxlint rule here when Oxlint supports it.

`unused-imports` is intentionally not included. That plugin requires type information, and Oxlint `jsPlugins` does not support that currently.

If you are using pnpm, add the following to your `.npmrc` to hoist ESLint plugin dependencies so the Oxlint can resolve them:

```ini
public-hoist-pattern[]=*eslint-plugin*
```

### What's Included

This config includes opinionated rules from the following plugins:

#### Always enabled

- `oxc`
- `eslint`
- `typescript`
- `unicorn`
- `promise`
- `node`
- `jsx-a11y`
- `import` / `import-sort`
- `jsdoc`
- `stylistic`
- `de-morgan`
- `zod`
- `regexp`
- `sonarjs`

#### Conditionally enabled

- `react` — auto-detected or via `react` option
- `nextjs` — auto-detected or via `nextjs` option
- `vitest` — via `vitest` option
- `playwright` — via `playwright` option
- `tailwindcss` — via `tailwindcss` option
npm package: @nelsonlaidev/prettier-config
Description: Personal Prettier configurations for Nelson Lai projects.
Author: Nelson Lai
Latest version: 0.3.0

# @nelsonlaidev/prettier-config

Personal Prettier configurations for Nelson Lai projects.

## Installation

```bash
npm i -D @nelsonlaidev/prettier-config prettier-plugin-packagejson
```

Create a `prettier.config.js` file with the following content:

```js
import { defineConfig } from '@nelsonlaidev/prettier-config'

export default defineConfig({
  // Custom Prettier configuration options
})
```
npm package: @nelsonlaidev/typescript-config
Description: Personal TypeScript configurations for Nelson Lai projects.
Author: Nelson Lai
Latest version: 1.2.1

# @nelsonlaidev/typescript-config

Personal TypeScript configurations for Nelson Lai projects.

## Installation

```bash
npm i -D @nelsonlaidev/typescript-config
```

Create a `tsconfig.json` file with the following content:

```jsonc
{
  "extends": "@nelsonlaidev/typescript-config/base.json",
  "compilerOptions": {
    // Custom TypeScript configuration options
  }
}
```

### Presets

You can also use predefined presets for your configuration.

- `@nelsonlaidev/typescript-config/base.json`
- `@nelsonlaidev/typescript-config/library.json`
- `@nelsonlaidev/typescript-config/nextjs.json`
- `@nelsonlaidev/typescript-config/react-library.json`
- `@nelsonlaidev/typescript-config/tanstack-start.json`
npm package: @nelsonomuto/axios-request-timeout
Description: wrapper to add timeout to axios request - [x] will throw an error when the timeout is passed and the code in the catch block will be executed.
Author: Nelson Omuto
Latest version: 1.0.4

# axios-request-timeout
wrapper to add timeout to axios request
- [x] will throw an error when the timeout is passed and the code in the catch block will be executed.

## install
```
yarn add @nelsonomuto/axios-request-timeout
```
or `npm i @nelsonomuto/axios-request-timeout`

## usage
```
import axiosRequest from '@nelsonomuto/axios-request-timeout';

try {
  await axiosRequest({
    url: 'https://www.cnn.com/',
    method: 'GET',
    timeout: 10
  });
} catch(error) {
  console.log({ error });
  expect(error).toEqual({'message': 'timeout cancel'});
}
```
npm package: @nelsonomuto/gender-info
Description: tell if a name is male/female
Author: Nelson Omuto
Latest version: 1.0.2


<!-- [![Build Status](https://travis-ci.org/nelsonomuto/@nelsonomuto/gender-info.svg?branch=master)](https://travis-ci.org/nelsonomuto/@nelsonomuto/gender-info) -->

<!-- [![Dependencies status](https://david-dm.org/nelsonomuto/@nelsonomuto/gender-info.svg?style=flat)](https://david-dm.org/nelsonomuto/@nelsonomuto/gender-info) [![devDependency Status](https://david-dm.org/nelsonomuto/@nelsonomuto/gender-info/dev-status.svg?style=flat&breakCache=0)](https://david-dm.org/nelsonomuto/@nelsonomuto/gender-info#info=devDependencies) -->
<span class="badge-npmversion"><a href="https://npmjs.org/package/@nelsonomuto/gender-info" title="View this project on NPM"><img src="https://img.shields.io/npm/v/@nelsonomuto/gender-info.svg" alt="NPM version" /></a></span>
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/@nelsonomuto/gender-info" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/@nelsonomuto/gender-info.svg" alt="NPM downloads" /></a></span>

<!-- [![Coverage Status](https://coveralls.io/repos/github/nelsonomuto/@nelsonomuto/gender-info/badge.svg?branch=master)](https://coveralls.io/github/nelsonomuto/@nelsonomuto/gender-info?branch=master) -->

# Gender-info
Determine the gender of a name using javascript api.

Artificial intelligence via synaptic library.

![gender-info 2018-12-23 09_12_26](https://user-images.githubusercontent.com/1546207/50384473-0972fa00-0693-11e9-9875-64032441f8bf.gif)


## Getting started
Install via `npm install @nelsonomuto/gender-info`

###Server side Example
```
const getGenderInfo =  require('@nelsonomuto/gender-info');

console.log(getGenderInfo('Ben Simmons'));
// { male: true, female: false, certainty: '76%'}

```

## Client side Example
TBD

# Local development
- Use yarn `yarn install`

## Train the algorithm
Run `yarn train`
npm package: @nelsonroque/watchthis
Description: A simple open-source logger of all browser events for behavioral research studies (i.e., those with participant consent).
Author: Nelson Roque, PhD
Latest version: 1.0.5

# @nelsonroque/watchthis

## Description
`@nelsonroque/watchthis` is a simple open-source logger of all browser events for behavioral research studies (i.e., those with participant consent). 

## Features
- Logs common browser events (e.g., `click`, `mousemove`, `keydown`).
- Dynamically creates UI elements (floating button and modal).
- Uses Plotly for visualizing event logs in a scatter plot.
- Allows downloading event logs in JSON format.

## Installation
You can install the package using npm:

```bash
npm install @nelsonroque/watchthis
```

Here’s a simple example of how to use the EventLogger class:

```
import EventLogger from '@nelsonroque/watchthis';

// Initialize the event logger
const logger = new EventLogger();

// By default, the event logger will track events like clicks, keypresses, and mouse movements.
To display the floating "Show Graph" button, add ?show_graph=true to your URL.
```

Using Custom Event Types: If you want to log only specific event types, pass them as an array when initializing the class:
```
const logger = new EventLogger(['click', 'mousemove']);
```

Initialize with anonymization and a blacklist of element IDs
``` 
const logger = new EventLogger(null, {
    anonymize: true,
    blacklist: ['passwordInput', 'creditCardForm']
});
```


## Demo
Use `watchthis` to dynamically creates UI elements like a floating button and modal to display logged events in a graphical format using Plotly, and supports downloading the logged events as JSON.

## Github Repo
https://github.com/nelsonroque/watchthis

## Roadmap
- Unit tests
- Logging to API every N seconds
- More graphs (mouse movements?)


[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/nelsonroque)

## License
MIT License. See the LICENSE file for more details.
npm package: @nelsontkq/ng-datatable
Description: DataTable component for Angular framework
Author: nelsontruran@best-inc.com
Latest version: 2.1.2

# Table component with sorting and pagination for Angular
It is a forked version of [ng-datatable](https://github.com/cmglez10/ng-datatable) updated to Angular 7.

[![npm version](https://badge.fury.io/js/%40nelsontkq%2Fng-datatable.svg)](https://badge.fury.io/js/%40nelsontkq%2Fng-datatable)

## 

## Installation

```
npm i @nelsontkq/ng-datatable --save
```

## Usage example

AppModule.ts
```typescript
import {NgModule} from "@angular/core";
...
import {DataTableModule} from "@nelsontkq/ng-datatable";

@NgModule({
    imports: [
        ...
        DataTableModule
    ],
    ...
})
export class AppModule {

}
```

AppComponent.html
```html
<table class="table table-striped" [mfData]="data" #mf="mfDataTable" [mfRowsOnPage]="5">
    <thead>
    <tr>
        <th style="width: 20%">
            <mfDefaultSorter by="name">Name</mfDefaultSorter>
        </th>
        <th style="width: 50%">
            <mfDefaultSorter by="email">Email</mfDefaultSorter>
        </th>
        <th style="width: 10%">
            <mfDefaultSorter by="age">Age</mfDefaultSorter>
        </th>
        <th style="width: 20%">
            <mfDefaultSorter by="city">City</mfDefaultSorter>
        </th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let item of mf.data">
        <td>{{item.name}}</td>
        <td>{{item.email}}</td>
        <td class="text-right">{{item.age}}</td>
        <td>{{item.city | uppercase}}</td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="4">
            <mfBootstrapPaginator [rowsOnPageSet]="[5,10,25]"></mfBootstrapPaginator>
        </td>
    </tr>
    </tfoot>
</table>
```

## API

### `mfData` directive

 - selector: `table[mfData]`
 - exportAs: `mfDataTable`
 - inputs
   - `mfData: any[]` - array of data to display in table
   - `mfRowsOnPage: number` - number of rows should be displayed on page (default: 1000)
   - `mfActivePage: number` - page number (default: 1)
   - `mfSortBy: any` - sort by parameter
   - `mfSortOrder: string` - sort order parameter, "asc" or "desc"
 - outputs
   - `mfSortByChange: any` - sort by parameter
   - `mfSortOrderChange: any` - sort order parameter
 
### `mfDefaultSorter` component

 - selector: `mfDefaultSorter`
 - inputs
   - `by: any` - specify how to sort data (argument for lodash function [_.sortBy ](https://lodash.com/docs#sortBy))
 
### `mfBootstrapPaginator` component
Displays buttons for changing current page and number of displayed rows using bootstrap template (css for bootstrap is required). If array length is smaller than current displayed rows on page then it doesn't show button for changing page. If array length is smaller than min value rowsOnPage then it doesn't show any buttons.

 - selector: `mfBootstrapPaginator`
 - inputs
   - `rowsOnPageSet: number` - specify values for buttons to change number of diplayed rows
npm package: @nelssec/qualys-mcp
Description: MCP server for Qualys security APIs - enables natural language interaction with vulnerability, asset, and cloud security data
Author: Andrew Nelson
Latest version: 2.1.0

# @nelssec/qualys-mcp

MCP server for Qualys security APIs - enables natural language interaction with vulnerability, asset, and cloud security data through Claude and other MCP-compatible AI assistants.

## Quick Start

```bash
# Run with MCP Inspector
npx @modelcontextprotocol/inspector npx @nelssec/qualys-mcp

# Or install globally
npm install -g @nelssec/qualys-mcp
```

## Configuration

Set environment variables:

```bash
export QUALYS_USERNAME=your-username
export QUALYS_PASSWORD=your-password
export QUALYS_POD=US1  # US1, US2, US3, US4, EU1, EU2, EU3, CA1, IN1, AE1, UK1, AU1
```

### Custom Platform Support

For engineering, development, or private cloud deployments:

```bash
export QUALYS_PLATFORM=qualysguard.p03.eng.sjc01.qualys.com
```

Or specify URLs directly:

```bash
export QUALYS_API_URL=https://qualysapi.custom.qualys.com
export QUALYS_GATEWAY_URL=https://gateway.custom.qualys.com
```

## Usage with Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "qualys": {
      "command": "npx",
      "args": ["@nelssec/qualys-mcp"],
      "env": {
        "QUALYS_USERNAME": "your-username",
        "QUALYS_PASSWORD": "your-password",
        "QUALYS_POD": "US1"
      }
    }
  }
}
```

For custom/engineering platforms:

```json
{
  "mcpServers": {
    "qualys": {
      "command": "npx",
      "args": ["@nelssec/qualys-mcp"],
      "env": {
        "QUALYS_USERNAME": "your-username",
        "QUALYS_PASSWORD": "your-password",
        "QUALYS_PLATFORM": "qualysguard.p03.eng.sjc01.qualys.com"
      }
    }
  }
}
```

## Features

- **61 MCP Tools** across 13 Qualys modules
- VMDR, Container Security, Global AssetView, KnowledgeBase
- TotalCloud (AWS, Azure, GCP, OCI), Patch Management
- EDR, FIM, WAS, Compliance, CertView, CAR
- Cross-module workflows for risk prioritization

## Example Queries

- "Am I affected by CVE-2024-3094?"
- "Show me critical vulnerabilities on internet-facing assets"
- "What should I fix first on my external attack surface?"
- "List AWS EC2 instances with failing security controls"

## Documentation

See [GitHub repo](https://github.com/nelssec/qualys-mcp) for full documentation.

## License

MIT
npm package: @nelts/agent
Description: agent for nelts
Author: cevio
Latest version: 1.0.33

# @nelts/messager

messager for nelts

# Usage

```bash
npm i @nelts/messager
```

by ts:

```ts
import { Base, Master, Worker, Agent } from '@nelts/messager';
const master = new Master<APP>(app);
const worker = new Worker<APP>(app, mpid);
const agent = new Agent<APP>(app, mpid);

[which target].receiveMessage(message, socket);
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/cli
Description: nelts client line inteface tool
Author: cevio
Latest version: 1.0.12

# @nelts/cli

`nelts`命令行工具

## Usage

在项目中安装工具

```bash
npm i @nelts/cli
```

## Server commanders

```bash
Usage: nelts-server [options] [command]

Options:
  -v, --version    output the version number
  -h, --help       output usage information

Commands:
  dev [options]
  start [options]
  restart
  stop
```

### dev

```bash
Usage: dev [options]

Options:
  -b, --base <base>      project base dir<like package.json dirname> (default: ".")
  -m, --max <max>        how many process would you like to bootstrap (default: 0)
  -c, --config <config>  where is the config file which named nelts.config.<ts|js> (default: "nelts.config")
  -p, --port <port>      which port do server run at? (default: 8080)
  -h, --help             output usage information
```

### start

```bash
Usage: start [options]

Options:
  -b, --base <base>      project base dir<like package.json dirname> (default: ".")
  -m, --max <max>        how many process would you like to bootstrap (default: 0)
  -c, --config <config>  where is the config file which named nelts.config.<ts|js> (default: "nelts.config")
  -p, --port <port>      which port do server run at? (default: 8080)
  -h, --help             output usage information
```

### restart

```bash
Usage: restart [options]

Options:
  -h, --help  output usage information
```

### stop

```bash
Usage: stop [options]

Options:
  -h, --help  output usage information
```

## Client commanders

```bash
Usage: nelts [options] [command]

Options:
  -v, --version   output the version number
  -h, --help      output usage information

Commands:
  init [project]
```

### init

```bash
Usage: init [options] [project]

Options:
  -h, --help  output usage information
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2018-present, yunjie (Evio) shen
npm package: @nelts/context
Description: utils for nelts
Author: cevio
Latest version: 1.0.17

# @nelts/context

context for nelts

# Usage

```bash
npm i @nelts/context
```

by ts:

```ts
import Context from '@nelts/context';
type BodyType = { [name: string]: any };
type FileType = { [name: string]: any };
const ctx = new Context<APP, BodyType, FileType>(app, req, res, {
  cookie, params, logger,
});
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/dubbo
Description: dubbo for nelts worker
Author: cevio
Latest version: 1.0.35

# @nelts/dubbo

service module using dubbo for nelts

# Usage

```bash
npm i @nelts/dubbo
```

## Preview

![code demo](images/preview.jpeg)

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/factory
Description: messager for nelts
Author: cevio
Latest version: 1.0.24

# @nelts/factory

factory for nelts

# Usage

```bash
npm i @nelts/factory
```

by ts:

```ts
import { 
  Factory,
  Plugin,
  InCommingMessage,
  Loader,
  Compiler,
 } from '@nelts/factory';
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/http
Description: http for nelts worker
Author: cevio
Latest version: 1.0.53

# @nelts/messager

messager for nelts

# Usage

```bash
npm i @nelts/messager
```

by ts:

```ts
import { Base, Master, Worker, Agent } from '@nelts/messager';
const master = new Master<APP>(app);
const worker = new Worker<APP>(app, mpid);
const agent = new Agent<APP>(app, mpid);

[which target].receiveMessage(message, socket);
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/master
Description: master for nelts
Author: cevio
Latest version: 1.0.54

# @nelts/messager

messager for nelts

# Usage

```bash
npm i @nelts/messager
```

by ts:

```ts
import { Base, Master, Worker, Agent } from '@nelts/messager';
const master = new Master<APP>(app);
const worker = new Worker<APP>(app, mpid);
const agent = new Agent<APP>(app, mpid);

[which target].receiveMessage(message, socket);
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/messager
Description: messager for nelts
Author: cevio
Latest version: 1.0.27

# @nelts/messager

messager for nelts

# Usage

```bash
npm i @nelts/messager
```

by ts:

```ts
import { Base, Master, Worker, Agent } from '@nelts/messager';
const master = new Master<APP>(app);
const worker = new Worker<APP>(app, mpid);
const agent = new Agent<APP>(app, mpid);

[which target].receiveMessage(message, socket);
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/orm
Description: nelts orm
Author: cevio
Latest version: 1.0.25

# @nelts/orm

nelts架构的ORM库。

## Install

```bash
npm i @nelts/orm
```

## Configure

```ts
import { Plugin } from '@nelts/nelts';
export default async (app: Plugin) => {
  app.on('props', async configs => {
    await app.getComponent('@nelts/orm').props({
      // sequelize configs: http://docs.sequelizejs.com/manual/dialects.html
      sequelize: {
        database: configs.sequelize.database,
        username: configs.sequelize.username,
        password: configs.sequelize.password,
        options: configs.sequelize.options,
      },
      // local redis: true
      // object redis: { port, host }
      // string redis: `${host}:${port}`
      redis: '192.168.2.208:6379'
    });
  });
}
```

## Sequelize Models

在项目目录下存在一个`sequelize`目录，里面指定的目录结构是这样的 `sequelize/${database_name}/${table_name}.ts`。每个ts文件内容请参考[这里](http://docs.sequelizejs.com/manual/typescript.html)

```ts
import { sequelize } from '@nelts/orm';
const { Sequelize, Model, DataTypes } = sequelize;

export default class Maintainers extends Model {
  public id: number;
  public account: string;
  public pid: number;
  public ctime: Date;

  public static installer(sequelize: Sequelize) {
    Maintainers.init({
      id: {
        type: DataTypes.INTEGER.UNSIGNED,
        primaryKey: true,
        autoIncrement: true
      },
      account: DataTypes.STRING(100),
      pid: DataTypes.INTEGER({ length: 11 }),
      ctime: DataTypes.DATE
    }, {
      tableName: 'maintainer',
      sequelize,
      createdAt: 'ctime',
      updatedAt: 'utime',
      charset: 'utf8',
      collate: 'utf8_general_ci',
    });
  }
}
```

`public static installer(sequelize: Sequelize)` 函数必须存在，定义创建表的结构。

## Redis

Redis是存在于 `ctx.redis` 上。

## Redis operations

- `set(key: string, obj: any, expire?: number): Promise<void>`;
- `get(key: string): Promise<any>`;
- `exists(key: string): Promise<any>`;
- `delete(key: string): Promise<any>`;
- `clear(): Promise<void>`;

具体请看 `/src/redis.ts` 源码。

## Use Cacheable in service

```ts
import { Component, Context } from '@nelts/nelts';
import { Cacheable, CacheableInterface } from '../index';
export default class IndexService extends Component.Service {
  constructor(ctx: Context) {
    super(ctx);
  }

  @Cacheable('/test/:id(\\d+)')
  async valid() {
    return await this.ctx.dbomaintainer.findAll({
      attributes: ['id', 'pid', 'account', 'ctime']
    });
  }

  async get() {
    const obj: CacheableInterface = await this.valid();
    return await obj.get({ id: 123 });
  }
}
```

`@Cacheable('/test/:id(\\d+)')`注解指定service的方法`valid`是一个缓存函数。那么可以如下调用：

```ts
// eg: in controller
const service = new this.service.IndexService(ctx);
const obj: CacheableInterface = await service.valid();
const result = await obj.invoke();
const result = await obj.set({ id: 234 }, 10000);
const result = await obj.get({ id: 234 }, 10000);
await obj.delete({ id: 234 });
```

## License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/process
Description: nelts client inteface line tool
Latest version: 1.1.26

# @nelts/process

`nelts`安全进程辅助架构。

## Usage

在项目中安装工具

```bash
npm i @nelts/process
```

开发模式下启动

```bash
ts-node node_modules/@nelts/cli/dist/runtime.ts --script={start file name}
```

生产环境下启动，建议使用[PM2](https://www.npmjs.com/package/pm2)启动。

```bash
pm2 start node_modules/@nelts/cli/dist/runtime.js --name={name} -- --script={start file name}
```

## Lifecycle

每个启动的进程对应一个script文件地址，它具有以下的生命周期：

- `componentWillCreate` 进程启动前执行函数 此时 *messager* 不可用
- `componentDidCreated` 进程启动完毕执行函数 此时 *messager* 可用
- `componentWillDestroy` 进程结束前执行函数 此时 *messager* 可用
- `componentDidDestroyed` 进程结束后执行函数 此时 *messager* 不可用
- `componentCatchError` 统一错误捕获 参数为 `error: Error`
- `componentReceiveMessage` 统一消息接受函数 `(message, socket) => {}`

script文件内容必须是一个返回的class对象

eg:

```javascript
import { Component, Processer } from '@nelts/process';

export default class DemoComponent extends Component {
  constructor(processer: Processer, args: { [name:string]: any }) {
    super(processer, args);
  }
  async componentWillCreate() {}
  async componentDidCreated() {}
  async componentWillDestroy() {}
  async componentDidDestroyed() {}
  componentCatchError(err: Error) {}
  componentReceiveMessage(message:any, socket?:any) {}
}
```

它具有以下隐式方法

- `this.send(message:any, socket?:any)` 发送消息
- `this.kill(pid?: number)` 杀掉进程
- `this.createAgent(name: string, file: string, _args?: any)` 创建子agent进程
- `this.createWorkerForker(file: string, _args?: any)` 创建子worker进程

## this.send(message:any, socket?:any)

- `message` {object} 消息体 `{ to, event, data }`
- `socket` socket对象

发送消息

```javascript
this.send({
  to: 'test',
  event: 'abc',
  data: {
    a: 1
  }
});
```

## this.kill(pid?: number)

杀掉自身进程或者指定进程，或者全局结束所有进程

- `pid` 进程ID。如果省略就是杀掉所有相关进程。

```javascript
this.kill(process.pid);
this.kill(0); // 0 表示杀死全部
```

## this.createAgent(name: string, file: string, _args?: any)

创建一个agent进程

- `name` 进程名
- `file` 进程执行文件地址
- `_args` 额外参数 为json数据

```javascript
import { Node } from '@nelts/process';
const agent: Node = await this.createAgent('test', 'test/file.js');
// agent 就是对应的Node进程节点
```

## this.createWorkerForker(file: string, _args?: any)

创建一个worker进程forker。

- `file` 进程执行文件地址
- `_args` 额外参数 为json数据

```javascript
const fork = this.createWorkerForker('test/worker.js');
await fork();
await fork();
await fork();
await fork();
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2018-present, yunjie (Evio) shen
npm package: @nelts/redis
Description: The description of this project
Author: cevio
Latest version: 1.0.3

# @nelts/redis

基于[ioredis](https://www.npmjs.com/package/ioredis)的nelts插件。

# Usage

```bash
npm i @nelts/redis
```

# Example

```ts
import { AutoBindRedis } from '@nelts/redis';

export default (plu: LocalMasterPlugin) => {
  plu.on('props', async configs => {
    AutoBindRedis('reids', plu, configs.redis);
  });
}
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/utils
Description: utils for nelts
Author: cevio
Latest version: 1.0.20

# @nelts/utils

utils for nelts

# Usage

```bash
npm i @nelts/utils
```

by ts:

```ts
import * as utils from '@nelts/utils';
```

## utils.LRU

```ts
import { LRU, LRU_OPTIONS, LRU_VALUE } from '@nelts/utils';
const lru = new LRU<string>(1000);
lru.set('abc', 123, { maxAge: 10000 });
lru.get('abc', { maxAge: 10000 });
lru.keys();
```

## utils.IsJson

```ts
import { IsJson } from '@nelts/utils';
IsJson('abc'); // false
IsJson({ a: 1 }); // true
```

## utils.Compose

```ts
import { Context } from '@nelts/netls';
import { Compose, ComposeNextCallback, ComposeMiddleware, ComposedMiddleware } from '@nelts/utils';
const ctx = new Context();
const stacks: ComposeMiddleware<Context>[] = [];
stacks.push(async (ctx: Context, next: ComposeNextCallback) => await next());
stacks.push(async (ctx: Context, next: ComposeNextCallback) => await next());
stacks.push(async (ctx: Context, next: ComposeNextCallback) => await next());
const fnMiddleware = Compose<Context>(stacks);
fnMiddleware(ctx[, fn: ComposeMiddleware]).then(() => {}).catch(e => {});
```

## utils.Require

abc.ts

```ts
export const a = 1;
export default () => {}
```

```ts
import { Require, RequireDefault } from '@nelts/utils';
const { a, default } = Require<{ a: number, default: () => {} }>('abc.ts');
const fn = RequireDefault<() => {}>('abc.ts'); // fn == () => {}
```

## utils.Collect

```ts
import { Collect, COLLECT_OPTIONS, DEFINE_PLUGIN_OPTIONS, PLUGIN_COLLECT_RESULT, NELTS_PACKAGE_JSON_INTERFACE } from '@nelts/utils';
Collect(cwd: string, node_module_path: string, options: COLLECT_OPTIONS): PLUGIN_COLLECT_RESULT;
```

## utils.AjvChecker

```ts
import { AjvChecker } from '@nelts/utils';
AjvChecker({
  type: 'object',
  properties: {
    a: {
      type: 'integer',
      default: 1
    }
  }
}, { a: 2 });
```

## utils.ErrorInject

```ts
import { ErrorInject } from '@nelts/utils';
ErrorInject(stream: Stream, error: (err: Error) => void): Stream;
```

## utils.EventEmitter

```ts
import { EventEmitter } from '@nelts/utils';
const e = new EventEmitter();
e.on('abc', async (c: string) => console.log(c));
e.emit('abc', 'x').then(() => {}).catch(e => {});
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelts/worker
Description: worker for nelts
Author: cevio
Latest version: 1.0.44

# @nelts/messager

messager for nelts

# Usage

```bash
npm i @nelts/messager
```

by ts:

```ts
import { Base, Master, Worker, Agent } from '@nelts/messager';
const master = new Master<APP>(app);
const worker = new Worker<APP>(app, mpid);
const agent = new Agent<APP>(app, mpid);

[which target].receiveMessage(message, socket);
```

# License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2019-present, yunjie (Evio) shen
npm package: @nelwhix/goserve
Description: Golang CLI for starting blazing fast server for your local sites
Author: Nelson Isioma
Latest version: 1.1.10

# GoServe
CLI for starting blazing fast server for your local sites. Also perfect for designing Html, css
templates

## Installation
You can install goserve globally from npm
```bash
    npm i -g @nelwhix/goserve
```

To confirm it is downloaded, run
```bash
goserve -h
```

## Usage
For now, Serve supports just HTML, CSS and Javascript
```bash
    goserve # this starts a server on port 3000

    # To use a custom port run
    goserve -p 5173

    # To serve another folder
    goserve -root "/Desktop/my-cool-site/dist"

    # goserve -root "/Desktop/my-cool-site/dist/index.html" won't work because the root flag needs a directory to serve not a file
```

For local development, you will need to add this script tag to your html head

```html
    <script src="https://nelwhix-serve.s3.eu-central-1.amazonaws.com/serve.js"></script>
```
this downloads a script that listens for filechange events
from the server

### Troubleshooting
On Windows, if after install the goserve command is not available. Confirm that the nodejs bin directory is in your system's environment variables PATH