@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.cjs
CHANGED
|
@@ -580,7 +580,8 @@ function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
|
580
580
|
let macCheckPassed;
|
|
581
581
|
try {
|
|
582
582
|
macCheckPassed = timing_safe_equal_default(tag, expectedTag);
|
|
583
|
-
} catch {
|
|
583
|
+
} catch {
|
|
584
|
+
}
|
|
584
585
|
if (!macCheckPassed) {
|
|
585
586
|
throw new JWEDecryptionFailed;
|
|
586
587
|
}
|
|
@@ -588,7 +589,8 @@ function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
|
588
589
|
try {
|
|
589
590
|
const decipher = import_node_crypto6.createDecipheriv(algorithm, encKey, iv);
|
|
590
591
|
plaintext = concat(decipher.update(ciphertext), decipher.final());
|
|
591
|
-
} catch {
|
|
592
|
+
} catch {
|
|
593
|
+
}
|
|
592
594
|
if (!plaintext) {
|
|
593
595
|
throw new JWEDecryptionFailed;
|
|
594
596
|
}
|
|
@@ -767,7 +769,8 @@ function isPublicJWK(key) {
|
|
|
767
769
|
function isSecretJWK(key) {
|
|
768
770
|
return isJWK(key) && key.kty === "oct" && typeof key.k === "string";
|
|
769
771
|
}
|
|
770
|
-
var init_is_jwk = () => {
|
|
772
|
+
var init_is_jwk = () => {
|
|
773
|
+
};
|
|
771
774
|
|
|
772
775
|
// node_modules/jose/dist/node/esm/runtime/get_named_curve.js
|
|
773
776
|
var import_node_crypto8, weakMap, namedCurveToJOSE = (namedCurve) => {
|
|
@@ -949,7 +952,8 @@ var import_node_crypto11, check_key_length_default = (key, alg) => {
|
|
|
949
952
|
} else {
|
|
950
953
|
modulusLength = Buffer.from(key.n, "base64url").byteLength << 3;
|
|
951
954
|
}
|
|
952
|
-
} catch {
|
|
955
|
+
} catch {
|
|
956
|
+
}
|
|
953
957
|
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
954
958
|
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
955
959
|
}
|
|
@@ -1710,7 +1714,8 @@ async function generalDecrypt(jwe, key, options) {
|
|
|
1710
1714
|
tag: jwe.tag,
|
|
1711
1715
|
unprotected: jwe.unprotected
|
|
1712
1716
|
}, key, options);
|
|
1713
|
-
} catch {
|
|
1717
|
+
} catch {
|
|
1718
|
+
}
|
|
1714
1719
|
}
|
|
1715
1720
|
throw new JWEDecryptionFailed;
|
|
1716
1721
|
}
|
|
@@ -2596,7 +2601,8 @@ async function generalVerify(jws, key, options) {
|
|
|
2596
2601
|
protected: signature.protected,
|
|
2597
2602
|
signature: signature.signature
|
|
2598
2603
|
}, key, options);
|
|
2599
|
-
} catch {
|
|
2604
|
+
} catch {
|
|
2605
|
+
}
|
|
2600
2606
|
}
|
|
2601
2607
|
throw new JWSSignatureVerificationFailed;
|
|
2602
2608
|
}
|
|
@@ -2679,7 +2685,8 @@ var normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, ""),
|
|
|
2679
2685
|
let payload;
|
|
2680
2686
|
try {
|
|
2681
2687
|
payload = JSON.parse(decoder.decode(encodedPayload));
|
|
2682
|
-
} catch {
|
|
2688
|
+
} catch {
|
|
2689
|
+
}
|
|
2683
2690
|
if (!isObject(payload)) {
|
|
2684
2691
|
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
2685
2692
|
}
|
|
@@ -3364,7 +3371,8 @@ class LocalJWKSet {
|
|
|
3364
3371
|
for (const jwk2 of candidates) {
|
|
3365
3372
|
try {
|
|
3366
3373
|
yield await importWithAlgCache(_cached, jwk2, alg);
|
|
3367
|
-
} catch {
|
|
3374
|
+
} catch {
|
|
3375
|
+
}
|
|
3368
3376
|
}
|
|
3369
3377
|
};
|
|
3370
3378
|
throw error;
|
|
@@ -3911,7 +3919,8 @@ var require_util = __commonJS((exports2) => {
|
|
|
3911
3919
|
var util4;
|
|
3912
3920
|
(function(util5) {
|
|
3913
3921
|
util5.assertEqual = (val) => val;
|
|
3914
|
-
function assertIs(_arg) {
|
|
3922
|
+
function assertIs(_arg) {
|
|
3923
|
+
}
|
|
3915
3924
|
util5.assertIs = assertIs;
|
|
3916
3925
|
function assertNever(_x) {
|
|
3917
3926
|
throw new Error;
|
|
@@ -6327,7 +6336,8 @@ var require_types = __commonJS((exports2) => {
|
|
|
6327
6336
|
});
|
|
6328
6337
|
status.dirty();
|
|
6329
6338
|
}
|
|
6330
|
-
} else if (unknownKeys === "strip") {
|
|
6339
|
+
} else if (unknownKeys === "strip") {
|
|
6340
|
+
} else {
|
|
6331
6341
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
6332
6342
|
}
|
|
6333
6343
|
} else {
|
|
@@ -8479,7 +8489,8 @@ var require_logLevelLogger = __commonJS((exports2) => {
|
|
|
8479
8489
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
8480
8490
|
return theFunc.bind(logger);
|
|
8481
8491
|
}
|
|
8482
|
-
return function() {
|
|
8492
|
+
return function() {
|
|
8493
|
+
};
|
|
8483
8494
|
}
|
|
8484
8495
|
return {
|
|
8485
8496
|
error: _filterFunc("error", types_1.DiagLogLevel.ERROR),
|
|
@@ -8704,7 +8715,8 @@ var require_NoopMeter = __commonJS((exports2) => {
|
|
|
8704
8715
|
exports2.createNoopMeter = exports2.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = exports2.NOOP_OBSERVABLE_GAUGE_METRIC = exports2.NOOP_OBSERVABLE_COUNTER_METRIC = exports2.NOOP_UP_DOWN_COUNTER_METRIC = exports2.NOOP_HISTOGRAM_METRIC = exports2.NOOP_GAUGE_METRIC = exports2.NOOP_COUNTER_METRIC = exports2.NOOP_METER = exports2.NoopObservableUpDownCounterMetric = exports2.NoopObservableGaugeMetric = exports2.NoopObservableCounterMetric = exports2.NoopObservableMetric = exports2.NoopHistogramMetric = exports2.NoopGaugeMetric = exports2.NoopUpDownCounterMetric = exports2.NoopCounterMetric = exports2.NoopMetric = exports2.NoopMeter = undefined;
|
|
8705
8716
|
|
|
8706
8717
|
class NoopMeter {
|
|
8707
|
-
constructor() {
|
|
8718
|
+
constructor() {
|
|
8719
|
+
}
|
|
8708
8720
|
createGauge(_name, _options) {
|
|
8709
8721
|
return exports2.NOOP_GAUGE_METRIC;
|
|
8710
8722
|
}
|
|
@@ -8726,8 +8738,10 @@ var require_NoopMeter = __commonJS((exports2) => {
|
|
|
8726
8738
|
createObservableUpDownCounter(_name, _options) {
|
|
8727
8739
|
return exports2.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
8728
8740
|
}
|
|
8729
|
-
addBatchObservableCallback(_callback, _observables) {
|
|
8730
|
-
|
|
8741
|
+
addBatchObservableCallback(_callback, _observables) {
|
|
8742
|
+
}
|
|
8743
|
+
removeBatchObservableCallback(_callback) {
|
|
8744
|
+
}
|
|
8731
8745
|
}
|
|
8732
8746
|
exports2.NoopMeter = NoopMeter;
|
|
8733
8747
|
|
|
@@ -8736,28 +8750,34 @@ var require_NoopMeter = __commonJS((exports2) => {
|
|
|
8736
8750
|
exports2.NoopMetric = NoopMetric;
|
|
8737
8751
|
|
|
8738
8752
|
class NoopCounterMetric extends NoopMetric {
|
|
8739
|
-
add(_value, _attributes) {
|
|
8753
|
+
add(_value, _attributes) {
|
|
8754
|
+
}
|
|
8740
8755
|
}
|
|
8741
8756
|
exports2.NoopCounterMetric = NoopCounterMetric;
|
|
8742
8757
|
|
|
8743
8758
|
class NoopUpDownCounterMetric extends NoopMetric {
|
|
8744
|
-
add(_value, _attributes) {
|
|
8759
|
+
add(_value, _attributes) {
|
|
8760
|
+
}
|
|
8745
8761
|
}
|
|
8746
8762
|
exports2.NoopUpDownCounterMetric = NoopUpDownCounterMetric;
|
|
8747
8763
|
|
|
8748
8764
|
class NoopGaugeMetric extends NoopMetric {
|
|
8749
|
-
record(_value, _attributes) {
|
|
8765
|
+
record(_value, _attributes) {
|
|
8766
|
+
}
|
|
8750
8767
|
}
|
|
8751
8768
|
exports2.NoopGaugeMetric = NoopGaugeMetric;
|
|
8752
8769
|
|
|
8753
8770
|
class NoopHistogramMetric extends NoopMetric {
|
|
8754
|
-
record(_value, _attributes) {
|
|
8771
|
+
record(_value, _attributes) {
|
|
8772
|
+
}
|
|
8755
8773
|
}
|
|
8756
8774
|
exports2.NoopHistogramMetric = NoopHistogramMetric;
|
|
8757
8775
|
|
|
8758
8776
|
class NoopObservableMetric {
|
|
8759
|
-
addCallback(_callback) {
|
|
8760
|
-
|
|
8777
|
+
addCallback(_callback) {
|
|
8778
|
+
}
|
|
8779
|
+
removeCallback(_callback) {
|
|
8780
|
+
}
|
|
8761
8781
|
}
|
|
8762
8782
|
exports2.NoopObservableMetric = NoopObservableMetric;
|
|
8763
8783
|
|
|
@@ -8862,7 +8882,8 @@ var require_context2 = __commonJS((exports2) => {
|
|
|
8862
8882
|
var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager;
|
|
8863
8883
|
|
|
8864
8884
|
class ContextAPI {
|
|
8865
|
-
constructor() {
|
|
8885
|
+
constructor() {
|
|
8886
|
+
}
|
|
8866
8887
|
static getInstance() {
|
|
8867
8888
|
if (!this._instance) {
|
|
8868
8889
|
this._instance = new ContextAPI;
|
|
@@ -8951,11 +8972,13 @@ var require_NonRecordingSpan = __commonJS((exports2) => {
|
|
|
8951
8972
|
updateName(_name) {
|
|
8952
8973
|
return this;
|
|
8953
8974
|
}
|
|
8954
|
-
end(_endTime) {
|
|
8975
|
+
end(_endTime) {
|
|
8976
|
+
}
|
|
8955
8977
|
isRecording() {
|
|
8956
8978
|
return false;
|
|
8957
8979
|
}
|
|
8958
|
-
recordException(_exception, _time) {
|
|
8980
|
+
recordException(_exception, _time) {
|
|
8981
|
+
}
|
|
8959
8982
|
}
|
|
8960
8983
|
exports2.NonRecordingSpan = NonRecordingSpan;
|
|
8961
8984
|
});
|
|
@@ -9257,7 +9280,8 @@ var require_tracestate_impl = __commonJS((exports2) => {
|
|
|
9257
9280
|
const value = listMember.slice(i + 1, part.length);
|
|
9258
9281
|
if ((0, tracestate_validators_1.validateKey)(key) && (0, tracestate_validators_1.validateValue)(value)) {
|
|
9259
9282
|
agg.set(key, value);
|
|
9260
|
-
} else {
|
|
9283
|
+
} else {
|
|
9284
|
+
}
|
|
9261
9285
|
}
|
|
9262
9286
|
return agg;
|
|
9263
9287
|
}, new Map);
|
|
@@ -9329,7 +9353,8 @@ var require_metrics = __commonJS((exports2) => {
|
|
|
9329
9353
|
var API_NAME2 = "metrics";
|
|
9330
9354
|
|
|
9331
9355
|
class MetricsAPI {
|
|
9332
|
-
constructor() {
|
|
9356
|
+
constructor() {
|
|
9357
|
+
}
|
|
9333
9358
|
static getInstance() {
|
|
9334
9359
|
if (!this._instance) {
|
|
9335
9360
|
this._instance = new MetricsAPI;
|
|
@@ -9366,7 +9391,8 @@ var require_NoopTextMapPropagator = __commonJS((exports2) => {
|
|
|
9366
9391
|
exports2.NoopTextMapPropagator = undefined;
|
|
9367
9392
|
|
|
9368
9393
|
class NoopTextMapPropagator {
|
|
9369
|
-
inject(_context, _carrier) {
|
|
9394
|
+
inject(_context, _carrier) {
|
|
9395
|
+
}
|
|
9370
9396
|
extract(context, _carrier) {
|
|
9371
9397
|
return context;
|
|
9372
9398
|
}
|
|
@@ -9679,7 +9705,8 @@ class Registry {
|
|
|
9679
9705
|
return this.kv.getByKey(identifier);
|
|
9680
9706
|
}
|
|
9681
9707
|
}
|
|
9682
|
-
var init_registry = () => {
|
|
9708
|
+
var init_registry = () => {
|
|
9709
|
+
};
|
|
9683
9710
|
|
|
9684
9711
|
// node_modules/superjson/dist/class-registry.js
|
|
9685
9712
|
var ClassRegistry;
|
|
@@ -9764,7 +9791,8 @@ class CustomTransformerRegistry {
|
|
|
9764
9791
|
return this.transfomers[name2];
|
|
9765
9792
|
}
|
|
9766
9793
|
}
|
|
9767
|
-
var init_custom_transformer_registry = () => {
|
|
9794
|
+
var init_custom_transformer_registry = () => {
|
|
9795
|
+
};
|
|
9768
9796
|
|
|
9769
9797
|
// node_modules/superjson/dist/is.js
|
|
9770
9798
|
var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1), isUndefined = (payload) => typeof payload === "undefined", isNull = (payload) => payload === null, isPlainObject = (payload) => {
|
|
@@ -10109,7 +10137,8 @@ var getNthKey = (value, n) => {
|
|
|
10109
10137
|
}
|
|
10110
10138
|
return object;
|
|
10111
10139
|
};
|
|
10112
|
-
var init_accessDeep = () => {
|
|
10140
|
+
var init_accessDeep = () => {
|
|
10141
|
+
};
|
|
10113
10142
|
|
|
10114
10143
|
// node_modules/superjson/dist/plainer.js
|
|
10115
10144
|
function traverse(tree, walker, origin = []) {
|
|
@@ -10698,7 +10727,8 @@ var require_NoopLogger = __commonJS((exports2) => {
|
|
|
10698
10727
|
exports2.NOOP_LOGGER = exports2.NoopLogger = undefined;
|
|
10699
10728
|
|
|
10700
10729
|
class NoopLogger {
|
|
10701
|
-
emit(_logRecord) {
|
|
10730
|
+
emit(_logRecord) {
|
|
10731
|
+
}
|
|
10702
10732
|
}
|
|
10703
10733
|
exports2.NoopLogger = NoopLogger;
|
|
10704
10734
|
exports2.NOOP_LOGGER = new NoopLogger;
|
|
@@ -10792,7 +10822,8 @@ var require_logs = __commonJS((exports2) => {
|
|
|
10792
10822
|
var NoopLoggerProvider_1 = require_NoopLoggerProvider();
|
|
10793
10823
|
|
|
10794
10824
|
class LogsAPI {
|
|
10795
|
-
constructor() {
|
|
10825
|
+
constructor() {
|
|
10826
|
+
}
|
|
10796
10827
|
static getInstance() {
|
|
10797
10828
|
if (!this._instance) {
|
|
10798
10829
|
this._instance = new LogsAPI;
|
|
@@ -11260,7 +11291,8 @@ var require_browser = __commonJS((exports2, module2) => {
|
|
|
11260
11291
|
});
|
|
11261
11292
|
args.splice(lastC, 0, c);
|
|
11262
11293
|
}
|
|
11263
|
-
exports2.log = console.debug || console.log || (() => {
|
|
11294
|
+
exports2.log = console.debug || console.log || (() => {
|
|
11295
|
+
});
|
|
11264
11296
|
function save(namespaces) {
|
|
11265
11297
|
try {
|
|
11266
11298
|
if (namespaces) {
|
|
@@ -11268,13 +11300,15 @@ var require_browser = __commonJS((exports2, module2) => {
|
|
|
11268
11300
|
} else {
|
|
11269
11301
|
exports2.storage.removeItem("debug");
|
|
11270
11302
|
}
|
|
11271
|
-
} catch (error) {
|
|
11303
|
+
} catch (error) {
|
|
11304
|
+
}
|
|
11272
11305
|
}
|
|
11273
11306
|
function load() {
|
|
11274
11307
|
let r;
|
|
11275
11308
|
try {
|
|
11276
11309
|
r = exports2.storage.getItem("debug");
|
|
11277
|
-
} catch (error) {
|
|
11310
|
+
} catch (error) {
|
|
11311
|
+
}
|
|
11278
11312
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
11279
11313
|
r = process.env.DEBUG;
|
|
11280
11314
|
}
|
|
@@ -11283,7 +11317,8 @@ var require_browser = __commonJS((exports2, module2) => {
|
|
|
11283
11317
|
function localstorage() {
|
|
11284
11318
|
try {
|
|
11285
11319
|
return localStorage;
|
|
11286
|
-
} catch (error) {
|
|
11320
|
+
} catch (error) {
|
|
11321
|
+
}
|
|
11287
11322
|
}
|
|
11288
11323
|
module2.exports = require_common()(exports2);
|
|
11289
11324
|
var { formatters } = module2.exports;
|
|
@@ -11415,7 +11450,8 @@ var require_node3 = __commonJS((exports2, module2) => {
|
|
|
11415
11450
|
exports2.save = save;
|
|
11416
11451
|
exports2.load = load;
|
|
11417
11452
|
exports2.useColors = useColors;
|
|
11418
|
-
exports2.destroy = util4.deprecate(() => {
|
|
11453
|
+
exports2.destroy = util4.deprecate(() => {
|
|
11454
|
+
}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
11419
11455
|
exports2.colors = [6, 2, 3, 4, 5, 1];
|
|
11420
11456
|
try {
|
|
11421
11457
|
const supportsColor = require_supports_color();
|
|
@@ -11499,7 +11535,8 @@ var require_node3 = __commonJS((exports2, module2) => {
|
|
|
11499
11535
|
221
|
|
11500
11536
|
];
|
|
11501
11537
|
}
|
|
11502
|
-
} catch (error) {
|
|
11538
|
+
} catch (error) {
|
|
11539
|
+
}
|
|
11503
11540
|
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
11504
11541
|
return /^debug_/i.test(key);
|
|
11505
11542
|
}).reduce((obj, key) => {
|
|
@@ -13748,7 +13785,8 @@ var require_jsbn = __commonJS((exports2, module2) => {
|
|
|
13748
13785
|
++this[w];
|
|
13749
13786
|
}
|
|
13750
13787
|
}
|
|
13751
|
-
function NullExp() {
|
|
13788
|
+
function NullExp() {
|
|
13789
|
+
}
|
|
13752
13790
|
function nNop(x) {
|
|
13753
13791
|
return x;
|
|
13754
13792
|
}
|
|
@@ -14173,7 +14211,8 @@ var require_jsbn = __commonJS((exports2, module2) => {
|
|
|
14173
14211
|
for (i2 = 0;i2 < ba.length; ++i2)
|
|
14174
14212
|
ba[i2] = rng_get_byte();
|
|
14175
14213
|
}
|
|
14176
|
-
function SecureRandom() {
|
|
14214
|
+
function SecureRandom() {
|
|
14215
|
+
}
|
|
14177
14216
|
SecureRandom.prototype.nextBytes = rng_get_bytes;
|
|
14178
14217
|
function Arcfour() {
|
|
14179
14218
|
this.i = 0;
|
|
@@ -16396,7 +16435,8 @@ var require_delayed_stream = __commonJS((exports2, module2) => {
|
|
|
16396
16435
|
delayedStream._handleEmit(arguments);
|
|
16397
16436
|
return realEmit.apply(source, arguments);
|
|
16398
16437
|
};
|
|
16399
|
-
source.on("error", function() {
|
|
16438
|
+
source.on("error", function() {
|
|
16439
|
+
});
|
|
16400
16440
|
if (delayedStream.pauseStream) {
|
|
16401
16441
|
source.pause();
|
|
16402
16442
|
}
|
|
@@ -25700,7 +25740,8 @@ var require_implementation = __commonJS((exports2, module2) => {
|
|
|
25700
25740
|
}
|
|
25701
25741
|
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
25702
25742
|
if (target.prototype) {
|
|
25703
|
-
var Empty = function Empty() {
|
|
25743
|
+
var Empty = function Empty() {
|
|
25744
|
+
};
|
|
25704
25745
|
Empty.prototype = target.prototype;
|
|
25705
25746
|
bound.prototype = new Empty;
|
|
25706
25747
|
Empty.prototype = null;
|
|
@@ -25820,7 +25861,8 @@ var require_get_intrinsic = __commonJS((exports2, module2) => {
|
|
|
25820
25861
|
var getEvalledConstructor = function(expressionSyntax) {
|
|
25821
25862
|
try {
|
|
25822
25863
|
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
|
|
25823
|
-
} catch (e2) {
|
|
25864
|
+
} catch (e2) {
|
|
25865
|
+
}
|
|
25824
25866
|
};
|
|
25825
25867
|
var $gOPD = require_gopd();
|
|
25826
25868
|
var $defineProperty = require_es_define_property();
|
|
@@ -26559,9 +26601,11 @@ var require_debug = __commonJS((exports2, module2) => {
|
|
|
26559
26601
|
if (!debug) {
|
|
26560
26602
|
try {
|
|
26561
26603
|
debug = require_src4()("follow-redirects");
|
|
26562
|
-
} catch (error) {
|
|
26604
|
+
} catch (error) {
|
|
26605
|
+
}
|
|
26563
26606
|
if (typeof debug !== "function") {
|
|
26564
|
-
debug = function() {
|
|
26607
|
+
debug = function() {
|
|
26608
|
+
};
|
|
26565
26609
|
}
|
|
26566
26610
|
}
|
|
26567
26611
|
debug.apply(null, arguments);
|
|
@@ -26936,7 +26980,8 @@ var require_follow_redirects = __commonJS((exports2, module2) => {
|
|
|
26936
26980
|
});
|
|
26937
26981
|
return exports3;
|
|
26938
26982
|
}
|
|
26939
|
-
function noop2() {
|
|
26983
|
+
function noop2() {
|
|
26984
|
+
}
|
|
26940
26985
|
function parseUrl(input) {
|
|
26941
26986
|
var parsed;
|
|
26942
26987
|
if (useNativeURL) {
|
|
@@ -27319,7 +27364,8 @@ var require_axios = __commonJS((exports2, module2) => {
|
|
|
27319
27364
|
isArray3(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
|
|
27320
27365
|
return obj;
|
|
27321
27366
|
};
|
|
27322
|
-
var noop2 = () => {
|
|
27367
|
+
var noop2 = () => {
|
|
27368
|
+
};
|
|
27323
27369
|
var toFiniteNumber = (value2, defaultValue) => {
|
|
27324
27370
|
return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue;
|
|
27325
27371
|
};
|
|
@@ -28772,7 +28818,8 @@ var require_axios = __commonJS((exports2, module2) => {
|
|
|
28772
28818
|
try {
|
|
28773
28819
|
const knownLength = await util__default["default"].promisify(data.getLength).call(data);
|
|
28774
28820
|
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
|
28775
|
-
} catch (e2) {
|
|
28821
|
+
} catch (e2) {
|
|
28822
|
+
}
|
|
28776
28823
|
}
|
|
28777
28824
|
} else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
|
|
28778
28825
|
data.size && headers.setContentType(data.type || "application/octet-stream");
|
|
@@ -29046,11 +29093,13 @@ var require_axios = __commonJS((exports2, module2) => {
|
|
|
29046
29093
|
this.write(name2, "", Date.now() - 86400000);
|
|
29047
29094
|
}
|
|
29048
29095
|
} : {
|
|
29049
|
-
write() {
|
|
29096
|
+
write() {
|
|
29097
|
+
},
|
|
29050
29098
|
read() {
|
|
29051
29099
|
return null;
|
|
29052
29100
|
},
|
|
29053
|
-
remove() {
|
|
29101
|
+
remove() {
|
|
29102
|
+
}
|
|
29054
29103
|
};
|
|
29055
29104
|
var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
29056
29105
|
function mergeConfig(config1, config2) {
|
|
@@ -29544,7 +29593,8 @@ var require_axios = __commonJS((exports2, module2) => {
|
|
|
29544
29593
|
if (fn) {
|
|
29545
29594
|
try {
|
|
29546
29595
|
Object.defineProperty(fn, "name", { value: value2 });
|
|
29547
|
-
} catch (e2) {
|
|
29596
|
+
} catch (e2) {
|
|
29597
|
+
}
|
|
29548
29598
|
Object.defineProperty(fn, "adapterName", { value: value2 });
|
|
29549
29599
|
}
|
|
29550
29600
|
});
|
|
@@ -29694,7 +29744,8 @@ var require_axios = __commonJS((exports2, module2) => {
|
|
|
29694
29744
|
err.stack += `
|
|
29695
29745
|
` + stack;
|
|
29696
29746
|
}
|
|
29697
|
-
} catch (e2) {
|
|
29747
|
+
} catch (e2) {
|
|
29748
|
+
}
|
|
29698
29749
|
}
|
|
29699
29750
|
throw err;
|
|
29700
29751
|
}
|
|
@@ -31767,7 +31818,8 @@ var require_logger = __commonJS((exports2) => {
|
|
|
31767
31818
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
31768
31819
|
exports2.DefaultLogger = undefined;
|
|
31769
31820
|
exports2.DefaultLogger = {
|
|
31770
|
-
silly: (...params) => {
|
|
31821
|
+
silly: (...params) => {
|
|
31822
|
+
},
|
|
31771
31823
|
debug: (...params) => {
|
|
31772
31824
|
console.log(new Date, params);
|
|
31773
31825
|
},
|
|
@@ -34510,7 +34562,8 @@ var require_constants4 = __commonJS((exports2, module2) => {
|
|
|
34510
34562
|
kListener: Symbol("kListener"),
|
|
34511
34563
|
kStatusCode: Symbol("status-code"),
|
|
34512
34564
|
kWebSocket: Symbol("websocket"),
|
|
34513
|
-
NOOP: () => {
|
|
34565
|
+
NOOP: () => {
|
|
34566
|
+
}
|
|
34514
34567
|
};
|
|
34515
34568
|
});
|
|
34516
34569
|
|
|
@@ -34588,7 +34641,8 @@ var require_buffer_util = __commonJS((exports2, module2) => {
|
|
|
34588
34641
|
else
|
|
34589
34642
|
bufferUtil.unmask(buffer, mask);
|
|
34590
34643
|
};
|
|
34591
|
-
} catch (e2) {
|
|
34644
|
+
} catch (e2) {
|
|
34645
|
+
}
|
|
34592
34646
|
}
|
|
34593
34647
|
});
|
|
34594
34648
|
|
|
@@ -35067,7 +35121,8 @@ var require_validation = __commonJS((exports2, module2) => {
|
|
|
35067
35121
|
module2.exports.isValidUTF8 = function(buf) {
|
|
35068
35122
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
35069
35123
|
};
|
|
35070
|
-
} catch (e2) {
|
|
35124
|
+
} catch (e2) {
|
|
35125
|
+
}
|
|
35071
35126
|
}
|
|
35072
35127
|
});
|
|
35073
35128
|
|
|
@@ -37497,7 +37552,8 @@ var require_websocket_client = __commonJS((exports2) => {
|
|
|
37497
37552
|
this.options = Object.assign({ pongTimeout: 7500, pingInterval: 1e4, reconnectTimeout: 500 }, options);
|
|
37498
37553
|
this.listenKeyStateStore = {};
|
|
37499
37554
|
this.wsUrlKeyMap = {};
|
|
37500
|
-
this.on("error", () => {
|
|
37555
|
+
this.on("error", () => {
|
|
37556
|
+
});
|
|
37501
37557
|
}
|
|
37502
37558
|
getRestClientOptions() {
|
|
37503
37559
|
return Object.assign(Object.assign(Object.assign({}, this.options), this.options.restOptions), { api_key: this.options.api_key, api_secret: this.options.api_secret });
|
|
@@ -38914,7 +38970,8 @@ var require_logger2 = __commonJS((exports2) => {
|
|
|
38914
38970
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38915
38971
|
exports2.DefaultLogger = undefined;
|
|
38916
38972
|
exports2.DefaultLogger = {
|
|
38917
|
-
trace: (..._params) => {
|
|
38973
|
+
trace: (..._params) => {
|
|
38974
|
+
},
|
|
38918
38975
|
info: (...params) => {
|
|
38919
38976
|
console.info(params);
|
|
38920
38977
|
},
|
|
@@ -40960,7 +41017,8 @@ var require_BaseWSClient = __commonJS((exports2) => {
|
|
|
40960
41017
|
if (wsState === null || wsState === undefined ? undefined : wsState.activePongTimer) {
|
|
40961
41018
|
clearTimeout(wsState.activePongTimer);
|
|
40962
41019
|
wsState.activePongTimer = undefined;
|
|
40963
|
-
} else {
|
|
41020
|
+
} else {
|
|
41021
|
+
}
|
|
40964
41022
|
}
|
|
40965
41023
|
clearReconnectTimer(wsKey) {
|
|
40966
41024
|
const wsState = this.wsStore.get(wsKey);
|
|
@@ -41843,6 +41901,7 @@ __export(exports_src, {
|
|
|
41843
41901
|
determine_break_even_price: () => determine_break_even_price,
|
|
41844
41902
|
determine_average_entry_and_size: () => determine_average_entry_and_size,
|
|
41845
41903
|
determine_amount_to_buy: () => determine_amount_to_buy,
|
|
41904
|
+
determineRewardFactor: () => determineRewardFactor,
|
|
41846
41905
|
determineOptimumReward: () => determineOptimumReward,
|
|
41847
41906
|
database: () => exports_database,
|
|
41848
41907
|
createArray: () => createArray,
|
|
@@ -41871,7 +41930,8 @@ __export(exports_app, {
|
|
|
41871
41930
|
var util;
|
|
41872
41931
|
(function(util2) {
|
|
41873
41932
|
util2.assertEqual = (val) => val;
|
|
41874
|
-
function assertIs(_arg) {
|
|
41933
|
+
function assertIs(_arg) {
|
|
41934
|
+
}
|
|
41875
41935
|
util2.assertIs = assertIs;
|
|
41876
41936
|
function assertNever(_x) {
|
|
41877
41937
|
throw new Error;
|
|
@@ -46732,7 +46792,8 @@ var API_NAME = "task-context";
|
|
|
46732
46792
|
|
|
46733
46793
|
class TaskContextAPI {
|
|
46734
46794
|
static _instance;
|
|
46735
|
-
constructor() {
|
|
46795
|
+
constructor() {
|
|
46796
|
+
}
|
|
46736
46797
|
static getInstance() {
|
|
46737
46798
|
if (!this._instance) {
|
|
46738
46799
|
this._instance = new TaskContextAPI;
|
|
@@ -47152,7 +47213,8 @@ class ParseError extends Error {
|
|
|
47152
47213
|
super(message2), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
47153
47214
|
}
|
|
47154
47215
|
}
|
|
47155
|
-
function noop(_arg) {
|
|
47216
|
+
function noop(_arg) {
|
|
47217
|
+
}
|
|
47156
47218
|
function createParser(callbacks) {
|
|
47157
47219
|
if (typeof callbacks == "function")
|
|
47158
47220
|
throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
|
|
@@ -47355,7 +47417,8 @@ async function _doZodFetchWithRetries(schema, url, requestInit, options, attempt
|
|
|
47355
47417
|
if (error instanceof ApiError) {
|
|
47356
47418
|
throw error;
|
|
47357
47419
|
}
|
|
47358
|
-
if (error instanceof import_zod_validation_error.ValidationError) {
|
|
47420
|
+
if (error instanceof import_zod_validation_error.ValidationError) {
|
|
47421
|
+
}
|
|
47359
47422
|
if (options?.retry) {
|
|
47360
47423
|
const retry = { ...defaultRetryOptions2, ...options.retry };
|
|
47361
47424
|
const delay = calculateNextRetryDelay(retry, attempt);
|
|
@@ -47829,7 +47892,8 @@ class ApiClientMissingError extends Error {
|
|
|
47829
47892
|
|
|
47830
47893
|
class APIClientManagerAPI {
|
|
47831
47894
|
static _instance;
|
|
47832
|
-
constructor() {
|
|
47895
|
+
constructor() {
|
|
47896
|
+
}
|
|
47833
47897
|
static getInstance() {
|
|
47834
47898
|
if (!this._instance) {
|
|
47835
47899
|
this._instance = new APIClientManagerAPI;
|
|
@@ -48384,7 +48448,8 @@ var PrefetchQueue = class {
|
|
|
48384
48448
|
if (__privateGet(this, _queueTailUrl) && !__privateGet(this, _prefetchQueue).has(__privateGet(this, _queueTailUrl))) {
|
|
48385
48449
|
__privateMethod(this, _PrefetchQueue_instances, prefetch_fn).call(this, __privateGet(this, _queueTailUrl), args[1]);
|
|
48386
48450
|
}
|
|
48387
|
-
}).catch(() => {
|
|
48451
|
+
}).catch(() => {
|
|
48452
|
+
});
|
|
48388
48453
|
return request;
|
|
48389
48454
|
}
|
|
48390
48455
|
};
|
|
@@ -48415,8 +48480,10 @@ prefetch_fn = function(...args) {
|
|
|
48415
48480
|
}
|
|
48416
48481
|
__privateSet(this, _queueTailUrl, nextUrl);
|
|
48417
48482
|
return __privateMethod(this, _PrefetchQueue_instances, prefetch_fn).call(this, nextUrl, args[1]);
|
|
48418
|
-
}).catch(() => {
|
|
48419
|
-
|
|
48483
|
+
}).catch(() => {
|
|
48484
|
+
});
|
|
48485
|
+
} catch (_) {
|
|
48486
|
+
}
|
|
48420
48487
|
};
|
|
48421
48488
|
function getNextChunkUrl(url, res) {
|
|
48422
48489
|
const shapeHandle = res.headers.get(SHAPE_HANDLE_HEADER);
|
|
@@ -48519,7 +48586,8 @@ var ShapeStream = class {
|
|
|
48519
48586
|
get lastOffset() {
|
|
48520
48587
|
return __privateGet(this, _lastOffset);
|
|
48521
48588
|
}
|
|
48522
|
-
subscribe(callback, onError = () => {
|
|
48589
|
+
subscribe(callback, onError = () => {
|
|
48590
|
+
}) {
|
|
48523
48591
|
const subscriptionId = Math.random();
|
|
48524
48592
|
__privateGet(this, _subscribers).set(subscriptionId, [callback, onError]);
|
|
48525
48593
|
return () => {
|
|
@@ -49713,7 +49781,8 @@ class SimpleClock {
|
|
|
49713
49781
|
const nowStruct = now.toStruct();
|
|
49714
49782
|
return [nowStruct.seconds, nowStruct.nanos];
|
|
49715
49783
|
}
|
|
49716
|
-
reset() {
|
|
49784
|
+
reset() {
|
|
49785
|
+
}
|
|
49717
49786
|
}
|
|
49718
49787
|
|
|
49719
49788
|
// node_modules/@trigger.dev/core/dist/esm/v3/clock/index.js
|
|
@@ -49722,7 +49791,8 @@ var SIMPLE_CLOCK = new SimpleClock;
|
|
|
49722
49791
|
|
|
49723
49792
|
class ClockAPI {
|
|
49724
49793
|
static _instance;
|
|
49725
|
-
constructor() {
|
|
49794
|
+
constructor() {
|
|
49795
|
+
}
|
|
49726
49796
|
static getInstance() {
|
|
49727
49797
|
if (!this._instance) {
|
|
49728
49798
|
this._instance = new ClockAPI;
|
|
@@ -49748,7 +49818,8 @@ var clock = ClockAPI.getInstance();
|
|
|
49748
49818
|
|
|
49749
49819
|
// node_modules/@trigger.dev/core/dist/esm/v3/usage/noopUsageManager.js
|
|
49750
49820
|
class NoopUsageManager {
|
|
49751
|
-
disable() {
|
|
49821
|
+
disable() {
|
|
49822
|
+
}
|
|
49752
49823
|
start() {
|
|
49753
49824
|
return {
|
|
49754
49825
|
sample: () => ({ cpuTime: 0, wallTime: 0 })
|
|
@@ -49771,7 +49842,8 @@ var NOOP_USAGE_MANAGER = new NoopUsageManager;
|
|
|
49771
49842
|
|
|
49772
49843
|
class UsageAPI {
|
|
49773
49844
|
static _instance;
|
|
49774
|
-
constructor() {
|
|
49845
|
+
constructor() {
|
|
49846
|
+
}
|
|
49775
49847
|
static getInstance() {
|
|
49776
49848
|
if (!this._instance) {
|
|
49777
49849
|
this._instance = new UsageAPI;
|
|
@@ -49831,7 +49903,8 @@ class NoopRunMetadataManager {
|
|
|
49831
49903
|
refresh(requestOptions) {
|
|
49832
49904
|
throw new Error("Method not implemented.");
|
|
49833
49905
|
}
|
|
49834
|
-
enterWithMetadata(metadata) {
|
|
49906
|
+
enterWithMetadata(metadata) {
|
|
49907
|
+
}
|
|
49835
49908
|
current() {
|
|
49836
49909
|
throw new Error("Method not implemented.");
|
|
49837
49910
|
}
|
|
@@ -49887,7 +49960,8 @@ var NOOP_MANAGER = new NoopRunMetadataManager;
|
|
|
49887
49960
|
|
|
49888
49961
|
class RunMetadataAPI {
|
|
49889
49962
|
static _instance;
|
|
49890
|
-
constructor() {
|
|
49963
|
+
constructor() {
|
|
49964
|
+
}
|
|
49891
49965
|
static getInstance() {
|
|
49892
49966
|
if (!this._instance) {
|
|
49893
49967
|
this._instance = new RunMetadataAPI;
|
|
@@ -49972,7 +50046,8 @@ var NOOP_TIMEOUT_MANAGER = new NoopTimeoutManager;
|
|
|
49972
50046
|
|
|
49973
50047
|
class TimeoutAPI {
|
|
49974
50048
|
static _instance;
|
|
49975
|
-
constructor() {
|
|
50049
|
+
constructor() {
|
|
50050
|
+
}
|
|
49976
50051
|
static getInstance() {
|
|
49977
50052
|
if (!this._instance) {
|
|
49978
50053
|
this._instance = new TimeoutAPI;
|
|
@@ -50376,7 +50451,8 @@ function getTokenPayload(e2) {
|
|
|
50376
50451
|
return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
|
|
50377
50452
|
}).join(""));
|
|
50378
50453
|
return JSON.parse(t2) || {};
|
|
50379
|
-
} catch (e3) {
|
|
50454
|
+
} catch (e3) {
|
|
50455
|
+
}
|
|
50380
50456
|
return {};
|
|
50381
50457
|
}
|
|
50382
50458
|
function isTokenExpired(e2, t2 = 0) {
|
|
@@ -50430,7 +50506,8 @@ class BaseAuthStore {
|
|
|
50430
50506
|
let n = {};
|
|
50431
50507
|
try {
|
|
50432
50508
|
n = JSON.parse(s2), (typeof n === null || typeof n != "object" || Array.isArray(n)) && (n = {});
|
|
50433
|
-
} catch (e3) {
|
|
50509
|
+
} catch (e3) {
|
|
50510
|
+
}
|
|
50434
50511
|
this.save(n.token || "", n.record || n.model || null);
|
|
50435
50512
|
}
|
|
50436
50513
|
exportToCookie(e2, t2 = i) {
|
|
@@ -50577,7 +50654,8 @@ class RealtimeService extends BaseService {
|
|
|
50577
50654
|
let i3;
|
|
50578
50655
|
try {
|
|
50579
50656
|
i3 = JSON.parse(s3?.data);
|
|
50580
|
-
} catch {
|
|
50657
|
+
} catch {
|
|
50658
|
+
}
|
|
50581
50659
|
t2(i3 || {});
|
|
50582
50660
|
};
|
|
50583
50661
|
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);
|
|
@@ -51290,7 +51368,8 @@ class Client {
|
|
|
51290
51368
|
let s3 = {};
|
|
51291
51369
|
try {
|
|
51292
51370
|
s3 = await e3.json();
|
|
51293
|
-
} catch (e4) {
|
|
51371
|
+
} catch (e4) {
|
|
51372
|
+
}
|
|
51294
51373
|
if (this.afterSend && (s3 = await this.afterSend(e3, s3, t2)), e3.status >= 400)
|
|
51295
51374
|
throw new ClientResponseError({ url: e3.url, status: e3.status, data: s3 });
|
|
51296
51375
|
return s3;
|
|
@@ -51922,6 +52001,91 @@ class AppDatabase {
|
|
|
51922
52001
|
}
|
|
51923
52002
|
return null;
|
|
51924
52003
|
}
|
|
52004
|
+
async getBotViewInstance(payload) {
|
|
52005
|
+
const { asset, main_account } = payload;
|
|
52006
|
+
const bot_instances = await this.pb.collection("bot_view").getFullList({
|
|
52007
|
+
filter: `main_symbol:lower="${asset.toLowerCase()}" && main_account.owner:lower="${main_account.owner.toLowerCase()}" && main_account.exchange:lower="${main_account.exchange.toLowerCase()}"`,
|
|
52008
|
+
expand: "main_account,secondary_account,main_long_strategy,main_short_strategy,secondary_long_strategy,secondary_short_strategy"
|
|
52009
|
+
});
|
|
52010
|
+
if (bot_instances.length > 0) {
|
|
52011
|
+
const instance = bot_instances[0];
|
|
52012
|
+
const {
|
|
52013
|
+
main_account: main_account2,
|
|
52014
|
+
secondary_account,
|
|
52015
|
+
main_long_strategy,
|
|
52016
|
+
main_short_strategy,
|
|
52017
|
+
secondary_long_strategy,
|
|
52018
|
+
secondary_short_strategy
|
|
52019
|
+
} = instance.expand;
|
|
52020
|
+
return {
|
|
52021
|
+
...instance,
|
|
52022
|
+
main: {
|
|
52023
|
+
account: main_account2,
|
|
52024
|
+
symbol: instance.main_symbol,
|
|
52025
|
+
strategy: {
|
|
52026
|
+
long: main_long_strategy,
|
|
52027
|
+
short: main_short_strategy
|
|
52028
|
+
},
|
|
52029
|
+
position: {
|
|
52030
|
+
long: instance.main_long_position,
|
|
52031
|
+
short: instance.main_short_position
|
|
52032
|
+
}
|
|
52033
|
+
},
|
|
52034
|
+
secondary: {
|
|
52035
|
+
account: secondary_account,
|
|
52036
|
+
symbol: instance.secondary_symbol,
|
|
52037
|
+
strategy: {
|
|
52038
|
+
long: secondary_long_strategy,
|
|
52039
|
+
short: secondary_short_strategy
|
|
52040
|
+
},
|
|
52041
|
+
position: {
|
|
52042
|
+
long: instance.secondary_long_position,
|
|
52043
|
+
short: instance.secondary_short_position
|
|
52044
|
+
}
|
|
52045
|
+
}
|
|
52046
|
+
};
|
|
52047
|
+
}
|
|
52048
|
+
return null;
|
|
52049
|
+
}
|
|
52050
|
+
async getBotInstance(payload) {
|
|
52051
|
+
const { asset, main_account } = payload;
|
|
52052
|
+
const bot_instances = await this.pb.collection("bot_instances").getFullList({
|
|
52053
|
+
filter: `asset:lower="${asset.toLowerCase()}" && main_account.owner:lower="${main_account.owner.toLowerCase()}" && main_account.exchange:lower="${main_account.exchange.toLowerCase()}"`
|
|
52054
|
+
});
|
|
52055
|
+
if (bot_instances.length > 0) {
|
|
52056
|
+
return bot_instances[0];
|
|
52057
|
+
}
|
|
52058
|
+
return null;
|
|
52059
|
+
}
|
|
52060
|
+
async getBotState(payload) {
|
|
52061
|
+
const { asset, main_account, running } = payload;
|
|
52062
|
+
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()}"`;
|
|
52063
|
+
if (running !== undefined) {
|
|
52064
|
+
filter += ` && running=${running}`;
|
|
52065
|
+
}
|
|
52066
|
+
const bot_states = await this.pb.collection("bot_states").getFullList({
|
|
52067
|
+
filter
|
|
52068
|
+
});
|
|
52069
|
+
return bot_states;
|
|
52070
|
+
}
|
|
52071
|
+
async getBotOrderHistories(payload) {
|
|
52072
|
+
const { asset, main_account, symbol, kind, type } = payload;
|
|
52073
|
+
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()}"`;
|
|
52074
|
+
if (symbol) {
|
|
52075
|
+
filter += ` && symbol:lower="${symbol.toLowerCase()}"`;
|
|
52076
|
+
}
|
|
52077
|
+
if (kind) {
|
|
52078
|
+
filter += ` && kind="${kind}"`;
|
|
52079
|
+
}
|
|
52080
|
+
if (type) {
|
|
52081
|
+
filter += ` && type="${type}"`;
|
|
52082
|
+
}
|
|
52083
|
+
const bot_order_histories = await this.pb.collection("bot_order_history").getFullList({
|
|
52084
|
+
filter,
|
|
52085
|
+
sort: "-created"
|
|
52086
|
+
});
|
|
52087
|
+
return bot_order_histories;
|
|
52088
|
+
}
|
|
51925
52089
|
async createOrUpdateWindingDownMarket(payload) {
|
|
51926
52090
|
const { symbol, risk_reward = 30 } = payload;
|
|
51927
52091
|
const existing_winding_down_market = await this.pb.collection("winding_down_markets").getFullList({
|
|
@@ -52594,7 +52758,8 @@ class Signal {
|
|
|
52594
52758
|
support: kind === "long" ? _stop_loss : this.support
|
|
52595
52759
|
};
|
|
52596
52760
|
const instance = new Signal(derivedConfig);
|
|
52597
|
-
if (kind === "short") {
|
|
52761
|
+
if (kind === "short") {
|
|
52762
|
+
}
|
|
52598
52763
|
let result = instance.get_bulk_trade_zones({ current_price, kind });
|
|
52599
52764
|
return result;
|
|
52600
52765
|
return result?.filter((x) => {
|
|
@@ -52812,7 +52977,8 @@ class Signal {
|
|
|
52812
52977
|
kind = "long",
|
|
52813
52978
|
raw
|
|
52814
52979
|
}) {
|
|
52815
|
-
if (raw) {
|
|
52980
|
+
if (raw) {
|
|
52981
|
+
}
|
|
52816
52982
|
const margin_range = this.get_margin_range(current_price, kind);
|
|
52817
52983
|
let margin_zones = this.get_margin_zones({ current_price });
|
|
52818
52984
|
let remaining_zones = margin_zones.filter((x) => JSON.stringify(x) != JSON.stringify(margin_range));
|
|
@@ -53023,7 +53189,8 @@ class Signal {
|
|
|
53023
53189
|
return true;
|
|
53024
53190
|
});
|
|
53025
53191
|
let total_orders = limit_trades.concat(market_trades);
|
|
53026
|
-
if (kind === "short") {
|
|
53192
|
+
if (kind === "short") {
|
|
53193
|
+
}
|
|
53027
53194
|
if (this.minimum_size && total_orders.length > 0) {
|
|
53028
53195
|
let payload = total_orders;
|
|
53029
53196
|
let greater_than_min_size = total_orders.filter((o) => o ? o.quantity >= this.minimum_size : true);
|
|
@@ -53109,7 +53276,8 @@ class Signal {
|
|
|
53109
53276
|
});
|
|
53110
53277
|
const multiplier = start - index;
|
|
53111
53278
|
const incurred_fees = fees.reduce((a, b) => a + b, 0) + previous_risks.reduce((a, b) => a + b, 0);
|
|
53112
|
-
if (index === 0) {
|
|
53279
|
+
if (index === 0) {
|
|
53280
|
+
}
|
|
53113
53281
|
let quantity = determine_position_size2({
|
|
53114
53282
|
entry,
|
|
53115
53283
|
stop,
|
|
@@ -53207,7 +53375,8 @@ function buildConfig(app_config, {
|
|
|
53207
53375
|
return [];
|
|
53208
53376
|
}
|
|
53209
53377
|
const condition = (kind === "long" ? entry > app_config.support : entry >= app_config.support) && stop >= app_config.support * 0.999;
|
|
53210
|
-
if (kind === "short") {
|
|
53378
|
+
if (kind === "short") {
|
|
53379
|
+
}
|
|
53211
53380
|
const result = entry === stop ? [] : condition ? instance.build_entry({
|
|
53212
53381
|
current_price: entry,
|
|
53213
53382
|
stop_loss: stop,
|
|
@@ -53912,6 +54081,12 @@ function calculate_factor(payload) {
|
|
|
53912
54081
|
calculated_factor = to_f2(calculated_factor, places);
|
|
53913
54082
|
return calculated_factor;
|
|
53914
54083
|
}
|
|
54084
|
+
function determineRewardFactor(payload) {
|
|
54085
|
+
const { quantity, avg_qty, minimum_pnl, risk } = payload;
|
|
54086
|
+
const reward_factor = minimum_pnl / risk;
|
|
54087
|
+
const quantity_ratio = quantity / avg_qty;
|
|
54088
|
+
return to_f2(reward_factor / quantity_ratio, "%.4f");
|
|
54089
|
+
}
|
|
53915
54090
|
|
|
53916
54091
|
// src/helpers/strategy.ts
|
|
53917
54092
|
class Strategy {
|
|
@@ -54386,8 +54561,11 @@ class Strategy {
|
|
|
54386
54561
|
}
|
|
54387
54562
|
}
|
|
54388
54563
|
};
|
|
54389
|
-
results.push(to_add);
|
|
54390
54564
|
const sell_kind = direction == "long" ? "short" : "long";
|
|
54565
|
+
if (sell_quantity[sell_kind] <= 0) {
|
|
54566
|
+
break;
|
|
54567
|
+
}
|
|
54568
|
+
results.push(to_add);
|
|
54391
54569
|
const remaining = this.to_df(params[sell_kind].quantity - sell_quantity[sell_kind]);
|
|
54392
54570
|
if (remaining <= 0) {
|
|
54393
54571
|
break;
|
|
@@ -54688,7 +54866,8 @@ async function createLimitPurchaseOrders(client, symbol, priceFormat, quantityFo
|
|
|
54688
54866
|
const splitOrders = (inputOrders) => {
|
|
54689
54867
|
const result = [];
|
|
54690
54868
|
for (const o of inputOrders) {
|
|
54691
|
-
if (o.take_profit) {
|
|
54869
|
+
if (o.take_profit) {
|
|
54870
|
+
}
|
|
54692
54871
|
if (o.stop && !o.side) {
|
|
54693
54872
|
result.push({
|
|
54694
54873
|
price: o.price,
|
|
@@ -55615,7 +55794,8 @@ async function createLimitPurchaseOrders2(client, symbol, priceFormat, quantityF
|
|
|
55615
55794
|
const splitOrders = (inputOrders) => {
|
|
55616
55795
|
const result = [];
|
|
55617
55796
|
for (const o of inputOrders) {
|
|
55618
|
-
if (o.take_profit) {
|
|
55797
|
+
if (o.take_profit) {
|
|
55798
|
+
}
|
|
55619
55799
|
if (o.stop && !o.side) {
|
|
55620
55800
|
result.push({
|
|
55621
55801
|
price: o.price,
|
|
@@ -56216,9 +56396,12 @@ class BybitExchange extends BaseExchange {
|
|
|
56216
56396
|
sellLeverage: payload.leverage.toString()
|
|
56217
56397
|
});
|
|
56218
56398
|
}
|
|
56219
|
-
async generateConfig(payload) {
|
|
56220
|
-
|
|
56221
|
-
async
|
|
56399
|
+
async generateConfig(payload) {
|
|
56400
|
+
}
|
|
56401
|
+
async checkDelistedMovers(payload) {
|
|
56402
|
+
}
|
|
56403
|
+
async closePosition(payload) {
|
|
56404
|
+
}
|
|
56222
56405
|
async getAllOpenSymbols() {
|
|
56223
56406
|
return [];
|
|
56224
56407
|
}
|
|
@@ -56243,8 +56426,10 @@ class BybitExchange extends BaseExchange {
|
|
|
56243
56426
|
async getDelistedSpotSymbols() {
|
|
56244
56427
|
return [];
|
|
56245
56428
|
}
|
|
56246
|
-
async crossAccountTransfer(payload) {
|
|
56247
|
-
|
|
56429
|
+
async crossAccountTransfer(payload) {
|
|
56430
|
+
}
|
|
56431
|
+
async placeMarketOrder(payload) {
|
|
56432
|
+
}
|
|
56248
56433
|
async rawCreateLimitPurchaseOrders(payload) {
|
|
56249
56434
|
const { symbol, orders, price_places, decimal_places } = payload;
|
|
56250
56435
|
return createLimitPurchaseOrders2(this.client, symbol, price_places, decimal_places, orders);
|
|
@@ -56252,7 +56437,8 @@ class BybitExchange extends BaseExchange {
|
|
|
56252
56437
|
getOpenOrders(payload) {
|
|
56253
56438
|
return getOpenOrders2(this.client, payload.symbol);
|
|
56254
56439
|
}
|
|
56255
|
-
async placeBadStopEntry(payload) {
|
|
56440
|
+
async placeBadStopEntry(payload) {
|
|
56441
|
+
}
|
|
56256
56442
|
}
|
|
56257
56443
|
|
|
56258
56444
|
// src/helpers/accounts.ts
|
|
@@ -57206,7 +57392,8 @@ class ExchangeAccount {
|
|
|
57206
57392
|
cancelExchangeOrders: this.cancelExchangeOrders.bind(this)
|
|
57207
57393
|
});
|
|
57208
57394
|
}
|
|
57209
|
-
if (all) {
|
|
57395
|
+
if (all) {
|
|
57396
|
+
} else {
|
|
57210
57397
|
if (!price) {
|
|
57211
57398
|
const position2 = await this.syncAccount({
|
|
57212
57399
|
symbol,
|
|
@@ -59081,7 +59268,12 @@ class ExchangeAccount {
|
|
|
59081
59268
|
reward_factor = strategy.reward_factor;
|
|
59082
59269
|
}
|
|
59083
59270
|
if (focus_position.avg_qty >= focus_position.quantity && strategy.max_reward_factor) {
|
|
59084
|
-
|
|
59271
|
+
if (strategy.dynamic) {
|
|
59272
|
+
const quantity_ratio = focus_position.quantity / focus_position.avg_qty;
|
|
59273
|
+
reward_factor = to_f2(quantity_ratio ** 2 * strategy.max_reward_factor, "%.2f");
|
|
59274
|
+
} else {
|
|
59275
|
+
reward_factor = to_f2(focus_position.quantity * strategy.max_reward_factor / focus_position.avg_qty, "%.4f");
|
|
59276
|
+
}
|
|
59085
59277
|
} else {
|
|
59086
59278
|
reward_factor = strategy.reward_factor;
|
|
59087
59279
|
}
|