railkit 5.0.0 → 5.0.2
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 +2 -2
- 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 +0 -143
- package/temp-irctc-connect/package/index.d.ts +0 -116
- package/temp-irctc-connect/package/index.obfuscated.js +0 -1
- package/temp-irctc-connect/package/package.json +0 -56
- package/temp-irctc-connect/package/postinstall.js +0 -64
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ npm install railkit
|
|
|
37
37
|
|
|
38
38
|
## 🔑 Getting an API Key
|
|
39
39
|
|
|
40
|
-
1. Visit **[railkit.
|
|
40
|
+
1. Visit **[railkit.in](https://railkit.in)**
|
|
41
41
|
2. Sign up and navigate to your Dashboard
|
|
42
42
|
3. Generate an API key from the **API Keys** section
|
|
43
43
|
4. Copy the key — you'll use it in the next step
|
|
@@ -843,7 +843,7 @@ Used by both `getAvailability` and `fareLookup`.
|
|
|
843
843
|
## 🙋 Support
|
|
844
844
|
|
|
845
845
|
- **Issues:** [GitHub Issues](https://github.com/RAJIV81205/railkit/issues)
|
|
846
|
-
- **Docs:** [railkit.
|
|
846
|
+
- **Docs:** [railkit.in/docs](https://railkit.in/docs)
|
|
847
847
|
- **Discussions:** [GitHub Discussions](https://github.com/RAJIV81205/railkit/discussions)
|
|
848
848
|
|
|
849
849
|
|
package/index.obfuscated.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x2631c4=a0_0x71f0;(function(_0x2ce2c6,_0x544a57){const _0x37b4ee=a0_0x71f0,_0x5c47ec=_0x2ce2c6();while(!![]){try{const _0x558ce6=parseInt(_0x37b4ee(0x163))/0x1+-parseInt(_0x37b4ee(0x167))/0x2+-parseInt(_0x37b4ee(0x158))/0x3+-parseInt(_0x37b4ee(0x170))/0x4*(-parseInt(_0x37b4ee(0x17f))/0x5)+parseInt(_0x37b4ee(0x161))/0x6+parseInt(_0x37b4ee(0x160))/0x7+parseInt(_0x37b4ee(0x155))/0x8;if(_0x558ce6===_0x544a57)break;else _0x5c47ec['push'](_0x5c47ec['shift']());}catch(_0x4c4d49){_0x5c47ec['push'](_0x5c47ec['shift']());}}}(a0_0x1449,0xa8242));import{createHash,createHmac,randomBytes}from'node:crypto';const _baseUrl=a0_0x2631c4(0x16d),_sdkVersion='1',_defaultSdkSigningSecret=a0_0x2631c4(0x183);let _apiKey='',_sdkSigningSecret=_defaultSdkSigningSecret;function configure(_0x2d8da3){const _0x573901=a0_0x2631c4;if(!_0x2d8da3||typeof _0x2d8da3!==_0x573901(0x179))throw new Error('[railkit]\x20configure()\x20requires\x20a\x20valid\x20API\x20key\x20string.');_apiKey=_0x2d8da3[_0x573901(0x169)]();}function _hashPayload(_0x11eee6){const _0x39b94a=a0_0x2631c4;return createHash(_0x39b94a(0x175))[_0x39b94a(0x181)](_0x11eee6)[_0x39b94a(0x174)](_0x39b94a(0x15b));}function _buildSignature({method:_0xa87acc,path:_0x22cb60,timestamp:_0x1de83f,nonce:_0x5d615b,payloadHash:_0x36ede3}){const _0x5c958c=a0_0x2631c4,_0x4ec77c=[_0xa87acc[_0x5c958c(0x16f)](),_0x22cb60,_0x1de83f,_0x5d615b,_0x36ede3,_apiKey]['join']('\x0a');return createHmac(_0x5c958c(0x175),_sdkSigningSecret)[_0x5c958c(0x181)](_0x4ec77c)['digest'](_0x5c958c(0x15b));}function _getSdkSecurityHeaders(_0x1cedc9,_0x38efd8,_0x32854e=''){const _0x46967b=a0_0x2631c4,_0x494526=String(Date[_0x46967b(0x17d)]()),_0x46802c=randomBytes(0x20)[_0x46967b(0x16c)](_0x46967b(0x15b)),_0x341491=_hashPayload(_0x32854e),_0x22932=_buildSignature({'method':_0x1cedc9,'path':_0x38efd8,'timestamp':_0x494526,'nonce':_0x46802c,'payloadHash':_0x341491});return{'x-irctc-sdk-ts':_0x494526,'x-irctc-sdk-nonce':_0x46802c,'x-irctc-sdk-payload-sha256':_0x341491,'x-irctc-sdk-signature':_0x22932,'x-irctc-sdk-version':_sdkVersion};}async function _get(_0x2fbf36){const _0x1d78d9=a0_0x2631c4;if(!_apiKey)return{'success':![],'error':_0x1d78d9(0x15c)};try{const _0xa81f59=_getSdkSecurityHeaders(_0x1d78d9(0x185),_0x2fbf36,''),_0x4d9768=await fetch(''+_baseUrl+_0x2fbf36,{'method':'GET','headers':{'x-api-key':_apiKey,'Accept':_0x1d78d9(0x184),..._0xa81f59}}),_0x105368=await _0x4d9768['json']();return _0x105368&&typeof _0x105368===_0x1d78d9(0x171)&&!Array['isArray'](_0x105368)&&Object[_0x1d78d9(0x162)](_0x105368,_0x1d78d9(0x154),{'value':_0x4d9768['status'],'enumerable':![]}),_0x105368;}catch(_0x34494a){return{'success':![],'error':'Request\x20failed:\x20'+_0x34494a['message']};}}async function checkPNRStatus(_0x253651){const _0x388ea7=a0_0x2631c4;if(!_0x253651||typeof _0x253651!==_0x388ea7(0x179))return{'success':![],'error':_0x388ea7(0x17b)};const _0x333145=_0x253651['trim']()[_0x388ea7(0x177)](/\D/g,'');if(_0x333145[_0x388ea7(0x164)]!==0xa)return{'success':![],'error':_0x388ea7(0x15d)};return _get('/api/checkPNRStatus/'+_0x333145);}async function getTrainInfo(_0x3134d6){const _0x57ff9b=a0_0x2631c4;if(!_0x3134d6||typeof _0x3134d6!==_0x57ff9b(0x179)||_0x3134d6[_0x57ff9b(0x169)]()[_0x57ff9b(0x164)]!==0x5)return{'success':![],'error':_0x57ff9b(0x16a)};return _get(_0x57ff9b(0x176)+_0x3134d6[_0x57ff9b(0x169)]());}async function trackTrain(_0x1d3de3,_0x476a85){const _0x4c6c4b=a0_0x2631c4;if(!_0x1d3de3||typeof _0x1d3de3!==_0x4c6c4b(0x179)||_0x1d3de3[_0x4c6c4b(0x169)]()['length']!==0x5)return{'success':![],'error':_0x4c6c4b(0x16a)};const _0x3a5250=_0x476a85?'/api/trackTrain/'+_0x1d3de3[_0x4c6c4b(0x169)]()+'/'+encodeURIComponent(_0x476a85[_0x4c6c4b(0x169)]()):_0x4c6c4b(0x187)+_0x1d3de3[_0x4c6c4b(0x169)]()+_0x4c6c4b(0x180);return _get(_0x3a5250);}async function getTrainHistory(_0x254178,_0x208fa2){const _0x16d262=a0_0x2631c4;if(!_0x254178||typeof _0x254178!==_0x16d262(0x179)||_0x254178[_0x16d262(0x169)]()[_0x16d262(0x164)]!==0x5)return{'success':![],'error':_0x16d262(0x16a)};if(!_0x208fa2||typeof _0x208fa2!==_0x16d262(0x179)||!/^\d{2}-\d{2}-\d{4}$/[_0x16d262(0x15f)](_0x208fa2['trim']()))return{'success':![],'error':_0x16d262(0x168)};return _get(_0x16d262(0x166)+_0x254178[_0x16d262(0x169)]()+'/'+encodeURIComponent(_0x208fa2[_0x16d262(0x169)]()));}async function liveAtStation(_0x679978,_0x4ad254){const _0x6afaba=a0_0x2631c4;if(!_0x679978||typeof _0x679978!==_0x6afaba(0x179))return{'success':![],'error':_0x6afaba(0x172)};let _0x1d8ccf='';if(_0x4ad254!==undefined&&_0x4ad254!==null){const _0x5a77b2=Number(_0x4ad254);if(![0x2,0x4,0x8][_0x6afaba(0x159)](_0x5a77b2))return{'success':![],'error':_0x6afaba(0x186)};_0x1d8ccf=_0x6afaba(0x182)+_0x5a77b2;}return _get(_0x6afaba(0x16e)+_0x679978[_0x6afaba(0x169)]()[_0x6afaba(0x16f)]()+_0x1d8ccf);}async function searchTrainBetweenStations(_0x239d0f,_0x1f20f1,_0xd4cf2d){const _0x1345e1=a0_0x2631c4;if(!_0x239d0f||typeof _0x239d0f!==_0x1345e1(0x179)||!_0x1f20f1||typeof _0x1f20f1!==_0x1345e1(0x179)||_0xd4cf2d&&typeof _0xd4cf2d!=='string')return{'success':![],'error':_0x1345e1(0x17a)};let _0x4c81ae=_0x1345e1(0x157)+_0x239d0f[_0x1345e1(0x169)]()[_0x1345e1(0x16f)]()+'/'+_0x1f20f1['trim']()[_0x1345e1(0x16f)]();return _0xd4cf2d&&(_0x4c81ae+=_0x1345e1(0x156)+encodeURIComponent(_0xd4cf2d['trim']())),_get(_0x4c81ae);}async function getAvailability(_0x2c95a0,_0x40b024,_0x58d42a,_0xd52928,_0x3c1c35,_0xfa6763){const _0x375ffb=a0_0x2631c4;if(!_0x2c95a0||!_0x40b024||!_0x58d42a||!_0xd52928||!_0x3c1c35||!_0xfa6763)return{'success':![],'error':'Incomplete\x20data.\x20Please\x20provide\x20all\x20required\x20fields.'};const _0x321948=_0x40b024[_0x375ffb(0x169)]()[_0x375ffb(0x16f)](),_0x1b31a4=_0x58d42a['trim']()[_0x375ffb(0x16f)](),_0x49c03d=_0x3c1c35['trim']()[_0x375ffb(0x16f)](),_0xe3c355=_0xfa6763[_0x375ffb(0x169)]()[_0x375ffb(0x16f)](),_0x334cfb=_0x2c95a0[_0x375ffb(0x169)]();return _get('/api/getAvailability/'+_0x334cfb+'/'+_0x321948+'/'+_0x1b31a4+'/'+encodeURIComponent(_0xd52928['trim']())+'/'+_0x49c03d+'/'+_0xe3c355);}async function fareLookup(_0x11c3f7,_0x416e98,_0x1c2fef,_0x3786f7,_0x18343a,_0x11c364){const _0x33f2ba=a0_0x2631c4;if(!_0x11c3f7||!_0x416e98||!_0x1c2fef||!_0x3786f7||!_0x18343a||!_0x11c364)return{'success':![],'error':_0x33f2ba(0x173)};const _0x13318d=_0x416e98['trim']()[_0x33f2ba(0x16f)](),_0x18536d=_0x1c2fef[_0x33f2ba(0x169)]()[_0x33f2ba(0x16f)](),_0x124528=_0x18343a['trim']()['toUpperCase'](),_0x2073ff=_0x11c364[_0x33f2ba(0x169)]()[_0x33f2ba(0x16f)](),_0x25c7b6=_0x11c3f7['trim']();return _get(_0x33f2ba(0x178)+_0x25c7b6+'/'+encodeURIComponent(_0x3786f7[_0x33f2ba(0x169)]())+'/'+_0x13318d+'/'+_0x18536d+'/'+_0x124528+'/'+_0x2073ff);}async function cancelList(){return _get('/api/cancelled');}function a0_0x71f0(_0x216689,_0x63447a){_0x216689=_0x216689-0x154;const _0x14494a=a0_0x1449();let _0x71f07b=_0x14494a[_0x216689];if(a0_0x71f0['gbZJYF']===undefined){var _0x262760=function(_0x5d78e0){const _0x2c2905='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3e4499='',_0x2d8da3='';for(let _0x11eee6=0x0,_0xa87acc,_0x22cb60,_0x1de83f=0x0;_0x22cb60=_0x5d78e0['charAt'](_0x1de83f++);~_0x22cb60&&(_0xa87acc=_0x11eee6%0x4?_0xa87acc*0x40+_0x22cb60:_0x22cb60,_0x11eee6++%0x4)?_0x3e4499+=String['fromCharCode'](0xff&_0xa87acc>>(-0x2*_0x11eee6&0x6)):0x0){_0x22cb60=_0x2c2905['indexOf'](_0x22cb60);}for(let _0x5d615b=0x0,_0x36ede3=_0x3e4499['length'];_0x5d615b<_0x36ede3;_0x5d615b++){_0x2d8da3+='%'+('00'+_0x3e4499['charCodeAt'](_0x5d615b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2d8da3);};a0_0x71f0['GxRscx']=_0x262760,a0_0x71f0['LPTmbo']={},a0_0x71f0['gbZJYF']=!![];}const _0x3c4bea=_0x14494a[0x0];a0_0x71f0['CKjDOq']!==_0x3c4bea&&(a0_0x71f0['LPTmbo']={},a0_0x71f0['CKjDOq']=_0x3c4bea);const _0x58faeb=a0_0x71f0['LPTmbo'][_0x216689];return _0x58faeb===undefined?(_0x71f07b=a0_0x71f0['GxRscx'](_0x71f07b),a0_0x71f0['LPTmbo'][_0x216689]=_0x71f07b):_0x71f07b=_0x58faeb,_0x71f07b;}function a0_0x1449(){const _0x5f3ed1=['ue5sig51BwjLCIbTDxn0igjLigv4ywn0BhKGmtaGzgLNAxrZlG','l2fWAs90CMfPBNmVC2vHCMnOp25HBwu9','DgvZDa','mZi3mJG3mvbuBgfHsa','odG3odC0v0jPDuz2','zgvMAw5LuhjVCgvYDhK','mJGXnte5Eg91tfPR','BgvUz3rO','u3rHDgLVBIbJB2rLig11C3qGyMuGms01igXLDhrLCNmGB3iGzgLNAxrZlG','l2fWAs90CMfPBKHPC3rVCNKV','mJyYmty5ohbMExjAtG','sM91CM5LEsbKyxrLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigLUierelu1nlvLzwvKGzM9YBwf0lG','DhjPBq','sw52ywXPzcb0CMfPBIbUDw1IzxiUieL0ig11C3qGyMuGysa1lwnOyxjHy3rLCIbZDhjPBMCU','rgf0zsbTDxn0igjLigLUierelu1nlvLzwvKGzM9YBwf0lG','Dg9tDhjPBMC','Ahr0Chm6lY9YywLSA2L0lwfWAs5YywPPDMr1yMv5lMrLDG','l2fWAs9SAxzLqxrtDgf0Aw9UlW','Dg9vChbLCKnHC2u','mJyYmdy0mhH5AxDwyq','B2jQzwn0','u3rHDgLVBIbJB2rLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigeGC3rYAw5NlG','sw5JB21WBgv0zsbKyxrHlIbqBgvHC2uGChjVDMLKzsbHBgWGCMvXDwLYzwqGzMLLBgrZlG','zgLNzxn0','C2HHmJu2','l2fWAs9NzxruCMfPBKLUzM8V','CMvWBgfJzq','l2fWAs9MyxjLtg9VA3vWlW','C3rYAw5N','qM90AcbMCM9TigfUzcb0BYbZDgf0Aw9UignVzgvZigfYzsbYzxf1AxjLzcbHBMqGBxvZDcbIzsbZDhjPBMDZlG','ue5sig51BwjLCIbPCYbYzxf1AxjLzcbHBMqGBxvZDcbIzsbHihn0CMLUzY4','l2fWAs90CMfPBI8','BM93','l2fWAs9ZDgf0Aw9UlW','nwnRq0PTwa','l3rVzgf5','DxbKyxrL','p2HYCZ0','otDJntzLmdHImJDImtyXmti0zJG4ywnKngyYngqXyMq1mgy0oda3nwyXmwrJmJnIowvHnMmWyMm5yJjModC5na','yxbWBgLJyxrPB24VANnVBG','r0vu','sw52ywXPzcaNAg91CNmNihzHBhvLlIbbBgXVD2vKihzHBhvLCZOGmIWGncWGoc4','l2fWAs90CMfJA1rYywLUlW','C3rHDhvZq29Kzq','ntKYnJG4meHfExPfqq','p2rHDgu9','l2fWAs9ZzwfYy2HuCMfPBKjLDhDLzw5tDgf0Aw9UCY8','odGWntq4DxLcBMHW','Aw5JBhvKzxm','u3rHDgLVBIbUyw1Lig11C3qGy29UDgfPBIbHDcbSzwfZDcaYignOyxjHy3rLCNmU','Agv4','CMfPBgTPDcbPCYbUB3qGy29UzMLNDxjLzc4Gq2fSBcbJB25MAwD1CMuOyxbPs2v5ksbMAxjZDc4'];a0_0x1449=function(){return _0x5f3ed1;};return a0_0x1449();}async function stationByCode(_0x32f5cf){const _0x8a4043=a0_0x2631c4;if(!_0x32f5cf||typeof _0x32f5cf!=='string'||!/^[A-Za-z0-9]{1,5}$/[_0x8a4043(0x15f)](_0x32f5cf['trim']()))return{'success':![],'error':_0x8a4043(0x165)};return _get(_0x8a4043(0x17e)+_0x32f5cf[_0x8a4043(0x169)]()[_0x8a4043(0x16f)]());}async function stationsByName(_0x4b1c54){const _0x14154c=a0_0x2631c4;if(!_0x4b1c54||typeof _0x4b1c54!==_0x14154c(0x179)||_0x4b1c54[_0x14154c(0x169)]()[_0x14154c(0x164)]<0x2)return{'success':![],'error':_0x14154c(0x15a)};return _get('/api/stations/search?name='+encodeURIComponent(_0x4b1c54['trim']()));}async function trainByNumber(_0x3447e2){const _0x35352e=a0_0x2631c4;if(!_0x3447e2||typeof _0x3447e2!=='string'||!/^\d{5}$/[_0x35352e(0x15f)](_0x3447e2[_0x35352e(0x169)]()))return{'success':![],'error':'Train\x20number\x20must\x20be\x20exactly\x205\x20digits.'};return _get(_0x35352e(0x17c)+_0x3447e2[_0x35352e(0x169)]());}async function trainsByName(_0x11f378){const _0x26ba04=a0_0x2631c4;if(!_0x11f378||typeof _0x11f378!==_0x26ba04(0x179)||_0x11f378[_0x26ba04(0x169)]()[_0x26ba04(0x164)]<0x2)return{'success':![],'error':'Train\x20name\x20must\x20contain\x20at\x20least\x202\x20characters.'};return _get(_0x26ba04(0x15e)+encodeURIComponent(_0x11f378[_0x26ba04(0x169)]()));}async function trainTimetableAtStation(_0x53e732,_0x1fb4d0){const _0x583460=a0_0x2631c4;if(!_0x53e732||typeof _0x53e732!==_0x583460(0x179)||!/^[A-Za-z0-9]{1,5}$/[_0x583460(0x15f)](_0x53e732[_0x583460(0x169)]()))return{'success':![],'error':_0x583460(0x165)};if(_0x1fb4d0!==undefined&&_0x1fb4d0!==null&&(typeof _0x1fb4d0!=='string'||!/^\d{2}-\d{2}-\d{4}$/['test'](_0x1fb4d0['trim']())))return{'success':![],'error':_0x583460(0x16b)};const _0x12360a=_0x1fb4d0?'?date='+encodeURIComponent(_0x1fb4d0[_0x583460(0x169)]()):'';return _get(_0x583460(0x17e)+_0x53e732['trim']()[_0x583460(0x16f)]()+'/timetable'+_0x12360a);}export{configure,checkPNRStatus,getTrainInfo,trackTrain,getTrainHistory,liveAtStation,searchTrainBetweenStations,getAvailability,fareLookup,cancelList,stationByCode,stationsByName,trainByNumber,trainsByName,trainTimetableAtStation};
|
|
1
|
+
const a0_0xd13dd5=a0_0x2933;(function(_0x46cde5,_0x14bf60){const _0x12d596=a0_0x2933,_0x273093=_0x46cde5();while(!![]){try{const _0x35ebe8=-parseInt(_0x12d596(0xb7))/0x1+-parseInt(_0x12d596(0xac))/0x2*(-parseInt(_0x12d596(0xb3))/0x3)+parseInt(_0x12d596(0xde))/0x4*(parseInt(_0x12d596(0xd9))/0x5)+parseInt(_0x12d596(0xba))/0x6*(parseInt(_0x12d596(0xe3))/0x7)+parseInt(_0x12d596(0xb8))/0x8+-parseInt(_0x12d596(0xc1))/0x9*(parseInt(_0x12d596(0xc3))/0xa)+parseInt(_0x12d596(0xd7))/0xb*(-parseInt(_0x12d596(0xcf))/0xc);if(_0x35ebe8===_0x14bf60)break;else _0x273093['push'](_0x273093['shift']());}catch(_0x3e02fa){_0x273093['push'](_0x273093['shift']());}}}(a0_0xb5f1,0x6fd94));import{createHash,createHmac,randomBytes}from'node:crypto';const _baseUrl=a0_0xd13dd5(0xd1),_sdkVersion='1',_defaultSdkSigningSecret=a0_0xd13dd5(0xc2);let _apiKey='',_sdkSigningSecret=_defaultSdkSigningSecret;function configure(_0x25f933){const _0x5c99ec=a0_0xd13dd5;if(!_0x25f933||typeof _0x25f933!==_0x5c99ec(0xbb))throw new Error('[railkit]\x20configure()\x20requires\x20a\x20valid\x20API\x20key\x20string.');_apiKey=_0x25f933[_0x5c99ec(0xab)]();}function _hashPayload(_0x274291){const _0x10d169=a0_0xd13dd5;return createHash(_0x10d169(0xd4))[_0x10d169(0xc6)](_0x274291)[_0x10d169(0xd8)](_0x10d169(0xd5));}function a0_0xb5f1(){const _0x521862=['sw5JB21WBgv0zsbKyxrHlIbqBgvHC2uGChjVDMLKzsbHBgWGCMvXDwLYzwqGzMLLBgrZlG','sw52ywXPzcb0CMfPBIbUDw1IzxiUieL0ig11C3qGyMuGysa1lwnOyxjHy3rLCIbZDhjPBMCU','yxbWBgLJyxrPB24VANnVBG','r0vu','mZz0wMfPthm','Dg9tDhjPBMC','Ahr0Chm6lY9HCgKUCMfPBgTPDc5PBG','p2rHDgu9','Aw5JBhvKzxm','C2HHmJu2','Agv4','ue5sig51BwjLCIbPCYbYzxf1AxjLzcbHBMqGBxvZDcbIzsbHihn0CMLUzY4','nZq5mtiYvfnsvg9q','zgLNzxn0','mteWmZviyMTcweO','BgvUz3rO','l2fWAs9JAgvJA1bouLn0yxr1CY8','l2fWAs9NzxruCMfPBKLUzM8V','l2fWAs9ZDgf0Aw9UCY9ZzwfYy2G/BMfTzt0','mtm4nhj5rhLRuq','AM9PBG','C3rHDhvZq29Kzq','Dg9vChbLCKnHC2u','uMvXDwvZDcbMywLSzwq6ia','mtiZovnxDg9Jsq','DgvZDa','sw52ywXPzcaNAg91CNmNihzHBhvLlIbbBgXVD2vKihzHBhvLCZOGmIWGncWGoc4','l2fWAs9Jyw5JzwXSzwq','DhjPBq','ntGYA0PvCwXv','vhjHAw4GBMfTzsbTDxn0ignVBNrHAw4GyxqGBgvHC3qGmIbJAgfYywn0zxjZlG','u3rHDgLVBIbUyw1Lig11C3qGy29UDgfPBIbHDcbSzwfZDcaYignOyxjHy3rLCNmU','l2fWAs9MyxjLtg9VA3vWlW','l2fWAs9NzxrbDMfPBgfIAwXPDhKV','l2fWAs9ZzwfYy2HuCMfPBKjLDhDLzw5tDgf0Aw9UCY8','CMvWBgfJzq','ndCYmMrPwKHwDq','u3rHDgLVBIbJB2rLig11C3qGyMuGms01igXLDhrLCNmGB3iGzgLNAxrZlG','l3rPBwv0ywjSzq','AxnbCNjHEq','nJy0otC2y0zwtLLy','nta1mtq0Ew5yAw9p','l2fWAs90CMfPBKHPC3rVCNKV','mtCXodroENbTzK0','C3rYAw5N','l2fWAs9SAxzLqxrtDgf0Aw9UlW','p2HYCZ0','ue5sig51BwjLCIbTDxn0igjLigv4ywn0BhKGmtaGzgLNAxrZlG','B2jQzwn0','l2fWAs90CMfPBI8','odaXwuL3s3DY','otDJntzLmdHImJDImtyXmti0zJG4ywnKngyYngqXyMq1mgy0oda3nwyXmwrJmJnIowvHnMmWyMm5yJjModC5na','ntiXnZbVsMXqBNy','rgf0zsbTDxn0igjLigLUierelu1nlvLzwvKGzM9YBwf0lG','zgvMAw5LuhjVCgvYDhK','DxbKyxrL','l2fWAs90CMfJA1rYywLUlW','BwvZC2fNzq','u3rHDgLVBIbJB2rLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigeGC3rYAw5NlG','ANnVBG'];a0_0xb5f1=function(){return _0x521862;};return a0_0xb5f1();}function _buildSignature({method:_0x16a5db,path:_0x11185c,timestamp:_0xe97fca,nonce:_0x311818,payloadHash:_0x2e61dd}){const _0x25d64b=a0_0xd13dd5,_0x12b550=[_0x16a5db[_0x25d64b(0xe1)](),_0x11185c,_0xe97fca,_0x311818,_0x2e61dd,_apiKey][_0x25d64b(0xdf)]('\x0a');return createHmac(_0x25d64b(0xd4),_sdkSigningSecret)[_0x25d64b(0xc6)](_0x12b550)[_0x25d64b(0xd8)](_0x25d64b(0xd5));}function _getSdkSecurityHeaders(_0x22b4af,_0x4dd4fc,_0xe1ad04=''){const _0x435fae=a0_0xd13dd5,_0x1844f2=String(Date['now']()),_0x2a3867=randomBytes(0x20)[_0x435fae(0xd0)](_0x435fae(0xd5)),_0x2bd56e=_hashPayload(_0xe1ad04),_0x53fa25=_buildSignature({'method':_0x22b4af,'path':_0x4dd4fc,'timestamp':_0x1844f2,'nonce':_0x2a3867,'payloadHash':_0x2bd56e});return{'x-irctc-sdk-ts':_0x1844f2,'x-irctc-sdk-nonce':_0x2a3867,'x-irctc-sdk-payload-sha256':_0x2bd56e,'x-irctc-sdk-signature':_0x53fa25,'x-irctc-sdk-version':_sdkVersion};}async function _get(_0x3d62ee){const _0x344d7a=a0_0xd13dd5;if(!_apiKey)return{'success':![],'error':'railkit\x20is\x20not\x20configured.\x20Call\x20configure(apiKey)\x20first.'};try{const _0x1b20f6=_getSdkSecurityHeaders(_0x344d7a(0xce),_0x3d62ee,''),_0x222820=await fetch(''+_baseUrl+_0x3d62ee,{'method':_0x344d7a(0xce),'headers':{'x-api-key':_apiKey,'Accept':_0x344d7a(0xcd),..._0x1b20f6}}),_0x1d2cad=await _0x222820[_0x344d7a(0xca)]();return _0x1d2cad&&typeof _0x1d2cad===_0x344d7a(0xbf)&&!Array[_0x344d7a(0xb6)](_0x1d2cad)&&Object[_0x344d7a(0xc5)](_0x1d2cad,_0x344d7a(0xe0),{'value':_0x222820['status'],'enumerable':![]}),_0x1d2cad;}catch(_0x226191){return{'success':![],'error':_0x344d7a(0xe2)+_0x226191[_0x344d7a(0xc8)]};}}async function checkPNRStatus(_0x3f0a35){const _0xa00c4a=a0_0xd13dd5;if(!_0x3f0a35||typeof _0x3f0a35!==_0xa00c4a(0xbb))return{'success':![],'error':_0xa00c4a(0xd6)};const _0x3ed764=_0x3f0a35['trim']()[_0xa00c4a(0xb2)](/\D/g,'');if(_0x3ed764[_0xa00c4a(0xda)]!==0xa)return{'success':![],'error':_0xa00c4a(0xbe)};return _get(_0xa00c4a(0xdb)+_0x3ed764);}async function getTrainInfo(_0x341480){const _0x13a710=a0_0xd13dd5;if(!_0x341480||typeof _0x341480!==_0x13a710(0xbb)||_0x341480[_0x13a710(0xab)]()[_0x13a710(0xda)]!==0x5)return{'success':![],'error':'Invalid\x20train\x20number.\x20It\x20must\x20be\x20a\x205-character\x20string.'};return _get(_0x13a710(0xdc)+_0x341480[_0x13a710(0xab)]());}async function trackTrain(_0x51fb75,_0x259062){const _0x367f07=a0_0xd13dd5;if(!_0x51fb75||typeof _0x51fb75!=='string'||_0x51fb75[_0x367f07(0xab)]()['length']!==0x5)return{'success':![],'error':'Invalid\x20train\x20number.\x20It\x20must\x20be\x20a\x205-character\x20string.'};const _0x4fce8f=_0x259062?_0x367f07(0xc7)+_0x51fb75[_0x367f07(0xab)]()+'/'+encodeURIComponent(_0x259062[_0x367f07(0xab)]()):_0x367f07(0xc7)+_0x51fb75[_0x367f07(0xab)]()+'/today';return _get(_0x4fce8f);}async function getTrainHistory(_0x4ab831,_0x207212){const _0x1e01e3=a0_0xd13dd5;if(!_0x4ab831||typeof _0x4ab831!=='string'||_0x4ab831[_0x1e01e3(0xab)]()[_0x1e01e3(0xda)]!==0x5)return{'success':![],'error':_0x1e01e3(0xcc)};if(!_0x207212||typeof _0x207212!==_0x1e01e3(0xbb)||!/^\d{2}-\d{2}-\d{4}$/[_0x1e01e3(0xe4)](_0x207212[_0x1e01e3(0xab)]()))return{'success':![],'error':'Journey\x20date\x20is\x20required\x20and\x20must\x20be\x20in\x20DD-MM-YYYY\x20format.'};return _get(_0x1e01e3(0xb9)+_0x4ab831[_0x1e01e3(0xab)]()+'/'+encodeURIComponent(_0x207212[_0x1e01e3(0xab)]()));}async function liveAtStation(_0x5ac99a,_0x21b7b4){const _0x5d6896=a0_0xd13dd5;if(!_0x5ac99a||typeof _0x5ac99a!==_0x5d6896(0xbb))return{'success':![],'error':_0x5d6896(0xc9)};let _0x2f2339='';if(_0x21b7b4!==undefined&&_0x21b7b4!==null){const _0x3f75b1=Number(_0x21b7b4);if(![0x2,0x4,0x8][_0x5d6896(0xd3)](_0x3f75b1))return{'success':![],'error':_0x5d6896(0xe5)};_0x2f2339=_0x5d6896(0xbd)+_0x3f75b1;}return _get(_0x5d6896(0xbc)+_0x5ac99a[_0x5d6896(0xab)]()[_0x5d6896(0xe1)]()+_0x2f2339);}function a0_0x2933(_0x4110f7,_0x77a553){_0x4110f7=_0x4110f7-0xaa;const _0xb5f15e=a0_0xb5f1();let _0x29332e=_0xb5f15e[_0x4110f7];if(a0_0x2933['uZJfGz']===undefined){var _0x26f64b=function(_0x1a2330){const _0x36896b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d707d='',_0x25f933='';for(let _0x274291=0x0,_0x16a5db,_0x11185c,_0xe97fca=0x0;_0x11185c=_0x1a2330['charAt'](_0xe97fca++);~_0x11185c&&(_0x16a5db=_0x274291%0x4?_0x16a5db*0x40+_0x11185c:_0x11185c,_0x274291++%0x4)?_0x2d707d+=String['fromCharCode'](0xff&_0x16a5db>>(-0x2*_0x274291&0x6)):0x0){_0x11185c=_0x36896b['indexOf'](_0x11185c);}for(let _0x311818=0x0,_0x2e61dd=_0x2d707d['length'];_0x311818<_0x2e61dd;_0x311818++){_0x25f933+='%'+('00'+_0x2d707d['charCodeAt'](_0x311818)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x25f933);};a0_0x2933['kyaDZR']=_0x26f64b,a0_0x2933['LEfNyT']={},a0_0x2933['uZJfGz']=!![];}const _0x409e8=_0xb5f15e[0x0];a0_0x2933['fqjHCk']!==_0x409e8&&(a0_0x2933['LEfNyT']={},a0_0x2933['fqjHCk']=_0x409e8);const _0x86660d=a0_0x2933['LEfNyT'][_0x4110f7];return _0x86660d===undefined?(_0x29332e=a0_0x2933['kyaDZR'](_0x29332e),a0_0x2933['LEfNyT'][_0x4110f7]=_0x29332e):_0x29332e=_0x86660d,_0x29332e;}async function searchTrainBetweenStations(_0x3b9f06,_0x2fe12c,_0x503d73){const _0x5f53f0=a0_0xd13dd5;if(!_0x3b9f06||typeof _0x3b9f06!=='string'||!_0x2fe12c||typeof _0x2fe12c!==_0x5f53f0(0xbb)||_0x503d73&&typeof _0x503d73!==_0x5f53f0(0xbb))return{'success':![],'error':'Both\x20from\x20and\x20to\x20station\x20codes\x20are\x20required\x20and\x20must\x20be\x20strings.'};let _0x116236=_0x5f53f0(0xb1)+_0x3b9f06[_0x5f53f0(0xab)]()[_0x5f53f0(0xe1)]()+'/'+_0x2fe12c['trim']()['toUpperCase']();return _0x503d73&&(_0x116236+=_0x5f53f0(0xd2)+encodeURIComponent(_0x503d73[_0x5f53f0(0xab)]())),_get(_0x116236);}async function getAvailability(_0x5d9c48,_0x1b6c0d,_0x7ad9f,_0x4fb01f,_0x405fa8,_0x51caec){const _0x1b4db9=a0_0xd13dd5;if(!_0x5d9c48||!_0x1b6c0d||!_0x7ad9f||!_0x4fb01f||!_0x405fa8||!_0x51caec)return{'success':![],'error':_0x1b4db9(0xcb)};const _0x211c0e=_0x1b6c0d[_0x1b4db9(0xab)]()[_0x1b4db9(0xe1)](),_0x135c7c=_0x7ad9f[_0x1b4db9(0xab)]()['toUpperCase'](),_0x438a7b=_0x405fa8[_0x1b4db9(0xab)]()['toUpperCase'](),_0x460a65=_0x51caec[_0x1b4db9(0xab)]()[_0x1b4db9(0xe1)](),_0x193639=_0x5d9c48['trim']();return _get(_0x1b4db9(0xb0)+_0x193639+'/'+_0x211c0e+'/'+_0x135c7c+'/'+encodeURIComponent(_0x4fb01f[_0x1b4db9(0xab)]())+'/'+_0x438a7b+'/'+_0x460a65);}async function fareLookup(_0x1bfa11,_0x37e303,_0x344958,_0x2a9bf5,_0x90a05e,_0x380ee8){const _0x685bb5=a0_0xd13dd5;if(!_0x1bfa11||!_0x37e303||!_0x344958||!_0x2a9bf5||!_0x90a05e||!_0x380ee8)return{'success':![],'error':_0x685bb5(0xcb)};const _0x5eff9c=_0x37e303[_0x685bb5(0xab)]()[_0x685bb5(0xe1)](),_0x4911e8=_0x344958[_0x685bb5(0xab)]()['toUpperCase'](),_0x3cc9ac=_0x90a05e[_0x685bb5(0xab)]()[_0x685bb5(0xe1)](),_0xaeeb2e=_0x380ee8[_0x685bb5(0xab)]()[_0x685bb5(0xe1)](),_0x1cd448=_0x1bfa11[_0x685bb5(0xab)]();return _get(_0x685bb5(0xaf)+_0x1cd448+'/'+encodeURIComponent(_0x2a9bf5[_0x685bb5(0xab)]())+'/'+_0x5eff9c+'/'+_0x4911e8+'/'+_0x3cc9ac+'/'+_0xaeeb2e);}async function cancelList(){const _0x3feaa6=a0_0xd13dd5;return _get(_0x3feaa6(0xaa));}async function stationByCode(_0x11ede1){const _0x1a8138=a0_0xd13dd5;if(!_0x11ede1||typeof _0x11ede1!==_0x1a8138(0xbb)||!/^[A-Za-z0-9]{1,5}$/[_0x1a8138(0xe4)](_0x11ede1[_0x1a8138(0xab)]()))return{'success':![],'error':'Station\x20code\x20must\x20be\x201-5\x20letters\x20or\x20digits.'};return _get('/api/station/'+_0x11ede1[_0x1a8138(0xab)]()['toUpperCase']());}async function stationsByName(_0x37926b){const _0x5acd64=a0_0xd13dd5;if(!_0x37926b||typeof _0x37926b!==_0x5acd64(0xbb)||_0x37926b[_0x5acd64(0xab)]()[_0x5acd64(0xda)]<0x2)return{'success':![],'error':_0x5acd64(0xae)};return _get(_0x5acd64(0xdd)+encodeURIComponent(_0x37926b[_0x5acd64(0xab)]()));}async function trainByNumber(_0x79b962){const _0x35eccd=a0_0xd13dd5;if(!_0x79b962||typeof _0x79b962!==_0x35eccd(0xbb)||!/^\d{5}$/[_0x35eccd(0xe4)](_0x79b962['trim']()))return{'success':![],'error':'Train\x20number\x20must\x20be\x20exactly\x205\x20digits.'};return _get(_0x35eccd(0xc0)+_0x79b962[_0x35eccd(0xab)]());}async function trainsByName(_0x3049cf){const _0x4c5273=a0_0xd13dd5;if(!_0x3049cf||typeof _0x3049cf!=='string'||_0x3049cf[_0x4c5273(0xab)]()[_0x4c5273(0xda)]<0x2)return{'success':![],'error':_0x4c5273(0xad)};return _get('/api/trains/search?name='+encodeURIComponent(_0x3049cf[_0x4c5273(0xab)]()));}async function trainTimetableAtStation(_0x46b4e4,_0x33c51c){const _0x2fde30=a0_0xd13dd5;if(!_0x46b4e4||typeof _0x46b4e4!==_0x2fde30(0xbb)||!/^[A-Za-z0-9]{1,5}$/['test'](_0x46b4e4[_0x2fde30(0xab)]()))return{'success':![],'error':_0x2fde30(0xb4)};if(_0x33c51c!==undefined&&_0x33c51c!==null&&(typeof _0x33c51c!==_0x2fde30(0xbb)||!/^\d{2}-\d{2}-\d{4}$/[_0x2fde30(0xe4)](_0x33c51c[_0x2fde30(0xab)]())))return{'success':![],'error':_0x2fde30(0xc4)};const _0x4f60cd=_0x33c51c?'?date='+encodeURIComponent(_0x33c51c[_0x2fde30(0xab)]()):'';return _get('/api/station/'+_0x46b4e4[_0x2fde30(0xab)]()[_0x2fde30(0xe1)]()+_0x2fde30(0xb5)+_0x4f60cd);}export{configure,checkPNRStatus,getTrainInfo,trackTrain,getTrainHistory,liveAtStation,searchTrainBetweenStations,getAvailability,fareLookup,cancelList,stationByCode,stationsByName,trainByNumber,trainsByName,trainTimetableAtStation};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "railkit",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"api-wrapper",
|
|
24
24
|
"india"
|
|
25
25
|
],
|
|
26
|
-
"homepage": "https://railkit.
|
|
26
|
+
"homepage": "https://railkit.in/",
|
|
27
27
|
"bugs": {
|
|
28
28
|
"url": "https://github.com/RAJIV81205/railkit/issues"
|
|
29
29
|
},
|
|
Binary file
|
|
@@ -1,143 +0,0 @@
|
|
|
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)
|
|
@@ -1,116 +0,0 @@
|
|
|
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>;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|