ti2 1.0.109 → 1.0.111

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.
@@ -1,3 +1,6 @@
1
+ /**
2
+ * SDL + document for ti2 plugins
3
+ */
1
4
  const typeDefs = `
2
5
  type Passenger {
3
6
  firstName: String
@@ -16,8 +19,15 @@ const typeDefs = `
16
19
  passengers: [Passenger]
17
20
  }
18
21
 
22
+ type PuDoInfo {
23
+ date: String
24
+ time: String
25
+ remarks: String
26
+ }
27
+
19
28
  type ServiceLine {
20
29
  serviceLineId: ID!
30
+ serviceLineUpdateCount: Int
21
31
  optionId: String!
22
32
  optionName: String
23
33
  linePrice: String
@@ -28,14 +38,20 @@ const typeDefs = `
28
38
  paxList: [Passenger]
29
39
  paxConfigs: [PaxConfig]
30
40
  status: String
41
+ puInfo: PuDoInfo
42
+ doInfo: PuDoInfo
31
43
  }
32
44
 
33
45
  type Query {
34
46
  bookingId: ID!
35
47
  name: String!
36
48
  bookingStatus: String
49
+ bookingStatusId: String
50
+ isBooking: Boolean
51
+ bookingAgent: String
37
52
  ref: String!
38
53
  agentRef: String
54
+ agentId: String
39
55
  totalPrice: String!
40
56
  currency: String!
41
57
  travelDate: String!
@@ -49,8 +65,12 @@ const query = `{
49
65
  name
50
66
  bookingId
51
67
  bookingStatus
68
+ bookingStatusId
69
+ isBooking
70
+ bookingAgent
52
71
  ref
53
72
  agentRef
73
+ agentId
54
74
  totalPrice
55
75
  currency
56
76
  travelDate
@@ -58,15 +78,25 @@ const query = `{
58
78
  canEdit
59
79
  serviceLines {
60
80
  serviceLineId
81
+ serviceLineUpdateCount
61
82
  linePrice
62
83
  quantity
63
84
  optionId
64
85
  optionName
65
86
  supplierId
66
87
  supplierName
67
- supplierId
68
88
  startDate
69
89
  status
90
+ puInfo {
91
+ date
92
+ time
93
+ remarks
94
+ }
95
+ doInfo {
96
+ date
97
+ time
98
+ remarks
99
+ }
70
100
  paxConfigs {
71
101
  roomType
72
102
  adults
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2",
3
- "version": "1.0.109",
3
+ "version": "1.0.111",
4
4
  "description": "Tourist Industry Exchange (TI2)",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/.windsurfrules DELETED
@@ -1,9 +0,0 @@
1
- This is a Node.js project using Sequelize for database operations and Express.js for the web server.
2
- The API is defined in api.yml using OpenAPI 3.0.2
3
- The database is defined in models/index.js
4
- The models are defined in models/
5
- to run tests you have to run them on the ti2 named docker container, and consider this codebase is part of node_modules/ti2 path for example :
6
- `` $ docker exec ti2 bash -c "cd /ti2 && npx jest lib/__tests__/callback.js --forceExit"``
7
- When writing / editing tests, make use of test/utils.js and review their implementation to understand how to mock the environment.
8
- Do not make any changes until you 95% confident of the changes you want to make, ask follow up questions until you have that confidence.
9
- when sending jobs to the background worker using the queue, asssume a worker is always runing to execute it but is on a different instance thread, so to review / wait for jobs we have to use the wokrer/queue.js listJobs fn to check for it
package/CLAUDE.md DELETED
@@ -1,159 +0,0 @@
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
- Ti2 (Tourism Information Interchange) is an open-source integration framework for the tourism industry. It provides standardized functions for bookings, content, and rates management through a plugin-based architecture.
8
-
9
- ## Critical Development Rules
10
-
11
- 1. **Docker Container Execution**: ALL commands must be run inside the `ti2` Docker container
12
- - The codebase is located at `/ti2` path inside the container
13
- - This project is part of `node_modules/ti2` in the container environment
14
- - **NEVER run npm, node, or npx commands on the host machine**
15
- - Always use: `docker exec ti2 bash -c "cd /ti2 && <command>"`
16
- - Example for npm install: `docker exec ti2 bash -c "cd /ti2 && npm install <package>"`
17
-
18
- 2. **Testing Rules**:
19
- - Tests MUST be run inside the Docker container
20
- - Example: `docker exec ti2 bash -c "cd /ti2 && npx jest lib/__tests__/callback.js --forceExit"`
21
- - Use `test/utils.js` for mocking the environment
22
- - Review test utility implementations before writing/editing tests
23
-
24
- 3. **Background Jobs**:
25
- - Jobs sent to the queue run on a separate worker thread/instance
26
- - Use `worker/queue.js` `listJobs` function to check job status
27
- - Workers are always assumed to be running
28
-
29
- 4. **Code Confidence**: Do not make changes until 95% confident. Ask follow-up questions if uncertain.
30
-
31
- ## Common Development Commands
32
-
33
- ```bash
34
- # Run tests (inside Docker container)
35
- docker exec ti2 bash -c "cd /ti2 && npm test"
36
- docker exec ti2 bash -c "cd /ti2 && npx jest [test-file] --forceExit"
37
-
38
- # Run specific test file
39
- docker exec ti2 bash -c "cd /ti2 && npx jest controllers/__tests__/bookings.js --forceExit"
40
-
41
- # Database migrations
42
- docker exec ti2 bash -c "cd /ti2 && npm run sequelize db:migrate"
43
-
44
- # Generate documentation
45
- docker exec ti2 bash -c "cd /ti2 && npm run doc"
46
- ```
47
-
48
- ## Architecture
49
-
50
- ### Core Components
51
-
52
- 1. **Main Entry Point** (`index.js`):
53
- - Initializes Express server on port 10010 (default)
54
- - Sets up Swagger documentation at `/api-docs`
55
- - Handles plugin instantiation and middleware
56
- - Implements caching mechanism
57
- - Manages background job processing via `worker/queue.js`
58
-
59
- 2. **API Definition** (`api.yml`):
60
- - OpenAPI 3.0.0 specification
61
- - Defines all endpoints and schemas
62
- - JWT Bearer authentication
63
-
64
- 3. **Plugin System**:
65
- - Two types: Integration Plugins (connect systems) and App Plugins (value-added tools)
66
- - Plugins are instantiated with cache, axios, events, and configuration
67
- - Plugin schemas are merged with main API schema
68
- - Each plugin gets its own routes under `/apps/{pluginName}`
69
-
70
- 4. **Controllers** (`controllers/`):
71
- - `app.js`: Core application controller
72
- - `bookings.js`: Booking operations (searchProducts, createBooking, etc.)
73
- - `admin.js`: Administrative functions
74
- - `user.js`: User management
75
- - `ping.js`: Health check endpoints
76
- - `allotment.js`: Allotment management
77
-
78
- 5. **Database Models** (`models/`):
79
- - Sequelize ORM with MySQL
80
- - Key models: Integration, User, UserAppKey, CronJobs, ApiCronJobs
81
- - Migrations in `migrations/` directory
82
-
83
- 6. **Worker System** (`worker/`):
84
- - Bull queue for background job processing
85
- - Redis-backed job queue
86
- - Supports plugin jobs, API jobs, and callback jobs
87
- - Multi-worker support with throng
88
-
89
- 7. **Authentication** (`auth/authHandler.js`):
90
- - JWT-based authentication
91
- - Bearer token scheme
92
-
93
- ### Key Features
94
-
95
- - **Caching**: Redis-based caching with configurable TTL
96
- - **Event System**: EventEmitter2 for plugin communication
97
- - **Background Jobs**: Async job processing with Bull/Redis
98
- - **Cron Jobs**: Scheduled task execution
99
- - **Multi-tenancy**: Support for multiple integrations/plugins
100
-
101
- ### Plugin Development
102
-
103
- Plugins must implement standard methods:
104
- - `validateToken`: Token validation
105
- - `tokenTemplate`: Token configuration template
106
- - Booking methods: `searchProducts`, `searchAvailability`, `createBooking`, `cancelBooking`
107
- - Content methods: `getProducts`, `getProduct`, `createProduct`, `updateProduct`
108
-
109
- ### Testing Strategy
110
-
111
- - Jest testing framework
112
- - Test fixtures in `__fixtures__/`
113
- - Mock plugins in `__mocks__/`
114
- - Use `test/utils.js` for creating test environments
115
- - Tests organized by controller in `controllers/__tests__/`
116
-
117
- ## Database
118
-
119
- - Sequelize ORM with MySQL/MariaDB
120
- - Connection managed through `models/db.js`
121
- - Migrations handled via sequelize-cli
122
- - Models auto-loaded from `models/` directory
123
-
124
- ## Environment Variables
125
-
126
- Key variables:
127
- - `PORT`: Server port (default: 10010)
128
- - `REDIS_URL`: Redis connection (default: redis://redis:6379)
129
- - `jwtSecret`: JWT signing secret
130
- - `adminKey`: Admin authentication key
131
- - `WEB_CONCURRENCY`: Number of workers
132
- - `MAX_JOBS_PER_WORKER`: Job concurrency per worker
133
- - `SSL_INSECURE_ALLOWED_DOMAINS`: Pipe-separated list of domains where SSL certificate verification is skipped (e.g., `localhost|staging.example.com|192.168.1.100`)
134
-
135
- Plugin-specific variables follow pattern: `ti2_{pluginName}_{setting}`
136
-
137
- ### SSL Configuration
138
-
139
- The `SSL_INSECURE_ALLOWED_DOMAINS` environment variable allows you to specify domains where SSL certificate verification should be skipped. This is useful for:
140
- - Development environments with self-signed certificates
141
- - Testing against staging servers with invalid certificates
142
- - Local development with HTTPS
143
-
144
- Example usage:
145
- ```bash
146
- # Skip SSL verification for specific domains
147
- export SSL_INSECURE_ALLOWED_DOMAINS="localhost|staging.api.com|192.168.1.100"
148
-
149
- # Multiple domains separated by pipe
150
- export SSL_INSECURE_ALLOWED_DOMAINS="dev.example.com|test.example.com"
151
- ```
152
-
153
- **Important Implementation Notes**:
154
- - SSL configuration is ONLY applied to plugin axios instances (for external API calls) and worker axios instances
155
- - Internal communication (callbacks, per-request axios) do NOT use SSL configuration
156
- - SSL configuration uses a per-request interceptor approach for better isolation
157
- - The configuration checks domains dynamically on each request
158
-
159
- **Warning**: Only use this in development/testing environments. Never skip SSL verification in production for security reasons.