npm package: @netair-tech/n8n-nodes-tiny-erp-auth2
Description: n8n custom node for Tiny ERP integration with OAuth2 authentication
Author: Netair Tech
Latest version: 1.0.10

# @netair-tech/n8n-nodes-tiny-erp-auth2

An n8n custom node for integrating with Tiny ERP API using OAuth2 authentication.

## Features

This custom node provides comprehensive integration with Tiny ERP's product management API, supporting:

### Product Operations
- **Create Product** - Create new products in Tiny ERP
- **Get Product** - Retrieve a specific product by ID
- **Get Many Products** - Retrieve multiple products with filtering options
- **Update Product** - Update existing product information
- **Update Price** - Update product pricing information

### Manufacturing Operations
- **Get Manufacturing** - Retrieve product manufacturing data
- **Update Manufacturing** - Update manufacturing information and steps

### Kit Operations
- **Get Kit** - Retrieve product kit information
- **Update Kit** - Update kit composition and quantities

### Variation Operations
- **Create Variation** - Create product variations
- **Update Variation** - Update existing variations
- **Delete Variation** - Remove product variations

### Additional Operations
- **Get Costs** - Retrieve product cost information
- **Get Tags** - Retrieve product tags

## Prerequisites

- n8n instance (version 1.0.0 or higher)
- Tiny ERP account with API access
- OAuth2 application configured in Tiny ERP

## Installation

### From npm (when published)
```bash
npm install @netair-tech/n8n-nodes-tiny-erp-auth2
```

### From source
1. Clone this repository
2. Install dependencies:
   ```bash
   npm install
   ```
3. Build the project:
   ```bash
   npm run build
   ```
4. Link to your n8n installation or copy the `dist` folder to your n8n custom nodes directory

## Configuration

### OAuth2 Setup
1. In your Tiny ERP account, create a new OAuth2 application
2. Note down the Client ID and Client Secret
3. Set the redirect URI to your n8n instance OAuth callback URL

### n8n Credential Configuration
1. In n8n, create a new credential of type "Tiny ERP OAuth2 API"
2. Enter your Client ID and Client Secret
3. Complete the OAuth2 authorization flow

## Usage

1. Add the "Tiny ERP" node to your workflow
2. Select the desired operation (e.g., "Get Many", "Create", "Update")
3. Configure the required parameters based on the operation
4. Connect your OAuth2 credentials

### Example: Get All Products
- Operation: Get Many
- Additional Fields:
  - Name: "Product Name" (optional filter)
  - Status: "Active"
  - Limit: 50

### Example: Create Product
- Operation: Create
- Product Data:
  - SKU: "PROD-001"
  - Description: "My Product"
  - Type: "Product"
  - Unit: "UN"

## API Documentation

This node is built based on the Tiny ERP API documentation. For detailed information about available fields and operations, refer to the [Tiny ERP API Documentation](https://dev.tiny.com.br/docs).

## Development

### Project Structure
```
├── credentials/
│   └── TinyOAuth2Api.credentials.ts    # OAuth2 credential definition
├── nodes/
│   └── TinyErp/
│       ├── TinyErp.node.ts             # Main node implementation
│       ├── GenericFunctions.ts         # Helper functions
│       └── tinyerp.svg                 # Node icon
├── dist/                               # Compiled output
├── package.json                        # Project configuration
├── tsconfig.json                       # TypeScript configuration
└── README.md                           # This file
```

### Building
```bash
npm run build
```

### Linting
```bash
npm run lint
npm run lintfix  # Auto-fix issues
```

### Development Mode
```bash
npm run dev  # Watch mode for TypeScript compilation
```

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run tests and linting
5. Submit a pull request

## License

MIT License - see LICENSE file for details

## Support

For issues and questions:
- Check the [n8n community forum](https://community.n8n.io/)
- Review the [Tiny ERP API documentation](https://dev.tiny.com.br/docs)
- Open an issue in this repository

## Changelog

### 1.0.0
- Initial release
- Support for all major product operations
- OAuth2 authentication
- Comprehensive error handling
- Full TypeScript support