@gbozee/ultimate 0.0.2-102 → 0.0.2-103
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/dist/frontend/frontend-index.js +1318 -0
- package/dist/frontend-index.d.ts +6 -0
- package/dist/frontend-index.js +25 -8
- package/dist/index.cjs +286 -94
- package/dist/index.d.ts +94 -0
- package/dist/index.js +294 -98
- package/dist/mcp-client.cjs +50 -25
- package/dist/mcp-client.js +50 -25
- package/dist/mcp-server.cjs +285 -97
- package/dist/mcp-server.js +293 -101
- package/dist/mcp.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -229,7 +229,8 @@ var init_errors = __esm(() => {
|
|
|
229
229
|
|
|
230
230
|
// node_modules/jose/dist/node/esm/runtime/random.js
|
|
231
231
|
import { randomFillSync } from "node:crypto";
|
|
232
|
-
var init_random = () => {
|
|
232
|
+
var init_random = () => {
|
|
233
|
+
};
|
|
233
234
|
|
|
234
235
|
// node_modules/jose/dist/node/esm/lib/iv.js
|
|
235
236
|
function bitLength(alg) {
|
|
@@ -270,7 +271,8 @@ var init_check_iv_length = __esm(() => {
|
|
|
270
271
|
// node_modules/jose/dist/node/esm/runtime/is_key_object.js
|
|
271
272
|
import * as util2 from "node:util";
|
|
272
273
|
var is_key_object_default = (obj) => util2.types.isKeyObject(obj);
|
|
273
|
-
var init_is_key_object = () => {
|
|
274
|
+
var init_is_key_object = () => {
|
|
275
|
+
};
|
|
274
276
|
|
|
275
277
|
// node_modules/jose/dist/node/esm/runtime/check_cek_length.js
|
|
276
278
|
var checkCekLength = (enc, cek) => {
|
|
@@ -532,7 +534,8 @@ var ciphers, ciphers_default = (algorithm) => {
|
|
|
532
534
|
ciphers ||= new Set(getCiphers());
|
|
533
535
|
return ciphers.has(algorithm);
|
|
534
536
|
};
|
|
535
|
-
var init_ciphers = () => {
|
|
537
|
+
var init_ciphers = () => {
|
|
538
|
+
};
|
|
536
539
|
|
|
537
540
|
// node_modules/jose/dist/node/esm/runtime/is_key_like.js
|
|
538
541
|
var is_key_like_default = (key) => is_key_object_default(key) || isCryptoKey(key), types3;
|
|
@@ -563,7 +566,8 @@ function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
|
563
566
|
let macCheckPassed;
|
|
564
567
|
try {
|
|
565
568
|
macCheckPassed = timing_safe_equal_default(tag, expectedTag);
|
|
566
|
-
} catch {
|
|
569
|
+
} catch {
|
|
570
|
+
}
|
|
567
571
|
if (!macCheckPassed) {
|
|
568
572
|
throw new JWEDecryptionFailed;
|
|
569
573
|
}
|
|
@@ -571,7 +575,8 @@ function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
|
571
575
|
try {
|
|
572
576
|
const decipher = createDecipheriv(algorithm, encKey, iv);
|
|
573
577
|
plaintext = concat(decipher.update(ciphertext), decipher.final());
|
|
574
|
-
} catch {
|
|
578
|
+
} catch {
|
|
579
|
+
}
|
|
575
580
|
if (!plaintext) {
|
|
576
581
|
throw new JWEDecryptionFailed;
|
|
577
582
|
}
|
|
@@ -749,7 +754,8 @@ function isPublicJWK(key) {
|
|
|
749
754
|
function isSecretJWK(key) {
|
|
750
755
|
return isJWK(key) && key.kty === "oct" && typeof key.k === "string";
|
|
751
756
|
}
|
|
752
|
-
var init_is_jwk = () => {
|
|
757
|
+
var init_is_jwk = () => {
|
|
758
|
+
};
|
|
753
759
|
|
|
754
760
|
// node_modules/jose/dist/node/esm/runtime/get_named_curve.js
|
|
755
761
|
import { KeyObject as KeyObject3 } from "node:crypto";
|
|
@@ -932,12 +938,14 @@ var check_key_length_default = (key, alg) => {
|
|
|
932
938
|
} else {
|
|
933
939
|
modulusLength = Buffer.from(key.n, "base64url").byteLength << 3;
|
|
934
940
|
}
|
|
935
|
-
} catch {
|
|
941
|
+
} catch {
|
|
942
|
+
}
|
|
936
943
|
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
937
944
|
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
938
945
|
}
|
|
939
946
|
};
|
|
940
|
-
var init_check_key_length = () => {
|
|
947
|
+
var init_check_key_length = () => {
|
|
948
|
+
};
|
|
941
949
|
|
|
942
950
|
// node_modules/jose/dist/node/esm/runtime/rsaes.js
|
|
943
951
|
import { KeyObject as KeyObject7, publicEncrypt, constants, privateDecrypt } from "node:crypto";
|
|
@@ -1691,7 +1699,8 @@ async function generalDecrypt(jwe, key, options) {
|
|
|
1691
1699
|
tag: jwe.tag,
|
|
1692
1700
|
unprotected: jwe.unprotected
|
|
1693
1701
|
}, key, options);
|
|
1694
|
-
} catch {
|
|
1702
|
+
} catch {
|
|
1703
|
+
}
|
|
1695
1704
|
}
|
|
1696
1705
|
throw new JWEDecryptionFailed;
|
|
1697
1706
|
}
|
|
@@ -2576,7 +2585,8 @@ async function generalVerify(jws, key, options) {
|
|
|
2576
2585
|
protected: signature.protected,
|
|
2577
2586
|
signature: signature.signature
|
|
2578
2587
|
}, key, options);
|
|
2579
|
-
} catch {
|
|
2588
|
+
} catch {
|
|
2589
|
+
}
|
|
2580
2590
|
}
|
|
2581
2591
|
throw new JWSSignatureVerificationFailed;
|
|
2582
2592
|
}
|
|
@@ -2659,7 +2669,8 @@ var normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, ""),
|
|
|
2659
2669
|
let payload;
|
|
2660
2670
|
try {
|
|
2661
2671
|
payload = JSON.parse(decoder.decode(encodedPayload));
|
|
2662
|
-
} catch {
|
|
2672
|
+
} catch {
|
|
2673
|
+
}
|
|
2663
2674
|
if (!isObject(payload)) {
|
|
2664
2675
|
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
2665
2676
|
}
|
|
@@ -3344,7 +3355,8 @@ class LocalJWKSet {
|
|
|
3344
3355
|
for (const jwk2 of candidates) {
|
|
3345
3356
|
try {
|
|
3346
3357
|
yield await importWithAlgCache(_cached, jwk2, alg);
|
|
3347
|
-
} catch {
|
|
3358
|
+
} catch {
|
|
3359
|
+
}
|
|
3348
3360
|
}
|
|
3349
3361
|
};
|
|
3350
3362
|
throw error;
|
|
@@ -3891,7 +3903,8 @@ var require_util = __commonJS((exports) => {
|
|
|
3891
3903
|
var util4;
|
|
3892
3904
|
(function(util5) {
|
|
3893
3905
|
util5.assertEqual = (val) => val;
|
|
3894
|
-
function assertIs(_arg) {
|
|
3906
|
+
function assertIs(_arg) {
|
|
3907
|
+
}
|
|
3895
3908
|
util5.assertIs = assertIs;
|
|
3896
3909
|
function assertNever(_x) {
|
|
3897
3910
|
throw new Error;
|
|
@@ -6307,7 +6320,8 @@ var require_types = __commonJS((exports) => {
|
|
|
6307
6320
|
});
|
|
6308
6321
|
status.dirty();
|
|
6309
6322
|
}
|
|
6310
|
-
} else if (unknownKeys === "strip") {
|
|
6323
|
+
} else if (unknownKeys === "strip") {
|
|
6324
|
+
} else {
|
|
6311
6325
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
6312
6326
|
}
|
|
6313
6327
|
} else {
|
|
@@ -8459,7 +8473,8 @@ var require_logLevelLogger = __commonJS((exports) => {
|
|
|
8459
8473
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
8460
8474
|
return theFunc.bind(logger);
|
|
8461
8475
|
}
|
|
8462
|
-
return function() {
|
|
8476
|
+
return function() {
|
|
8477
|
+
};
|
|
8463
8478
|
}
|
|
8464
8479
|
return {
|
|
8465
8480
|
error: _filterFunc("error", types_1.DiagLogLevel.ERROR),
|
|
@@ -8684,7 +8699,8 @@ var require_NoopMeter = __commonJS((exports) => {
|
|
|
8684
8699
|
exports.createNoopMeter = exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = exports.NOOP_OBSERVABLE_GAUGE_METRIC = exports.NOOP_OBSERVABLE_COUNTER_METRIC = exports.NOOP_UP_DOWN_COUNTER_METRIC = exports.NOOP_HISTOGRAM_METRIC = exports.NOOP_GAUGE_METRIC = exports.NOOP_COUNTER_METRIC = exports.NOOP_METER = exports.NoopObservableUpDownCounterMetric = exports.NoopObservableGaugeMetric = exports.NoopObservableCounterMetric = exports.NoopObservableMetric = exports.NoopHistogramMetric = exports.NoopGaugeMetric = exports.NoopUpDownCounterMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = undefined;
|
|
8685
8700
|
|
|
8686
8701
|
class NoopMeter {
|
|
8687
|
-
constructor() {
|
|
8702
|
+
constructor() {
|
|
8703
|
+
}
|
|
8688
8704
|
createGauge(_name, _options) {
|
|
8689
8705
|
return exports.NOOP_GAUGE_METRIC;
|
|
8690
8706
|
}
|
|
@@ -8706,8 +8722,10 @@ var require_NoopMeter = __commonJS((exports) => {
|
|
|
8706
8722
|
createObservableUpDownCounter(_name, _options) {
|
|
8707
8723
|
return exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
8708
8724
|
}
|
|
8709
|
-
addBatchObservableCallback(_callback, _observables) {
|
|
8710
|
-
|
|
8725
|
+
addBatchObservableCallback(_callback, _observables) {
|
|
8726
|
+
}
|
|
8727
|
+
removeBatchObservableCallback(_callback) {
|
|
8728
|
+
}
|
|
8711
8729
|
}
|
|
8712
8730
|
exports.NoopMeter = NoopMeter;
|
|
8713
8731
|
|
|
@@ -8716,28 +8734,34 @@ var require_NoopMeter = __commonJS((exports) => {
|
|
|
8716
8734
|
exports.NoopMetric = NoopMetric;
|
|
8717
8735
|
|
|
8718
8736
|
class NoopCounterMetric extends NoopMetric {
|
|
8719
|
-
add(_value, _attributes) {
|
|
8737
|
+
add(_value, _attributes) {
|
|
8738
|
+
}
|
|
8720
8739
|
}
|
|
8721
8740
|
exports.NoopCounterMetric = NoopCounterMetric;
|
|
8722
8741
|
|
|
8723
8742
|
class NoopUpDownCounterMetric extends NoopMetric {
|
|
8724
|
-
add(_value, _attributes) {
|
|
8743
|
+
add(_value, _attributes) {
|
|
8744
|
+
}
|
|
8725
8745
|
}
|
|
8726
8746
|
exports.NoopUpDownCounterMetric = NoopUpDownCounterMetric;
|
|
8727
8747
|
|
|
8728
8748
|
class NoopGaugeMetric extends NoopMetric {
|
|
8729
|
-
record(_value, _attributes) {
|
|
8749
|
+
record(_value, _attributes) {
|
|
8750
|
+
}
|
|
8730
8751
|
}
|
|
8731
8752
|
exports.NoopGaugeMetric = NoopGaugeMetric;
|
|
8732
8753
|
|
|
8733
8754
|
class NoopHistogramMetric extends NoopMetric {
|
|
8734
|
-
record(_value, _attributes) {
|
|
8755
|
+
record(_value, _attributes) {
|
|
8756
|
+
}
|
|
8735
8757
|
}
|
|
8736
8758
|
exports.NoopHistogramMetric = NoopHistogramMetric;
|
|
8737
8759
|
|
|
8738
8760
|
class NoopObservableMetric {
|
|
8739
|
-
addCallback(_callback) {
|
|
8740
|
-
|
|
8761
|
+
addCallback(_callback) {
|
|
8762
|
+
}
|
|
8763
|
+
removeCallback(_callback) {
|
|
8764
|
+
}
|
|
8741
8765
|
}
|
|
8742
8766
|
exports.NoopObservableMetric = NoopObservableMetric;
|
|
8743
8767
|
|
|
@@ -8842,7 +8866,8 @@ var require_context2 = __commonJS((exports) => {
|
|
|
8842
8866
|
var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager;
|
|
8843
8867
|
|
|
8844
8868
|
class ContextAPI {
|
|
8845
|
-
constructor() {
|
|
8869
|
+
constructor() {
|
|
8870
|
+
}
|
|
8846
8871
|
static getInstance() {
|
|
8847
8872
|
if (!this._instance) {
|
|
8848
8873
|
this._instance = new ContextAPI;
|
|
@@ -8931,11 +8956,13 @@ var require_NonRecordingSpan = __commonJS((exports) => {
|
|
|
8931
8956
|
updateName(_name) {
|
|
8932
8957
|
return this;
|
|
8933
8958
|
}
|
|
8934
|
-
end(_endTime) {
|
|
8959
|
+
end(_endTime) {
|
|
8960
|
+
}
|
|
8935
8961
|
isRecording() {
|
|
8936
8962
|
return false;
|
|
8937
8963
|
}
|
|
8938
|
-
recordException(_exception, _time) {
|
|
8964
|
+
recordException(_exception, _time) {
|
|
8965
|
+
}
|
|
8939
8966
|
}
|
|
8940
8967
|
exports.NonRecordingSpan = NonRecordingSpan;
|
|
8941
8968
|
});
|
|
@@ -9237,7 +9264,8 @@ var require_tracestate_impl = __commonJS((exports) => {
|
|
|
9237
9264
|
const value = listMember.slice(i + 1, part.length);
|
|
9238
9265
|
if ((0, tracestate_validators_1.validateKey)(key) && (0, tracestate_validators_1.validateValue)(value)) {
|
|
9239
9266
|
agg.set(key, value);
|
|
9240
|
-
} else {
|
|
9267
|
+
} else {
|
|
9268
|
+
}
|
|
9241
9269
|
}
|
|
9242
9270
|
return agg;
|
|
9243
9271
|
}, new Map);
|
|
@@ -9309,7 +9337,8 @@ var require_metrics = __commonJS((exports) => {
|
|
|
9309
9337
|
var API_NAME2 = "metrics";
|
|
9310
9338
|
|
|
9311
9339
|
class MetricsAPI {
|
|
9312
|
-
constructor() {
|
|
9340
|
+
constructor() {
|
|
9341
|
+
}
|
|
9313
9342
|
static getInstance() {
|
|
9314
9343
|
if (!this._instance) {
|
|
9315
9344
|
this._instance = new MetricsAPI;
|
|
@@ -9346,7 +9375,8 @@ var require_NoopTextMapPropagator = __commonJS((exports) => {
|
|
|
9346
9375
|
exports.NoopTextMapPropagator = undefined;
|
|
9347
9376
|
|
|
9348
9377
|
class NoopTextMapPropagator {
|
|
9349
|
-
inject(_context, _carrier) {
|
|
9378
|
+
inject(_context, _carrier) {
|
|
9379
|
+
}
|
|
9350
9380
|
extract(context, _carrier) {
|
|
9351
9381
|
return context;
|
|
9352
9382
|
}
|
|
@@ -9659,7 +9689,8 @@ class Registry {
|
|
|
9659
9689
|
return this.kv.getByKey(identifier);
|
|
9660
9690
|
}
|
|
9661
9691
|
}
|
|
9662
|
-
var init_registry = () => {
|
|
9692
|
+
var init_registry = () => {
|
|
9693
|
+
};
|
|
9663
9694
|
|
|
9664
9695
|
// node_modules/superjson/dist/class-registry.js
|
|
9665
9696
|
var ClassRegistry;
|
|
@@ -9744,7 +9775,8 @@ class CustomTransformerRegistry {
|
|
|
9744
9775
|
return this.transfomers[name2];
|
|
9745
9776
|
}
|
|
9746
9777
|
}
|
|
9747
|
-
var init_custom_transformer_registry = () => {
|
|
9778
|
+
var init_custom_transformer_registry = () => {
|
|
9779
|
+
};
|
|
9748
9780
|
|
|
9749
9781
|
// node_modules/superjson/dist/is.js
|
|
9750
9782
|
var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1), isUndefined = (payload) => typeof payload === "undefined", isNull = (payload) => payload === null, isPlainObject = (payload) => {
|
|
@@ -10089,7 +10121,8 @@ var getNthKey = (value, n) => {
|
|
|
10089
10121
|
}
|
|
10090
10122
|
return object;
|
|
10091
10123
|
};
|
|
10092
|
-
var init_accessDeep = () => {
|
|
10124
|
+
var init_accessDeep = () => {
|
|
10125
|
+
};
|
|
10093
10126
|
|
|
10094
10127
|
// node_modules/superjson/dist/plainer.js
|
|
10095
10128
|
function traverse(tree, walker, origin = []) {
|
|
@@ -10678,7 +10711,8 @@ var require_NoopLogger = __commonJS((exports) => {
|
|
|
10678
10711
|
exports.NOOP_LOGGER = exports.NoopLogger = undefined;
|
|
10679
10712
|
|
|
10680
10713
|
class NoopLogger {
|
|
10681
|
-
emit(_logRecord) {
|
|
10714
|
+
emit(_logRecord) {
|
|
10715
|
+
}
|
|
10682
10716
|
}
|
|
10683
10717
|
exports.NoopLogger = NoopLogger;
|
|
10684
10718
|
exports.NOOP_LOGGER = new NoopLogger;
|
|
@@ -10772,7 +10806,8 @@ var require_logs = __commonJS((exports) => {
|
|
|
10772
10806
|
var NoopLoggerProvider_1 = require_NoopLoggerProvider();
|
|
10773
10807
|
|
|
10774
10808
|
class LogsAPI {
|
|
10775
|
-
constructor() {
|
|
10809
|
+
constructor() {
|
|
10810
|
+
}
|
|
10776
10811
|
static getInstance() {
|
|
10777
10812
|
if (!this._instance) {
|
|
10778
10813
|
this._instance = new LogsAPI;
|
|
@@ -11240,7 +11275,8 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
11240
11275
|
});
|
|
11241
11276
|
args.splice(lastC, 0, c);
|
|
11242
11277
|
}
|
|
11243
|
-
exports.log = console.debug || console.log || (() => {
|
|
11278
|
+
exports.log = console.debug || console.log || (() => {
|
|
11279
|
+
});
|
|
11244
11280
|
function save(namespaces) {
|
|
11245
11281
|
try {
|
|
11246
11282
|
if (namespaces) {
|
|
@@ -11248,13 +11284,15 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
11248
11284
|
} else {
|
|
11249
11285
|
exports.storage.removeItem("debug");
|
|
11250
11286
|
}
|
|
11251
|
-
} catch (error) {
|
|
11287
|
+
} catch (error) {
|
|
11288
|
+
}
|
|
11252
11289
|
}
|
|
11253
11290
|
function load() {
|
|
11254
11291
|
let r;
|
|
11255
11292
|
try {
|
|
11256
11293
|
r = exports.storage.getItem("debug");
|
|
11257
|
-
} catch (error) {
|
|
11294
|
+
} catch (error) {
|
|
11295
|
+
}
|
|
11258
11296
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
11259
11297
|
r = process.env.DEBUG;
|
|
11260
11298
|
}
|
|
@@ -11263,7 +11301,8 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
11263
11301
|
function localstorage() {
|
|
11264
11302
|
try {
|
|
11265
11303
|
return localStorage;
|
|
11266
|
-
} catch (error) {
|
|
11304
|
+
} catch (error) {
|
|
11305
|
+
}
|
|
11267
11306
|
}
|
|
11268
11307
|
module.exports = require_common()(exports);
|
|
11269
11308
|
var { formatters } = module.exports;
|
|
@@ -11395,7 +11434,8 @@ var require_node3 = __commonJS((exports, module) => {
|
|
|
11395
11434
|
exports.save = save;
|
|
11396
11435
|
exports.load = load;
|
|
11397
11436
|
exports.useColors = useColors;
|
|
11398
|
-
exports.destroy = util4.deprecate(() => {
|
|
11437
|
+
exports.destroy = util4.deprecate(() => {
|
|
11438
|
+
}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
11399
11439
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
11400
11440
|
try {
|
|
11401
11441
|
const supportsColor = require_supports_color();
|
|
@@ -11479,7 +11519,8 @@ var require_node3 = __commonJS((exports, module) => {
|
|
|
11479
11519
|
221
|
|
11480
11520
|
];
|
|
11481
11521
|
}
|
|
11482
|
-
} catch (error) {
|
|
11522
|
+
} catch (error) {
|
|
11523
|
+
}
|
|
11483
11524
|
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
11484
11525
|
return /^debug_/i.test(key);
|
|
11485
11526
|
}).reduce((obj, key) => {
|
|
@@ -13728,7 +13769,8 @@ var require_jsbn = __commonJS((exports, module) => {
|
|
|
13728
13769
|
++this[w];
|
|
13729
13770
|
}
|
|
13730
13771
|
}
|
|
13731
|
-
function NullExp() {
|
|
13772
|
+
function NullExp() {
|
|
13773
|
+
}
|
|
13732
13774
|
function nNop(x) {
|
|
13733
13775
|
return x;
|
|
13734
13776
|
}
|
|
@@ -14153,7 +14195,8 @@ var require_jsbn = __commonJS((exports, module) => {
|
|
|
14153
14195
|
for (i2 = 0;i2 < ba.length; ++i2)
|
|
14154
14196
|
ba[i2] = rng_get_byte();
|
|
14155
14197
|
}
|
|
14156
|
-
function SecureRandom() {
|
|
14198
|
+
function SecureRandom() {
|
|
14199
|
+
}
|
|
14157
14200
|
SecureRandom.prototype.nextBytes = rng_get_bytes;
|
|
14158
14201
|
function Arcfour() {
|
|
14159
14202
|
this.i = 0;
|
|
@@ -16376,7 +16419,8 @@ var require_delayed_stream = __commonJS((exports, module) => {
|
|
|
16376
16419
|
delayedStream._handleEmit(arguments);
|
|
16377
16420
|
return realEmit.apply(source, arguments);
|
|
16378
16421
|
};
|
|
16379
|
-
source.on("error", function() {
|
|
16422
|
+
source.on("error", function() {
|
|
16423
|
+
});
|
|
16380
16424
|
if (delayedStream.pauseStream) {
|
|
16381
16425
|
source.pause();
|
|
16382
16426
|
}
|
|
@@ -25680,7 +25724,8 @@ var require_implementation = __commonJS((exports, module) => {
|
|
|
25680
25724
|
}
|
|
25681
25725
|
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
25682
25726
|
if (target.prototype) {
|
|
25683
|
-
var Empty = function Empty() {
|
|
25727
|
+
var Empty = function Empty() {
|
|
25728
|
+
};
|
|
25684
25729
|
Empty.prototype = target.prototype;
|
|
25685
25730
|
bound.prototype = new Empty;
|
|
25686
25731
|
Empty.prototype = null;
|
|
@@ -25800,7 +25845,8 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
25800
25845
|
var getEvalledConstructor = function(expressionSyntax) {
|
|
25801
25846
|
try {
|
|
25802
25847
|
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
|
|
25803
|
-
} catch (e2) {
|
|
25848
|
+
} catch (e2) {
|
|
25849
|
+
}
|
|
25804
25850
|
};
|
|
25805
25851
|
var $gOPD = require_gopd();
|
|
25806
25852
|
var $defineProperty = require_es_define_property();
|
|
@@ -26539,9 +26585,11 @@ var require_debug = __commonJS((exports, module) => {
|
|
|
26539
26585
|
if (!debug) {
|
|
26540
26586
|
try {
|
|
26541
26587
|
debug = require_src4()("follow-redirects");
|
|
26542
|
-
} catch (error) {
|
|
26588
|
+
} catch (error) {
|
|
26589
|
+
}
|
|
26543
26590
|
if (typeof debug !== "function") {
|
|
26544
|
-
debug = function() {
|
|
26591
|
+
debug = function() {
|
|
26592
|
+
};
|
|
26545
26593
|
}
|
|
26546
26594
|
}
|
|
26547
26595
|
debug.apply(null, arguments);
|
|
@@ -26916,7 +26964,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
26916
26964
|
});
|
|
26917
26965
|
return exports2;
|
|
26918
26966
|
}
|
|
26919
|
-
function noop2() {
|
|
26967
|
+
function noop2() {
|
|
26968
|
+
}
|
|
26920
26969
|
function parseUrl(input) {
|
|
26921
26970
|
var parsed;
|
|
26922
26971
|
if (useNativeURL) {
|
|
@@ -27299,7 +27348,8 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
27299
27348
|
isArray3(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
|
|
27300
27349
|
return obj;
|
|
27301
27350
|
};
|
|
27302
|
-
var noop2 = () => {
|
|
27351
|
+
var noop2 = () => {
|
|
27352
|
+
};
|
|
27303
27353
|
var toFiniteNumber = (value2, defaultValue) => {
|
|
27304
27354
|
return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue;
|
|
27305
27355
|
};
|
|
@@ -28752,7 +28802,8 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
28752
28802
|
try {
|
|
28753
28803
|
const knownLength = await util__default["default"].promisify(data.getLength).call(data);
|
|
28754
28804
|
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
|
28755
|
-
} catch (e2) {
|
|
28805
|
+
} catch (e2) {
|
|
28806
|
+
}
|
|
28756
28807
|
}
|
|
28757
28808
|
} else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
|
|
28758
28809
|
data.size && headers.setContentType(data.type || "application/octet-stream");
|
|
@@ -29026,11 +29077,13 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
29026
29077
|
this.write(name2, "", Date.now() - 86400000);
|
|
29027
29078
|
}
|
|
29028
29079
|
} : {
|
|
29029
|
-
write() {
|
|
29080
|
+
write() {
|
|
29081
|
+
},
|
|
29030
29082
|
read() {
|
|
29031
29083
|
return null;
|
|
29032
29084
|
},
|
|
29033
|
-
remove() {
|
|
29085
|
+
remove() {
|
|
29086
|
+
}
|
|
29034
29087
|
};
|
|
29035
29088
|
var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
29036
29089
|
function mergeConfig(config1, config2) {
|
|
@@ -29524,7 +29577,8 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
29524
29577
|
if (fn) {
|
|
29525
29578
|
try {
|
|
29526
29579
|
Object.defineProperty(fn, "name", { value: value2 });
|
|
29527
|
-
} catch (e2) {
|
|
29580
|
+
} catch (e2) {
|
|
29581
|
+
}
|
|
29528
29582
|
Object.defineProperty(fn, "adapterName", { value: value2 });
|
|
29529
29583
|
}
|
|
29530
29584
|
});
|
|
@@ -29674,7 +29728,8 @@ var require_axios = __commonJS((exports, module) => {
|
|
|
29674
29728
|
err.stack += `
|
|
29675
29729
|
` + stack;
|
|
29676
29730
|
}
|
|
29677
|
-
} catch (e2) {
|
|
29731
|
+
} catch (e2) {
|
|
29732
|
+
}
|
|
29678
29733
|
}
|
|
29679
29734
|
throw err;
|
|
29680
29735
|
}
|
|
@@ -31747,7 +31802,8 @@ var require_logger = __commonJS((exports) => {
|
|
|
31747
31802
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31748
31803
|
exports.DefaultLogger = undefined;
|
|
31749
31804
|
exports.DefaultLogger = {
|
|
31750
|
-
silly: (...params) => {
|
|
31805
|
+
silly: (...params) => {
|
|
31806
|
+
},
|
|
31751
31807
|
debug: (...params) => {
|
|
31752
31808
|
console.log(new Date, params);
|
|
31753
31809
|
},
|
|
@@ -34490,7 +34546,8 @@ var require_constants4 = __commonJS((exports, module) => {
|
|
|
34490
34546
|
kListener: Symbol("kListener"),
|
|
34491
34547
|
kStatusCode: Symbol("status-code"),
|
|
34492
34548
|
kWebSocket: Symbol("websocket"),
|
|
34493
|
-
NOOP: () => {
|
|
34549
|
+
NOOP: () => {
|
|
34550
|
+
}
|
|
34494
34551
|
};
|
|
34495
34552
|
});
|
|
34496
34553
|
|
|
@@ -34568,7 +34625,8 @@ var require_buffer_util = __commonJS((exports, module) => {
|
|
|
34568
34625
|
else
|
|
34569
34626
|
bufferUtil.unmask(buffer, mask);
|
|
34570
34627
|
};
|
|
34571
|
-
} catch (e2) {
|
|
34628
|
+
} catch (e2) {
|
|
34629
|
+
}
|
|
34572
34630
|
}
|
|
34573
34631
|
});
|
|
34574
34632
|
|
|
@@ -35047,7 +35105,8 @@ var require_validation = __commonJS((exports, module) => {
|
|
|
35047
35105
|
module.exports.isValidUTF8 = function(buf) {
|
|
35048
35106
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
35049
35107
|
};
|
|
35050
|
-
} catch (e2) {
|
|
35108
|
+
} catch (e2) {
|
|
35109
|
+
}
|
|
35051
35110
|
}
|
|
35052
35111
|
});
|
|
35053
35112
|
|
|
@@ -37472,7 +37531,8 @@ var require_websocket_client = __commonJS((exports) => {
|
|
|
37472
37531
|
this.options = Object.assign({ pongTimeout: 7500, pingInterval: 1e4, reconnectTimeout: 500 }, options);
|
|
37473
37532
|
this.listenKeyStateStore = {};
|
|
37474
37533
|
this.wsUrlKeyMap = {};
|
|
37475
|
-
this.on("error", () => {
|
|
37534
|
+
this.on("error", () => {
|
|
37535
|
+
});
|
|
37476
37536
|
}
|
|
37477
37537
|
getRestClientOptions() {
|
|
37478
37538
|
return Object.assign(Object.assign(Object.assign({}, this.options), this.options.restOptions), { api_key: this.options.api_key, api_secret: this.options.api_secret });
|
|
@@ -38889,7 +38949,8 @@ var require_logger2 = __commonJS((exports) => {
|
|
|
38889
38949
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38890
38950
|
exports.DefaultLogger = undefined;
|
|
38891
38951
|
exports.DefaultLogger = {
|
|
38892
|
-
trace: (..._params) => {
|
|
38952
|
+
trace: (..._params) => {
|
|
38953
|
+
},
|
|
38893
38954
|
info: (...params) => {
|
|
38894
38955
|
console.info(params);
|
|
38895
38956
|
},
|
|
@@ -40935,7 +40996,8 @@ var require_BaseWSClient = __commonJS((exports) => {
|
|
|
40935
40996
|
if (wsState === null || wsState === undefined ? undefined : wsState.activePongTimer) {
|
|
40936
40997
|
clearTimeout(wsState.activePongTimer);
|
|
40937
40998
|
wsState.activePongTimer = undefined;
|
|
40938
|
-
} else {
|
|
40999
|
+
} else {
|
|
41000
|
+
}
|
|
40939
41001
|
}
|
|
40940
41002
|
clearReconnectTimer(wsKey) {
|
|
40941
41003
|
const wsState = this.wsStore.get(wsKey);
|
|
@@ -41815,7 +41877,8 @@ __export(exports_app, {
|
|
|
41815
41877
|
var util;
|
|
41816
41878
|
(function(util2) {
|
|
41817
41879
|
util2.assertEqual = (val) => val;
|
|
41818
|
-
function assertIs(_arg) {
|
|
41880
|
+
function assertIs(_arg) {
|
|
41881
|
+
}
|
|
41819
41882
|
util2.assertIs = assertIs;
|
|
41820
41883
|
function assertNever(_x) {
|
|
41821
41884
|
throw new Error;
|
|
@@ -46676,7 +46739,8 @@ var API_NAME = "task-context";
|
|
|
46676
46739
|
|
|
46677
46740
|
class TaskContextAPI {
|
|
46678
46741
|
static _instance;
|
|
46679
|
-
constructor() {
|
|
46742
|
+
constructor() {
|
|
46743
|
+
}
|
|
46680
46744
|
static getInstance() {
|
|
46681
46745
|
if (!this._instance) {
|
|
46682
46746
|
this._instance = new TaskContextAPI;
|
|
@@ -47096,7 +47160,8 @@ class ParseError extends Error {
|
|
|
47096
47160
|
super(message2), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
47097
47161
|
}
|
|
47098
47162
|
}
|
|
47099
|
-
function noop(_arg) {
|
|
47163
|
+
function noop(_arg) {
|
|
47164
|
+
}
|
|
47100
47165
|
function createParser(callbacks) {
|
|
47101
47166
|
if (typeof callbacks == "function")
|
|
47102
47167
|
throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
|
|
@@ -47299,7 +47364,8 @@ async function _doZodFetchWithRetries(schema, url, requestInit, options, attempt
|
|
|
47299
47364
|
if (error instanceof ApiError) {
|
|
47300
47365
|
throw error;
|
|
47301
47366
|
}
|
|
47302
|
-
if (error instanceof import_zod_validation_error.ValidationError) {
|
|
47367
|
+
if (error instanceof import_zod_validation_error.ValidationError) {
|
|
47368
|
+
}
|
|
47303
47369
|
if (options?.retry) {
|
|
47304
47370
|
const retry = { ...defaultRetryOptions2, ...options.retry };
|
|
47305
47371
|
const delay = calculateNextRetryDelay(retry, attempt);
|
|
@@ -47773,7 +47839,8 @@ class ApiClientMissingError extends Error {
|
|
|
47773
47839
|
|
|
47774
47840
|
class APIClientManagerAPI {
|
|
47775
47841
|
static _instance;
|
|
47776
|
-
constructor() {
|
|
47842
|
+
constructor() {
|
|
47843
|
+
}
|
|
47777
47844
|
static getInstance() {
|
|
47778
47845
|
if (!this._instance) {
|
|
47779
47846
|
this._instance = new APIClientManagerAPI;
|
|
@@ -48328,7 +48395,8 @@ var PrefetchQueue = class {
|
|
|
48328
48395
|
if (__privateGet(this, _queueTailUrl) && !__privateGet(this, _prefetchQueue).has(__privateGet(this, _queueTailUrl))) {
|
|
48329
48396
|
__privateMethod(this, _PrefetchQueue_instances, prefetch_fn).call(this, __privateGet(this, _queueTailUrl), args[1]);
|
|
48330
48397
|
}
|
|
48331
|
-
}).catch(() => {
|
|
48398
|
+
}).catch(() => {
|
|
48399
|
+
});
|
|
48332
48400
|
return request;
|
|
48333
48401
|
}
|
|
48334
48402
|
};
|
|
@@ -48359,8 +48427,10 @@ prefetch_fn = function(...args) {
|
|
|
48359
48427
|
}
|
|
48360
48428
|
__privateSet(this, _queueTailUrl, nextUrl);
|
|
48361
48429
|
return __privateMethod(this, _PrefetchQueue_instances, prefetch_fn).call(this, nextUrl, args[1]);
|
|
48362
|
-
}).catch(() => {
|
|
48363
|
-
|
|
48430
|
+
}).catch(() => {
|
|
48431
|
+
});
|
|
48432
|
+
} catch (_) {
|
|
48433
|
+
}
|
|
48364
48434
|
};
|
|
48365
48435
|
function getNextChunkUrl(url, res) {
|
|
48366
48436
|
const shapeHandle = res.headers.get(SHAPE_HANDLE_HEADER);
|
|
@@ -48463,7 +48533,8 @@ var ShapeStream = class {
|
|
|
48463
48533
|
get lastOffset() {
|
|
48464
48534
|
return __privateGet(this, _lastOffset);
|
|
48465
48535
|
}
|
|
48466
|
-
subscribe(callback, onError = () => {
|
|
48536
|
+
subscribe(callback, onError = () => {
|
|
48537
|
+
}) {
|
|
48467
48538
|
const subscriptionId = Math.random();
|
|
48468
48539
|
__privateGet(this, _subscribers).set(subscriptionId, [callback, onError]);
|
|
48469
48540
|
return () => {
|
|
@@ -49657,7 +49728,8 @@ class SimpleClock {
|
|
|
49657
49728
|
const nowStruct = now.toStruct();
|
|
49658
49729
|
return [nowStruct.seconds, nowStruct.nanos];
|
|
49659
49730
|
}
|
|
49660
|
-
reset() {
|
|
49731
|
+
reset() {
|
|
49732
|
+
}
|
|
49661
49733
|
}
|
|
49662
49734
|
|
|
49663
49735
|
// node_modules/@trigger.dev/core/dist/esm/v3/clock/index.js
|
|
@@ -49666,7 +49738,8 @@ var SIMPLE_CLOCK = new SimpleClock;
|
|
|
49666
49738
|
|
|
49667
49739
|
class ClockAPI {
|
|
49668
49740
|
static _instance;
|
|
49669
|
-
constructor() {
|
|
49741
|
+
constructor() {
|
|
49742
|
+
}
|
|
49670
49743
|
static getInstance() {
|
|
49671
49744
|
if (!this._instance) {
|
|
49672
49745
|
this._instance = new ClockAPI;
|
|
@@ -49692,7 +49765,8 @@ var clock = ClockAPI.getInstance();
|
|
|
49692
49765
|
|
|
49693
49766
|
// node_modules/@trigger.dev/core/dist/esm/v3/usage/noopUsageManager.js
|
|
49694
49767
|
class NoopUsageManager {
|
|
49695
|
-
disable() {
|
|
49768
|
+
disable() {
|
|
49769
|
+
}
|
|
49696
49770
|
start() {
|
|
49697
49771
|
return {
|
|
49698
49772
|
sample: () => ({ cpuTime: 0, wallTime: 0 })
|
|
@@ -49715,7 +49789,8 @@ var NOOP_USAGE_MANAGER = new NoopUsageManager;
|
|
|
49715
49789
|
|
|
49716
49790
|
class UsageAPI {
|
|
49717
49791
|
static _instance;
|
|
49718
|
-
constructor() {
|
|
49792
|
+
constructor() {
|
|
49793
|
+
}
|
|
49719
49794
|
static getInstance() {
|
|
49720
49795
|
if (!this._instance) {
|
|
49721
49796
|
this._instance = new UsageAPI;
|
|
@@ -49775,7 +49850,8 @@ class NoopRunMetadataManager {
|
|
|
49775
49850
|
refresh(requestOptions) {
|
|
49776
49851
|
throw new Error("Method not implemented.");
|
|
49777
49852
|
}
|
|
49778
|
-
enterWithMetadata(metadata) {
|
|
49853
|
+
enterWithMetadata(metadata) {
|
|
49854
|
+
}
|
|
49779
49855
|
current() {
|
|
49780
49856
|
throw new Error("Method not implemented.");
|
|
49781
49857
|
}
|
|
@@ -49831,7 +49907,8 @@ var NOOP_MANAGER = new NoopRunMetadataManager;
|
|
|
49831
49907
|
|
|
49832
49908
|
class RunMetadataAPI {
|
|
49833
49909
|
static _instance;
|
|
49834
|
-
constructor() {
|
|
49910
|
+
constructor() {
|
|
49911
|
+
}
|
|
49835
49912
|
static getInstance() {
|
|
49836
49913
|
if (!this._instance) {
|
|
49837
49914
|
this._instance = new RunMetadataAPI;
|
|
@@ -49916,7 +49993,8 @@ var NOOP_TIMEOUT_MANAGER = new NoopTimeoutManager;
|
|
|
49916
49993
|
|
|
49917
49994
|
class TimeoutAPI {
|
|
49918
49995
|
static _instance;
|
|
49919
|
-
constructor() {
|
|
49996
|
+
constructor() {
|
|
49997
|
+
}
|
|
49920
49998
|
static getInstance() {
|
|
49921
49999
|
if (!this._instance) {
|
|
49922
50000
|
this._instance = new TimeoutAPI;
|
|
@@ -50325,7 +50403,8 @@ function getTokenPayload(e2) {
|
|
|
50325
50403
|
return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
|
|
50326
50404
|
}).join(""));
|
|
50327
50405
|
return JSON.parse(t2) || {};
|
|
50328
|
-
} catch (e3) {
|
|
50406
|
+
} catch (e3) {
|
|
50407
|
+
}
|
|
50329
50408
|
return {};
|
|
50330
50409
|
}
|
|
50331
50410
|
function isTokenExpired(e2, t2 = 0) {
|
|
@@ -50379,7 +50458,8 @@ class BaseAuthStore {
|
|
|
50379
50458
|
let n = {};
|
|
50380
50459
|
try {
|
|
50381
50460
|
n = JSON.parse(s2), (typeof n === null || typeof n != "object" || Array.isArray(n)) && (n = {});
|
|
50382
|
-
} catch (e3) {
|
|
50461
|
+
} catch (e3) {
|
|
50462
|
+
}
|
|
50383
50463
|
this.save(n.token || "", n.record || n.model || null);
|
|
50384
50464
|
}
|
|
50385
50465
|
exportToCookie(e2, t2 = i) {
|
|
@@ -50526,7 +50606,8 @@ class RealtimeService extends BaseService {
|
|
|
50526
50606
|
let i3;
|
|
50527
50607
|
try {
|
|
50528
50608
|
i3 = JSON.parse(s3?.data);
|
|
50529
|
-
} catch {
|
|
50609
|
+
} catch {
|
|
50610
|
+
}
|
|
50530
50611
|
t2(i3 || {});
|
|
50531
50612
|
};
|
|
50532
50613
|
return this.subscriptions[i2] || (this.subscriptions[i2] = []), this.subscriptions[i2].push(listener), this.isConnected ? this.subscriptions[i2].length === 1 ? await this.submitSubscriptions() : this.eventSource?.addEventListener(i2, listener) : await this.connect(), async () => this.unsubscribeByTopicAndListener(e2, listener);
|
|
@@ -51239,7 +51320,8 @@ class Client {
|
|
|
51239
51320
|
let s3 = {};
|
|
51240
51321
|
try {
|
|
51241
51322
|
s3 = await e3.json();
|
|
51242
|
-
} catch (e4) {
|
|
51323
|
+
} catch (e4) {
|
|
51324
|
+
}
|
|
51243
51325
|
if (this.afterSend && (s3 = await this.afterSend(e3, s3, t2)), e3.status >= 400)
|
|
51244
51326
|
throw new ClientResponseError({ url: e3.url, status: e3.status, data: s3 });
|
|
51245
51327
|
return s3;
|
|
@@ -51871,6 +51953,91 @@ class AppDatabase {
|
|
|
51871
51953
|
}
|
|
51872
51954
|
return null;
|
|
51873
51955
|
}
|
|
51956
|
+
async getBotViewInstance(payload) {
|
|
51957
|
+
const { asset, main_account } = payload;
|
|
51958
|
+
const bot_instances = await this.pb.collection("bot_view").getFullList({
|
|
51959
|
+
filter: `main_symbol:lower="${asset.toLowerCase()}" && main_account.owner:lower="${main_account.owner.toLowerCase()}" && main_account.exchange:lower="${main_account.exchange.toLowerCase()}"`,
|
|
51960
|
+
expand: "main_account,secondary_account,main_long_strategy,main_short_strategy,secondary_long_strategy,secondary_short_strategy"
|
|
51961
|
+
});
|
|
51962
|
+
if (bot_instances.length > 0) {
|
|
51963
|
+
const instance = bot_instances[0];
|
|
51964
|
+
const {
|
|
51965
|
+
main_account: main_account2,
|
|
51966
|
+
secondary_account,
|
|
51967
|
+
main_long_strategy,
|
|
51968
|
+
main_short_strategy,
|
|
51969
|
+
secondary_long_strategy,
|
|
51970
|
+
secondary_short_strategy
|
|
51971
|
+
} = instance.expand;
|
|
51972
|
+
return {
|
|
51973
|
+
...instance,
|
|
51974
|
+
main: {
|
|
51975
|
+
account: main_account2,
|
|
51976
|
+
symbol: instance.main_symbol,
|
|
51977
|
+
strategy: {
|
|
51978
|
+
long: main_long_strategy,
|
|
51979
|
+
short: main_short_strategy
|
|
51980
|
+
},
|
|
51981
|
+
position: {
|
|
51982
|
+
long: instance.main_long_position,
|
|
51983
|
+
short: instance.main_short_position
|
|
51984
|
+
}
|
|
51985
|
+
},
|
|
51986
|
+
secondary: {
|
|
51987
|
+
account: secondary_account,
|
|
51988
|
+
symbol: instance.secondary_symbol,
|
|
51989
|
+
strategy: {
|
|
51990
|
+
long: secondary_long_strategy,
|
|
51991
|
+
short: secondary_short_strategy
|
|
51992
|
+
},
|
|
51993
|
+
position: {
|
|
51994
|
+
long: instance.secondary_long_position,
|
|
51995
|
+
short: instance.secondary_short_position
|
|
51996
|
+
}
|
|
51997
|
+
}
|
|
51998
|
+
};
|
|
51999
|
+
}
|
|
52000
|
+
return null;
|
|
52001
|
+
}
|
|
52002
|
+
async getBotInstance(payload) {
|
|
52003
|
+
const { asset, main_account } = payload;
|
|
52004
|
+
const bot_instances = await this.pb.collection("bot_instances").getFullList({
|
|
52005
|
+
filter: `asset:lower="${asset.toLowerCase()}" && main_account.owner:lower="${main_account.owner.toLowerCase()}" && main_account.exchange:lower="${main_account.exchange.toLowerCase()}"`
|
|
52006
|
+
});
|
|
52007
|
+
if (bot_instances.length > 0) {
|
|
52008
|
+
return bot_instances[0];
|
|
52009
|
+
}
|
|
52010
|
+
return null;
|
|
52011
|
+
}
|
|
52012
|
+
async getBotState(payload) {
|
|
52013
|
+
const { asset, main_account, running } = payload;
|
|
52014
|
+
let filter = `bot.asset:lower="${asset.toLowerCase()}" && bot.main_account.owner:lower="${main_account.owner.toLowerCase()}" && bot.main_account.exchange:lower="${main_account.exchange.toLowerCase()}"`;
|
|
52015
|
+
if (running !== undefined) {
|
|
52016
|
+
filter += ` && running=${running}`;
|
|
52017
|
+
}
|
|
52018
|
+
const bot_states = await this.pb.collection("bot_states").getFullList({
|
|
52019
|
+
filter
|
|
52020
|
+
});
|
|
52021
|
+
return bot_states;
|
|
52022
|
+
}
|
|
52023
|
+
async getBotOrderHistories(payload) {
|
|
52024
|
+
const { asset, main_account, symbol, kind, type } = payload;
|
|
52025
|
+
let filter = `field.bot.asset:lower="${asset.toLowerCase()}" && field.bot.main_account.owner:lower="${main_account.owner.toLowerCase()}" && field.bot.main_account.exchange:lower="${main_account.exchange.toLowerCase()}"`;
|
|
52026
|
+
if (symbol) {
|
|
52027
|
+
filter += ` && symbol:lower="${symbol.toLowerCase()}"`;
|
|
52028
|
+
}
|
|
52029
|
+
if (kind) {
|
|
52030
|
+
filter += ` && kind="${kind}"`;
|
|
52031
|
+
}
|
|
52032
|
+
if (type) {
|
|
52033
|
+
filter += ` && type="${type}"`;
|
|
52034
|
+
}
|
|
52035
|
+
const bot_order_histories = await this.pb.collection("bot_order_history").getFullList({
|
|
52036
|
+
filter,
|
|
52037
|
+
sort: "-created"
|
|
52038
|
+
});
|
|
52039
|
+
return bot_order_histories;
|
|
52040
|
+
}
|
|
51874
52041
|
async createOrUpdateWindingDownMarket(payload) {
|
|
51875
52042
|
const { symbol, risk_reward = 30 } = payload;
|
|
51876
52043
|
const existing_winding_down_market = await this.pb.collection("winding_down_markets").getFullList({
|
|
@@ -52543,7 +52710,8 @@ class Signal {
|
|
|
52543
52710
|
support: kind === "long" ? _stop_loss : this.support
|
|
52544
52711
|
};
|
|
52545
52712
|
const instance = new Signal(derivedConfig);
|
|
52546
|
-
if (kind === "short") {
|
|
52713
|
+
if (kind === "short") {
|
|
52714
|
+
}
|
|
52547
52715
|
let result = instance.get_bulk_trade_zones({ current_price, kind });
|
|
52548
52716
|
return result;
|
|
52549
52717
|
return result?.filter((x) => {
|
|
@@ -52761,7 +52929,8 @@ class Signal {
|
|
|
52761
52929
|
kind = "long",
|
|
52762
52930
|
raw
|
|
52763
52931
|
}) {
|
|
52764
|
-
if (raw) {
|
|
52932
|
+
if (raw) {
|
|
52933
|
+
}
|
|
52765
52934
|
const margin_range = this.get_margin_range(current_price, kind);
|
|
52766
52935
|
let margin_zones = this.get_margin_zones({ current_price });
|
|
52767
52936
|
let remaining_zones = margin_zones.filter((x) => JSON.stringify(x) != JSON.stringify(margin_range));
|
|
@@ -52972,7 +53141,8 @@ class Signal {
|
|
|
52972
53141
|
return true;
|
|
52973
53142
|
});
|
|
52974
53143
|
let total_orders = limit_trades.concat(market_trades);
|
|
52975
|
-
if (kind === "short") {
|
|
53144
|
+
if (kind === "short") {
|
|
53145
|
+
}
|
|
52976
53146
|
if (this.minimum_size && total_orders.length > 0) {
|
|
52977
53147
|
let payload = total_orders;
|
|
52978
53148
|
let greater_than_min_size = total_orders.filter((o) => o ? o.quantity >= this.minimum_size : true);
|
|
@@ -53058,7 +53228,8 @@ class Signal {
|
|
|
53058
53228
|
});
|
|
53059
53229
|
const multiplier = start - index;
|
|
53060
53230
|
const incurred_fees = fees.reduce((a, b) => a + b, 0) + previous_risks.reduce((a, b) => a + b, 0);
|
|
53061
|
-
if (index === 0) {
|
|
53231
|
+
if (index === 0) {
|
|
53232
|
+
}
|
|
53062
53233
|
let quantity = determine_position_size2({
|
|
53063
53234
|
entry,
|
|
53064
53235
|
stop,
|
|
@@ -53156,7 +53327,8 @@ function buildConfig(app_config, {
|
|
|
53156
53327
|
return [];
|
|
53157
53328
|
}
|
|
53158
53329
|
const condition = (kind === "long" ? entry > app_config.support : entry >= app_config.support) && stop >= app_config.support * 0.999;
|
|
53159
|
-
if (kind === "short") {
|
|
53330
|
+
if (kind === "short") {
|
|
53331
|
+
}
|
|
53160
53332
|
const result = entry === stop ? [] : condition ? instance.build_entry({
|
|
53161
53333
|
current_price: entry,
|
|
53162
53334
|
stop_loss: stop,
|
|
@@ -53861,6 +54033,12 @@ function calculate_factor(payload) {
|
|
|
53861
54033
|
calculated_factor = to_f2(calculated_factor, places);
|
|
53862
54034
|
return calculated_factor;
|
|
53863
54035
|
}
|
|
54036
|
+
function determineRewardFactor(payload) {
|
|
54037
|
+
const { quantity, avg_qty, minimum_pnl, risk } = payload;
|
|
54038
|
+
const reward_factor = minimum_pnl / risk;
|
|
54039
|
+
const quantity_ratio = quantity / avg_qty;
|
|
54040
|
+
return to_f2(reward_factor / quantity_ratio, "%.4f");
|
|
54041
|
+
}
|
|
53864
54042
|
|
|
53865
54043
|
// src/helpers/strategy.ts
|
|
53866
54044
|
class Strategy {
|
|
@@ -54335,8 +54513,11 @@ class Strategy {
|
|
|
54335
54513
|
}
|
|
54336
54514
|
}
|
|
54337
54515
|
};
|
|
54338
|
-
results.push(to_add);
|
|
54339
54516
|
const sell_kind = direction == "long" ? "short" : "long";
|
|
54517
|
+
if (sell_quantity[sell_kind] <= 0) {
|
|
54518
|
+
break;
|
|
54519
|
+
}
|
|
54520
|
+
results.push(to_add);
|
|
54340
54521
|
const remaining = this.to_df(params[sell_kind].quantity - sell_quantity[sell_kind]);
|
|
54341
54522
|
if (remaining <= 0) {
|
|
54342
54523
|
break;
|
|
@@ -54637,7 +54818,8 @@ async function createLimitPurchaseOrders(client, symbol, priceFormat, quantityFo
|
|
|
54637
54818
|
const splitOrders = (inputOrders) => {
|
|
54638
54819
|
const result = [];
|
|
54639
54820
|
for (const o of inputOrders) {
|
|
54640
|
-
if (o.take_profit) {
|
|
54821
|
+
if (o.take_profit) {
|
|
54822
|
+
}
|
|
54641
54823
|
if (o.stop && !o.side) {
|
|
54642
54824
|
result.push({
|
|
54643
54825
|
price: o.price,
|
|
@@ -55564,7 +55746,8 @@ async function createLimitPurchaseOrders2(client, symbol, priceFormat, quantityF
|
|
|
55564
55746
|
const splitOrders = (inputOrders) => {
|
|
55565
55747
|
const result = [];
|
|
55566
55748
|
for (const o of inputOrders) {
|
|
55567
|
-
if (o.take_profit) {
|
|
55749
|
+
if (o.take_profit) {
|
|
55750
|
+
}
|
|
55568
55751
|
if (o.stop && !o.side) {
|
|
55569
55752
|
result.push({
|
|
55570
55753
|
price: o.price,
|
|
@@ -56165,9 +56348,12 @@ class BybitExchange extends BaseExchange {
|
|
|
56165
56348
|
sellLeverage: payload.leverage.toString()
|
|
56166
56349
|
});
|
|
56167
56350
|
}
|
|
56168
|
-
async generateConfig(payload) {
|
|
56169
|
-
|
|
56170
|
-
async
|
|
56351
|
+
async generateConfig(payload) {
|
|
56352
|
+
}
|
|
56353
|
+
async checkDelistedMovers(payload) {
|
|
56354
|
+
}
|
|
56355
|
+
async closePosition(payload) {
|
|
56356
|
+
}
|
|
56171
56357
|
async getAllOpenSymbols() {
|
|
56172
56358
|
return [];
|
|
56173
56359
|
}
|
|
@@ -56192,8 +56378,10 @@ class BybitExchange extends BaseExchange {
|
|
|
56192
56378
|
async getDelistedSpotSymbols() {
|
|
56193
56379
|
return [];
|
|
56194
56380
|
}
|
|
56195
|
-
async crossAccountTransfer(payload) {
|
|
56196
|
-
|
|
56381
|
+
async crossAccountTransfer(payload) {
|
|
56382
|
+
}
|
|
56383
|
+
async placeMarketOrder(payload) {
|
|
56384
|
+
}
|
|
56197
56385
|
async rawCreateLimitPurchaseOrders(payload) {
|
|
56198
56386
|
const { symbol, orders, price_places, decimal_places } = payload;
|
|
56199
56387
|
return createLimitPurchaseOrders2(this.client, symbol, price_places, decimal_places, orders);
|
|
@@ -56201,7 +56389,8 @@ class BybitExchange extends BaseExchange {
|
|
|
56201
56389
|
getOpenOrders(payload) {
|
|
56202
56390
|
return getOpenOrders2(this.client, payload.symbol);
|
|
56203
56391
|
}
|
|
56204
|
-
async placeBadStopEntry(payload) {
|
|
56392
|
+
async placeBadStopEntry(payload) {
|
|
56393
|
+
}
|
|
56205
56394
|
}
|
|
56206
56395
|
|
|
56207
56396
|
// src/helpers/accounts.ts
|
|
@@ -57155,7 +57344,8 @@ class ExchangeAccount {
|
|
|
57155
57344
|
cancelExchangeOrders: this.cancelExchangeOrders.bind(this)
|
|
57156
57345
|
});
|
|
57157
57346
|
}
|
|
57158
|
-
if (all) {
|
|
57347
|
+
if (all) {
|
|
57348
|
+
} else {
|
|
57159
57349
|
if (!price) {
|
|
57160
57350
|
const position2 = await this.syncAccount({
|
|
57161
57351
|
symbol,
|
|
@@ -59030,7 +59220,12 @@ class ExchangeAccount {
|
|
|
59030
59220
|
reward_factor = strategy.reward_factor;
|
|
59031
59221
|
}
|
|
59032
59222
|
if (focus_position.avg_qty >= focus_position.quantity && strategy.max_reward_factor) {
|
|
59033
|
-
|
|
59223
|
+
if (strategy.dynamic) {
|
|
59224
|
+
const quantity_ratio = focus_position.quantity / focus_position.avg_qty;
|
|
59225
|
+
reward_factor = to_f2(quantity_ratio ** 2 * strategy.max_reward_factor, "%.2f");
|
|
59226
|
+
} else {
|
|
59227
|
+
reward_factor = to_f2(focus_position.quantity * strategy.max_reward_factor / focus_position.avg_qty, "%.4f");
|
|
59228
|
+
}
|
|
59034
59229
|
} else {
|
|
59035
59230
|
reward_factor = strategy.reward_factor;
|
|
59036
59231
|
}
|
|
@@ -59747,6 +59942,7 @@ export {
|
|
|
59747
59942
|
determine_break_even_price,
|
|
59748
59943
|
determine_average_entry_and_size,
|
|
59749
59944
|
determine_amount_to_buy,
|
|
59945
|
+
determineRewardFactor,
|
|
59750
59946
|
determineOptimumReward,
|
|
59751
59947
|
exports_database as database,
|
|
59752
59948
|
createArray,
|