railkit 4.0.3 → 4.1.0

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/index.d.ts CHANGED
@@ -114,3 +114,11 @@ export function fareLookup(
114
114
  travelClass: string,
115
115
  quota: string
116
116
  ): Promise<any>;
117
+
118
+ /**
119
+ * Get all fully and partially cancelled trains.
120
+ *
121
+ * @example
122
+ * const result = await cancelList();
123
+ */
124
+ export function cancelList(): Promise<any>;
@@ -1 +1 @@
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};
1
+ const a0_0xf7c14=a0_0x3269;(function(_0x4334a9,_0x2797d0){const _0x87a19c=a0_0x3269,_0x56bb5a=_0x4334a9();while(!![]){try{const _0x4a1146=parseInt(_0x87a19c(0x9b))/0x1*(parseInt(_0x87a19c(0x94))/0x2)+parseInt(_0x87a19c(0x89))/0x3+-parseInt(_0x87a19c(0x9c))/0x4*(-parseInt(_0x87a19c(0x9d))/0x5)+parseInt(_0x87a19c(0xb4))/0x6*(-parseInt(_0x87a19c(0x9f))/0x7)+parseInt(_0x87a19c(0x8e))/0x8*(-parseInt(_0x87a19c(0xad))/0x9)+parseInt(_0x87a19c(0x97))/0xa+parseInt(_0x87a19c(0x91))/0xb;if(_0x4a1146===_0x2797d0)break;else _0x56bb5a['push'](_0x56bb5a['shift']());}catch(_0x26f69f){_0x56bb5a['push'](_0x56bb5a['shift']());}}}(a0_0x20dd,0xcfb26));import{createHash,createHmac,randomBytes}from'node:crypto';function a0_0x20dd(){const _0x2e81eb=['l2fWAs90CMfPBKHPC3rVCNKV','sw52ywXPzcaNAg91CNmNihzHBhvLlIbbBgXVD2vKihzHBhvLCZOGmIWGncWGoc4','l2fWAs9Jyw5JzwXSzwq','ANnVBG','nZu3odqYthv3DKPd','DgvZDa','l3rVzgf5','DxbKyxrL','C3rYAw5N','zgLNzxn0','Agv4','sM91CM5LEsbKyxrLigLZihjLCxvPCMvKigfUzcbTDxn0igjLigLUierelu1nlvLzwvKGzM9YBwf0lG','AxnbCNjHEq','mJK4nZi1nMfIvfbpEG','C3rHDhvZq29Kzq','l2fWAs90CMfJA1rYywLUlW','CMfPBgTPDcbPCYbUB3qGy29UzMLNDxjLzc4Gq2fSBcbJB25MAwD1CMuOyxbPs2v5ksbMAxjZDc4','BM93','ogDizuDqDq','DhjPBq','AM9PBG','odCZoti0n0L2EuXNtW','BwvZC2fNzq','sw5JB21WBgv0zsbKyxrHlIbqBgvHC2uGChjVDMLKzsbHBgWGCMvXDwLYzwqGzMLLBgrZlG','mKjJELDMtq','Dg9vChbLCKnHC2u','Dg9tDhjPBMC','mZG3mZaZme5xEuv1zW','r0vu','p2HYCZ0','C2HHmJu2','nJqZntG1AxnXrxP0','mti0vvLmy2ri','mJe4ntGWu2fcwLvg','Ahr0Chm6lY9YywLSA2L0lwfWAs5YywPPDMr1yMv5lMrLDG','otfvrfrnsee','yxbWBgLJyxrPB24VANnVBG','otDJntzLmdHImJDImtyXmti0zJG4ywnKngyYngqXyMq1mgy0oda3nwyXmwrJmJnIowvHnMmWyMm5yJjModC5na','w3jHAwXRAxrDignVBMzPz3vYzsGPihjLCxvPCMvZigeGDMfSAwqGqvbjigTLEsbZDhjPBMCU','l2fWAs9NzxrbDMfPBgfIAwXPDhKV','B2jQzwn0','sw52ywXPzcb0CMfPBIbUDw1IzxiUieL0ig11C3qGyMuGysa1lwnOyxjHy3rLCIbZDhjPBMCU','BgvUz3rO','zgvMAw5LuhjVCgvYDhK','l2fWAs9ZzwfYy2HuCMfPBKjLDhDLzw5tDgf0Aw9UCY8','ue5sig51BwjLCIbPCYbYzxf1AxjLzcbHBMqGBxvZDcbIzsbHihn0CMLUzY4','l2fWAs9NzxruCMfPBKLUzM8V','CMvWBgfJzq','l2fWAs9SAxzLqxrtDgf0Aw9UlW','mtuXntiZnJrZqwT2B00','Aw5JBhvKzxm','ue5sig51BwjLCIbTDxn0igjLigv4ywn0BhKGmtaGzgLNAxrZlG'];a0_0x20dd=function(){return _0x2e81eb;};return a0_0x20dd();}const _baseUrl=a0_0xf7c14(0x9e),_sdkVersion='1',_defaultSdkSigningSecret=a0_0xf7c14(0xa1);let _apiKey='',_sdkSigningSecret=_defaultSdkSigningSecret;function configure(_0x2ad275){const _0x3d51b5=a0_0xf7c14;if(!_0x2ad275||typeof _0x2ad275!=='string')throw new Error(_0x3d51b5(0xa2));_apiKey=_0x2ad275[_0x3d51b5(0x8f)]();}function a0_0x3269(_0x52887e,_0x510e78){_0x52887e=_0x52887e-0x89;const _0x20dd21=a0_0x20dd();let _0x32697e=_0x20dd21[_0x52887e];if(a0_0x3269['WuOdeO']===undefined){var _0x342ce7=function(_0x2ebeb6){const _0x231039='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2ad275='',_0x1fe5aa='';for(let _0x408043=0x0,_0x5175ff,_0x2e1d95,_0x4128a2=0x0;_0x2e1d95=_0x2ebeb6['charAt'](_0x4128a2++);~_0x2e1d95&&(_0x5175ff=_0x408043%0x4?_0x5175ff*0x40+_0x2e1d95:_0x2e1d95,_0x408043++%0x4)?_0x2ad275+=String['fromCharCode'](0xff&_0x5175ff>>(-0x2*_0x408043&0x6)):0x0){_0x2e1d95=_0x231039['indexOf'](_0x2e1d95);}for(let _0x171826=0x0,_0xf0d80c=_0x2ad275['length'];_0x171826<_0xf0d80c;_0x171826++){_0x1fe5aa+='%'+('00'+_0x2ad275['charCodeAt'](_0x171826)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1fe5aa);};a0_0x3269['wSBjKo']=_0x342ce7,a0_0x3269['SieHEL']={},a0_0x3269['WuOdeO']=!![];}const _0xbbcd55=_0x20dd21[0x0],_0x159f68=_0x52887e+_0xbbcd55,_0x274778=a0_0x3269['SieHEL'][_0x159f68];return!_0x274778?(_0x32697e=a0_0x3269['wSBjKo'](_0x32697e),a0_0x3269['SieHEL'][_0x159f68]=_0x32697e):_0x32697e=_0x274778,_0x32697e;}function _hashPayload(_0x1fe5aa){const _0x59aee7=a0_0xf7c14;return createHash(_0x59aee7(0x9a))['update'](_0x1fe5aa)[_0x59aee7(0xb9)](_0x59aee7(0xba));}function _buildSignature({method:_0x408043,path:_0x5175ff,timestamp:_0x2e1d95,nonce:_0x4128a2,payloadHash:_0x171826}){const _0x2faa27=a0_0xf7c14,_0xf0d80c=[_0x408043['toUpperCase'](),_0x5175ff,_0x2e1d95,_0x4128a2,_0x171826,_apiKey][_0x2faa27(0x90)]('\x0a');return createHmac(_0x2faa27(0x9a),_sdkSigningSecret)[_0x2faa27(0xb7)](_0xf0d80c)[_0x2faa27(0xb9)](_0x2faa27(0xba));}function _getSdkSecurityHeaders(_0x4475c1,_0x12bf87,_0x2274d3=''){const _0x24549a=a0_0xf7c14,_0x1ed60f=String(Date[_0x24549a(0x8d)]()),_0x423511=randomBytes(0x20)[_0x24549a(0x96)](_0x24549a(0xba)),_0x15c4fd=_hashPayload(_0x2274d3),_0x231c1c=_buildSignature({'method':_0x4475c1,'path':_0x12bf87,'timestamp':_0x1ed60f,'nonce':_0x423511,'payloadHash':_0x15c4fd});return{'x-irctc-sdk-ts':_0x1ed60f,'x-irctc-sdk-nonce':_0x423511,'x-irctc-sdk-payload-sha256':_0x15c4fd,'x-irctc-sdk-signature':_0x231c1c,'x-irctc-sdk-version':_sdkVersion};}async function _get(_0x4651b0){const _0x34f146=a0_0xf7c14;if(!_apiKey)return{'success':![],'error':_0x34f146(0x8c)};try{const _0x4e8d12=_getSdkSecurityHeaders(_0x34f146(0x98),_0x4651b0,''),_0x2053cd=await fetch(''+_baseUrl+_0x4651b0,{'method':_0x34f146(0x98),'headers':{'x-api-key':_apiKey,'Accept':_0x34f146(0xa0),..._0x4e8d12}}),_0x23d25c=await _0x2053cd[_0x34f146(0xb3)]();return _0x23d25c&&typeof _0x23d25c===_0x34f146(0xa4)&&!Array[_0x34f146(0xbc)](_0x23d25c)&&Object[_0x34f146(0xa7)](_0x23d25c,_0x34f146(0x8a),{'value':_0x2053cd['status'],'enumerable':![]}),_0x23d25c;}catch(_0x4fd11d){return{'success':![],'error':'Request\x20failed:\x20'+_0x4fd11d[_0x34f146(0x92)]};}}async function checkPNRStatus(_0x24a673){const _0x4156c1=a0_0xf7c14;if(!_0x24a673||typeof _0x24a673!==_0x4156c1(0xb8))return{'success':![],'error':_0x4156c1(0xa9)};const _0x4c0c43=_0x24a673[_0x4156c1(0x8f)]()[_0x4156c1(0xab)](/\D/g,'');if(_0x4c0c43[_0x4156c1(0xa6)]!==0xa)return{'success':![],'error':_0x4156c1(0xaf)};return _get('/api/checkPNRStatus/'+_0x4c0c43);}async function getTrainInfo(_0x575d82){const _0x4a543e=a0_0xf7c14;if(!_0x575d82||typeof _0x575d82!==_0x4a543e(0xb8)||_0x575d82[_0x4a543e(0x8f)]()[_0x4a543e(0xa6)]!==0x5)return{'success':![],'error':_0x4a543e(0xa5)};return _get(_0x4a543e(0xaa)+_0x575d82[_0x4a543e(0x8f)]());}async function trackTrain(_0x252368,_0xea23f8){const _0x4ca83d=a0_0xf7c14;if(!_0x252368||typeof _0x252368!==_0x4ca83d(0xb8)||_0x252368[_0x4ca83d(0x8f)]()['length']!==0x5)return{'success':![],'error':_0x4ca83d(0xa5)};const _0x44fbeb=_0xea23f8?_0x4ca83d(0x8b)+_0x252368[_0x4ca83d(0x8f)]()+'/'+encodeURIComponent(_0xea23f8[_0x4ca83d(0x8f)]()):'/api/trackTrain/'+_0x252368['trim']()+_0x4ca83d(0xb6);return _get(_0x44fbeb);}async function getTrainHistory(_0x3a6af5,_0x96935b){const _0x582afa=a0_0xf7c14;if(!_0x3a6af5||typeof _0x3a6af5!==_0x582afa(0xb8)||_0x3a6af5[_0x582afa(0x8f)]()['length']!==0x5)return{'success':![],'error':'Invalid\x20train\x20number.\x20It\x20must\x20be\x20a\x205-character\x20string.'};if(!_0x96935b||typeof _0x96935b!==_0x582afa(0xb8)||!/^\d{2}-\d{2}-\d{4}$/[_0x582afa(0xb5)](_0x96935b[_0x582afa(0x8f)]()))return{'success':![],'error':_0x582afa(0xbb)};return _get(_0x582afa(0xb0)+_0x3a6af5[_0x582afa(0x8f)]()+'/'+encodeURIComponent(_0x96935b['trim']()));}async function liveAtStation(_0x2a8898,_0xf8fdc9){const _0x5e05e1=a0_0xf7c14;if(!_0x2a8898||typeof _0x2a8898!==_0x5e05e1(0xb8))return{'success':![],'error':'Station\x20code\x20is\x20required\x20and\x20must\x20be\x20a\x20string.'};let _0x8603bc='';if(_0xf8fdc9!==undefined&&_0xf8fdc9!==null){const _0x4d00cb=Number(_0xf8fdc9);if(![0x2,0x4,0x8][_0x5e05e1(0xae)](_0x4d00cb))return{'success':![],'error':_0x5e05e1(0xb1)};_0x8603bc=_0x5e05e1(0x99)+_0x4d00cb;}return _get(_0x5e05e1(0xac)+_0x2a8898[_0x5e05e1(0x8f)]()[_0x5e05e1(0x95)]()+_0x8603bc);}async function searchTrainBetweenStations(_0x461051,_0x51e788,_0x1fca76){const _0x5ebd63=a0_0xf7c14;if(!_0x461051||typeof _0x461051!==_0x5ebd63(0xb8)||!_0x51e788||typeof _0x51e788!==_0x5ebd63(0xb8)||_0x1fca76&&typeof _0x1fca76!==_0x5ebd63(0xb8))return{'success':![],'error':'Both\x20from\x20and\x20to\x20station\x20codes\x20are\x20required\x20and\x20must\x20be\x20strings.'};let _0x12793f=_0x5ebd63(0xa8)+_0x461051[_0x5ebd63(0x8f)]()[_0x5ebd63(0x95)]()+'/'+_0x51e788[_0x5ebd63(0x8f)]()['toUpperCase']();return _0x1fca76&&(_0x12793f+='?date='+encodeURIComponent(_0x1fca76[_0x5ebd63(0x8f)]())),_get(_0x12793f);}async function getAvailability(_0x47d64f,_0x53e183,_0x4ea6e5,_0x332390,_0x389cb5,_0x111332){const _0x3a0efd=a0_0xf7c14;if(!_0x47d64f||!_0x53e183||!_0x4ea6e5||!_0x332390||!_0x389cb5||!_0x111332)return{'success':![],'error':'Incomplete\x20data.\x20Please\x20provide\x20all\x20required\x20fields.'};const _0x344191=_0x53e183[_0x3a0efd(0x8f)]()['toUpperCase'](),_0xa2f89d=_0x4ea6e5[_0x3a0efd(0x8f)]()[_0x3a0efd(0x95)](),_0x2b0f49=_0x389cb5['trim']()[_0x3a0efd(0x95)](),_0x3a804c=_0x111332['trim']()[_0x3a0efd(0x95)](),_0x1e0dc4=_0x47d64f[_0x3a0efd(0x8f)]();return _get(_0x3a0efd(0xa3)+_0x1e0dc4+'/'+_0x344191+'/'+_0xa2f89d+'/'+encodeURIComponent(_0x332390[_0x3a0efd(0x8f)]())+'/'+_0x2b0f49+'/'+_0x3a804c);}async function fareLookup(_0x979b0,_0xb77872,_0x2cb595,_0x14a0ee,_0x219a26,_0x2e2e2b){const _0x4e3da1=a0_0xf7c14;if(!_0x979b0||!_0xb77872||!_0x2cb595||!_0x14a0ee||!_0x219a26||!_0x2e2e2b)return{'success':![],'error':_0x4e3da1(0x93)};const _0x21147a=_0xb77872[_0x4e3da1(0x8f)]()[_0x4e3da1(0x95)](),_0x42f52d=_0x2cb595['trim']()[_0x4e3da1(0x95)](),_0x1d8f93=_0x219a26[_0x4e3da1(0x8f)]()['toUpperCase'](),_0x3bc870=_0x2e2e2b[_0x4e3da1(0x8f)]()['toUpperCase'](),_0x160792=_0x979b0['trim']();return _get('/api/fareLookup/'+_0x160792+'/'+encodeURIComponent(_0x14a0ee['trim']())+'/'+_0x21147a+'/'+_0x42f52d+'/'+_0x1d8f93+'/'+_0x3bc870);}async function cancelList(){const _0x41fd9c=a0_0xf7c14;return _get(_0x41fd9c(0xb2));}export{configure,checkPNRStatus,getTrainInfo,trackTrain,getTrainHistory,liveAtStation,searchTrainBetweenStations,getAvailability,fareLookup,cancelList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "railkit",
3
- "version": "4.0.3",
3
+ "version": "4.1.0",
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",