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 +8 -0
- package/index.obfuscated.js +1 -1
- package/package.json +1 -1
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>;
|
package/index.obfuscated.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
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
|
+
"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",
|