railkit 4.0.0 → 4.0.3
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/README.md +20 -18
- package/index.obfuscated.js +1 -1
- package/package.json +2 -2
- package/temp-irctc-connect/irctc-connect-3.3.0.tgz +0 -0
- package/temp-irctc-connect/package/README.md +143 -0
- package/temp-irctc-connect/package/index.d.ts +116 -0
- package/temp-irctc-connect/package/index.obfuscated.js +1 -0
- package/temp-irctc-connect/package/package.json +56 -0
- package/temp-irctc-connect/package/postinstall.js +64 -0
- package/.claude/settings.local.json +0 -10
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# RailKit
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/railkit)
|
|
4
|
+
[](https://www.npmjs.com/package/railkit)
|
|
5
|
+
[](https://github.com/RAJIV81205/railkit/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
<img width="1536" height="657" alt="RailKit Banner" src="https://github.com/user-attachments/assets/6bdcc05f-186d-4f6f-918d-a99a65026c97" />
|
|
6
8
|
|
|
7
|
-
<img width="1536" height="657" alt="IRCTC Connect Banner" src="https://github.com/user-attachments/assets/39c770a2-639c-443c-93b6-4e78889e78b0" />
|
|
8
9
|
|
|
9
10
|
A comprehensive Node.js SDK for Indian Railways. Get real-time PNR status, train information, live tracking, station updates, train search, and seat availability — all through a single, clean API.
|
|
10
11
|
|
|
@@ -26,14 +27,14 @@ A comprehensive Node.js SDK for Indian Railways. Get real-time PNR status, train
|
|
|
26
27
|
## 📦 Installation
|
|
27
28
|
|
|
28
29
|
```bash
|
|
29
|
-
npm install
|
|
30
|
+
npm install railkit
|
|
30
31
|
```
|
|
31
32
|
|
|
32
33
|
---
|
|
33
34
|
|
|
34
35
|
## 🔑 Getting an API Key
|
|
35
36
|
|
|
36
|
-
1. Visit **[
|
|
37
|
+
1. Visit **[railkit.rajivdubey.dev](https://railkit.rajivdubey.dev)**
|
|
37
38
|
2. Sign up and navigate to your Dashboard
|
|
38
39
|
3. Generate an API key from the **API Keys** section
|
|
39
40
|
4. Copy the key — you'll use it in the next step
|
|
@@ -46,15 +47,15 @@ npm install irctc-connect
|
|
|
46
47
|
|
|
47
48
|
```bash
|
|
48
49
|
# .env
|
|
49
|
-
|
|
50
|
+
RAILKIT_API_KEY=your_api_key_here
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
### Step 2 — Configure the SDK once at startup
|
|
53
54
|
|
|
54
55
|
```javascript
|
|
55
|
-
import { configure } from '
|
|
56
|
+
import { configure } from 'railkit';
|
|
56
57
|
|
|
57
|
-
configure(process.env.
|
|
58
|
+
configure(process.env.RAILKIT_API_KEY);
|
|
58
59
|
```
|
|
59
60
|
|
|
60
61
|
Call `configure()` **once** at the top of your app before using any other function. It stores your key globally for all subsequent calls.
|
|
@@ -71,10 +72,10 @@ import {
|
|
|
71
72
|
searchTrainBetweenStations,
|
|
72
73
|
getAvailability,
|
|
73
74
|
fareLookup,
|
|
74
|
-
} from '
|
|
75
|
+
} from 'railkit';
|
|
75
76
|
|
|
76
77
|
// Configure once
|
|
77
|
-
configure(process.env.
|
|
78
|
+
configure(process.env.RAILKIT_API_KEY);
|
|
78
79
|
|
|
79
80
|
// Check PNR status
|
|
80
81
|
const pnrResult = await checkPNRStatus('1234567890');
|
|
@@ -111,9 +112,9 @@ Configure the SDK with your API key. **Must be called once before any other func
|
|
|
111
112
|
| `apiKey` | string | Your API key from the dashboard |
|
|
112
113
|
|
|
113
114
|
```javascript
|
|
114
|
-
import { configure } from '
|
|
115
|
+
import { configure } from 'railkit';
|
|
115
116
|
|
|
116
|
-
configure(process.env.
|
|
117
|
+
configure(process.env.RAILKIT_API_KEY);
|
|
117
118
|
```
|
|
118
119
|
|
|
119
120
|
---
|
|
@@ -675,7 +676,7 @@ All functions return a consistent response structure. Always check `success` bef
|
|
|
675
676
|
|
|
676
677
|
| Error | Cause |
|
|
677
678
|
|-------|-------|
|
|
678
|
-
| `
|
|
679
|
+
| `railkit is not configured` | `configure()` was not called |
|
|
679
680
|
| `Invalid API key` (401) | Key doesn't exist in the system |
|
|
680
681
|
| `API key is inactive` (403) | Key has been deactivated |
|
|
681
682
|
| `Usage limit exceeded` (429) | Monthly request quota reached |
|
|
@@ -760,15 +761,16 @@ Used by both `getAvailability` and `fareLookup`.
|
|
|
760
761
|
|
|
761
762
|
- Node.js 18+ (native `fetch` required)
|
|
762
763
|
- Internet connection for API calls
|
|
763
|
-
- A valid
|
|
764
|
+
- A valid RailKit API key
|
|
764
765
|
|
|
765
766
|
---
|
|
766
767
|
|
|
767
768
|
## 🙋 Support
|
|
768
769
|
|
|
769
|
-
- **Issues:** [GitHub Issues](https://github.com/RAJIV81205/
|
|
770
|
-
- **Docs:** [
|
|
771
|
-
- **Discussions:** [GitHub Discussions](https://github.com/RAJIV81205/
|
|
770
|
+
- **Issues:** [GitHub Issues](https://github.com/RAJIV81205/railkit/issues)
|
|
771
|
+
- **Docs:** [railkit.rajivdubey.dev/docs](https://railkit.rajivdubey.dev/docs)
|
|
772
|
+
- **Discussions:** [GitHub Discussions](https://github.com/RAJIV81205/railkit/discussions)
|
|
773
|
+
|
|
772
774
|
|
|
773
775
|
---
|
|
774
776
|
|
package/index.obfuscated.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a0_0x2ccd(){const _0x520c55=['yxbWBgLJyxrPB24VANnVBG','Agv4','l2fWAs9JAgvJA1bouLn0yxr1CY8','Dg9vChbLCKnHC2u','p2HYCZ0','sM91CM5LEsbKyxrLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigLUierelu1nlvLzwvKGzM9YBwf0lG','BM93','nZGYmZiXB1vizufA','Ahr0Chm6lY9YywLSA2L0lwfWAs5YywPPDMr1yMv5lMrLDG','l2fWAs90CMfPBKHPC3rVCNKV','AxnbCNjHEq','mLnVzNf4Ba','C3rYAw5N','C3rHDhvZq29Kzq','qM90AcbMCM9TigfUzcb0BYbZDgf0Aw9UignVzgvZigfYzsbYzxf1AxjLzcbHBMqGBxvZDcbIzsbZDhjPBMDZlG','otDJntzLmdHImJDImtyXmti0zJG4ywnKngyYngqXyMq1mgy0oda3nwyXmwrJmJnIowvHnMmWyMm5yJjModC5na','r0vu','nJGXotjwBwvgDeC','ANnVBG','DgvZDa','B2jQzwn0','mty4nJq0n3fgzuXVBa','nJeZodyWmfLfwNblqW','sw52ywXPzcaNAg91CNmNihzHBhvLlIbbBgXVD2vKihzHBhvLCZOGmIWGncWGoc4','mJC5DfbACwvJ','ue5sig51BwjLCIbPCYbYzxf1AxjLzcbHBMqGBxvZDcbIzsbHihn0CMLUzY4','w3jHAwXRAxrDignVBMzPz3vYzsGPihjLCxvPCMvZigeGDMfSAwqGqvbjigTLEsbZDhjPBMCU','l2fWAs9SAxzLqxrtDgf0Aw9UlW','DxbKyxrL','Aw5JBhvKzxm','ue5sig51BwjLCIbTDxn0igjLigv4ywn0BhKGmtaGzgLNAxrZlG','C3rHDhvZ','l2fWAs9NzxruCMfPBKLUzM8V','sw52ywXPzcb0CMfPBIbUDw1IzxiUieL0ig11C3qGyMuGysa1lwnOyxjHy3rLCIbZDhjPBMCU','BgvUz3rO','p2rHDgu9','uMvXDwvZDcbMywLSzwq6ia','nMXpzwXJwG','l2fWAs9MyxjLtg9VA3vWlW','l2fWAs9NzxrbDMfPBgfIAwXPDhKV','CMvWBgfJzq','nde5mtu2mgv6q0X5sa','DhjPBq','CMfPBgTPDcbPCYbUB3qGy29UzMLNDxjLzc4Gq2fSBcbJB25MAwD1CMuOyxbPs2v5ksbMAxjZDc4','ndiXmtiZmK9Qrfz0Bq','l2fWAs90CMfJA1rYywLUlW','u3rHDgLVBIbJB2rLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigeGC3rYAw5NlG','BwvZC2fNzq','l2fWAs9ZzwfYy2HuCMfPBKjLDhDLzw5tDgf0Aw9UCY8','C2HHmJu2','ntmXmte2nLL1t1fytq','sw5JB21WBgv0zsbKyxrHlIbqBgvHC2uGChjVDMLKzsbHBgWGCMvXDwLYzwqGzMLLBgrZlG'];a0_0x2ccd=function(){return _0x520c55;};return a0_0x2ccd();}const a0_0x4e53bf=a0_0x1090;(function(_0x128c9c,_0x3624f0){const _0x2f8ac8=a0_0x1090,_0x471ec5=_0x128c9c();while(!![]){try{const _0x3b2958=-parseInt(_0x2f8ac8(0x209))/0x1*(-parseInt(_0x2f8ac8(0x20d))/0x2)+parseInt(_0x2f8ac8(0x1e3))/0x3+-parseInt(_0x2f8ac8(0x1fa))/0x4+-parseInt(_0x2f8ac8(0x1f7))/0x5+parseInt(_0x2f8ac8(0x1f3))/0x6*(parseInt(_0x2f8ac8(0x200))/0x7)+parseInt(_0x2f8ac8(0x213))/0x8*(-parseInt(_0x2f8ac8(0x1e6))/0x9)+parseInt(_0x2f8ac8(0x1e4))/0xa;if(_0x3b2958===_0x3624f0)break;else _0x471ec5['push'](_0x471ec5['shift']());}catch(_0x117974){_0x471ec5['push'](_0x471ec5['shift']());}}}(a0_0x2ccd,0x89228));import{createHash,createHmac,randomBytes}from'node:crypto';const _baseUrl=a0_0x4e53bf(0x20a),_sdkVersion='1',_defaultSdkSigningSecret=a0_0x4e53bf(0x211);let _apiKey='',_sdkSigningSecret=_defaultSdkSigningSecret;function configure(_0x430fc2){const _0x3dea9=a0_0x4e53bf;if(!_0x430fc2||typeof _0x430fc2!==_0x3dea9(0x20e))throw new Error(_0x3dea9(0x1e8));_apiKey=_0x430fc2[_0x3dea9(0x1f8)]();}function a0_0x1090(_0x222767,_0x5186bf){_0x222767=_0x222767-0x1e0;const _0x2ccd33=a0_0x2ccd();let _0x109046=_0x2ccd33[_0x222767];if(a0_0x1090['zZESLq']===undefined){var _0x4a8580=function(_0x147805){const _0x5915e9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x430fc2='',_0x133003='';for(let _0x6c4d38=0x0,_0x1e8445,_0x2d85fe,_0x52e5a2=0x0;_0x2d85fe=_0x147805['charAt'](_0x52e5a2++);~_0x2d85fe&&(_0x1e8445=_0x6c4d38%0x4?_0x1e8445*0x40+_0x2d85fe:_0x2d85fe,_0x6c4d38++%0x4)?_0x430fc2+=String['fromCharCode'](0xff&_0x1e8445>>(-0x2*_0x6c4d38&0x6)):0x0){_0x2d85fe=_0x5915e9['indexOf'](_0x2d85fe);}for(let _0x406f4d=0x0,_0x2200e5=_0x430fc2['length'];_0x406f4d<_0x2200e5;_0x406f4d++){_0x133003+='%'+('00'+_0x430fc2['charCodeAt'](_0x406f4d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x133003);};a0_0x1090['jvuGeU']=_0x4a8580,a0_0x1090['mBYFOk']={},a0_0x1090['zZESLq']=!![];}const _0x43c083=_0x2ccd33[0x0],_0x3e6fe2=_0x222767+_0x43c083,_0x135e4d=a0_0x1090['mBYFOk'][_0x3e6fe2];return!_0x135e4d?(_0x109046=a0_0x1090['jvuGeU'](_0x109046),a0_0x1090['mBYFOk'][_0x3e6fe2]=_0x109046):_0x109046=_0x135e4d,_0x109046;}function _hashPayload(_0x133003){const _0x25f029=a0_0x4e53bf;return createHash(_0x25f029(0x1ff))[_0x25f029(0x1ea)](_0x133003)['digest'](_0x25f029(0x203));}function _buildSignature({method:_0x6c4d38,path:_0x1e8445,timestamp:_0x2d85fe,nonce:_0x52e5a2,payloadHash:_0x406f4d}){const _0x11379c=a0_0x4e53bf,_0x2200e5=[_0x6c4d38[_0x11379c(0x205)](),_0x1e8445,_0x2d85fe,_0x52e5a2,_0x406f4d,_apiKey]['join']('\x0a');return createHmac(_0x11379c(0x1ff),_sdkSigningSecret)[_0x11379c(0x1ea)](_0x2200e5)['digest'](_0x11379c(0x203));}function _getSdkSecurityHeaders(_0x43a077,_0x5ae2c4,_0xb0894=''){const _0x31d075=a0_0x4e53bf,_0x11cea9=String(Date[_0x31d075(0x208)]()),_0x5b4a3d=randomBytes(0x20)['toString']('hex'),_0x19451b=_hashPayload(_0xb0894),_0x2a887e=_buildSignature({'method':_0x43a077,'path':_0x5ae2c4,'timestamp':_0x11cea9,'nonce':_0x5b4a3d,'payloadHash':_0x19451b});return{'x-irctc-sdk-ts':_0x11cea9,'x-irctc-sdk-nonce':_0x5b4a3d,'x-irctc-sdk-payload-sha256':_0x19451b,'x-irctc-sdk-signature':_0x2a887e,'x-irctc-sdk-version':_sdkVersion};}async function _get(_0x515a0d){const _0x4fe55c=a0_0x4e53bf;if(!_apiKey)return{'success':![],'error':_0x4fe55c(0x1f9)};try{const _0x24efc8=_getSdkSecurityHeaders('GET',_0x515a0d,''),_0x3cc475=await fetch(''+_baseUrl+_0x515a0d,{'method':_0x4fe55c(0x212),'headers':{'x-api-key':_apiKey,'Accept':_0x4fe55c(0x202),..._0x24efc8}}),_0x37b1f8=await _0x3cc475[_0x4fe55c(0x1e0)]();return _0x37b1f8&&typeof _0x37b1f8===_0x4fe55c(0x1e2)&&!Array[_0x4fe55c(0x20c)](_0x37b1f8)&&Object['defineProperty'](_0x37b1f8,_0x4fe55c(0x20f),{'value':_0x3cc475[_0x4fe55c(0x1ed)],'enumerable':![]}),_0x37b1f8;}catch(_0x3d2be9){return{'success':![],'error':_0x4fe55c(0x1f2)+_0x3d2be9[_0x4fe55c(0x1fd)]};}}async function checkPNRStatus(_0x4e1e85){const _0x1ad7f0=a0_0x4e53bf;if(!_0x4e1e85||typeof _0x4e1e85!==_0x1ad7f0(0x20e))return{'success':![],'error':_0x1ad7f0(0x1e7)};const _0xfa283=_0x4e1e85[_0x1ad7f0(0x1f8)]()[_0x1ad7f0(0x1f6)](/\D/g,'');if(_0xfa283['length']!==0xa)return{'success':![],'error':_0x1ad7f0(0x1ec)};return _get(_0x1ad7f0(0x204)+_0xfa283);}async function getTrainInfo(_0x1774af){const _0x1c87f5=a0_0x4e53bf;if(!_0x1774af||typeof _0x1774af!==_0x1c87f5(0x20e)||_0x1774af[_0x1c87f5(0x1f8)]()[_0x1c87f5(0x1f0)]!==0x5)return{'success':![],'error':_0x1c87f5(0x1ef)};return _get(_0x1c87f5(0x1ee)+_0x1774af[_0x1c87f5(0x1f8)]());}async function trackTrain(_0x41f3d3,_0x4667d7){const _0x1101ce=a0_0x4e53bf;if(!_0x41f3d3||typeof _0x41f3d3!=='string'||_0x41f3d3[_0x1101ce(0x1f8)]()['length']!==0x5)return{'success':![],'error':_0x1101ce(0x1ef)};const _0x48b5a1=_0x4667d7?_0x1101ce(0x1fb)+_0x41f3d3[_0x1101ce(0x1f8)]()+'/'+encodeURIComponent(_0x4667d7[_0x1101ce(0x1f8)]()):'/api/trackTrain/'+_0x41f3d3[_0x1101ce(0x1f8)]()+'/today';return _get(_0x48b5a1);}async function getTrainHistory(_0x1c3848,_0x1d9528){const _0xa12d01=a0_0x4e53bf;if(!_0x1c3848||typeof _0x1c3848!==_0xa12d01(0x20e)||_0x1c3848[_0xa12d01(0x1f8)]()[_0xa12d01(0x1f0)]!==0x5)return{'success':![],'error':'Invalid\x20train\x20number.\x20It\x20must\x20be\x20a\x205-character\x20string.'};if(!_0x1d9528||typeof _0x1d9528!==_0xa12d01(0x20e)||!/^\d{2}-\d{2}-\d{4}$/[_0xa12d01(0x1e1)](_0x1d9528[_0xa12d01(0x1f8)]()))return{'success':![],'error':_0xa12d01(0x207)};return _get(_0xa12d01(0x20b)+_0x1c3848[_0xa12d01(0x1f8)]()+'/'+encodeURIComponent(_0x1d9528[_0xa12d01(0x1f8)]()));}async function liveAtStation(_0x2047f0,_0x59e4bd){const _0x4f2f92=a0_0x4e53bf;if(!_0x2047f0||typeof _0x2047f0!=='string')return{'success':![],'error':_0x4f2f92(0x1fc)};let _0x12e816='';if(_0x59e4bd!==undefined&&_0x59e4bd!==null){const _0x290be4=Number(_0x59e4bd);if(![0x2,0x4,0x8][_0x4f2f92(0x1eb)](_0x290be4))return{'success':![],'error':_0x4f2f92(0x1e5)};_0x12e816=_0x4f2f92(0x206)+_0x290be4;}return _get(_0x4f2f92(0x1e9)+_0x2047f0['trim']()[_0x4f2f92(0x205)]()+_0x12e816);}async function searchTrainBetweenStations(_0x4ee690,_0x4f75e9,_0x1831ad){const _0x1f7890=a0_0x4e53bf;if(!_0x4ee690||typeof _0x4ee690!=='string'||!_0x4f75e9||typeof _0x4f75e9!==_0x1f7890(0x20e)||_0x1831ad&&typeof _0x1831ad!=='string')return{'success':![],'error':_0x1f7890(0x210)};let _0x34500d=_0x1f7890(0x1fe)+_0x4ee690['trim']()[_0x1f7890(0x205)]()+'/'+_0x4f75e9[_0x1f7890(0x1f8)]()[_0x1f7890(0x205)]();return _0x1831ad&&(_0x34500d+=_0x1f7890(0x1f1)+encodeURIComponent(_0x1831ad['trim']())),_get(_0x34500d);}async function getAvailability(_0xa87837,_0x20594b,_0x57b964,_0x19d6b0,_0x9e0381,_0x1469da){const _0x5b8440=a0_0x4e53bf;if(!_0xa87837||!_0x20594b||!_0x57b964||!_0x19d6b0||!_0x9e0381||!_0x1469da)return{'success':![],'error':_0x5b8440(0x201)};const _0x4e3fa2=_0x20594b['trim']()[_0x5b8440(0x205)](),_0x1451e3=_0x57b964[_0x5b8440(0x1f8)]()[_0x5b8440(0x205)](),_0x44cde7=_0x9e0381[_0x5b8440(0x1f8)]()[_0x5b8440(0x205)](),_0x4d8914=_0x1469da['trim']()[_0x5b8440(0x205)](),_0x5257ce=_0xa87837[_0x5b8440(0x1f8)]();return _get(_0x5b8440(0x1f5)+_0x5257ce+'/'+_0x4e3fa2+'/'+_0x1451e3+'/'+encodeURIComponent(_0x19d6b0[_0x5b8440(0x1f8)]())+'/'+_0x44cde7+'/'+_0x4d8914);}async function fareLookup(_0x3aec91,_0x13acb8,_0x4613ae,_0x109711,_0x223e19,_0x351af0){const _0x3ab374=a0_0x4e53bf;if(!_0x3aec91||!_0x13acb8||!_0x4613ae||!_0x109711||!_0x223e19||!_0x351af0)return{'success':![],'error':'Incomplete\x20data.\x20Please\x20provide\x20all\x20required\x20fields.'};const _0x36809d=_0x13acb8[_0x3ab374(0x1f8)]()[_0x3ab374(0x205)](),_0x404327=_0x4613ae[_0x3ab374(0x1f8)]()[_0x3ab374(0x205)](),_0x47c7f0=_0x223e19[_0x3ab374(0x1f8)]()[_0x3ab374(0x205)](),_0xe89db6=_0x351af0[_0x3ab374(0x1f8)]()[_0x3ab374(0x205)](),_0x80402b=_0x3aec91[_0x3ab374(0x1f8)]();return _get(_0x3ab374(0x1f4)+_0x80402b+'/'+encodeURIComponent(_0x109711[_0x3ab374(0x1f8)]())+'/'+_0x36809d+'/'+_0x404327+'/'+_0x47c7f0+'/'+_0xe89db6);}export{configure,checkPNRStatus,getTrainInfo,trackTrain,getTrainHistory,liveAtStation,searchTrainBetweenStations,getAvailability,fareLookup};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "railkit",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "🚂 Complete Node.js SDK for Indian Railways - Check PNR status, train schedules, live running status, seat availability, station information and more. Promise-based API with TypeScript support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"railkit",
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
"dev": "nodemon index.js",
|
|
50
50
|
"obfuscate": "npx javascript-obfuscator index.js --output index.obfuscated.js --compact true --string-array true --string-array-encoding base64 --rename-globals false --control-flow-flattening false --dead-code-injection false"
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
> ## ⚠️ DEPRECATION NOTICE
|
|
2
|
+
>
|
|
3
|
+
> **`irctc-connect` has been renamed to [`railkit`](https://www.npmjs.com/package/railkit).**
|
|
4
|
+
>
|
|
5
|
+
> This package will continue to work for now, but it will **not** receive new features, bug fixes, or security updates. Please migrate to `railkit` as soon as possible.
|
|
6
|
+
>
|
|
7
|
+
> ### 🔄 Migrate in 3 steps
|
|
8
|
+
>
|
|
9
|
+
> ```bash
|
|
10
|
+
> # 1. Remove the old package
|
|
11
|
+
> npm uninstall irctc-connect
|
|
12
|
+
>
|
|
13
|
+
> # 2. Install the new package
|
|
14
|
+
> npm install railkit
|
|
15
|
+
> ```
|
|
16
|
+
>
|
|
17
|
+
> ```diff
|
|
18
|
+
> - import { configure, checkPNRStatus } from "irctc-connect";
|
|
19
|
+
> + import { configure, checkPNRStatus } from "railkit";
|
|
20
|
+
> ```
|
|
21
|
+
>
|
|
22
|
+
> 📖 **New documentation:** [https://railkit.rajivdubey.dev](https://railkit.rajivdubey.dev)
|
|
23
|
+
> 📦 **New repository:** [github.com/RAJIV81205/RailKit](https://github.com/RAJIV81205/RailKit)
|
|
24
|
+
> 🚀 **npm page:** [npmjs.com/package/railkit](https://www.npmjs.com/package/railkit)
|
|
25
|
+
>
|
|
26
|
+
> ---
|
|
27
|
+
|
|
28
|
+
# IRCTC Connect (DEPRECATED)
|
|
29
|
+
|
|
30
|
+
[](https://www.npmjs.com/package/irctc-connect)
|
|
31
|
+
[](https://www.npmjs.com/package/irctc-connect)
|
|
32
|
+
[](https://github.com/RAJIV81205/RailKit/blob/main/LICENSE)
|
|
33
|
+
[](#-deprecation-notice)
|
|
34
|
+
|
|
35
|
+
<img width="1536" height="657" alt="IRCTC Connect Banner" src="https://github.com/user-attachments/assets/39c770a2-639c-443c-93b6-4e78889e78b0" />
|
|
36
|
+
|
|
37
|
+
> **Heads up:** This is the **legacy** `irctc-connect` package. It still works, but the actively maintained successor is **[`railkit`](https://www.npmjs.com/package/railkit)**. New users should install `railkit` directly.
|
|
38
|
+
|
|
39
|
+
A comprehensive Node.js SDK for Indian Railways. Get real-time PNR status, train information, live tracking, station updates, train search, and seat availability — all through a single, clean API.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## ✨ Features
|
|
44
|
+
|
|
45
|
+
- 🎫 **PNR Status** — Real-time PNR status with full passenger details
|
|
46
|
+
- 🚂 **Train Information** — Complete train details with station-by-station route
|
|
47
|
+
- 📍 **Live Train Tracking** — Real-time position and delay info for any train
|
|
48
|
+
- 🚉 **Live Station Board** — Upcoming trains at any station right now
|
|
49
|
+
- 🔍 **Train Search** — Find all direct trains between two stations
|
|
50
|
+
- 💺 **Seat Availability** — Check availability and fare for any class and quota
|
|
51
|
+
- 💰 **Fare Lookup** — Full fare breakdown for any train, class, and quota
|
|
52
|
+
- ⚡ **Fast & Reliable** — Built-in timeout handling, input validation, and caching
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 📦 Installation (NEW package — recommended)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install railkit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Legacy installation (this package)
|
|
63
|
+
|
|
64
|
+
If you specifically need the legacy `irctc-connect` package — for example to keep an existing project running while you migrate — you can still install it, but a deprecation warning will be shown on every install/update:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install irctc-connect@^3.3.1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🔑 Getting an API Key
|
|
73
|
+
|
|
74
|
+
1. Visit **[railkit.rajivdubey.dev](https://railkit.rajivdubey.dev)**
|
|
75
|
+
2. Sign up and navigate to your Dashboard
|
|
76
|
+
3. Generate an API key from the **API Keys** section
|
|
77
|
+
4. Copy the key — you'll use it in the next step
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🚀 Quick Start
|
|
82
|
+
|
|
83
|
+
### Step 1 — Add your API key to `.env`
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# .env
|
|
87
|
+
IRCTC_API_KEY=your_api_key_here
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Step 2 — Use the SDK
|
|
91
|
+
|
|
92
|
+
**With the new `railkit` package (recommended):**
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
import { configure, checkPNRStatus } from "railkit";
|
|
96
|
+
|
|
97
|
+
configure(process.env.IRCTC_API_KEY);
|
|
98
|
+
|
|
99
|
+
const result = await checkPNRStatus("1234567890");
|
|
100
|
+
console.log(result);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**With the legacy `irctc-connect` package (still works):**
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
import { configure, checkPNRStatus } from "irctc-connect";
|
|
107
|
+
|
|
108
|
+
configure(process.env.IRCTC_API_KEY);
|
|
109
|
+
|
|
110
|
+
const result = await checkPNRStatus("1234567890");
|
|
111
|
+
console.log(result);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The API surface is identical — once you've swapped the import, you're done.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🧭 Migration Checklist
|
|
119
|
+
|
|
120
|
+
- [ ] Run `npm uninstall irctc-connect`
|
|
121
|
+
- [ ] Run `npm install railkit`
|
|
122
|
+
- [ ] Replace every `from "irctc-connect"` with `from "railkit"`
|
|
123
|
+
- [ ] Re-test your application
|
|
124
|
+
- [ ] Deploy 🚀
|
|
125
|
+
|
|
126
|
+
The `configure(apiKey)` call and all function names/signatures remain the same, so no other code changes are required.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 📚 Documentation
|
|
131
|
+
|
|
132
|
+
| Resource | Link |
|
|
133
|
+
| ----------------- | ------------------------------------------------------------------------------------- |
|
|
134
|
+
| New docs site | <https://railkit.rajivdubey.dev> |
|
|
135
|
+
| npm (new package) | <https://www.npmjs.com/package/railkit> |
|
|
136
|
+
| GitHub repository | <https://github.com/RAJIV81205/RailKit> |
|
|
137
|
+
| Issues | <https://github.com/RAJIV81205/RailKit/issues> |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 📜 License
|
|
142
|
+
|
|
143
|
+
ISC © [Rajiv81205](https://github.com/RAJIV81205)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure the SDK with your API key before using any other function.
|
|
3
|
+
* The backend URL is managed by the package - you only need your API key.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* configure('your-api-key-here');
|
|
7
|
+
*/
|
|
8
|
+
export function configure(apiKey: string): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Check the PNR status for a given 10-digit PNR number.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const result = await checkPNRStatus('1234567890');
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export function checkPNRStatus(pnr: string): Promise<any>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get detailed information and route for a given 5-digit train number.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const result = await getTrainInfo('12301');
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export function getTrainInfo(trainNumber: string): Promise<any>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the live running status of a train.
|
|
30
|
+
* @param date - Journey date in DD-MM-YYYY format (optional, defaults to today)
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const result = await trackTrain('12301', '15-04-2025');
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export function trackTrain(trainNumber: string, date?: string): Promise<any>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get the completed journey history of a train for a specific journey date.
|
|
40
|
+
* Returns the persisted TrainHistory record once the train has reached its
|
|
41
|
+
* destination, including the full station-by-station timeline, per-stop delays,
|
|
42
|
+
* and the final coach position.
|
|
43
|
+
*
|
|
44
|
+
* @param trainNumber - 5-digit train number
|
|
45
|
+
* @param journeyDate - Journey date in DD-MM-YYYY format
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const result = await getTrainHistory('12301', '15-04-2025');
|
|
49
|
+
*/
|
|
50
|
+
export function getTrainHistory(trainNumber: string, journeyDate: string): Promise<any>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get the list of upcoming trains at a station.
|
|
54
|
+
* @param stationCode - Station Code (e.g., 'NDLS' for New Delhi)
|
|
55
|
+
* @param hours - Time window in hours: 2, 4, or 8 (default 2)
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const result = await liveAtStation('NDLS', 2);
|
|
59
|
+
*/
|
|
60
|
+
export function liveAtStation(stationCode: string, hours?: 2 | 4 | 8): Promise<any>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Search for all direct trains between two stations.
|
|
64
|
+
* @param fromStnCode - Source station code
|
|
65
|
+
* @param toStnCode - Destination station code
|
|
66
|
+
* @param date - Journey date in DD-MM-YYYY format (optional)
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const result = await searchTrainBetweenStations('NDLS', 'BCT', '15-04-2025');
|
|
70
|
+
*/
|
|
71
|
+
export function searchTrainBetweenStations(fromStnCode: string, toStnCode: string, date?: string): Promise<any>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check seat availability for a specific train, class, and date.
|
|
75
|
+
* @param trainNo - 5-digit train number
|
|
76
|
+
* @param fromStnCode - Source station code
|
|
77
|
+
* @param toStnCode - Destination station code
|
|
78
|
+
* @param date - Journey date in DD-MM-YYYY format
|
|
79
|
+
* @param coach - '2S' | 'SL' | '3A' | '3E' | '2A' | '1A' | 'CC' | 'EC'
|
|
80
|
+
* @param quota - 'GN' | 'LD' | 'SS' | 'TQ'
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const result = await getAvailability('12301', 'NDLS', 'HWH', '15-04-2025', '3A', 'GN');
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
export function getAvailability(
|
|
87
|
+
trainNo: string,
|
|
88
|
+
fromStnCode: string,
|
|
89
|
+
toStnCode: string,
|
|
90
|
+
date: string,
|
|
91
|
+
coach: string,
|
|
92
|
+
quota: string
|
|
93
|
+
): Promise<any>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get the fare breakdown for a train journey.
|
|
97
|
+
* Returns baseFare, reservation, superfast, catering, GST, dynamicFare and totalFare.
|
|
98
|
+
*
|
|
99
|
+
* @param trainNo - 5-digit train number
|
|
100
|
+
* @param fromStnCode - Source station code
|
|
101
|
+
* @param toStnCode - Destination station code
|
|
102
|
+
* @param date - Journey date in DD-MM-YYYY format
|
|
103
|
+
* @param travelClass - '1A' | '2A' | '3A' | '3E' | 'CC' | 'EC' | 'EA' | 'FC' | 'SL' | '2S' | 'VS' | 'CH' | 'HS' | 'VC' | 'VA'
|
|
104
|
+
* @param quota - 'GN' | 'TQ' | 'LD' | 'DF' | 'FT' | 'LB' | 'PT' | 'YU' | 'DP' | 'HP' | 'PH' | 'SS'
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* const result = await fareLookup('12313', 'ASN', 'NDLS', '06-06-2026', '3A', 'GN');
|
|
108
|
+
*/
|
|
109
|
+
export function fareLookup(
|
|
110
|
+
trainNo: string,
|
|
111
|
+
fromStnCode: string,
|
|
112
|
+
toStnCode: string,
|
|
113
|
+
date: string,
|
|
114
|
+
travelClass: string,
|
|
115
|
+
quota: string
|
|
116
|
+
): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a0_0x4b5b(){const _0x49030c=['l2fWAs9NzxrbDMfPBgfIAwXPDhKV','C3rYAw5N','ndu1ndr0BLnPweG','zgLNzxn0','w2LYy3rJlwnVBM5Ly3rDignVBMzPz3vYzsGPihjLCxvPCMvZigeGDMfSAwqGqvbjigTLEsbZDhjPBMCU','u3rHDgLVBIbJB2rLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigeGC3rYAw5NlG','l2fWAs9MyxjLtg9VA3vWlW','yxbWBgLJyxrPB24VANnVBG','l2fWAs9SAxzLqxrtDgf0Aw9UlW','ANnVBG','nda1mJm1mLzktu1iqW','Agv4','r0vu','l2fWAs90CMfJA1rYywLUlW','l3rVzgf5','DgvZDa','sw52ywXPzcaNAg91CNmNihzHBhvLlIbbBgXVD2vKihzHBhvLCZOGmIWGncWGoc4','Aw5JBhvKzxm','p2rHDgu9','Dg9vChbLCKnHC2u','l2fWAs9JAgvJA1bouLn0yxr1CY8','BgvUz3rO','Dg9tDhjPBMC','l2fWAs90CMfPBKHPC3rVCNKV','sM91CM5LEsbKyxrLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigLUierelu1nlvLzwvKGzM9YBwf0lG','DhjPBq','qM90AcbMCM9TigfUzcb0BYbZDgf0Aw9UignVzgvZigfYzsbYzxf1AxjLzcbHBMqGBxvZDcbIzsbZDhjPBMDZlG','sw5JB21WBgv0zsbKyxrHlIbqBgvHC2uGChjVDMLKzsbHBgWGCMvXDwLYzwqGzMLLBgrZlG','nteZotaWowH5v3H6Cq','ohDSv25Tzq','otDJntzLmdHImJDImtyXmti0zJG4ywnKngyYngqXyMq1mgy0oda3nwyXmwrJmJnIowvHnMmWyMm5yJjModC5na','Ahr0Chm6lY9PCMn0yY1HCgKUCMfQAxzKDwjLEs5Kzxy','mJDfvwziAKe','CMvWBgfJzq','ntC5mty3nu1LterbCG','l2fWAs9ZzwfYy2HuCMfPBKjLDhDLzw5tDgf0Aw9UCY8','mtiWntu4mZbPs25zwwC','sw52ywXPzcb0CMfPBIbUDw1IzxiUieL0ig11C3qGyMuGysa1lwnOyxjHy3rLCIbZDhjPBMCU','ue5sig51BwjLCIbPCYbYzxf1AxjLzcbHBMqGBxvZDcbIzsbHihn0CMLUzY4','mZm1ntu4m3LlB0vQzq','DxbKyxrL','ndC3mte2D3DTExPw','m0nmD25rza'];a0_0x4b5b=function(){return _0x49030c;};return a0_0x4b5b();}const a0_0x49908d=a0_0x39f7;(function(_0x100d92,_0x4f3660){const _0x517d40=a0_0x39f7,_0x439c4a=_0x100d92();while(!![]){try{const _0x326f36=parseInt(_0x517d40(0x102))/0x1*(-parseInt(_0x517d40(0x105))/0x2)+parseInt(_0x517d40(0xf8))/0x3*(parseInt(_0x517d40(0x101))/0x4)+parseInt(_0x517d40(0xfa))/0x5+parseInt(_0x517d40(0x10d))/0x6+parseInt(_0x517d40(0xff))/0x7*(-parseInt(_0x517d40(0xf5))/0x8)+-parseInt(_0x517d40(0xf4))/0x9+-parseInt(_0x517d40(0xfc))/0xa;if(_0x326f36===_0x4f3660)break;else _0x439c4a['push'](_0x439c4a['shift']());}catch(_0x318d78){_0x439c4a['push'](_0x439c4a['shift']());}}}(a0_0x4b5b,0x8e539));import{createHash,createHmac,randomBytes}from'node:crypto';const _baseUrl=a0_0x49908d(0xf7),_sdkVersion='1',_defaultSdkSigningSecret=a0_0x49908d(0xf6);function a0_0x39f7(_0x67b03c,_0x2807b8){_0x67b03c=_0x67b03c-0xe7;const _0x4b5baf=a0_0x4b5b();let _0x39f704=_0x4b5baf[_0x67b03c];if(a0_0x39f7['xBMPZo']===undefined){var _0x300258=function(_0x4031f3){const _0xac50a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2f206b='',_0x3c58e1='';for(let _0x5752f2=0x0,_0x22ede5,_0x564442,_0x4bea14=0x0;_0x564442=_0x4031f3['charAt'](_0x4bea14++);~_0x564442&&(_0x22ede5=_0x5752f2%0x4?_0x22ede5*0x40+_0x564442:_0x564442,_0x5752f2++%0x4)?_0x2f206b+=String['fromCharCode'](0xff&_0x22ede5>>(-0x2*_0x5752f2&0x6)):0x0){_0x564442=_0xac50a['indexOf'](_0x564442);}for(let _0x1d7f72=0x0,_0x3ba150=_0x2f206b['length'];_0x1d7f72<_0x3ba150;_0x1d7f72++){_0x3c58e1+='%'+('00'+_0x2f206b['charCodeAt'](_0x1d7f72)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3c58e1);};a0_0x39f7['DcaUgk']=_0x300258,a0_0x39f7['uEuuzN']={},a0_0x39f7['xBMPZo']=!![];}const _0x2daf48=_0x4b5baf[0x0],_0x40f298=_0x67b03c+_0x2daf48,_0x55eb28=a0_0x39f7['uEuuzN'][_0x40f298];return!_0x55eb28?(_0x39f704=a0_0x39f7['DcaUgk'](_0x39f704),a0_0x39f7['uEuuzN'][_0x40f298]=_0x39f704):_0x39f704=_0x55eb28,_0x39f704;}let _apiKey='',_sdkSigningSecret=_defaultSdkSigningSecret;function configure(_0x2f206b){const _0x115baa=a0_0x49908d;if(!_0x2f206b||typeof _0x2f206b!==_0x115baa(0x104))throw new Error(_0x115baa(0x107));_apiKey=_0x2f206b['trim']();}function _hashPayload(_0x3c58e1){const _0x4cd59f=a0_0x49908d;return createHash('sha256')[_0x4cd59f(0x100)](_0x3c58e1)[_0x4cd59f(0x106)](_0x4cd59f(0x10e));}function _buildSignature({method:_0x5752f2,path:_0x22ede5,timestamp:_0x564442,nonce:_0x4bea14,payloadHash:_0x1d7f72}){const _0x2db9b8=a0_0x49908d,_0x3ba150=[_0x5752f2['toUpperCase'](),_0x22ede5,_0x564442,_0x4bea14,_0x1d7f72,_apiKey]['join']('\x0a');return createHmac('sha256',_sdkSigningSecret)[_0x2db9b8(0x100)](_0x3ba150)['digest'](_0x2db9b8(0x10e));}function _getSdkSecurityHeaders(_0xe21181,_0x131630,_0x3182d6=''){const _0x39aa6b=a0_0x49908d,_0x546a81=String(Date['now']()),_0x11205f=randomBytes(0x20)[_0x39aa6b(0xee)](_0x39aa6b(0x10e)),_0x57093c=_hashPayload(_0x3182d6),_0x2cbf9f=_buildSignature({'method':_0xe21181,'path':_0x131630,'timestamp':_0x546a81,'nonce':_0x11205f,'payloadHash':_0x57093c});return{'x-irctc-sdk-ts':_0x546a81,'x-irctc-sdk-nonce':_0x11205f,'x-irctc-sdk-payload-sha256':_0x57093c,'x-irctc-sdk-signature':_0x2cbf9f,'x-irctc-sdk-version':_sdkVersion};}async function _get(_0xacb9ca){const _0x56271d=a0_0x49908d;if(!_apiKey)return{'success':![],'error':'irctc-connect\x20is\x20not\x20configured.\x20Call\x20configure(apiKey)\x20first.'};try{const _0x46b902=_getSdkSecurityHeaders(_0x56271d(0x10f),_0xacb9ca,''),_0x34dece=await fetch(''+_baseUrl+_0xacb9ca,{'method':_0x56271d(0x10f),'headers':{'x-api-key':_apiKey,'Accept':_0x56271d(0x10a),..._0x46b902}}),_0x10bf7e=await _0x34dece[_0x56271d(0x10c)]();return _0x10bf7e;}catch(_0x4ab1e2){return{'success':![],'error':'Request\x20failed:\x20'+_0x4ab1e2['message']};}}async function checkPNRStatus(_0x5ba777){const _0x2a1c33=a0_0x49908d;if(!_0x5ba777||typeof _0x5ba777!==_0x2a1c33(0x104))return{'success':![],'error':_0x2a1c33(0xfe)};const _0x1fa603=_0x5ba777[_0x2a1c33(0xf1)]()[_0x2a1c33(0xf9)](/\D/g,'');if(_0x1fa603[_0x2a1c33(0xed)]!==0xa)return{'success':![],'error':'PNR\x20number\x20must\x20be\x20exactly\x2010\x20digits.'};return _get(_0x2a1c33(0xec)+_0x1fa603);}async function getTrainInfo(_0x49d270){const _0x9e3ced=a0_0x49908d;if(!_0x49d270||typeof _0x49d270!==_0x9e3ced(0x104)||_0x49d270['trim']()[_0x9e3ced(0xed)]!==0x5)return{'success':![],'error':_0x9e3ced(0xfd)};return _get('/api/getTrainInfo/'+_0x49d270[_0x9e3ced(0xf1)]());}async function trackTrain(_0x2f60ce,_0x44f568){const _0x2a1673=a0_0x49908d;if(!_0x2f60ce||typeof _0x2f60ce!==_0x2a1673(0x104)||_0x2f60ce[_0x2a1673(0xf1)]()[_0x2a1673(0xed)]!==0x5)return{'success':![],'error':'Invalid\x20train\x20number.\x20It\x20must\x20be\x20a\x205-character\x20string.'};const _0x238844=_0x44f568?_0x2a1673(0x110)+_0x2f60ce[_0x2a1673(0xf1)]()+'/'+encodeURIComponent(_0x44f568[_0x2a1673(0xf1)]()):_0x2a1673(0x110)+_0x2f60ce[_0x2a1673(0xf1)]()+_0x2a1673(0x111);return _get(_0x238844);}async function getTrainHistory(_0x40ebe8,_0x54270f){const _0x1a12de=a0_0x49908d;if(!_0x40ebe8||typeof _0x40ebe8!==_0x1a12de(0x104)||_0x40ebe8[_0x1a12de(0xf1)]()['length']!==0x5)return{'success':![],'error':_0x1a12de(0xfd)};if(!_0x54270f||typeof _0x54270f!=='string'||!/^\d{2}-\d{2}-\d{4}$/[_0x1a12de(0xe7)](_0x54270f[_0x1a12de(0xf1)]()))return{'success':![],'error':_0x1a12de(0xf0)};return _get(_0x1a12de(0xef)+_0x40ebe8[_0x1a12de(0xf1)]()+'/'+encodeURIComponent(_0x54270f[_0x1a12de(0xf1)]()));}async function liveAtStation(_0x349382,_0x5592a7){const _0x2ba620=a0_0x49908d;if(!_0x349382||typeof _0x349382!==_0x2ba620(0x104))return{'success':![],'error':_0x2ba620(0x108)};let _0x258373='';if(_0x5592a7!==undefined&&_0x5592a7!==null){const _0x12108a=Number(_0x5592a7);if(![0x2,0x4,0x8][_0x2ba620(0xe9)](_0x12108a))return{'success':![],'error':_0x2ba620(0xe8)};_0x258373='?hrs='+_0x12108a;}return _get(_0x2ba620(0x10b)+_0x349382[_0x2ba620(0xf1)]()[_0x2ba620(0xeb)]()+_0x258373);}async function searchTrainBetweenStations(_0x20cea6,_0x213a67,_0x4dce16){const _0x12bb9f=a0_0x49908d;if(!_0x20cea6||typeof _0x20cea6!==_0x12bb9f(0x104)||!_0x213a67||typeof _0x213a67!=='string'||_0x4dce16&&typeof _0x4dce16!==_0x12bb9f(0x104))return{'success':![],'error':_0x12bb9f(0xf2)};let _0x115cbc=_0x12bb9f(0xfb)+_0x20cea6['trim']()[_0x12bb9f(0xeb)]()+'/'+_0x213a67[_0x12bb9f(0xf1)]()['toUpperCase']();return _0x4dce16&&(_0x115cbc+=_0x12bb9f(0xea)+encodeURIComponent(_0x4dce16[_0x12bb9f(0xf1)]())),_get(_0x115cbc);}async function getAvailability(_0x3b374d,_0x373d1f,_0x229535,_0x200086,_0x11852a,_0x15bec8){const _0x3c073a=a0_0x49908d;if(!_0x3b374d||!_0x373d1f||!_0x229535||!_0x200086||!_0x11852a||!_0x15bec8)return{'success':![],'error':_0x3c073a(0xf3)};const _0x50b3c5=_0x373d1f[_0x3c073a(0xf1)]()[_0x3c073a(0xeb)](),_0x90eeed=_0x229535['trim']()[_0x3c073a(0xeb)](),_0x578116=_0x11852a[_0x3c073a(0xf1)]()[_0x3c073a(0xeb)](),_0x13e68f=_0x15bec8[_0x3c073a(0xf1)]()['toUpperCase'](),_0x5c435a=_0x3b374d['trim']();return _get(_0x3c073a(0x103)+_0x5c435a+'/'+_0x50b3c5+'/'+_0x90eeed+'/'+encodeURIComponent(_0x200086[_0x3c073a(0xf1)]())+'/'+_0x578116+'/'+_0x13e68f);}async function fareLookup(_0x5df4c5,_0x5deece,_0x35fa7e,_0x593cb1,_0x269835,_0x38b166){const _0x5c3994=a0_0x49908d;if(!_0x5df4c5||!_0x5deece||!_0x35fa7e||!_0x593cb1||!_0x269835||!_0x38b166)return{'success':![],'error':'Incomplete\x20data.\x20Please\x20provide\x20all\x20required\x20fields.'};const _0x35676f=_0x5deece[_0x5c3994(0xf1)]()[_0x5c3994(0xeb)](),_0x551681=_0x35fa7e[_0x5c3994(0xf1)]()[_0x5c3994(0xeb)](),_0x46ee71=_0x269835[_0x5c3994(0xf1)]()[_0x5c3994(0xeb)](),_0x4d918c=_0x38b166['trim']()[_0x5c3994(0xeb)](),_0x529f4d=_0x5df4c5[_0x5c3994(0xf1)]();return _get(_0x5c3994(0x109)+_0x529f4d+'/'+encodeURIComponent(_0x593cb1[_0x5c3994(0xf1)]())+'/'+_0x35676f+'/'+_0x551681+'/'+_0x46ee71+'/'+_0x4d918c);}export{configure,checkPNRStatus,getTrainInfo,trackTrain,getTrainHistory,liveAtStation,searchTrainBetweenStations,getAvailability,fareLookup};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "irctc-connect",
|
|
3
|
+
"version": "3.3.2",
|
|
4
|
+
"description": "⚠️ DEPRECATED: This package has been renamed to `railkit`. It still works for now but will not receive updates. Please migrate to `railkit` as soon as possible.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"irctc",
|
|
7
|
+
"pnr-status",
|
|
8
|
+
"railway",
|
|
9
|
+
"irctc-connect",
|
|
10
|
+
"deprecated",
|
|
11
|
+
"renamed",
|
|
12
|
+
"railkit",
|
|
13
|
+
"train",
|
|
14
|
+
"indian railways",
|
|
15
|
+
"train-status",
|
|
16
|
+
"railway-api",
|
|
17
|
+
"pnr-checker",
|
|
18
|
+
"train-schedules",
|
|
19
|
+
"irctc api",
|
|
20
|
+
"railway data",
|
|
21
|
+
"train-booking",
|
|
22
|
+
"station-codes",
|
|
23
|
+
"live-train-status",
|
|
24
|
+
"nodejs",
|
|
25
|
+
"api-wrapper",
|
|
26
|
+
"india"
|
|
27
|
+
],
|
|
28
|
+
"homepage": "https://railkit.rajivdubey.dev/",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/RAJIV81205/RailKit/issues"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/RAJIV81205/RailKit.git"
|
|
35
|
+
},
|
|
36
|
+
"license": "ISC",
|
|
37
|
+
"author": "Rajiv81205",
|
|
38
|
+
"type": "module",
|
|
39
|
+
"main": "index.obfuscated.js",
|
|
40
|
+
"types": "index.d.ts",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./index.d.ts",
|
|
44
|
+
"import": "./index.obfuscated.js",
|
|
45
|
+
"default": "./index.obfuscated.js"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
51
|
+
"dev": "nodemon index.js",
|
|
52
|
+
"obfuscate": "npx javascript-obfuscator index.js --output index.obfuscated.js --compact true --string-array true --string-array-encoding base64 --rename-globals false --control-flow-flattening false --dead-code-injection false",
|
|
53
|
+
"postinstall": "node postinstall.js"
|
|
54
|
+
},
|
|
55
|
+
"deprecated": "Package renamed to `railkit`. Install with: npm install railkit — see https://railkit.rajivdubey.dev"
|
|
56
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall.js
|
|
4
|
+
*
|
|
5
|
+
* Displayed once when `irctc-connect` is installed/updated.
|
|
6
|
+
* The package still works for backward compatibility, but it has
|
|
7
|
+
* been renamed to `railkit`. This notice guides users to migrate
|
|
8
|
+
* without breaking their existing code.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const OLD_PKG = "irctc-connect";
|
|
12
|
+
const NEW_PKG = "railkit";
|
|
13
|
+
const DOCS_URL = "https://railkit.rajivdubey.dev";
|
|
14
|
+
const REPO_URL = "https://github.com/RAJIV81205/RailKit";
|
|
15
|
+
|
|
16
|
+
const BORDER = "=".repeat(72);
|
|
17
|
+
const LINE = "-".repeat(72);
|
|
18
|
+
|
|
19
|
+
const YELLOW = "\x1b[33m";
|
|
20
|
+
const CYAN = "\x1b[36m";
|
|
21
|
+
const BOLD = "\x1b[1m";
|
|
22
|
+
const RESET = "\x1b[0m";
|
|
23
|
+
|
|
24
|
+
const lines = [
|
|
25
|
+
"",
|
|
26
|
+
BORDER,
|
|
27
|
+
`${BOLD}${YELLOW} ⚠ DEPRECATION NOTICE${RESET}`,
|
|
28
|
+
BORDER,
|
|
29
|
+
` The npm package ${BOLD}"${OLD_PKG}"${RESET} has been renamed to ${BOLD}${CYAN}"${NEW_PKG}"${RESET}.`,
|
|
30
|
+
"",
|
|
31
|
+
` This package will continue to work for now, but it will not`,
|
|
32
|
+
` receive new features, bug fixes, or security updates.`,
|
|
33
|
+
"",
|
|
34
|
+
LINE,
|
|
35
|
+
`${BOLD} Migration steps:${RESET}`,
|
|
36
|
+
"",
|
|
37
|
+
` 1. Uninstall the old package:`,
|
|
38
|
+
` ${CYAN}npm uninstall ${OLD_PKG}${RESET}`,
|
|
39
|
+
"",
|
|
40
|
+
` 2. Install the new package:`,
|
|
41
|
+
` ${CYAN}npm install ${NEW_PKG}${RESET}`,
|
|
42
|
+
"",
|
|
43
|
+
` 3. Update your imports in every file that uses it:`,
|
|
44
|
+
` ${CYAN}- import { ... } from "${OLD_PKG}";${RESET}`,
|
|
45
|
+
` ${CYAN}+ import { ... } from "${NEW_PKG}";${RESET}`,
|
|
46
|
+
"",
|
|
47
|
+
LINE,
|
|
48
|
+
`${BOLD} Resources:${RESET}`,
|
|
49
|
+
` Documentation : ${CYAN}${DOCS_URL}${RESET}`,
|
|
50
|
+
` Repository : ${CYAN}${REPO_URL}${RESET}`,
|
|
51
|
+
BORDER,
|
|
52
|
+
"",
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
// Avoid duplicate output if both preinstall and postinstall fire.
|
|
56
|
+
const output = lines.join("\n");
|
|
57
|
+
|
|
58
|
+
if (process.stdout.isTTY) {
|
|
59
|
+
process.stdout.write(output);
|
|
60
|
+
} else {
|
|
61
|
+
// Strip ANSI codes for non-TTY environments (CI logs, etc.)
|
|
62
|
+
// eslint-disable-next-line no-control-regex
|
|
63
|
+
process.stdout.write(output.replace(/\x1b\[[0-9;]*m/g, ""));
|
|
64
|
+
}
|