open-index/open-npm huggingface dataset:
npm package: @megalo/cli
Description: megalo project template
Author: zwwill
Latest version: 1.0.0-beta.2

# template-megalo

> megalo project template

## useage

install

``` bash
$ npm i -g sao
```

build and create project

``` bash
$ sao npm:@megalo/cli@latest your-project-name --update
```

enter the project root directory

``` bash
$ cd your-project-name
```

running

``` bash
$ npm run dev:wechat
```
npm package: @megalo/cli-plugin-eslint
Description: eslint plugin for megalo-cli
Author: bigMeow
Latest version: 1.0.0-beta.2

# @megalo/cli-plugin-mp

> eslint plugin for megalo-cli

## 注入的命令

- **`megalo-cli-service lint`**

  ```
  Usage: megalo-cli-service lint [options] [...files]

  Options:

    --format [formatter] specify formatter (default: codeframe)
    --no-fix             do not fix errors
    --max-errors         specify number of errors to make build failed (default: 0)
    --max-warnings       specify number of warnings to make build failed (default: Infinity)
  ```

  检查提示以及修复文件格式。 如果没有特别指定文件或目录，默认情况下它会检查 `src` 和 `test` 目录下的所有文件

  另外 [ESLint CLI options](https://eslint.org/docs/user-guide/command-line-interface#options) 这里的选项也是支持的.

## 配置

ESLint可以通过 `.eslintrc` 或 `package.json` 中的 `eslintConfig` 字段进行配置。

默认情况下启用 `eslint-loader` 进行开发时的保存。 可以使用 `megalo.config.js` 中的 `lintOnSave` 选项禁用它：

``` js
module.exports = {
  lintOnSave: false
}
```

设置为 `true` 时，`eslint-loader` 会将 lint 错误输出为编译警告。默认情况下，警告仅仅会被输出到命令行，且不会使得编译失败。

如果你希望让 `lint` 错误在开发时直接显示在浏览器中，你可以使用 `lintOnSave: 'error'`。这会强制 `eslint-loader` 将 `lint` 错误输出为编译错误，同时也意味着 `lint` 错误将会导致编译失败。

或者，你也可以通过设置让浏览器 `overlay` 同时显示警告和错误：

``` js
// megalo.config.js
module.exports = {
  // 编译小程序不支持该选项
  devServer: {
    overlay: {
      warnings: true,
      errors: true
    }
  }
}
```

当 `lintOnSave` 是一个 truthy 的值时，`eslint-loader` 在开发和生产构建下都会被启用。如果你想要在生产构建时禁用 `eslint-loader`，你可以用如下配置：

``` js
// megalo.config.js
module.exports = {
  lintOnSave: process.env.NODE_ENV !== 'production'
}
```

## 注入的 webpack-chain 规则

- `config.module.rule('eslint')`
- `config.module.rule('eslint').use('eslint-loader')`
npm package: @megalo/cli-plugin-flx-es6-to-es5
Description: 解决小程序开发工具勾选es6转es5报错的问题 
Author: bigMeow
Latest version: 1.0.0-beta.2

# @megalo/cli-plugin-flx-es6-to-es5
解决小程序开发工具勾选es6转es5报错的问题

## 解决思路：
- fock [`regenerator-runtime`](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime) 仓库，注释掉编译报错代码，发布新包 `fock-regenerator-runtime`
- 通过 `webpack` 的 `alias` 设置 将 `regenerator-runtime` 替换成 `fock-regenerator-runtime`

## 缺点：官方更新，这里也要更新，同步版本号

## 注意： 此插件只适用于 `@megalo/cli` beta及其以上版本创建的项目(@megalo/cli-service beta及其以上版本)


## 使用方式：

``` bash
npm i @megalo/cli-plugin-flx-es6-to-es5 -D
```

安装后 `@megalo/cli-service` 会自动加载该插件
npm package: @megalo/cli-plugin-typescript
Description: typescript plugin for megalo-cli 
Author: bigMeow
Latest version: 1.0.0-beta.2

# @megalo/cli-plugin-typescript

> typescript plugin for megalo-cli

使用 `TypeScript` + `ts-loader` + `fork-ts-checker-webpack-plugin` 进行类型检查.

## 配置

可以通过 `tsconfig.json` 配置 `TypeScript`.

此插件依赖 `TypeScript` , 你可以在项目的 `package.json` 安装适合自己的 `typescript` 版本.

这个插件可以和 `@megalo/cli-plugin-babel` 一起使用. 与Babel一起使用时，此插件将输出ES2015，并根据babel配置将其余部分交给Babel进行自动编译转换.


## 注入的命令

使用 `ts-lint` 修复代码格式

- **`megalo-cli-service lint`**

  ```
  Usage: megalo-cli-service lint [options] [...files]

  Options:

    --format [formatter] specify formatter (default: codeframe)
    --no-fix             do not fix errors
    --formatters-dir         formatter directory
    --rules-dir       rules directory
  ```

## 注入的 webpack-chain 规则

- `config.rule('ts')`
- `config.rule('ts').use('ts-loader')`
- `config.plugin('fork-ts-checker')`
npm package: @megalo/env-plugin
Description: 为megalo-cli创建的工程提供模式
Author: running@vip.163.com
Latest version: 1.0.1

# megalojs-env-plugin
为megalo-cli创建的工程提供模式设置、环境变量

## 使用指南

安装:
```bash
$ npm i @megalo/env-plugin
```

webpack 配置:
```js
const EnvPlugin = require('@megalo/env-plugin')
const EnvPluginInstance = new EnvPlugin()

...

// The webpack 'plugins' options
module.exports = {
    // ...
    plugins: [
        EnvPluginInstance
    ]
}
```

在项目根目录下新建 `.env.模式名` 文件，在 `package.json` 的 `scripts` 里加入一条cli命令:
```json
"dev:wechat": "node ./build/megalo-cli.js --mode development --platform wechat",
```

然后执行:
```bash
$ npm run dev:wechat
```

## 控制台参数

### `--mode` 

默认值是 `development` , 本库内置了三个模式 `development、test、production` ,其中 `development` 模式下 `process.env.NODE_ENV` 的值是 `development` ,webpack将启用`开发模式`，监听你的项目文件修改，每次保存都会重新编译代码，自动刷新

三个内置的模式 `development、test、production` 对应的 `process.env.NODE_ENV` 值是和模式的名字一模一样，但只有 `development` 模式会启动webpack的`开发模式`

你可以自定义模式名，但 `process.env.NODE_ENV` 的值都将是 `production` ,webpack将启用`生产模式`,除了编译代码外，还会压缩混淆你的代码

如果你希望其它模式也能启用webpack的开发模式，你可以在你的 `.env.模式` 文件中设置如下值：
```js
// 注意：NODE_ENV的值不可随意更改，只能是 `development、test、production` 中的任一个
NODE_ENV=development
```

### `--platform`

默认值是 `wechat` , 目前在 `megalo` 工程中支持三个平台的值: `wechat、alipay、swan` ,你可以在nodejs中或者项目中通过 `process.env.PLATFORM` 访问到它

配合 `@megalo/target` 插件， 将根据你传的 `--platform` 参数来编译成不同平台的小程序代码


## 详细文档

点击[这里查看](https://cli.vuejs.org/zh/guide/mode-and-env.html#%E6%A8%A1%E5%BC%8F),功效和vue-cli3的环境变量和模式一致

## 原理说明
根据用户执行cli命令时，传递的 `mode` 参数，读取指定目录下（默认项目根目录）的 `.env` 文件内的键值对，注入到Nodejs的环境变量对象 `process.env` 身上,然后通过 `webpack.DefinePlugin` 插件，替换项目中写的 `process.env.xxx` 为  `.env` 文件配置的值

以[megalo-demo](https://github.com/bigmeow/megalo-demo)举例：
```json
// cli 命令
"dev:wechat": "node ./build/megalo-cli.js --mode development --platform wechat"
```
这条cli命令的 `mode` 参数值是 `development`，我们将读取项目根目录下的 `.env.development` 文件

假设你的 `.env.development` 文件里配置了如下内容：
```config
VUE_APP_API=http://dev.api.com
API2=http://dev.api2.com
```

程序默认将读取其中以 `VUE_APP_` 开头的键名（可修改过滤规则），将其注入到Node环境变量中，你可以在项目中使用 `process.env.VUE_APP_API` 来访问你配置的值

打开编译后代码，你会发现程序已经将你写的 `process.env.VUE_APP_API` 替换成了 `'http://dev.api.com'`

本库并不限于 `megalo` 专用, webpack4的脚手架均可使用
npm package: @megalo/eslint-config-standard
Description: eslint-config-standard for megalo project
Author: bigMeow
Latest version: 1.0.0

# eslint-config-standard
eslint-config-standard for megalo project


## Install
```bash
npm i eslint @megalo/eslint-config-standard -D
```

## Configure
If you have already configured the eslint-related webpack configuration, 
you can create a file `.eslintrc.js` in project root directory, that`s all content of file:
```js
module.exports = {
  root: true,
  extends: [
    '@megalo/standard'
  ]
}

```

## Recommendations
We recommend using it with @megalo/cli-serve. [Click this enter to portal](https://github.com/megalojs/megalo-cli/tree/master/packages/@megalo/cli-service)
npm package: @megalo/eslint-config-typescript
Description: eslint-config-standard for megalo project
Author: bigMeow
Latest version: 1.0.0-alpha.1

# eslint-config-typescript
eslint-config-typescript for  magolo-cli

## Install
```bash
npm i eslint @megalo/eslint-config-typescript -D
```

## Configure
If you have already configured the eslint-related webpack configuration, 
you can create a file `.eslintrc.js` in project root directory, that`s all content of file:
```js
module.exports = {
  root: true,
  extends: [
    '@megalo/typescript'
  ]
}

```

## Recommendations
We recommend using it with @megalo/cli-serve. [Click this enter to portal](https://github.com/megalojs/megalo-cli/tree/master/packages/@megalo/cli-service)
npm package: @megalo/fock-regenerator-runtime
Description: Runtime for Regenerator-compiled generator and async functions.
Author: Ben Newman
Latest version: 0.13.2

# fock-regenerator-runtime

此包fock自[regenerator-runtime](https://github.com/bigmeow/regenerator/tree/master/packages/regenerator-runtime),主要解决小程序开发工具开启es6转es5时的报错问题，按照 `regenerator-runtime` 官方仓库的说法，开启babel严格模式时会有这个问题，并且它使用 `Function("r", "regeneratorRuntime = r")(runtime);`  这行代码来解决，遗憾的是 小程序不支持 `Function` 函数动态注入代码，并且会报错，导致编译不通过。

在和官方沟通无果后，基于此，本仓库Fock了 `regenerator-runtime` 的代码，把出错的导致这行代码编译不通过的代码注释掉了， 并且通过`webpack` 的 `alias` 将 `regenerator-runtime` 替换成本包。具体修改的代码在 `runtime.js` 末尾的最后几行，如果你有更好的解决方案，欢迎提issues


Standalone runtime for
[Regenerator](https://github.com/facebook/regenerator)-compiled generator
and `async` functions.

To import the runtime as a module (recommended), either of the following
import styles will work:
```js
// CommonJS
const regeneratorRuntime = require("regenerator-runtime");

// ECMAScript 2015
import regeneratorRuntime from "regenerator-runtime";
```

To ensure that `regeneratorRuntime` is defined globally, either of the
following styles will work:
```js
// CommonJS
require("regenerator-runtime/runtime");

// ECMAScript 2015
import "regenerator-runtime/runtime";
```

To get the absolute file system path of `runtime.js`, evaluate the
following expression:
```js
require("regenerator-runtime/path").path
```
npm package: @megalo/px2rpx
Description: According to one stylesheet, generate rpx version and @1x, @2x and @3x stylesheet
Author: zwwill
Latest version: 0.1.0

# px2rpx

According to one stylesheet, generate rpx version.

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Downloads][downloads-image]][downloads-url]

[npm-image]: https://img.shields.io/npm/v/@megalo/px2rpx.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@megalo/px2rpx
[travis-image]: https://img.shields.io/travis/megalojs/megalo-px2rpx.svg?style=flat-square
[travis-url]: https://travis-ci.org/megalojs/megalo-px2rpx
[coveralls-image]: https://img.shields.io/coveralls/megalojs/megalo-px2rpx.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/megalojs/megalo-px2rpx
[downloads-image]: http://img.shields.io/npm/dm/@megalo/px2rpx.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/@megalo/px2rpx


## Usage

The raw stylesheet only contains @2x style, and if you

* don't intend to transform the original value, eg: 1px border, add `/*no*/` after the declaration

**Attention: Dealing with SASS or LESS, only `/*...*/` comment can be used, in order to have the comments persisted**


### API

```
var Px2rpx = require('@megalojs/px2rpx');
var px2rpxIns = new Px2rpx({
  {rpxUnit: 0.5}
});
var originCssText = '...';
var newCssText = px2rpxIns.generateRpx(originCssText); // generate rpx version stylesheet
```

### Example

#### Pre processing:

One raw stylesheet: `test.css`

```
.selector {
  width: 350px;
  height: 60px; 
  font-size: 20px; 
  border: 1px solid #ddd; /*no*/
}
```

#### After processing:

Rpx version: `test.debug.css`

```
.selector {
  width: 750rpx;
  height: 120rpx;
  font-size: 40rpx;
  border: 1px solid #ddd;
}
```

## Technical proposal

comment hook + css parser

## Change Log

### 0.0.1

* forked from [songsiqi/px2rem](https://github.com/songsiqi/px2rem) and rename px2rpx

## License

MIT
npm package: @megalo/ui
Description: UI KIT for Megalo
Author: kaola-fed
Latest version: 1.0.0

## megalo-ui
Megalo UI 是基于 *Megalo* 框架开发的多端UI组件库

### 特性
- 基于 *Megalo* 开发 UI 组件
- 一套组件可以在微信小程序、支付宝小程序、百度小程序等多端适配运行(H5端后面会更好的支持)
- 提供友好的 API 和可灵活使用的组件

### 体验
使用微信扫一扫体验小程序组件示例

![](https://haitao.nos.netease.com/7b1459d9-1e1c-4f2e-8b13-87767cdc71c6_258_258.jpg)

### 安装
```bash
npm install @megalo/ui
```

### 使用
组件使用了scss以及px2rpx两个loader, 因此需要在配置文件中引用
```json
{
  test: /\.scss$/,
  use: [
    'css-loader',
    {
      loader: 'px2rpx-loader',
      options: {
        rpxUnit: 1,
        rpxPrecision: 6
      }
    },
    'sass-loader'
  ]
}
```

配置路径alias(小程序中解析vue组件路径比较特殊，后续会做优化，优化后可直接在组件库根目录引用组件)
```json
alias: {
  'megalo-ui': '@megalo/ui/dist/components'
}
```

在代码中 *import* 需要的组件并使用
```javascript
import { mgAvatar } from 'megalo-ui/avatar'
```

### 开发计划
[开发计划](https://github.com/megalojs/megalo-ui/tree/master/PLANS.md)

### 贡献
如果你在使用 Megalo UI 时遇到问题，或者有好的建议，欢迎给我们提 Issue 或 Pull Request。在开始之前，请阅读 [贡献指南](https://github.com/megalojs/megalo-ui/tree/master/.github/CONTRIBUTING.md)

### License
MIT

#### Inspired by taro-ui
npm package: @megamatt/prettier-config
Description: Shared Prettier config
Author: Matt Miller
Latest version: 1.0.1

# Shared Prettier configuration

This shared [Prettier](https://prettier.io/) configuration changes some of the default behavior.

## Integrate into new project

1. Install this package as devDependency

```sh
# with Yarn
$ yarn add -D @megamatt/prettier-config

# with npm
$ npm i -D @megamatt/prettier-config
```

2. Install peer dependencies of this package in your project as devDependencies

Therefore, you can make use of the tool [install-peerdeps](https://github.com/nathanhleung/install-peerdeps):

```sh
# with Yarn
$ yarn dlx install-peerdeps --dev @megamatt/prettier-config

# with npm
$ npx install-peerdeps --dev @megamatt/prettier-config
```

3. Use Prettier config in your project

Create a `.prettierrc` file in project root with the following content:

```
"@megamatt/prettier-config"
```
npm package: @megamax-dev/directus-extension-builder
Description: 1- Just run npm i -g directus-extension-builder or yarn global add directus-extension-builder
Author: Karamoko Israel
Latest version: 2.0.0

# directus-extension-builder

1- Just run npm i -g directus-extension-builder or yarn global add directus-extension-builder


2- in order to build all extensions like "displays", "interfaces", "layouts", "modules" and "panels", run

```
directus-extension-builder build
```

3- in order to build all extensions a specific extension type like displays

```
directus-extension-builder build displays
```
npm package: @megamiun/loteria
Description: ### O que é
Author: Gabryel Monteiro
Latest version: 1.0.4

## Loteria SDK

### O que é

Uma biblioteca para extração de dados de loteria do site da Caixa.

### Como utilizar

#### Implementação Padrão

Para a configuração padrão, basta instanciar uma instância de `GameFetcher` por meio da função `getFetcher()`. 

Com esta você é capaz de pedir por meio da função `fetch(game: Game)` os detalhes sobre a modalidade desejada, após isso.

Exemplo:

```$kotlin
val fetcher = getFetcher()

// Pega último jogo para a modalidade
val lastGameResult = fetcher.fetch(Game.QUINA)

// Pega um sorteio especifico para a modalidade
val hundrethGameResult = fetcher.fetch(Game.QUINA, 100)

// Pega um jogo não registrado no enum de Game
val otherGameResult = fetcher.fetch("supersete", 100)
```

#### Configurações Avançadas

Para configuração avançada, é possível instanciar sua própria versão de um `GameFetcher`, para minimizar a configuração, há diversas funções para criação de objetos padrão.

Mesmo assim, caso desejado, é possível instanciar os itens manualmente chamando seus construtores. A relação das responsabilidades é:

- **Extractor**: Extrator do site da Caixa de informações sobre os jogos. Recebe tanto o Enum de `Game` ou uma `String`, correspondente ao última parte do link do jogo no site da Caixa. Retorna um `Map<String, Any>` contendo todas as informações oferecidas pela Caixa do jogo. 
    - Exemplos de Input: 
        - **Quina**: `Game.QUINA` ou `quina`
        - **Mega-Sena**: `Game.MEGA_SENA` ou `megasena`
- **Converter**: Conversores de `Map<String, Any>` para `Data`, os dados do jogo esperado. Existe um para cada tipo de jogo.
- **GameFetcher**: Classe central, que executa todo o fluxo de aquisição e conversão dos dados da Caixa.

#### Adição de Novos Conversores

Para adicionar um novo conversor, é possível buscar os conversores padrões em `getDefaultConverters()` e adicionar ao mapa os conversores desejados, relacionando como chave o nome do jogo, de acordo com como pesquisado no site da Caixa e uma nova instância do construtor.

Uma vez adicionado, esse mapa pode ser passado para `getFetcher(converters: Map<String, Converter>)` para adquirir o resultado desejado.

### TODO

Possibilitar chamada sem criação de corroutines.
npm package: @meganet/loopback-connector-redis
Description: The official Redis connector for the LoopBack Framework.
Author: StrongLoop
Latest version: 3.2.3
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

![StrongLoop Labs](http://loopback.io/images/9830552.png "StrongLoop Labs")

This project provides early access to advanced or experimental functionality. 
It may lack usability, completeness, documentation, and robustness, and may be outdated.

However, StrongLoop supports this project. Community users, please report bugs on GitHub.

# loopback-connector-redis

The official Redis connector for the LoopBack framework.

## Usage

### Install dependencies

Install the required dependencies via NPM:

```
npm install --save loopback-connector-redis
npm install --save loopback-datasource-juggler
```

> This connector depends on [`loopback-datasource-juggler`](https://github.com/strongloop/loopback-datasource-juggler).

### Configure a Redis datasource

In your code, declare Redis as a datasource:

```
var DataSource = require('loopback-datasource-juggler).DataSource;

var ds = new DataSource('redis');
...
```

## Testing

1. Start the Redis server (using the default port)
2. Run `npm test`

> WARNING
> 
> Existing data in database 0 may be deleted
npm package: @megaofmegalodon/2d-collisions
Description: A TypeScript library for 2D collision detection.
Author: megaofmegalodon
Latest version: 1.0.1

# @megaofmegalodon/2d-collisions

A lightweight TypeScript library for 2D collision detection. 
Uses the **Separating Axis Theorem (SAT)** for collision detection on **convex** polygons. 

The library supports:
- Circle vs. Circle collisions
- Polygon vs. Circle collisions
- Polygon vs. Polygon collisions

## Installation
```bash
npm i @megaofmegalodon/2d-collisions
```

## Usage

### Circle Collisions
```js
import { checkCollision, circleCollision, Circle, Vertex } from "@megaofmegalodon/2d-collisions";

const c1 = new Circle(new Vertex(0, 0), 5);
const c2 = new Circle(new Vertex(3, 4), 5);

console.log(checkCollision(c1, c2)); // true
console.log(circleCollision(c1, c2)); // true
```

### Polygon vs. Circle Collisions
```js
import { checkCollision, Polygon, Circle, Vertex } from "@megaofmegalodon/2d-collisions";

const c1 = new Circle(new Vertex(1, 1), 0.5);
const p1 = new Polygon(new Vertex(0, 0))
    .addVertex(new Vertex(0, 0))
    .addVertex(new Vertex(2, 0))
    .addVertex(new Vertex(1, 2));

console.log(checkCollision(c1, p1)); // true
console.log(checkCollision(p1, c1)); // true

```

### Polygon Collisions
```js
import { checkCollision, Polygon, Vertex } from "@megaofmegalodon/2d-collisions";

const p1 = new Polygon(new Vertex(0, 0))
    .addVertex(new Vertex(0, 0))
    .addVertex(new Vertex(2, 0))
    .addVertex(new Vertex(1, 2));

const p2 = new Polygon(new Vertex(1, 1))
    .addVertex(new Vertex(0, 0))
    .addVertex(new Vertex(2, 0))
    .addVertex(new Vertex(1, 2));

console.log(checkCollision(p1, p2)); // true
```
**Notes**:
- Polygons must be convex, meaning that all interior angles must be less than 180 degrees.
- Vertices must be added in **clockwise or counter-clockwise order**. Inconsistent ordering may cause the collision detection to fail.
npm package: @megaorm/core
Description: A powerful and feature-rich ORM for Node.js with seamless database management and query execution.
Author: Mohamed
Latest version: 1.0.0

# MegaORM

**MegaORM** is a powerful, feature-rich ORM for Node.js, designed to streamline database management, query execution, and app development. With a modular design and focus on simplicity, it provides flexibility and ease of use, making it ideal for projects of all sizes.

## Installation

Install MegaORM via npm:

```bash
npm install @megaorm/core
```

## MegaORM Components

- **[@megaorm/mysql](https://github.com/megaorm/megaorm-mysql)** MegaORM driver for `MySQL` databases.
- **[@megaorm/sqlite](https://github.com/megaorm/megaorm-sqlite)** MegaORM driver for `SQLite` databases.
- **[@megaorm/pg](https://github.com/megaorm/megaorm-pg)** MegaORM driver for `PostgreSQL` databases.
- **[@megaorm/pool](https://github.com/megaorm/megaorm-pool)** MegaORM connection manager.
- **[@megaorm/cluster](https://github.com/megaorm/megaorm-cluster)** Manage multiple database servers easily.
- **[@megaorm/cli](https://github.com/megaorm/megaorm-cli)** Interact with MegaORM through the command line.
- **[@megaorm/gen](https://github.com/megaorm/megaorm-gen)** Manage table creation and deletion easily.
- **[@megaorm/faker](https://github.com/megaorm/megaorm-faker)** Generate realistic fake data.
- **[@megaorm/seeder](https://github.com/megaorm/megaorm-seeder)** Populate databases with test or default data.
- **[@megaorm/builder](https://github.com/megaorm/megaorm-builder)** Build complex SQL queries with a fluent API.
- **[@megaorm/model](https://github.com/megaorm/megaorm-model)** Simplifies CRUD operations.

## MegaORM Helpers

- **[@megaorm/utc](https://github.com/megaorm/megaorm-utc)** Handle date and time in UTC.
- **[@megaorm/zone](https://github.com/megaorm/megaorm-zone)** Convert timezones from UTC.
- **[@megaorm/config](https://github.com/megaorm/megaorm-config)** Manage and validate configuration files.
- **[@megaorm/test](https://github.com/megaorm/megaorm-test)** Perform type checking and validation.
- **[@megaorm/text](https://github.com/megaorm/megaorm-text)** Manipulate and format strings.
- **[@megaorm/logger](https://github.com/megaorm/megaorm-logger)** Log and manage log files.
- **[@megaorm/echo](https://github.com/megaorm/megaorm-echo)** Retry mechanisms for async operations.

## Contribution Guide

We welcome contributions to MegaORM! Here’s how you can help:

1. **Report Bugs and Issues**

   - Create a [GitHub Issue](https://github.com/megaorm/megaorm/issues) for any bugs or problems you encounter.

2. **Suggest Improvements and New Features**

   - Share your ideas for improvements by opening a feature request issue.

3. **Improve Documentation**

   - Found a typo or incorrect information? Report it or suggest changes directly.

4. **Get Help**
   - If you’re stuck, reach out to us via GitHub or email **essefrimohamed123@gmail.com**.

For more details, see the [CONTRIBUTING.md](CONTRIBUTING.md) file in the repository.
npm package: @megaorm/errors
Description: This package provides custom error classes for handling transaction, connection, and queue management issues in MegaORM.
Author: Mohamed
Latest version: 1.0.0

# MegaORM Errors

This package provides custom error classes for handling transaction, connection, and queue management issues in MegaORM, providing a consistent way to report failures.

## Installation

To install the `@megaorm/errors` package, run the following command:

```bash
npm install @megaorm/errors
```

## Errors

This package defines the following error classes:

```typescript
new BeginTransactionError(message?: string)
```

> Represents an error that occurs when starting a database transaction.

```typescript
new CommitTransactionError(message?: string)
```

> Represents an error that occurs when committing a database transaction.

```typescript
new RollbackTransactionError(message?: string)
```

> Represents an error that occurs when rolling back a database transaction.

```typescript
new CloseConnectionError(message?: string)
```

> Represents an error that occurs when closing a database connection.

```typescript
new CreateConnectionError(message?: string)
```

> Represents an error that occurs when creating a database connection.

```typescript
new MaxConnectionError(message?: string)
```

> Represents an error when the maximum number of database connections is exceeded.

```typescript
new MaxQueueSizeError(message?: string)
```

> Represents an error when the maximum queue size is exceeded.

```typescript
new MaxQueueTimeError(message?: string)
```

> Represents an error when the maximum allowed queue time is exceeded.

```typescript
new QueryError(message?: string)
```

> Represents an error that occurs during query execution.

```typescript
new ShutdownError(message?: string)
```

> Represents an error that occurs during shutdown.

## Default Error Messages

Each error class has a default message that is used if no custom message is provided. Below are the default messages for each error:

- **`BeginTransactionError`**: `'Begin transaction failed'`
- **`CommitTransactionError`**: `'Commit transaction failed'`
- **`RollbackTransactionError`**: `'Rollback transaction failed'`
- **`CloseConnectionError`**: `'Close connection failed'`
- **`CreateConnectionError`**: `'Create connection failed'`
- **`MaxConnectionError`**: `'Max number of connections passed'`
- **`MaxQueueSizeError`**: `'Max queue size passed'`
- **`MaxQueueTimeError`**: `'Max queue time passed'`
- **`QueryError`**: `'Query execution failed'`
- **`ShutdownError`**: `'Shutdown failed'`
npm package: @megaorm/utils
Description: This package provides utility functions to validate whether a value is a MegaORM driver or a connection.
Author: Mohamed
Latest version: 1.0.0

# MegaORM Utils

This package provides utility functions to validate whether a value is a MegaORM driver or a connection.

## Installation

To install this package, run the following command:

```bash
npm install @megaorm/utils
```

## Functions

`isDriver(driver)`: Ensures that the given value is one of MegaORM's supported drivers: `@megaorm/mysql`, `@megaorm/sqlite`, or `@megaorm/pg`.

```js
const { isDriver } = require('@megaorm/utils');

console.log(isDriver({})); // false
```

> Returns `true` if the value is a valid MegaORM driver, `false` otherwise.

`isMySQL(driver)`: Ensures that the given value is a `@megaorm/mysql` driver.

```js
const { isMySQL } = require('@megaorm/utils');

console.log(isMySQL({})); // false
```

> Returns `true` if the value is the MySQL driver, `false` otherwise.

`isPostgreSQL(driver)`: Ensures that the given value is a `@megaorm/pg` driver.

```js
const { isPostgreSQL } = require('@megaorm/utils');

console.log(isPostgreSQL({})); // false
```

> Returns `true` if the value is the PostgreSQL driver, `false` otherwise.

`isSQLite(driver)`: Ensures that the given value is a `@megaorm/sqlite` driver.

```js
const { isSQLite } = require('@megaorm/utils');

console.log(isSQLite({})); // false
```

> Returns `true` if the value is the SQLite driver, `false` otherwise.

`isCon(connection)`: Ensures that the given value is a `MegaConnection` — a connection created by any MegaORM driver.

```js
const { isCon } = require('@megaorm/utils');

console.log(isCon({})); // false
```

> Returns `true` if the value is a `MegaConnection`, `false` otherwise.

`isPendingCon(connection)`: Ensures that the given value is a `MegaPendingConnection` — a connection that could not be closed by `MegaPool`.

```js
const { isPendingCon } = require('@megaorm/utils');

console.log(isPendingCon({})); // false
```

> Returns `true` if the value is a `MegaPendingConnection`, `false` otherwise.

`isPoolCon(connection)`: Ensures that the given value is a `MegaPoolConnection` — a connection created by `MegaPool`.

```js
const { isPoolCon } = require('@megaorm/utils');

console.log(isPoolCon({})); // false
```

> Returns `true` if the value is a `MegaPoolConnection`, `false` otherwise.

## Usage Examples

```js
const { isDriver, isSQLite, isCon } = require('@megaorm/utils');

const { SQLite } = require('@megaorm/sqlite');

// Create a driver instance
const driver = new SQLite(':memory:');

// Ensure it's an SQLite driver instance
if (isSQLite(driver)) {
  console.log('This is an SQLite driver!');
}

// Ensure it's a MegaORM driver instance (SQLite, PostgreSQL, MySQL)
if (isDriver(driver)) {
  console.log('This is a MegaORM driver!');
}

// Create a connection
driver.create().then((connection) => {
  // Ensure it's a MegaConnection
  if (isCon(connection)) {
    console.log('This is a MegaConnection!');
  }
});
```