nsekit 0.3.3 → 0.3.5
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 +297 -297
- package/dist/brokers/fivepaisa/FivePaisaBroker.d.ts +5 -0
- package/dist/brokers/fivepaisa/FivePaisaBroker.d.ts.map +1 -1
- package/dist/brokers/fivepaisa/fivepaisa-constants.d.ts +1 -1
- package/dist/brokers/fivepaisa/fivepaisa-mapper.d.ts +1 -0
- package/dist/brokers/fivepaisa/fivepaisa-mapper.d.ts.map +1 -1
- package/dist/brokers/fivepaisa/scripcode-guard.d.ts +25 -0
- package/dist/brokers/fivepaisa/scripcode-guard.d.ts.map +1 -0
- package/dist/brokers/paper/paper-fill-engine.d.ts +14 -0
- package/dist/brokers/paper/paper-fill-engine.d.ts.map +1 -1
- package/dist/index.js +226 -90
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8798,17 +8798,6 @@ var require_db = __commonJS((exports, module) => {
|
|
|
8798
8798
|
};
|
|
8799
8799
|
});
|
|
8800
8800
|
|
|
8801
|
-
// node_modules/mime-db/index.js
|
|
8802
|
-
var require_mime_db = __commonJS((exports, module) => {
|
|
8803
|
-
/*!
|
|
8804
|
-
* mime-db
|
|
8805
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
8806
|
-
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|
8807
|
-
* MIT Licensed
|
|
8808
|
-
*/
|
|
8809
|
-
module.exports = require_db();
|
|
8810
|
-
});
|
|
8811
|
-
|
|
8812
8801
|
// node_modules/mime-types/index.js
|
|
8813
8802
|
var require_mime_types = __commonJS((exports) => {
|
|
8814
8803
|
/*!
|
|
@@ -8817,7 +8806,7 @@ var require_mime_types = __commonJS((exports) => {
|
|
|
8817
8806
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
8818
8807
|
* MIT Licensed
|
|
8819
8808
|
*/
|
|
8820
|
-
var db =
|
|
8809
|
+
var db = require_db();
|
|
8821
8810
|
var extname = __require("path").extname;
|
|
8822
8811
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
8823
8812
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
@@ -9164,7 +9153,7 @@ var require_round = __commonJS((exports, module) => {
|
|
|
9164
9153
|
|
|
9165
9154
|
// node_modules/math-intrinsics/isNaN.js
|
|
9166
9155
|
var require_isNaN = __commonJS((exports, module) => {
|
|
9167
|
-
module.exports = Number.isNaN || function
|
|
9156
|
+
module.exports = Number.isNaN || function isNaN2(a) {
|
|
9168
9157
|
return a !== a;
|
|
9169
9158
|
};
|
|
9170
9159
|
});
|
|
@@ -9298,7 +9287,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
9298
9287
|
var toStr = Object.prototype.toString;
|
|
9299
9288
|
var max = Math.max;
|
|
9300
9289
|
var funcType = "[object Function]";
|
|
9301
|
-
var concatty = function
|
|
9290
|
+
var concatty = function concatty2(a, b) {
|
|
9302
9291
|
var arr = [];
|
|
9303
9292
|
for (var i = 0;i < a.length; i += 1) {
|
|
9304
9293
|
arr[i] = a[i];
|
|
@@ -9308,7 +9297,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
9308
9297
|
}
|
|
9309
9298
|
return arr;
|
|
9310
9299
|
};
|
|
9311
|
-
var slicy = function
|
|
9300
|
+
var slicy = function slicy2(arrLike, offset) {
|
|
9312
9301
|
var arr = [];
|
|
9313
9302
|
for (var i = offset || 0, j = 0;i < arrLike.length; i += 1, j += 1) {
|
|
9314
9303
|
arr[j] = arrLike[i];
|
|
@@ -9349,7 +9338,7 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
9349
9338
|
}
|
|
9350
9339
|
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
9351
9340
|
if (target.prototype) {
|
|
9352
|
-
var Empty = function
|
|
9341
|
+
var Empty = function Empty2() {};
|
|
9353
9342
|
Empty.prototype = target.prototype;
|
|
9354
9343
|
bound.prototype = new Empty;
|
|
9355
9344
|
Empty.prototype = null;
|
|
@@ -9588,7 +9577,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
9588
9577
|
}
|
|
9589
9578
|
}
|
|
9590
9579
|
var errorProto;
|
|
9591
|
-
var doEval = function
|
|
9580
|
+
var doEval = function doEval2(name) {
|
|
9592
9581
|
var value;
|
|
9593
9582
|
if (name === "%AsyncFunction%") {
|
|
9594
9583
|
value = getEvalledConstructor("async function () {}");
|
|
@@ -9597,12 +9586,12 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
9597
9586
|
} else if (name === "%AsyncGeneratorFunction%") {
|
|
9598
9587
|
value = getEvalledConstructor("async function* () {}");
|
|
9599
9588
|
} else if (name === "%AsyncGenerator%") {
|
|
9600
|
-
var fn =
|
|
9589
|
+
var fn = doEval2("%AsyncGeneratorFunction%");
|
|
9601
9590
|
if (fn) {
|
|
9602
9591
|
value = fn.prototype;
|
|
9603
9592
|
}
|
|
9604
9593
|
} else if (name === "%AsyncIteratorPrototype%") {
|
|
9605
|
-
var gen =
|
|
9594
|
+
var gen = doEval2("%AsyncGenerator%");
|
|
9606
9595
|
if (gen && getProto) {
|
|
9607
9596
|
value = getProto(gen.prototype);
|
|
9608
9597
|
}
|
|
@@ -9673,7 +9662,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
9673
9662
|
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
9674
9663
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
9675
9664
|
var reEscapeChar = /\\(\\)?/g;
|
|
9676
|
-
var stringToPath = function
|
|
9665
|
+
var stringToPath = function stringToPath2(string) {
|
|
9677
9666
|
var first = $strSlice(string, 0, 1);
|
|
9678
9667
|
var last = $strSlice(string, -1);
|
|
9679
9668
|
if (first === "%" && last !== "%") {
|
|
@@ -9687,7 +9676,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
9687
9676
|
});
|
|
9688
9677
|
return result;
|
|
9689
9678
|
};
|
|
9690
|
-
var getBaseIntrinsic = function
|
|
9679
|
+
var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
|
|
9691
9680
|
var intrinsicName = name;
|
|
9692
9681
|
var alias;
|
|
9693
9682
|
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
@@ -12045,7 +12034,7 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
12045
12034
|
prototype.append = function append(name, value) {
|
|
12046
12035
|
this._pairs.push([name, value]);
|
|
12047
12036
|
};
|
|
12048
|
-
prototype.toString = function
|
|
12037
|
+
prototype.toString = function toString2(encoder) {
|
|
12049
12038
|
const _encode = encoder ? function(value) {
|
|
12050
12039
|
return encoder.call(this, value, encode$1);
|
|
12051
12040
|
} : encode$1;
|
|
@@ -13265,7 +13254,7 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
13265
13254
|
return req;
|
|
13266
13255
|
}
|
|
13267
13256
|
};
|
|
13268
|
-
var httpAdapter = isHttpAdapterSupported && function
|
|
13257
|
+
var httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
|
|
13269
13258
|
return wrapAsync(async function dispatchHttpRequest(resolve2, reject, onDone) {
|
|
13270
13259
|
let { data, lookup, family, httpVersion = 1, http2Options } = config;
|
|
13271
13260
|
const { responseType, responseEncoding } = config;
|
|
@@ -14323,7 +14312,7 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
14323
14312
|
}
|
|
14324
14313
|
var validators$1 = {};
|
|
14325
14314
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
14326
|
-
validators$1[type] = function
|
|
14315
|
+
validators$1[type] = function validator2(thing) {
|
|
14327
14316
|
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
14328
14317
|
};
|
|
14329
14318
|
});
|
|
@@ -17270,27 +17259,27 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17270
17259
|
var has = Object.prototype.hasOwnProperty;
|
|
17271
17260
|
var isArray = Array.isArray;
|
|
17272
17261
|
var overflowChannel = getSideChannel();
|
|
17273
|
-
var markOverflow = function
|
|
17262
|
+
var markOverflow = function markOverflow2(obj, maxIndex) {
|
|
17274
17263
|
overflowChannel.set(obj, maxIndex);
|
|
17275
17264
|
return obj;
|
|
17276
17265
|
};
|
|
17277
|
-
var isOverflow = function
|
|
17266
|
+
var isOverflow = function isOverflow2(obj) {
|
|
17278
17267
|
return overflowChannel.has(obj);
|
|
17279
17268
|
};
|
|
17280
|
-
var getMaxIndex = function
|
|
17269
|
+
var getMaxIndex = function getMaxIndex2(obj) {
|
|
17281
17270
|
return overflowChannel.get(obj);
|
|
17282
17271
|
};
|
|
17283
|
-
var setMaxIndex = function
|
|
17272
|
+
var setMaxIndex = function setMaxIndex2(obj, maxIndex) {
|
|
17284
17273
|
overflowChannel.set(obj, maxIndex);
|
|
17285
17274
|
};
|
|
17286
17275
|
var hexTable = function() {
|
|
17287
17276
|
var array = [];
|
|
17288
17277
|
for (var i = 0;i < 256; ++i) {
|
|
17289
|
-
array.
|
|
17278
|
+
array[array.length] = "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
|
|
17290
17279
|
}
|
|
17291
17280
|
return array;
|
|
17292
17281
|
}();
|
|
17293
|
-
var compactQueue = function
|
|
17282
|
+
var compactQueue = function compactQueue2(queue) {
|
|
17294
17283
|
while (queue.length > 1) {
|
|
17295
17284
|
var item = queue.pop();
|
|
17296
17285
|
var obj = item.obj[item.prop];
|
|
@@ -17298,14 +17287,14 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17298
17287
|
var compacted = [];
|
|
17299
17288
|
for (var j = 0;j < obj.length; ++j) {
|
|
17300
17289
|
if (typeof obj[j] !== "undefined") {
|
|
17301
|
-
compacted.
|
|
17290
|
+
compacted[compacted.length] = obj[j];
|
|
17302
17291
|
}
|
|
17303
17292
|
}
|
|
17304
17293
|
item.obj[item.prop] = compacted;
|
|
17305
17294
|
}
|
|
17306
17295
|
}
|
|
17307
17296
|
};
|
|
17308
|
-
var arrayToObject = function
|
|
17297
|
+
var arrayToObject = function arrayToObject2(source, options) {
|
|
17309
17298
|
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
|
17310
17299
|
for (var i = 0;i < source.length; ++i) {
|
|
17311
17300
|
if (typeof source[i] !== "undefined") {
|
|
@@ -17314,13 +17303,17 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17314
17303
|
}
|
|
17315
17304
|
return obj;
|
|
17316
17305
|
};
|
|
17317
|
-
var merge = function
|
|
17306
|
+
var merge = function merge2(target, source, options) {
|
|
17318
17307
|
if (!source) {
|
|
17319
17308
|
return target;
|
|
17320
17309
|
}
|
|
17321
17310
|
if (typeof source !== "object" && typeof source !== "function") {
|
|
17322
17311
|
if (isArray(target)) {
|
|
17323
|
-
target.
|
|
17312
|
+
var nextIndex = target.length;
|
|
17313
|
+
if (options && typeof options.arrayLimit === "number" && nextIndex > options.arrayLimit) {
|
|
17314
|
+
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
|
17315
|
+
}
|
|
17316
|
+
target[nextIndex] = source;
|
|
17324
17317
|
} else if (target && typeof target === "object") {
|
|
17325
17318
|
if (isOverflow(target)) {
|
|
17326
17319
|
var newIndex = getMaxIndex(target) + 1;
|
|
@@ -17344,7 +17337,11 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17344
17337
|
}
|
|
17345
17338
|
return markOverflow(result, getMaxIndex(source) + 1);
|
|
17346
17339
|
}
|
|
17347
|
-
|
|
17340
|
+
var combined = [target].concat(source);
|
|
17341
|
+
if (options && typeof options.arrayLimit === "number" && combined.length > options.arrayLimit) {
|
|
17342
|
+
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
|
17343
|
+
}
|
|
17344
|
+
return combined;
|
|
17348
17345
|
}
|
|
17349
17346
|
var mergeTarget = target;
|
|
17350
17347
|
if (isArray(target) && !isArray(source)) {
|
|
@@ -17355,9 +17352,9 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17355
17352
|
if (has.call(target, i)) {
|
|
17356
17353
|
var targetItem = target[i];
|
|
17357
17354
|
if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
|
|
17358
|
-
target[i] =
|
|
17355
|
+
target[i] = merge2(targetItem, item, options);
|
|
17359
17356
|
} else {
|
|
17360
|
-
target.
|
|
17357
|
+
target[target.length] = item;
|
|
17361
17358
|
}
|
|
17362
17359
|
} else {
|
|
17363
17360
|
target[i] = item;
|
|
@@ -17368,10 +17365,19 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17368
17365
|
return Object.keys(source).reduce(function(acc, key) {
|
|
17369
17366
|
var value = source[key];
|
|
17370
17367
|
if (has.call(acc, key)) {
|
|
17371
|
-
acc[key] =
|
|
17368
|
+
acc[key] = merge2(acc[key], value, options);
|
|
17372
17369
|
} else {
|
|
17373
17370
|
acc[key] = value;
|
|
17374
17371
|
}
|
|
17372
|
+
if (isOverflow(source) && !isOverflow(acc)) {
|
|
17373
|
+
markOverflow(acc, getMaxIndex(source));
|
|
17374
|
+
}
|
|
17375
|
+
if (isOverflow(acc)) {
|
|
17376
|
+
var keyNum = parseInt(key, 10);
|
|
17377
|
+
if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
|
|
17378
|
+
setMaxIndex(acc, keyNum);
|
|
17379
|
+
}
|
|
17380
|
+
}
|
|
17375
17381
|
return acc;
|
|
17376
17382
|
}, mergeTarget);
|
|
17377
17383
|
};
|
|
@@ -17393,7 +17399,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17393
17399
|
}
|
|
17394
17400
|
};
|
|
17395
17401
|
var limit = 1024;
|
|
17396
|
-
var encode = function
|
|
17402
|
+
var encode = function encode2(str, defaultEncoder, charset, kind, format) {
|
|
17397
17403
|
if (str.length === 0) {
|
|
17398
17404
|
return str;
|
|
17399
17405
|
}
|
|
@@ -17438,7 +17444,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17438
17444
|
}
|
|
17439
17445
|
return out;
|
|
17440
17446
|
};
|
|
17441
|
-
var compact = function
|
|
17447
|
+
var compact = function compact2(value) {
|
|
17442
17448
|
var queue = [{ obj: { o: value }, prop: "o" }];
|
|
17443
17449
|
var refs = [];
|
|
17444
17450
|
for (var i = 0;i < queue.length; ++i) {
|
|
@@ -17449,24 +17455,24 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17449
17455
|
var key = keys[j];
|
|
17450
17456
|
var val = obj[key];
|
|
17451
17457
|
if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
|
|
17452
|
-
queue.
|
|
17453
|
-
refs.
|
|
17458
|
+
queue[queue.length] = { obj, prop: key };
|
|
17459
|
+
refs[refs.length] = val;
|
|
17454
17460
|
}
|
|
17455
17461
|
}
|
|
17456
17462
|
}
|
|
17457
17463
|
compactQueue(queue);
|
|
17458
17464
|
return value;
|
|
17459
17465
|
};
|
|
17460
|
-
var isRegExp = function
|
|
17466
|
+
var isRegExp = function isRegExp2(obj) {
|
|
17461
17467
|
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
17462
17468
|
};
|
|
17463
|
-
var isBuffer = function
|
|
17469
|
+
var isBuffer = function isBuffer2(obj) {
|
|
17464
17470
|
if (!obj || typeof obj !== "object") {
|
|
17465
17471
|
return false;
|
|
17466
17472
|
}
|
|
17467
17473
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
17468
17474
|
};
|
|
17469
|
-
var combine = function
|
|
17475
|
+
var combine = function combine2(a, b, arrayLimit, plainObjects) {
|
|
17470
17476
|
if (isOverflow(a)) {
|
|
17471
17477
|
var newIndex = getMaxIndex(a) + 1;
|
|
17472
17478
|
a[newIndex] = b;
|
|
@@ -17479,11 +17485,11 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17479
17485
|
}
|
|
17480
17486
|
return result;
|
|
17481
17487
|
};
|
|
17482
|
-
var maybeMap = function
|
|
17488
|
+
var maybeMap = function maybeMap2(val, fn) {
|
|
17483
17489
|
if (isArray(val)) {
|
|
17484
17490
|
var mapped = [];
|
|
17485
17491
|
for (var i = 0;i < val.length; i += 1) {
|
|
17486
|
-
mapped.
|
|
17492
|
+
mapped[mapped.length] = fn(val[i]);
|
|
17487
17493
|
}
|
|
17488
17494
|
return mapped;
|
|
17489
17495
|
}
|
|
@@ -17499,6 +17505,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
17499
17505
|
isBuffer,
|
|
17500
17506
|
isOverflow,
|
|
17501
17507
|
isRegExp,
|
|
17508
|
+
markOverflow,
|
|
17502
17509
|
maybeMap,
|
|
17503
17510
|
merge
|
|
17504
17511
|
};
|
|
@@ -17552,11 +17559,11 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
17552
17559
|
skipNulls: false,
|
|
17553
17560
|
strictNullHandling: false
|
|
17554
17561
|
};
|
|
17555
|
-
var isNonNullishPrimitive = function
|
|
17562
|
+
var isNonNullishPrimitive = function isNonNullishPrimitive2(v) {
|
|
17556
17563
|
return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
|
|
17557
17564
|
};
|
|
17558
17565
|
var sentinel = {};
|
|
17559
|
-
var stringify = function
|
|
17566
|
+
var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
17560
17567
|
var obj = object;
|
|
17561
17568
|
var tmpSc = sideChannel;
|
|
17562
17569
|
var step = 0;
|
|
@@ -17632,11 +17639,11 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
17632
17639
|
sideChannel.set(object, step);
|
|
17633
17640
|
var valueSideChannel = getSideChannel();
|
|
17634
17641
|
valueSideChannel.set(sentinel, sideChannel);
|
|
17635
|
-
pushToArray(values,
|
|
17642
|
+
pushToArray(values, stringify2(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
|
|
17636
17643
|
}
|
|
17637
17644
|
return values;
|
|
17638
17645
|
};
|
|
17639
|
-
var normalizeStringifyOptions = function
|
|
17646
|
+
var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
|
|
17640
17647
|
if (!opts) {
|
|
17641
17648
|
return defaults;
|
|
17642
17649
|
}
|
|
@@ -17840,6 +17847,12 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
17840
17847
|
if (part.indexOf("[]=") > -1) {
|
|
17841
17848
|
val = isArray(val) ? [val] : val;
|
|
17842
17849
|
}
|
|
17850
|
+
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
17851
|
+
if (options.throwOnLimitExceeded) {
|
|
17852
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
17853
|
+
}
|
|
17854
|
+
val = utils.combine([], val, options.arrayLimit, options.plainObjects);
|
|
17855
|
+
}
|
|
17843
17856
|
if (key !== null) {
|
|
17844
17857
|
var existing = has.call(obj, key);
|
|
17845
17858
|
if (existing && options.duplicates === "combine") {
|
|
@@ -17872,11 +17885,17 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
17872
17885
|
var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
|
|
17873
17886
|
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
|
|
17874
17887
|
var index = parseInt(decodedRoot, 10);
|
|
17888
|
+
var isValidArrayIndex = !isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && options.parseArrays;
|
|
17875
17889
|
if (!options.parseArrays && decodedRoot === "") {
|
|
17876
17890
|
obj = { 0: leaf };
|
|
17877
|
-
} else if (
|
|
17891
|
+
} else if (isValidArrayIndex && index < options.arrayLimit) {
|
|
17878
17892
|
obj = [];
|
|
17879
17893
|
obj[index] = leaf;
|
|
17894
|
+
} else if (isValidArrayIndex && options.throwOnLimitExceeded) {
|
|
17895
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
17896
|
+
} else if (isValidArrayIndex) {
|
|
17897
|
+
obj[index] = leaf;
|
|
17898
|
+
utils.markOverflow(obj, index);
|
|
17880
17899
|
} else if (decodedRoot !== "__proto__") {
|
|
17881
17900
|
obj[decodedRoot] = leaf;
|
|
17882
17901
|
}
|
|
@@ -17885,7 +17904,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
17885
17904
|
}
|
|
17886
17905
|
return leaf;
|
|
17887
17906
|
};
|
|
17888
|
-
var splitKeyIntoSegments = function
|
|
17907
|
+
var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) {
|
|
17889
17908
|
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
|
|
17890
17909
|
if (options.depth <= 0) {
|
|
17891
17910
|
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
@@ -17906,7 +17925,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
17906
17925
|
return;
|
|
17907
17926
|
}
|
|
17908
17927
|
}
|
|
17909
|
-
keys.
|
|
17928
|
+
keys[keys.length] = parent;
|
|
17910
17929
|
}
|
|
17911
17930
|
var i = 0;
|
|
17912
17931
|
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
|
@@ -17917,13 +17936,13 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
17917
17936
|
return;
|
|
17918
17937
|
}
|
|
17919
17938
|
}
|
|
17920
|
-
keys.
|
|
17939
|
+
keys[keys.length] = segment[1];
|
|
17921
17940
|
}
|
|
17922
17941
|
if (segment) {
|
|
17923
17942
|
if (options.strictDepth === true) {
|
|
17924
17943
|
throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
|
|
17925
17944
|
}
|
|
17926
|
-
keys.
|
|
17945
|
+
keys[keys.length] = "[" + key.slice(segment.index) + "]";
|
|
17927
17946
|
}
|
|
17928
17947
|
return keys;
|
|
17929
17948
|
};
|
|
@@ -17937,7 +17956,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
17937
17956
|
}
|
|
17938
17957
|
return parseObject(keys, val, options, valuesParsed);
|
|
17939
17958
|
};
|
|
17940
|
-
var normalizeParseOptions = function
|
|
17959
|
+
var normalizeParseOptions = function normalizeParseOptions2(opts) {
|
|
17941
17960
|
if (!opts) {
|
|
17942
17961
|
return defaults;
|
|
17943
17962
|
}
|
|
@@ -23901,6 +23920,9 @@ function shouldLimitFill(side, limitPrice, ltp) {
|
|
|
23901
23920
|
return ltp <= limitPrice;
|
|
23902
23921
|
return ltp >= limitPrice;
|
|
23903
23922
|
}
|
|
23923
|
+
function computeLimitFillPrice(_side, _limitPrice, ltp) {
|
|
23924
|
+
return ltp;
|
|
23925
|
+
}
|
|
23904
23926
|
function shouldTrigger(side, triggerPrice, ltp) {
|
|
23905
23927
|
if (side === "BUY")
|
|
23906
23928
|
return ltp >= triggerPrice;
|
|
@@ -24075,7 +24097,7 @@ class PaperFillEngine {
|
|
|
24075
24097
|
case "LIMIT": {
|
|
24076
24098
|
if (shouldLimitFill(params.side, params.price ?? 0, ltp)) {
|
|
24077
24099
|
const fillQty = determineFillQty(remainingQty, this.config.partialFillProb);
|
|
24078
|
-
const fillPrice = params.price ?? ltp;
|
|
24100
|
+
const fillPrice = computeLimitFillPrice(params.side, params.price ?? 0, ltp);
|
|
24079
24101
|
this.applyFill(orderId, pending, fillQty, fillPrice);
|
|
24080
24102
|
}
|
|
24081
24103
|
break;
|
|
@@ -24092,7 +24114,7 @@ class PaperFillEngine {
|
|
|
24092
24114
|
if (pending.triggered) {
|
|
24093
24115
|
if (shouldLimitFill(params.side, params.price ?? 0, ltp)) {
|
|
24094
24116
|
const fillQty = determineFillQty(remainingQty, this.config.partialFillProb);
|
|
24095
|
-
const fillPrice = params.price ?? ltp;
|
|
24117
|
+
const fillPrice = computeLimitFillPrice(params.side, params.price ?? 0, ltp);
|
|
24096
24118
|
this.applyFill(orderId, pending, fillQty, fillPrice);
|
|
24097
24119
|
}
|
|
24098
24120
|
}
|
|
@@ -24595,7 +24617,7 @@ var ROUTES = {
|
|
|
24595
24617
|
TOTP_LOGIN: `${FIVEPAISA_API_BASE}/TOTPLogin`,
|
|
24596
24618
|
ACCESS_TOKEN: `${FIVEPAISA_API_BASE}/GetAccessToken`,
|
|
24597
24619
|
MARGIN: `${FIVEPAISA_API_BASE}/V4/Margin`,
|
|
24598
|
-
ORDER_BOOK: `${FIVEPAISA_API_BASE}/
|
|
24620
|
+
ORDER_BOOK: `${FIVEPAISA_API_BASE}/V4/OrderBook`,
|
|
24599
24621
|
HOLDINGS: `${FIVEPAISA_API_BASE}/V3/Holding`,
|
|
24600
24622
|
POSITIONS: `${FIVEPAISA_API_BASE}/V1/NetPositionNetWise`,
|
|
24601
24623
|
PLACE_ORDER: `${FIVEPAISA_API_BASE}/V1/PlaceOrderRequest`,
|
|
@@ -24964,7 +24986,7 @@ function fromOrder4(order) {
|
|
|
24964
24986
|
pendingQty: num2(order.PendingQty),
|
|
24965
24987
|
price: num2(order.Rate),
|
|
24966
24988
|
triggerPrice: num2(order.SLTriggerRate) || undefined,
|
|
24967
|
-
averagePrice: filled > 0 ? num2(order.
|
|
24989
|
+
averagePrice: filled > 0 ? num2(order.AveragePrice ?? order.TradedPrice) : 0,
|
|
24968
24990
|
status: safeStatus4(order.OrderStatus),
|
|
24969
24991
|
validity: num2(order.OrderValidity) === 3 ? "IOC" : "DAY",
|
|
24970
24992
|
tag: order.RemoteOrderID || undefined,
|
|
@@ -25393,6 +25415,47 @@ class FivePaisaInstruments {
|
|
|
25393
25415
|
}
|
|
25394
25416
|
}
|
|
25395
25417
|
|
|
25418
|
+
// src/brokers/fivepaisa/scripcode-guard.ts
|
|
25419
|
+
function candidateScripCode(instrument) {
|
|
25420
|
+
const raw = instrument.brokerTokens.fivepaisa?.scripCode;
|
|
25421
|
+
if (!raw)
|
|
25422
|
+
return 0;
|
|
25423
|
+
const n = parseInt(raw, 10);
|
|
25424
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
25425
|
+
}
|
|
25426
|
+
function resolveScripCodeSafe(requestedTradingSymbol, resolved, searchResults) {
|
|
25427
|
+
if (/^\d+$/.test(requestedTradingSymbol)) {
|
|
25428
|
+
const code = parseInt(requestedTradingSymbol, 10);
|
|
25429
|
+
if (code > 0)
|
|
25430
|
+
return { ok: true, scripCode: code };
|
|
25431
|
+
}
|
|
25432
|
+
const normalizedRequest = requestedTradingSymbol.toUpperCase();
|
|
25433
|
+
if (resolved) {
|
|
25434
|
+
const code = candidateScripCode(resolved);
|
|
25435
|
+
if (code > 0)
|
|
25436
|
+
return { ok: true, scripCode: code };
|
|
25437
|
+
}
|
|
25438
|
+
const foundSymbols = [];
|
|
25439
|
+
for (const candidate of searchResults) {
|
|
25440
|
+
foundSymbols.push(candidate.tradingSymbol);
|
|
25441
|
+
if (candidate.tradingSymbol.toUpperCase() !== normalizedRequest)
|
|
25442
|
+
continue;
|
|
25443
|
+
const code = candidateScripCode(candidate);
|
|
25444
|
+
if (code > 0)
|
|
25445
|
+
return { ok: true, scripCode: code };
|
|
25446
|
+
}
|
|
25447
|
+
if (foundSymbols.length > 0) {
|
|
25448
|
+
return {
|
|
25449
|
+
ok: false,
|
|
25450
|
+
error: `Cannot resolve ScripCode for ${requestedTradingSymbol} \u2014 fuzzy search returned non-matching contracts: ${foundSymbols.join(", ")}. Refusing to place order on wrong contract.`
|
|
25451
|
+
};
|
|
25452
|
+
}
|
|
25453
|
+
return {
|
|
25454
|
+
ok: false,
|
|
25455
|
+
error: `Cannot resolve ScripCode for ${requestedTradingSymbol} \u2014 not found in instrument master.`
|
|
25456
|
+
};
|
|
25457
|
+
}
|
|
25458
|
+
|
|
25396
25459
|
// src/brokers/fivepaisa/FivePaisaBroker.ts
|
|
25397
25460
|
class FivePaisaBroker {
|
|
25398
25461
|
id = "fivepaisa";
|
|
@@ -25453,24 +25516,15 @@ class FivePaisaBroker {
|
|
|
25453
25516
|
const exchange = params.exchange ?? "NSE";
|
|
25454
25517
|
const clientCode = this.session?.userId ?? "";
|
|
25455
25518
|
const appSource = parseInt(this.credentials?.appSource ?? "0", 10) || 0;
|
|
25456
|
-
let scripCode = 0;
|
|
25457
25519
|
const resolveKey = `${exchange}:${params.tradingSymbol}`;
|
|
25458
25520
|
const resolved = this.resolve(resolveKey);
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
if (
|
|
25463
|
-
|
|
25464
|
-
for (const r of results) {
|
|
25465
|
-
if (r.brokerTokens.fivepaisa?.scripCode) {
|
|
25466
|
-
scripCode = parseInt(r.brokerTokens.fivepaisa.scripCode, 10);
|
|
25467
|
-
break;
|
|
25468
|
-
}
|
|
25469
|
-
}
|
|
25470
|
-
}
|
|
25471
|
-
if (scripCode === 0) {
|
|
25472
|
-
return Err(new Error(`Cannot resolve ScripCode for ${params.tradingSymbol} on ${exchange}`));
|
|
25521
|
+
const resolvedInstrument = resolved.ok ? resolved.value : undefined;
|
|
25522
|
+
const searchResults = resolvedInstrument ? [] : this.search(params.tradingSymbol, exchange, undefined, 5);
|
|
25523
|
+
const scripResolution = resolveScripCodeSafe(params.tradingSymbol, resolvedInstrument, searchResults);
|
|
25524
|
+
if (!scripResolution.ok) {
|
|
25525
|
+
return Err(new Error(scripResolution.error));
|
|
25473
25526
|
}
|
|
25527
|
+
const scripCode = scripResolution.scripCode;
|
|
25474
25528
|
const body = toOrderPayload({ ...params, exchange }, clientCode, appSource);
|
|
25475
25529
|
body.ScripCode = scripCode;
|
|
25476
25530
|
const payload = {
|
|
@@ -25487,9 +25541,20 @@ class FivePaisaBroker {
|
|
|
25487
25541
|
if (brokerOid === 0) {
|
|
25488
25542
|
return Err(new Error(`Order placement failed: ${res.Message ?? "No BrokerOrderID returned"}`));
|
|
25489
25543
|
}
|
|
25544
|
+
const brokerOidStr = String(brokerOid);
|
|
25545
|
+
let exchOid = res.ExchOrderID && res.ExchOrderID !== "0" ? res.ExchOrderID : "";
|
|
25546
|
+
if (!exchOid) {
|
|
25547
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
25548
|
+
const ordersResult = await this.getOrders();
|
|
25549
|
+
if (ordersResult.ok) {
|
|
25550
|
+
const match = ordersResult.value.find((o) => o.brokerOrderId === brokerOidStr);
|
|
25551
|
+
if (match?.orderId && match.orderId !== "0")
|
|
25552
|
+
exchOid = match.orderId;
|
|
25553
|
+
}
|
|
25554
|
+
}
|
|
25490
25555
|
return Ok({
|
|
25491
|
-
orderId:
|
|
25492
|
-
brokerOrderId:
|
|
25556
|
+
orderId: exchOid || brokerOidStr,
|
|
25557
|
+
brokerOrderId: brokerOidStr,
|
|
25493
25558
|
status: "PENDING",
|
|
25494
25559
|
timestamp: Date.now()
|
|
25495
25560
|
});
|
|
@@ -25499,8 +25564,9 @@ class FivePaisaBroker {
|
|
|
25499
25564
|
}
|
|
25500
25565
|
async modifyOrder(orderId, params) {
|
|
25501
25566
|
try {
|
|
25567
|
+
const exchOrderId = await this.resolveExchOrderId(orderId);
|
|
25502
25568
|
const body = {
|
|
25503
|
-
ExchOrderID:
|
|
25569
|
+
ExchOrderID: exchOrderId,
|
|
25504
25570
|
Qty: params.quantity,
|
|
25505
25571
|
Price: params.price
|
|
25506
25572
|
};
|
|
@@ -25509,8 +25575,30 @@ class FivePaisaBroker {
|
|
|
25509
25575
|
body: { ...this.buildBody(), ...body }
|
|
25510
25576
|
};
|
|
25511
25577
|
const res = await this.post(ROUTES.MODIFY_ORDER, payload);
|
|
25578
|
+
console.log("[5paisa] ModifyOrder response:", JSON.stringify(res));
|
|
25579
|
+
let newExchOid = res.ExchOrderID && res.ExchOrderID !== "0" ? res.ExchOrderID : "";
|
|
25580
|
+
if (!newExchOid) {
|
|
25581
|
+
await new Promise((r) => setTimeout(r, 800));
|
|
25582
|
+
const ordersResult = await this.getOrders();
|
|
25583
|
+
if (ordersResult.ok) {
|
|
25584
|
+
if (res.BrokerOrderID) {
|
|
25585
|
+
const match = ordersResult.value.find((o) => o.brokerOrderId === String(res.BrokerOrderID));
|
|
25586
|
+
if (match?.orderId && match.orderId !== "0")
|
|
25587
|
+
newExchOid = match.orderId;
|
|
25588
|
+
}
|
|
25589
|
+
if (!newExchOid) {
|
|
25590
|
+
const origOrder = ordersResult.value.find((o) => o.orderId === exchOrderId || o.brokerOrderId === exchOrderId);
|
|
25591
|
+
if (origOrder) {
|
|
25592
|
+
const active = ordersResult.value.find((o) => o.tradingSymbol === origOrder.tradingSymbol && o.side === origOrder.side && (o.status === "OPEN" || o.status === "PENDING") && o.orderId !== exchOrderId);
|
|
25593
|
+
if (active?.orderId && active.orderId !== "0")
|
|
25594
|
+
newExchOid = active.orderId;
|
|
25595
|
+
}
|
|
25596
|
+
}
|
|
25597
|
+
console.log("[5paisa] ModifyOrder resolved newExchOid:", newExchOid);
|
|
25598
|
+
}
|
|
25599
|
+
}
|
|
25512
25600
|
return Ok({
|
|
25513
|
-
orderId:
|
|
25601
|
+
orderId: newExchOid || exchOrderId,
|
|
25514
25602
|
brokerOrderId: String(res.BrokerOrderID ?? ""),
|
|
25515
25603
|
status: "OPEN",
|
|
25516
25604
|
timestamp: Date.now()
|
|
@@ -25521,13 +25609,18 @@ class FivePaisaBroker {
|
|
|
25521
25609
|
}
|
|
25522
25610
|
async cancelOrder(orderId) {
|
|
25523
25611
|
try {
|
|
25612
|
+
const exchOrderId = await this.resolveExchOrderId(orderId);
|
|
25524
25613
|
const payload = {
|
|
25525
|
-
head: {
|
|
25526
|
-
body: {
|
|
25614
|
+
head: { key: this.credentials?.userKey ?? this.credentials?.apiKey ?? "" },
|
|
25615
|
+
body: { ExchOrderID: exchOrderId }
|
|
25527
25616
|
};
|
|
25528
|
-
await this.post(ROUTES.CANCEL_ORDER, payload);
|
|
25617
|
+
const res = await this.post(ROUTES.CANCEL_ORDER, payload);
|
|
25618
|
+
console.log("[5paisa] CancelOrder response:", JSON.stringify(res));
|
|
25619
|
+
if ((res.Status ?? 0) !== 0) {
|
|
25620
|
+
return Err(new Error(res.Message ?? `Cancel failed (Status=${res.Status})`));
|
|
25621
|
+
}
|
|
25529
25622
|
return Ok({
|
|
25530
|
-
orderId,
|
|
25623
|
+
orderId: exchOrderId,
|
|
25531
25624
|
status: "CANCELLED",
|
|
25532
25625
|
timestamp: Date.now()
|
|
25533
25626
|
});
|
|
@@ -25538,14 +25631,15 @@ class FivePaisaBroker {
|
|
|
25538
25631
|
async getOrders() {
|
|
25539
25632
|
try {
|
|
25540
25633
|
const payload = {
|
|
25541
|
-
head: {
|
|
25542
|
-
body: this.
|
|
25634
|
+
head: { key: this.credentials?.userKey ?? this.credentials?.apiKey ?? "" },
|
|
25635
|
+
body: { ClientCode: this.session?.userId ?? "" }
|
|
25543
25636
|
};
|
|
25544
25637
|
const res = await this.post(ROUTES.ORDER_BOOK, payload);
|
|
25545
|
-
|
|
25638
|
+
const orders = res.orderBook ?? res.OrderBookDetail;
|
|
25639
|
+
if (!orders || orders.length === 0) {
|
|
25546
25640
|
return Ok([]);
|
|
25547
25641
|
}
|
|
25548
|
-
return Ok(
|
|
25642
|
+
return Ok(orders.map(fromOrder4));
|
|
25549
25643
|
} catch (err) {
|
|
25550
25644
|
return Err(err instanceof Error ? err : new Error(String(err)));
|
|
25551
25645
|
}
|
|
@@ -25560,18 +25654,49 @@ class FivePaisaBroker {
|
|
|
25560
25654
|
return Ok([]);
|
|
25561
25655
|
const order = matching[0];
|
|
25562
25656
|
let avgPrice = order.averagePrice ?? 0;
|
|
25563
|
-
if (order.status === "FILLED"
|
|
25657
|
+
if (order.status === "FILLED") {
|
|
25564
25658
|
try {
|
|
25565
25659
|
const tradePayload = {
|
|
25566
25660
|
head: { ...this.buildHead(), requestCode: REQUEST_CODES.TRADE_BOOK },
|
|
25567
25661
|
body: this.buildBody()
|
|
25568
25662
|
};
|
|
25569
25663
|
const tradeRes = await this.post(ROUTES.TRADE_BOOK, tradePayload);
|
|
25570
|
-
const
|
|
25664
|
+
const rawTrades = tradeRes.TradeBookDetail ?? [];
|
|
25665
|
+
if (rawTrades.length > 0) {
|
|
25666
|
+
console.log("[5paisa] Trade book entries (%d total), looking for orderId=%s:", rawTrades.length, orderId);
|
|
25667
|
+
for (const t of rawTrades.slice(0, 5)) {
|
|
25668
|
+
console.log("[5paisa] Trade:", JSON.stringify({ BrokerOrderId: t.BrokerOrderId, ExchOrderID: t.ExchOrderID, Rate: t.Rate, Qty: t.Qty, ScripName: t.ScripName }));
|
|
25669
|
+
}
|
|
25670
|
+
} else {
|
|
25671
|
+
console.log("[5paisa] Trade book is EMPTY for orderId=%s", orderId);
|
|
25672
|
+
}
|
|
25673
|
+
const exchOrderId = order.orderId;
|
|
25674
|
+
const allTrades = tradeRes.TradeBookDetail ?? [];
|
|
25675
|
+
const trades = allTrades.filter((t) => String(t.BrokerOrderId) === orderId || String(t.ExchOrderID) === orderId || exchOrderId && String(t.ExchOrderID) === exchOrderId || exchOrderId && String(t.BrokerOrderId) === exchOrderId);
|
|
25571
25676
|
if (trades.length > 0) {
|
|
25572
25677
|
const totalQty = trades.reduce((s, t) => s + (t.Qty ?? 0), 0);
|
|
25573
25678
|
const totalVal = trades.reduce((s, t) => s + (t.Rate ?? 0) * (t.Qty ?? 0), 0);
|
|
25574
25679
|
avgPrice = totalQty > 0 ? totalVal / totalQty : 0;
|
|
25680
|
+
} else {
|
|
25681
|
+
if (allTrades.length > 0) {
|
|
25682
|
+
const sample = allTrades.slice(0, 3).map((t) => ({
|
|
25683
|
+
BrokerOrderId: t.BrokerOrderId,
|
|
25684
|
+
ExchOrderID: t.ExchOrderID,
|
|
25685
|
+
ScripName: t.ScripName
|
|
25686
|
+
}));
|
|
25687
|
+
console.warn("[5paisa] Trade book has entries but none match orderId=%s exchOrderId=%s. Sample:", orderId, exchOrderId, JSON.stringify(sample));
|
|
25688
|
+
}
|
|
25689
|
+
try {
|
|
25690
|
+
const posResult = await this.getPositions();
|
|
25691
|
+
if (posResult.ok) {
|
|
25692
|
+
const sym = order.tradingSymbol.toUpperCase();
|
|
25693
|
+
const match = posResult.value.find((p) => p.tradingSymbol.toUpperCase() === sym && p.avgPrice > 0);
|
|
25694
|
+
if (match) {
|
|
25695
|
+
avgPrice = match.avgPrice;
|
|
25696
|
+
console.warn("[5paisa] Fill price resolved from positions: %s avgPrice=%s", sym, avgPrice);
|
|
25697
|
+
}
|
|
25698
|
+
}
|
|
25699
|
+
} catch {}
|
|
25575
25700
|
}
|
|
25576
25701
|
} catch {}
|
|
25577
25702
|
}
|
|
@@ -25821,6 +25946,17 @@ class FivePaisaBroker {
|
|
|
25821
25946
|
return { Exch: "N", ExchType: "C", ScripCode: parseInt(parts[0], 10) };
|
|
25822
25947
|
});
|
|
25823
25948
|
}
|
|
25949
|
+
async resolveExchOrderId(orderId) {
|
|
25950
|
+
if (orderId.length >= 12)
|
|
25951
|
+
return orderId;
|
|
25952
|
+
const ordersResult = await this.getOrders();
|
|
25953
|
+
if (ordersResult.ok) {
|
|
25954
|
+
const match = ordersResult.value.find((o) => o.brokerOrderId === orderId || o.orderId === orderId);
|
|
25955
|
+
if (match && match.orderId && match.orderId !== "0")
|
|
25956
|
+
return match.orderId;
|
|
25957
|
+
}
|
|
25958
|
+
return orderId;
|
|
25959
|
+
}
|
|
25824
25960
|
buildHead() {
|
|
25825
25961
|
return {
|
|
25826
25962
|
appName: this.credentials?.appName ?? "",
|