vtb-appit 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +71 -0
- package/appit.js +795 -212
- package/package.json +1 -1
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is a Node.js library for synchronizing travel data with the Appit4Travel platform. The library transforms travel data from various sources and uploads it to the Appit platform via API calls.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
The project consists of two main classes:
|
|
12
|
+
|
|
13
|
+
- **Appit** (`appit.js`) - Main orchestrator class that handles API communication and data synchronization
|
|
14
|
+
- **AppitBaseTransformer** (`appit-base-transformer.js`) - Base class for transforming travel data from external sources
|
|
15
|
+
|
|
16
|
+
### Data Flow
|
|
17
|
+
|
|
18
|
+
1. A transformer class (extending AppitBaseTransformer) provides travel data in a standardized format
|
|
19
|
+
2. The Appit class takes this transformer and synchronizes the data with the remote API
|
|
20
|
+
3. History tracking prevents duplicate uploads and manages updates/deletions
|
|
21
|
+
|
|
22
|
+
### Key Components
|
|
23
|
+
|
|
24
|
+
- **Authentication**: Login via email/password to get bearer token
|
|
25
|
+
- **History Management**: Tracks uploaded items in `../../assets/history.json` to avoid duplicates
|
|
26
|
+
- **Data Types**: Handles excursions, places, ships, flights, accommodations, destinations, schemes, contacts, documents, notifications, members, organizations, and travel info
|
|
27
|
+
- **Image Processing**: Downloads and processes images from URLs for upload
|
|
28
|
+
- **API Communication**: HTTPS requests to `portal.appit4travel.com/api/v1/`
|
|
29
|
+
|
|
30
|
+
## Common Commands
|
|
31
|
+
|
|
32
|
+
Since this is a library without build scripts in package.json, testing is typically done by requiring the module in other Node.js projects:
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
const { Appit, AppitBaseTransformer } = require('vtb-appit');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development Notes
|
|
39
|
+
|
|
40
|
+
- Uses Node.js built-in modules (fs, path, https) and axios for HTTP requests
|
|
41
|
+
- Expects travel data in `../../assets/travelplan.json`
|
|
42
|
+
- Stores JWT token in `../../assets/token.jwt` for TravelSpirit integration
|
|
43
|
+
- Images are fetched from URLs and processed for different crop sizes
|
|
44
|
+
- File uploads use FormData for multipart requests
|
|
45
|
+
- All API operations include error handling with console logging
|
|
46
|
+
- Rate limiting: 500ms delay between API requests
|
|
47
|
+
|
|
48
|
+
## Transformer Pattern
|
|
49
|
+
|
|
50
|
+
To use this library, extend AppitBaseTransformer and implement methods that return your travel data:
|
|
51
|
+
|
|
52
|
+
- `excursion()` - Main excursion details
|
|
53
|
+
- `places()` - Array of places/locations
|
|
54
|
+
- `ships()` - Array of ships/vessels
|
|
55
|
+
- `flights()` - Array of flight information
|
|
56
|
+
- `accommodations()` - Array of hotels/lodging
|
|
57
|
+
- `participants()` - Array of travelers/members
|
|
58
|
+
- `destinations()` - Array of destinations
|
|
59
|
+
- `schemes()` - Array of itinerary schemes
|
|
60
|
+
- `contacts()` - Array of contact information
|
|
61
|
+
- `documents()` - Array of travel documents
|
|
62
|
+
- `notifications()` - Array of notifications
|
|
63
|
+
- `travelInfo()` - Array of travel information
|
|
64
|
+
- `organizations()` - Array of organizations
|
|
65
|
+
- `labels()` - Array of labels for categorization
|
|
66
|
+
- `homescreen()` - Home screen configuration
|
|
67
|
+
- `menu()` - Menu configuration
|
|
68
|
+
- `settings()` - App settings
|
|
69
|
+
- `flightImages()` - Flight-related images
|
|
70
|
+
|
|
71
|
+
Each method should return data in the expected format or `false` if not applicable.
|