open-index/open-npm huggingface dataset:
npm package: @finwo/router
Description: TypeScript controller decorators
Author: Robin Bron
Latest version: 0.5.3

@finwo/router
=============

[![license][license:img]][license:url]
[![npm version][npm:@finwo/router:img]][npm:@finwo/router:url]

@finwo/router is a TypeScript decorator wrapper with pluggable routers, intended
to make setting up a new api cleaner.

## Installation

This package can not be used stand-alone and will need an adapter to hand off
the controllers' routes to the actual router.

To start using @finwo/router, install the required packages via NPM:

```sh
npm install --save @finwo/router
```

This package makes use of decorators and decorator metadata using the
[reflect-metadata][npm:reflect-metadata:url] package, which requires enabling
experimental decorators and emitting decorator metadata. It is not compatible
with the TS5 stage 3 decorators
[and this is not the only library affected](https://github.com/microsoft/tsyringe/issues/225).

Don't forget to enable emitting decorator metadata in your TypeScript config.
Add these two lines to your `tsconfig.json` file under the `compilerOptions`
key:

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

## Usage

Basic usage is as follows:

```ts
// some-controller.ts
import { Request, Response } from 'router-library';
import { Controller, Req, Res, Get } from '@finwo/router';

@Controller()
export class SomeController {

  @Get()
  @Middleware(require('cors')())
  indexAction(@Res() res: Response) {
    res.send({
      ok: true,
    });
  }

  @Get('/other')
  otherAction(@Res() res: Response) {
    res.send({
      ok: true,
    });
  }
}
```

Any controllers will be registered within the DI container of
[@finwo/di][npm:@finwo/di:url], allowing you to implement dependency injection
into your controllers to decouple from your dependencies.

## Middleware

Express-style middleware can be registered, but may not be supported by all
adapters.

[license:img]: https://img.shields.io/github/license/finwo/router
[license:url]: https://github.com/finwo/router/blob/main/LICENSE
[npm:@finwo/di:url]: https://npmjs.com/package/@finwo/di
[npm:@finwo/router:url]: https://npmjs.com/package/@finwo/router
[npm:@finwo/router:img]: https://img.shields.io/npm/v/@finwo/router
[npm:fastify:url]: https://npmjs.com/package/fastify
[npm:reflect-metadata:url]: https://npmjs.com/package/reflect-metadata
npm package: @finwo/router-fastify
Description: TypeScript controller decorators for fastify
Author: Robin Bron
Latest version: 0.5.3

@finwo/router-fastify
=====================

[![license][license:img]][license:url]
[![npm version][npm:@finwo/router-fastify:img]][npm:@finwo/router-fastify:url]

@finwo/router-fastify is a [fastify][npm:fastify:url] adapter for the
[@finwo/router][npm:@finwo/router:url] router decorators.

## Installation

To start using @finwo/router-fastify, install the required packages via NPM:

```sh
npm install --save @finwo/router @finwo/router-fastify
```

## Usage

To use this adapter to load your controllers into fastify, add the following to
the initialization of your fastify instance.

```ts
// index.ts
import fastify = require('fastify')();
import { plugin } from '@finwo/router-fastify';

// Build a list of controllers we'll start our application with
// Classes registered as controller will NOT be included by default
import { SomeController } from './some-controller';
const controllers: any[] = [
  SomeController,
];

// Register your controllers' routes
fastify.register(plugin, controllers);
```

For further usage, check out the [@finwo/router][npm:@finwo/router:url] readme.

## Middleware

This adapter **does** support middleware, by chaining the middleware before the
actual route handler.

[license:img]: https://img.shields.io/github/license/finwo/router
[license:url]: https://github.com/finwo/router/blob/main/LICENSE
[npm:@finwo/router-fastify:url]: https://npmjs.com/package/@finwo/router-fastify
[npm:@finwo/router-fastify:img]: https://img.shields.io/npm/v/@finwo/router-fastify
[npm:fastify:url]: https://npmjs.com/package/fastify
[npm:reflect-metadata:url]: https://npmjs.com/package/reflect-metadata
[npm:@finwo/router:url]: https://npmjs.com/package/@finwo/router
npm package: @finwo/scandir
Description: Simple scandir for my own purposes, as I've used versions of this throughout multiple projects.
Author: Robin Bron
Latest version: 0.0.3

# scandir

Simple scandir for my own purposes, as I've used versions of this throughout
multiple projects.

## Usage

```js
const scandir = require('@finwo/scandir');

// No way to await in async yet
scandir("path/to/directory", filename => {
  console.log(`Got a filename: ${filename}`);
}, ['json', 'js']);

// You can also load files directly (caution, may be dangerous)
// This loads the file through 'require'
scandir("path/to/directory", contents => {
  console.log(`Got file contents: ${contents}`);
}, ['json','js'], true);

// There's also a sync version, if that's what you need
// This accepts the same arguments
scandir.sync("path/to/directory", filename => {
  console.log(`Got a filename: ${filename}`);
}, ['json', 'js'], false);
```

### Methods

#### scandir( dir, handler, extensions = ['json','js'], load = false)

#### scandir.sync( dir, handler, extensions = ['json','js'], load = false)
npm package: @fio-pay/sdk
Description: TypeScript SDK for the Fio subscription billing API (PIX payments)
Latest version: 0.1.2

# @fio-pay/sdk

TypeScript SDK for the [Fio](https://fio.com.br) subscription billing API. Build recurring payments with PIX in minutes.

## Install

```bash
npm install @fio-pay/sdk
```

## Quick start

```ts
import { Fio } from '@fio-pay/sdk'

const fio = new Fio({ apiKey: 'fio_test_...' })

// Create a customer
const customer = await fio.customers.create({
  name: 'Maria Silva',
  taxId: '12345678900',
  email: 'maria@example.com',
})

// Create a plan
const plan = await fio.plans.create({
  name: 'Pro',
  amountCentavos: 4990, // R$49.90
  interval: 'month',
  intervalCount: 1,
})

// Start a subscription
const subscription = await fio.subscriptions.create({
  customerId: customer.id,
  planId: plan.id,
})

// List charges
const charges = await fio.charges.list({ subscriptionId: subscription.id })
```

## Resources

| Resource              | Methods                                         |
| --------------------- | ----------------------------------------------- |
| `fio.customers`       | `create`, `get`, `update`, `list`               |
| `fio.plans`           | `create`, `get`, `list`                         |
| `fio.subscriptions`   | `create`, `get`, `cancel`, `list`               |
| `fio.charges`         | `create`, `get`, `refund`, `list`               |
| `fio.invoices`        | `get`, `list`                                   |
| `fio.webhookEndpoints`| `create`, `get`, `delete`, `list`               |
| `fio.test`            | `advanceTime` (test environment only)           |

## Webhook verification

```ts
import { Fio } from '@fio-pay/sdk'

const isValid = Fio.webhooks.verify({
  payload: rawBody,
  signature: headers['x-fio-signature'],
  secret: 'whsec_...',
})
```

## Error handling

```ts
import { Fio, FioValidationError, FioAuthError } from '@fio-pay/sdk'

try {
  await fio.customers.create({ name: '' })
} catch (err) {
  if (err instanceof FioValidationError) {
    console.log(err.errors) // validation details
  }
  if (err instanceof FioAuthError) {
    console.log('Invalid API key')
  }
}
```

## Configuration

```ts
const fio = new Fio({
  apiKey: 'fio_live_...', // or fio_test_ for sandbox
  baseUrl: 'https://api.fio.com.br/v1', // optional, defaults to production
})
```

The environment (`test` or `live`) is automatically detected from the API key prefix.

## Requirements

- Node.js 20+
- ESM only (`"type": "module"`)

## License

MIT
npm package: @fio-pay/shared
Description: Shared types, Zod schemas, and constants for the Fio billing API
Latest version: 0.1.2

# @fio-pay/shared

Shared types, Zod schemas, and constants for the [Fio](https://fio.com.br) billing API. Used internally by `@fio-pay/sdk` and useful for server-side integrations that need Fio type definitions.

## Install

```bash
npm install @fio-pay/shared
```

## What's included

**Constants** - Status enums, event types, and configuration values:

```ts
import {
  SUBSCRIPTION_STATUS,  // trialing, active, past_due, canceled, paused
  CHARGE_STATUS,         // pending, paid, failed, expired, refunded, partially_refunded
  INVOICE_STATUS,        // draft, open, paid, failed, void
  EVENT_TYPES,           // charge.created, subscription.activated, etc.
  PLAN_INTERVAL,         // week, month, year
  API_KEY_PREFIX,        // fio_test_, fio_live_
} from '@fio-pay/shared'
```

**Types** - TypeScript interfaces for all API entities:

```ts
import type {
  Customer,
  Plan,
  Subscription,
  Charge,
  Invoice,
  WebhookEndpoint,
  Event,
  ErrorResponse,
} from '@fio-pay/shared'
```

**Zod schemas** - Runtime validation for API payloads:

```ts
import { customerSchema, planSchema, chargeSchema } from '@fio-pay/shared'
```

## Subpath exports

```ts
import { SUBSCRIPTION_STATUS } from '@fio-pay/shared/constants'
import { customerSchema } from '@fio-pay/shared/schemas'
import type { Customer } from '@fio-pay/shared/types'
```

## Money convention

All monetary values are integers in **centavos** (1/100 of BRL). For example, R$49.90 = `4990`. Never use floats for money.

## Requirements

- Node.js 20+
- ESM only (`"type": "module"`)

## License

MIT