open-index/open-npm huggingface dataset:
npm package: @juliodevelop/api-client
Description: HTTP client factory com Axios + interceptors JWT + React Query hooks
Latest version: 0.1.0

# @juliodevelop/api-client

HTTP client factory com Axios, interceptors JWT automáticos e hooks TanStack React Query.

## Instalação

```bash
npm install @juliodevelop/api-client
# peer deps:
npm install axios @tanstack/react-query react
```

> Requer `.npmrc` configurado com o registry `@juliodevelop`. Veja o [README raiz](../README.md#setup-para-consumir-os-pacotes).

## Uso

### Criar o client

```typescript
import { createApiClient } from '@juliodevelop/api-client'

const api = createApiClient({
  baseURL: 'https://api.example.com',
  getToken: () => localStorage.getItem('token'),
  onUnauthorized: () => {
    window.location.href = '/login'
  },
  refreshToken: async () => {
    const res = await fetch('/api/auth/refresh')
    const data = await res.json()
    return data.token
  },
})
```

### React Query Hooks

```typescript
import { createApiHooks } from '@juliodevelop/api-client'

const { useGet, usePost, usePut, useDelete, usePatch } = createApiHooks(api)

// GET
const { data, isLoading } = useGet<User[]>('/users')

// POST com invalidação automática
const createUser = usePost<User, CreateUserDTO>('/users', {
  invalidateKeys: [['users']],
})
createUser.mutate({ name: 'Julio', email: 'julio@email.com' })
```

### Provider

```tsx
import { ApiProvider } from '@juliodevelop/api-client'

function App() {
  return (
    <ApiProvider client={api}>
      <MyApp />
    </ApiProvider>
  )
}
```

### Next.js SSR

```typescript
const api = createApiClient({
  baseURL: '/api',
  getToken: async () => {
    const { cookies } = await import('next/headers')
    return cookies().get('token')?.value ?? null
  },
})
```
npm package: @juliodevelop/auth
Description: Auth toolkit com NextAuth v5, JWT utilities, middleware e hooks React
Latest version: 0.1.0

# @juliodevelop/auth

Auth toolkit para Next.js com NextAuth v5, middleware de rotas, hooks React, JWT e password hashing.

## Instalação

```bash
npm install @juliodevelop/auth
# peer deps:
npm install next next-auth react
```

> Requer `.npmrc` configurado com o registry `@juliodevelop`. Veja o [README raiz](../README.md#setup-para-consumir-os-pacotes).

## Sub-exports

```
@juliodevelop/auth          → config + middleware
@juliodevelop/auth/react    → AuthProvider + hooks
@juliodevelop/auth/jwt      → sign, verify, decode JWT
@juliodevelop/auth/password → hash + verify senha
```

## Uso

### Config NextAuth

```typescript
import { createAuthConfig } from '@juliodevelop/auth'

export const authConfig = createAuthConfig({
  providers: {
    credentials: {
      authorize: async (credentials) => {
        const user = await db.user.findUnique({ where: { email: credentials.email } })
        if (!user) return null
        return { id: user.id, email: user.email, role: user.role }
      },
    },
    google: {
      clientId: process.env.GOOGLE_CLIENT_ID!,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
    },
  },
  pages: { signIn: '/login' },
})

export const { auth, signIn, signOut, handlers } = authConfig
```

### Middleware

```typescript
import { createAuthMiddleware } from '@juliodevelop/auth'

// Tudo protegido por padrão, exceto publicRoutes
export default createAuthMiddleware({
  publicRoutes: ['/', '/login', '/register'],
  roleRoutes: {
    '/admin(.*)': ['admin'],
    '/seller(.*)': ['admin', 'seller'],
  },
})
```

### Hooks React

```tsx
import { AuthProvider, useAuth } from '@juliodevelop/auth/react'

// No layout:
<AuthProvider><App /></AuthProvider>

// Em componentes:
const { user, isAuthenticated, hasRole, signOut } = useAuth()
```

### JWT (standalone, sem Next.js)

```typescript
import { signJwt, verifyJwt, decodeJwt } from '@juliodevelop/auth/jwt'

const token = await signJwt({ userId: '123' }, { secret: 'key', expiresIn: '7d' })
const payload = await verifyJwt(token, 'key')
```

### Password (standalone, sem Next.js)

```typescript
import { hashPassword, verifyPassword } from '@juliodevelop/auth/password'

const hashed = await hashPassword('senha123')
const isValid = await verifyPassword('senha123', hashed)
```
npm package: @juliodevelop/br-utils
Description: Utilitários brasileiros: CPF, CNPJ, CEP, telefone, moeda BRL, placa, estados + Zod schemas
Latest version: 0.1.0

# @juliodevelop/br-utils

Utilitários brasileiros: CPF, CNPJ, CEP, telefone, moeda BRL, placa de veículo, estados + schemas Zod.

**Zero dependências** — 100% standalone (Zod é peer dep opcional).

## Instalação

```bash
npm install @juliodevelop/br-utils
```

> Requer `.npmrc` configurado com o registry `@juliodevelop`. Veja o [README raiz](../README.md#setup-para-consumir-os-pacotes).

## Uso

```typescript
import { cpf, cnpj, cpfCnpj, phone, cep, currency, plate, states } from '@juliodevelop/br-utils'

// CPF
cpf.validate('123.456.789-09')    // true
cpf.format('12345678909')         // '123.456.789-09'
cpf.strip('123.456.789-09')      // '12345678909'
cpf.mask('12345678909')           // '123.456.***-**'
cpf.generate()                     // CPF válido (para testes)

// CNPJ
cnpj.validate('11.222.333/0001-81')  // true
cnpj.format('11222333000181')         // '11.222.333/0001-81'

// CPF/CNPJ auto-detect
cpfCnpj.validate('12345678909')    // valida como CPF
cpfCnpj.validate('11222333000181') // valida como CNPJ
cpfCnpj.type('12345678909')       // 'cpf'

// Telefone
phone.format('92991234567')        // '(92) 99123-4567'
phone.validate('(92) 99123-4567') // true
phone.isMobile('92991234567')     // true
phone.toInternational('92991234567') // '+5592991234567'

// CEP
cep.format('69050001')            // '69050-001'
const addr = await cep.fetch('69050-001')
// → { cep, street, neighborhood, city, state, stateCode }

// Moeda BRL
currency.format(1234.56)          // 'R$ 1.234,56'
currency.parse('R$ 1.234,56')    // 1234.56
currency.cents(1234.56)          // 123456

// Placa de veículo
plate.validate('ABC1D23')         // true (Mercosul)
plate.validate('ABC-1234')        // true (antiga)
plate.type('ABC1D23')             // 'mercosul'

// Estados
states.list()                     // [{ code: 'AC', name: 'Acre' }, ...]
states.getByCode('AM')           // { code: 'AM', name: 'Amazonas', region: 'Norte' }
```

### Zod Schemas

```bash
npm install zod  # peer dep necessária
```

```typescript
import { schemas } from '@juliodevelop/br-utils/zod'
import { z } from 'zod'

const userSchema = z.object({
  cpf: schemas.cpf(),            // valida + strip automático
  phone: schemas.phone(),        // valida formato BR
  cep: schemas.cep(),
  salary: schemas.brl(),         // "1.234,56" → 1234.56
  plate: schemas.plate(),
})
```