open-index/open-npm huggingface dataset:
npm package: @gerkirill/json-api-service
Description: A library to simplify web API service creation, based on routing-controllers.
Author: Kyrylo Gerasymenko
Latest version: 1.0.1

# JSON API Service

A library to simplify web API service creation. It relies on express and [routing-controllers](https://github.com/typestack/routing-controllers#example-of-usage).

The library reduces a boilerplate to spin-up a rest API service. Also this library:

- Sets up HEAD request handler (HEAD requests appear as a part of CORS workflow).
- Handlers CORS but only in development (local) mode.
- Handles HTTP errors and responds with proper JSON and HTTP status code.

## Usage

Install library and required peer dependencies:

```bash
npm i @gerkirill/json-api-service routing-controllers@^0.10.4 class-transformer@^0.5.1 class-validator@^0.14.1 reflect-metadata
npm i -D @types/node typescript
```

Note: versions of class-transformer and class-validator are defined as peer dependencies of the routing-controllers^0.10.4.

Usage example:

```typescript
import { createApplication } from '@gerkirill/json-api-service';
import { Get, JsonController } from 'routing-controllers';

const BASE_PATH = '/api';
const PORT = 5000;

@JsonController()
class HealthController {
  // http://localhost:5000/api/health/
  @Get('/health') 
  public async getHealth() {
    return { status: 'ok' };
  }
}

const app = createApplication({
  routePrefix: BASE_PATH,
  controllers: [HealthController],
  errorHandler: (error) => console.error(error),
});
app.listen(PORT, () => {
  console.log(`Server listening at port ${PORT}`);
});
```

Also, make sure the following `compilerOptions` are set in your `tsconfig.json`:

```json
{
  "experimentalDecorators": true,
  "emitDecoratorMetadata": true
}
```

*createApplication* accepts configuration object with the following fields:

- *routePrefix* _(optional, string)_ A url fragment to be added to all controllers, e.g.: `/api/v1`.
- *controllers* _(array)_ Array of controller classes annotated with `@Controller()` or `@JsonController()`.
- *middlewares* _(optional, array)_ Array of [middleware](https://github.com/typestack/routing-controllers#using-middlewares) classes to use globally.
- *interceptors* _(optional, array)_ Array of [interceptors](https://github.com/typestack/routing-controllers#using-interceptors) to use globally, annotated with `@Interceptor()`.
- *earlyBootstrapFn* _(optional, function(app) => void)_ Function to execute on app before it is passed to [useExpressServer()](https://github.com/typestack/routing-controllers#pre-configure-expresskoa).
- *errorHandler* _(optional, function(err) => void)_ A callback invoked by the custom HTTP error handler this library provides. If error handler is not set - errors are logged to console with `console.error()`.


## Contributing

Upon update of `routing-controllers` - make sure to update peer dependency versions in package.json (dev dependencies section) and in README. Also, you may get a warning like this one `class-transformer 0.3.2 (0.5.1 is available) deprecated` - please don't upgrade unless your version of `routing-controllers` requires exactly this version.
npm package: @germanamz/eslint-config
Description: Just my own ESLint configuration
Author: German Meza
Latest version: 1.0.4

# eslint-config
Just my very nice eslint config

# Usage
```bash
npm install --save-dev @germanamz/eslint-config
```

In your eslint config file, add one of the following:

### Common config
```json
{
  "extends": "@germanamz/eslint-config/common"
}
```

### Base (node) config
```json
{
  "extends": "@germanamz/eslint-config/base"
}
```

### React config
```json
{
  "extends": "@germanamz/eslint-config/react"
}
```

# License
MIT License

Copyright (c) 2024 German Meza <iam@germanamz.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
npm package: @germanamz/luca
Description: Just a simple accounting engine
Author: German Meza
Latest version: 0.9.0

# Luca

Luca is a simple accounting engine that allows you to create and manage your accounts and transactions.

Based on the Double Entry Accounting System made by Luca Pacioli in the 15th century.

## Usage

```ts

```

## Architecture

Luca abstracts accounting into the following three concepts:

**Accounts** represent real accounting accounts (I know, I know, it's a bit of a stretch), they are hierarchical, meaning they can have child accounts that compose their parent account balance check [The accounting equation section](#the-accounting-equation) to understand how and whys.

**Transactions** represent the movement of money between accounts.

**Entries** represent rows in an account.

### The Accounting Equation

Uses the **Accounting Equation** as the foundation of the engine.

> Assets = Liabilities + Equity

This equation explains the relationship between the assets, liabilities and equity of a company and its divided into the following parts:

> **Assets** = `Liabilities + Equity`

> **Equity** = `Capital Contributions + Retained Earnings`

> **Retained Earnings** = `Opening Retained Earnings + Current Cycle Profit - Current Cycle Dividends`

> **Current Cycle Profit** = `Current Cycle Revenue - Current Cycle Expenses`

Making the **Expanded Accounting Equation**:

> **Assets** = `Liabilities + Capital Contributions + Opening Retained Earnings + Current Cycle Revenue - Current Cycle Expenses - Current Cycle Dividends`

We can rearange the equation to extract basic account types and their normal sides:

> **Current Cycle Expenses + Current Cycle Dividends + Assets** = `Liabilities + Capital Contributions + Opening Retained Earnings + Current Cycle Revenue`

This final equation explains how the left side of the equation is paied using the right side.

In a T account, the left side are DEBITS and the right side are CREDITS, making this equation arrangement match the T account structure.

> **Left side are DEBITS** = `Right side are CREDITS`

### Final and simplified equation

> **Expenses + Dividends + Assets** = `Liabilities + Capital Contributions + Earnings + Revenue`

## What this means for Luca?

**Luca** abstracts Accounts into a herarchical structure, where top accounts are composed of child accounts, and each child account has a normal side (DEBIT or CREDIT) that determines which side of the accounting equation the account belongs to (in a local scope).

An example of an account composed of 2 child accounts:

`Current Cycle Earnings` has 2 child accounts, `Current Cycle Expenses (DEBIT)` and `Current Cycle Revenue (CREDIT)`, meaning that the balance of `Current Cycle Earnings` is calculated as `Current Cycle Revenue (CREDIT) - Current Cycle Expenses (DEBIT)`, following the same rule as the accounting equation where the _left_ side are **DEBITS** and the _right_ side are **CREDITS**.

> This same logic is applied to all accounts.
npm package: @germanescobar/prisma-transactional
Description: Adds support for prisma transactions across functions
Author: Germán Escobar
Latest version: 0.6.0

# Prisma Transactional Context

This package adds support for transactions across functions without having to explicitly pass them around (argument drilling).

Underneath, it uses the [AsyncLocalStorage](https://nodejs.org/api/async_context.html) to store the transaction and [Proxy object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) to wrap the prisma client.

It also supports [**savepoints**](https://en.wikipedia.org/wiki/Savepoint) to mimic nested transactions in databases that support this feature (tested in PostgreSQL only for now). **Savepoints** are enable by default, see below on how to disable them.

## Installation

```
npm install @germanescobar/prisma-transactional
```

## Usage

```typescript
import { AsyncLocalStorage } from 'node:async_hooks'
import createPrismaTransactionalProxy from '@germanescobar/prisma-transactional'

// create the instance of AsyncLocalStorage, you may want to define and export this 
// from another file to reuse it across the code
const asyncLocalStorage = new AsyncLocalStorage();

const originalPrisma = new PrismaClient(...);
const prisma = createPrismaTransactionalProxy(originalPrisma, asyncLocalStorage);

// use prisma as you would normally do
async function executeTransfer() {
  prisma.$transaction(tx => {
    // but now you can call other functions inside the transaction
    await transfer('111', '222', 100);
  });
}

async function transfer(from, to, amount) {
  // all these queries will run inside the transaction created previously
  const fromAccount = await prisma.account.findUniqueOrThrow({ where: { id: from }});
  await prisma.account.update({ where: { id: from }, data: { balance: fromAccount.balance - amount } });

  const toAccount = await prisma.account.findUniqueOrThrow({ where: { id: to }});
  await prisma.account.update({ where: { id: to }, data: { balance: toAccount.balance + amount } });
}
```

To disable savepoints ("nested transactions") use the `enableSavepoints` option (they are enabled by default):

```typescript
const prisma = createPrismaTransactionalProxy(
  originalPrisma, 
  asyncLocalStorage, 
  { enableSavepoints: false } // disables savepoints
);
```
npm package: @germano-ignite-ui/docs
Description: This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Latest version: 0.0.0

# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

```js
export default tseslint.config([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...

      // Remove tseslint.configs.recommended and replace with this
      ...tseslint.configs.recommendedTypeChecked,
      // Alternatively, use this for stricter rules
      ...tseslint.configs.strictTypeChecked,
      // Optionally, add this for stylistic rules
      ...tseslint.configs.stylisticTypeChecked,

      // Other configs...
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default tseslint.config([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...
      // Enable lint rules for React
      reactX.configs['recommended-typescript'],
      // Enable lint rules for React DOM
      reactDom.configs.recommended,
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])
```
npm package: @germansan2002/service-generator
Description: CLI gor generate express services
Author: German Sancho Miñano
Latest version: 1.0.2

# Service Generator CLI

Service Generator CLI es una herramienta para generar automáticamente DTOs, servicios y controladores para entidades definidas en un archivo de configuración.

## Instalación

### Desde el Repositorio

Clona el repositorio e instala las dependencias:

```bash
git clone <repositorio-url>
cd Service-Generator
npm install
```

### Desde npm

Instala el paquete globalmente desde npm:

```bash
npm install -g service-generator-cli
```

## Uso

### Listar Entidades

```bash
service-generator list <config>
```

Lista todas las entidades en el archivo de configuración.

### Generar DTOs

```bash
service-generator generate:dto <config>
```

Genera DTOs para todas las entidades en el archivo de configuración.

### Generar Servicios

```bash
service-generator generate:services <config>
```

Genera servicios para todas las entidades en el archivo de configuración.

### Generar Controladores

```bash
service-generator generate:controllers <config>
```

Genera controladores para todas las entidades en el archivo de configuración.

### Generar Controladores

```bash
service-generator generate:main <config>
```

Genera archivo principal con rutas para una aplicacion express.


## Configuración

El archivo de configuración debe estar en formato JSON e incluir información sobre la base de datos y la salida deseada para los archivos generados.

```json
{
    "type": "mysql",
    "host": "localhost",
    "port": 3306,
    "username": "root",
    "password": "123456789",
    "database": "prueba-typeorm",
    "outputDir": "./src/generated"
}
```  

## Licencia

Este proyecto está licenciado bajo la Licencia MIT. Consulta el archivo [LICENSE](./LICENSE) para más detalles.