@jango-blockchained/hoox-shared 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/analytics.d.ts +23 -2
- package/dist/analytics.d.ts.map +1 -1
- package/dist/analytics.js +14 -3
- package/dist/api-client.d.ts +12 -2
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +74 -7
- package/dist/colors.d.ts +63 -25
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +60 -20
- package/dist/config.d.ts +34 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +61 -6
- package/dist/cron-handler.d.ts +34 -0
- package/dist/cron-handler.d.ts.map +1 -0
- package/dist/cron-handler.js +48 -0
- package/dist/d1/index.js +50 -6
- package/dist/d1/repository.d.ts +5 -0
- package/dist/d1/repository.d.ts.map +1 -1
- package/dist/d1/repository.js +297 -0
- package/dist/d1/schemas.js +81 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +48 -5
- package/dist/exchanges/base-exchange-client.d.ts +68 -0
- package/dist/exchanges/base-exchange-client.d.ts.map +1 -0
- package/dist/exchanges/base-exchange-client.js +120 -0
- package/dist/exchanges/index.d.ts +3 -0
- package/dist/exchanges/index.d.ts.map +1 -0
- package/dist/exchanges/index.js +120 -0
- package/dist/exchanges/types.d.ts +19 -0
- package/dist/exchanges/types.d.ts.map +1 -0
- package/dist/exchanges/types.js +1 -0
- package/dist/health.js +48 -5
- package/dist/index.d.ts +30 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1058 -73
- package/dist/kvUtils.js +48 -5
- package/dist/middleware/auth.d.ts +46 -7
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +151 -0
- package/dist/middleware/cors.d.ts +28 -2
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/cors.js +77 -0
- package/dist/middleware/index.d.ts +2 -2
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +361 -101
- package/dist/middleware/logger.d.ts +2 -1
- package/dist/middleware/logger.d.ts.map +1 -1
- package/dist/middleware/logger.js +202 -0
- package/dist/middleware/rate-limit.d.ts +3 -1
- package/dist/middleware/rate-limit.d.ts.map +1 -1
- package/dist/middleware/rate-limit.js +181 -0
- package/dist/middleware/security-headers.js +58 -0
- package/dist/middleware/validate.js +56 -0
- package/dist/operator-transport.d.ts +61 -0
- package/dist/operator-transport.d.ts.map +1 -0
- package/dist/operator-transport.js +87 -0
- package/dist/path-utils.d.ts +205 -0
- package/dist/path-utils.d.ts.map +1 -0
- package/dist/path-utils.js +188 -0
- package/dist/queue-handler.d.ts +43 -0
- package/dist/queue-handler.d.ts.map +1 -0
- package/dist/queue-handler.js +46 -0
- package/dist/router.d.ts +2 -2
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +15 -8
- package/dist/schemas/index.js +7 -4
- package/dist/schemas/registry.js +387 -0
- package/dist/schemas/types.js +1 -0
- package/dist/schemas/validators.d.ts.map +1 -1
- package/dist/schemas/validators.js +290 -0
- package/dist/service-bindings.d.ts +68 -26
- package/dist/service-bindings.d.ts.map +1 -1
- package/dist/service-bindings.js +219 -2
- package/dist/session.d.ts +9 -5
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +179 -4
- package/dist/sse.d.ts +12 -3
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js +70 -7
- package/dist/stores/config-store.d.ts.map +1 -1
- package/dist/stores/config-store.js +129 -6
- package/dist/stores/service-store.d.ts +50 -1
- package/dist/stores/service-store.d.ts.map +1 -1
- package/dist/stores/service-store.js +162 -27
- package/dist/test-utils.d.ts +132 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +128 -0
- package/dist/types/router.d.ts +18 -8
- package/dist/types/router.d.ts.map +1 -1
- package/dist/types.d.ts +124 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -0
- package/dist/wizard/engine.d.ts.map +1 -1
- package/dist/wizard/engine.js +501 -0
- package/dist/wizard/index.js +2 -1
- package/dist/wizard/persistence.js +31 -0
- package/dist/wizard/presets.js +199 -0
- package/dist/wizard/provisioner.js +1 -0
- package/dist/wizard/types.js +1 -0
- package/package.json +46 -12
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// src/exchanges/base-exchange-client.ts
|
|
19
|
+
class BaseExchangeClient {
|
|
20
|
+
apiKey;
|
|
21
|
+
apiSecret;
|
|
22
|
+
baseUrl;
|
|
23
|
+
isTestnet;
|
|
24
|
+
importedKeyPromise;
|
|
25
|
+
constructor(apiKey, apiSecret) {
|
|
26
|
+
if (!apiKey || !apiSecret) {
|
|
27
|
+
throw new Error(this.getErrorMessagePrefix() + "API key and secret are required.");
|
|
28
|
+
}
|
|
29
|
+
this.apiKey = apiKey;
|
|
30
|
+
this.apiSecret = apiSecret;
|
|
31
|
+
this.baseUrl = this.getDefaultBaseUrl();
|
|
32
|
+
this.isTestnet = false;
|
|
33
|
+
this.importedKeyPromise = this.importKey();
|
|
34
|
+
}
|
|
35
|
+
getErrorMessagePrefix() {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
generateSignature(_params) {
|
|
39
|
+
throw new Error("generateSignature must be implemented by subclass");
|
|
40
|
+
}
|
|
41
|
+
buildHeaders(_method, _path, _params) {
|
|
42
|
+
return new Headers;
|
|
43
|
+
}
|
|
44
|
+
async importKey() {
|
|
45
|
+
const encoder = new TextEncoder;
|
|
46
|
+
return crypto.subtle.importKey("raw", encoder.encode(this.apiSecret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
47
|
+
}
|
|
48
|
+
async cryptoSign(data) {
|
|
49
|
+
const encoder = new TextEncoder;
|
|
50
|
+
const key = await this.importedKeyPromise;
|
|
51
|
+
const signature = await crypto.subtle.sign("HMAC", key, encoder.encode(data));
|
|
52
|
+
return Array.from(new Uint8Array(signature)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
53
|
+
}
|
|
54
|
+
async fetch(method, path, params) {
|
|
55
|
+
const url = `${this.baseUrl}${path}`;
|
|
56
|
+
const headers = this.buildHeaders(method, path, params);
|
|
57
|
+
const body = params ? new URLSearchParams(params).toString() : undefined;
|
|
58
|
+
const response = await fetch(url, {
|
|
59
|
+
method,
|
|
60
|
+
headers,
|
|
61
|
+
body: method !== "GET" ? body : undefined
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const error = await response.text();
|
|
65
|
+
throw new Error(`Exchange API error: ${response.status} - ${error}`);
|
|
66
|
+
}
|
|
67
|
+
return response.json();
|
|
68
|
+
}
|
|
69
|
+
setLeverage(_symbol, _leverage) {
|
|
70
|
+
throw new Error("setLeverage must be implemented by subclass");
|
|
71
|
+
}
|
|
72
|
+
executeTrade(_params) {
|
|
73
|
+
throw new Error("executeTrade must be implemented by subclass");
|
|
74
|
+
}
|
|
75
|
+
getAccountInfo() {
|
|
76
|
+
throw new Error("getAccountInfo must be implemented by subclass");
|
|
77
|
+
}
|
|
78
|
+
getPositions(_symbol) {
|
|
79
|
+
throw new Error("getPositions must be implemented by subclass");
|
|
80
|
+
}
|
|
81
|
+
async openLong(symbol, quantity, price, orderType = "MARKET") {
|
|
82
|
+
return this.executeTrade({
|
|
83
|
+
symbol,
|
|
84
|
+
side: "BUY",
|
|
85
|
+
orderType,
|
|
86
|
+
quantity,
|
|
87
|
+
price
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async openShort(symbol, quantity, price, orderType = "MARKET") {
|
|
91
|
+
return this.executeTrade({
|
|
92
|
+
symbol,
|
|
93
|
+
side: "SELL",
|
|
94
|
+
orderType,
|
|
95
|
+
quantity,
|
|
96
|
+
price
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async closeLong(symbol, quantity) {
|
|
100
|
+
return this.executeTrade({
|
|
101
|
+
symbol,
|
|
102
|
+
side: "SELL",
|
|
103
|
+
orderType: "MARKET",
|
|
104
|
+
quantity,
|
|
105
|
+
reduceOnly: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async closeShort(symbol, quantity) {
|
|
109
|
+
return this.executeTrade({
|
|
110
|
+
symbol,
|
|
111
|
+
side: "BUY",
|
|
112
|
+
orderType: "MARKET",
|
|
113
|
+
quantity,
|
|
114
|
+
reduceOnly: true
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
BaseExchangeClient
|
|
120
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exchanges/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// src/exchanges/base-exchange-client.ts
|
|
19
|
+
class BaseExchangeClient {
|
|
20
|
+
apiKey;
|
|
21
|
+
apiSecret;
|
|
22
|
+
baseUrl;
|
|
23
|
+
isTestnet;
|
|
24
|
+
importedKeyPromise;
|
|
25
|
+
constructor(apiKey, apiSecret) {
|
|
26
|
+
if (!apiKey || !apiSecret) {
|
|
27
|
+
throw new Error(this.getErrorMessagePrefix() + "API key and secret are required.");
|
|
28
|
+
}
|
|
29
|
+
this.apiKey = apiKey;
|
|
30
|
+
this.apiSecret = apiSecret;
|
|
31
|
+
this.baseUrl = this.getDefaultBaseUrl();
|
|
32
|
+
this.isTestnet = false;
|
|
33
|
+
this.importedKeyPromise = this.importKey();
|
|
34
|
+
}
|
|
35
|
+
getErrorMessagePrefix() {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
generateSignature(_params) {
|
|
39
|
+
throw new Error("generateSignature must be implemented by subclass");
|
|
40
|
+
}
|
|
41
|
+
buildHeaders(_method, _path, _params) {
|
|
42
|
+
return new Headers;
|
|
43
|
+
}
|
|
44
|
+
async importKey() {
|
|
45
|
+
const encoder = new TextEncoder;
|
|
46
|
+
return crypto.subtle.importKey("raw", encoder.encode(this.apiSecret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
47
|
+
}
|
|
48
|
+
async cryptoSign(data) {
|
|
49
|
+
const encoder = new TextEncoder;
|
|
50
|
+
const key = await this.importedKeyPromise;
|
|
51
|
+
const signature = await crypto.subtle.sign("HMAC", key, encoder.encode(data));
|
|
52
|
+
return Array.from(new Uint8Array(signature)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
53
|
+
}
|
|
54
|
+
async fetch(method, path, params) {
|
|
55
|
+
const url = `${this.baseUrl}${path}`;
|
|
56
|
+
const headers = this.buildHeaders(method, path, params);
|
|
57
|
+
const body = params ? new URLSearchParams(params).toString() : undefined;
|
|
58
|
+
const response = await fetch(url, {
|
|
59
|
+
method,
|
|
60
|
+
headers,
|
|
61
|
+
body: method !== "GET" ? body : undefined
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const error = await response.text();
|
|
65
|
+
throw new Error(`Exchange API error: ${response.status} - ${error}`);
|
|
66
|
+
}
|
|
67
|
+
return response.json();
|
|
68
|
+
}
|
|
69
|
+
setLeverage(_symbol, _leverage) {
|
|
70
|
+
throw new Error("setLeverage must be implemented by subclass");
|
|
71
|
+
}
|
|
72
|
+
executeTrade(_params) {
|
|
73
|
+
throw new Error("executeTrade must be implemented by subclass");
|
|
74
|
+
}
|
|
75
|
+
getAccountInfo() {
|
|
76
|
+
throw new Error("getAccountInfo must be implemented by subclass");
|
|
77
|
+
}
|
|
78
|
+
getPositions(_symbol) {
|
|
79
|
+
throw new Error("getPositions must be implemented by subclass");
|
|
80
|
+
}
|
|
81
|
+
async openLong(symbol, quantity, price, orderType = "MARKET") {
|
|
82
|
+
return this.executeTrade({
|
|
83
|
+
symbol,
|
|
84
|
+
side: "BUY",
|
|
85
|
+
orderType,
|
|
86
|
+
quantity,
|
|
87
|
+
price
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async openShort(symbol, quantity, price, orderType = "MARKET") {
|
|
91
|
+
return this.executeTrade({
|
|
92
|
+
symbol,
|
|
93
|
+
side: "SELL",
|
|
94
|
+
orderType,
|
|
95
|
+
quantity,
|
|
96
|
+
price
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async closeLong(symbol, quantity) {
|
|
100
|
+
return this.executeTrade({
|
|
101
|
+
symbol,
|
|
102
|
+
side: "SELL",
|
|
103
|
+
orderType: "MARKET",
|
|
104
|
+
quantity,
|
|
105
|
+
reduceOnly: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async closeShort(symbol, quantity) {
|
|
109
|
+
return this.executeTrade({
|
|
110
|
+
symbol,
|
|
111
|
+
side: "BUY",
|
|
112
|
+
orderType: "MARKET",
|
|
113
|
+
quantity,
|
|
114
|
+
reduceOnly: true
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
BaseExchangeClient
|
|
120
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type SupportedExchange = "binance" | "bybit" | "mexc";
|
|
2
|
+
export interface ExchangeOrder {
|
|
3
|
+
orderId: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
side: "BUY" | "SELL";
|
|
6
|
+
quantity: number;
|
|
7
|
+
price?: number;
|
|
8
|
+
leverage?: number;
|
|
9
|
+
status: "PENDING" | "FILLED" | "CANCELED" | "FAILED";
|
|
10
|
+
}
|
|
11
|
+
export interface ExchangePosition {
|
|
12
|
+
symbol: string;
|
|
13
|
+
quantity: number;
|
|
14
|
+
leverage: number;
|
|
15
|
+
markPrice: number;
|
|
16
|
+
unrealizedPnl: number;
|
|
17
|
+
side: "LONG" | "SHORT";
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exchanges/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;CACtD;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
package/dist/health.js
CHANGED
|
@@ -32,22 +32,65 @@ function toError(err, fallback = "Unknown error") {
|
|
|
32
32
|
return fallback;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
var SENSITIVE_FIELDS = new Set([
|
|
36
|
+
"password",
|
|
37
|
+
"token",
|
|
38
|
+
"secret",
|
|
39
|
+
"api_key",
|
|
40
|
+
"apiKey",
|
|
41
|
+
"authorization"
|
|
42
|
+
]);
|
|
43
|
+
function hasSensitiveFields(obj) {
|
|
44
|
+
for (const key of Object.keys(obj)) {
|
|
45
|
+
if (SENSITIVE_FIELDS.has(key))
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
function hasErrorValues(obj) {
|
|
51
|
+
for (const v of Object.values(obj)) {
|
|
52
|
+
if (v instanceof Error)
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
35
57
|
function sanitizeOutput(data) {
|
|
58
|
+
if (data === null || data === undefined)
|
|
59
|
+
return data;
|
|
60
|
+
const t = typeof data;
|
|
61
|
+
if (t === "string" || t === "number" || t === "boolean")
|
|
62
|
+
return data;
|
|
36
63
|
if (data instanceof Error) {
|
|
37
64
|
return { name: data.name, message: data.message };
|
|
38
65
|
}
|
|
39
|
-
if (
|
|
66
|
+
if (Array.isArray(data)) {
|
|
67
|
+
return data.map(sanitizeOutput);
|
|
68
|
+
}
|
|
69
|
+
if (t === "object") {
|
|
70
|
+
const obj = data;
|
|
71
|
+
const keys = Object.keys(obj);
|
|
72
|
+
if (keys.length < 10) {
|
|
73
|
+
const sanitized2 = {};
|
|
74
|
+
for (const k of keys) {
|
|
75
|
+
if (k === "stack" || k === "cause")
|
|
76
|
+
continue;
|
|
77
|
+
const v = obj[k];
|
|
78
|
+
sanitized2[k] = v instanceof Error ? { name: v.name, message: v.message } : sanitizeOutput(v);
|
|
79
|
+
}
|
|
80
|
+
return sanitized2;
|
|
81
|
+
}
|
|
82
|
+
if (!hasSensitiveFields(obj) && !hasErrorValues(obj)) {
|
|
83
|
+
return obj;
|
|
84
|
+
}
|
|
40
85
|
const sanitized = {};
|
|
41
|
-
for (const
|
|
86
|
+
for (const k of keys) {
|
|
42
87
|
if (k === "stack" || k === "cause")
|
|
43
88
|
continue;
|
|
89
|
+
const v = obj[k];
|
|
44
90
|
sanitized[k] = v instanceof Error ? { name: v.name, message: v.message } : sanitizeOutput(v);
|
|
45
91
|
}
|
|
46
92
|
return sanitized;
|
|
47
93
|
}
|
|
48
|
-
if (Array.isArray(data)) {
|
|
49
|
-
return data.map(sanitizeOutput);
|
|
50
|
-
}
|
|
51
94
|
return data;
|
|
52
95
|
}
|
|
53
96
|
function createJsonResponse(data, status = 200) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,37 +1,56 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @hoox/shared — Shared module for HOOX
|
|
2
|
+
* @hoox/shared — Shared module for HOOX (Open Core)
|
|
3
3
|
*
|
|
4
4
|
* Barrel export: re-exports all shared utilities, types, stores, and TUI helpers.
|
|
5
|
+
*
|
|
6
|
+
* This package is part of the **Open Core**.
|
|
7
|
+
* Enterprise-only extensions (advanced multi-tenancy, billing, proprietary features)
|
|
8
|
+
* live in a separate closed-source repository.
|
|
9
|
+
*
|
|
10
|
+
* See: /OPEN_CORE.md and /OPEN_CORE_FEATURE_SPLIT.md
|
|
5
11
|
*/
|
|
6
12
|
export { COPYRIGHT, TRADEMARKS, TRADEMARK_NOTICE, DISCLAIMER, FULL_LEGAL_NOTICE, DISCLAIMER_HEADER, } from "./legal";
|
|
7
13
|
export type { StandardResponse, ApiSuccessResponse, ApiErrorResponse, ApiResponse, WorkerServiceBinding, WorkerD1Binding, WorkerSecretsStoreBinding, WorkerQueueConfig, HousekeepingCheck, HousekeepingPayload, HousekeepingSummary, SettingsPayload, ProcessRequestBody, BaseEnv, Result, } from "./types";
|
|
8
|
-
export { TradeActionSchema, WebhookPayloadSchema, TradeSignalSchema, PositionSchema, BalanceSchema, } from "./types";
|
|
9
|
-
export type { TradeAction, WebhookPayload, TradeSignal } from "./types";
|
|
14
|
+
export { TradeActionSchema, WebhookPayloadSchema, TradeQueueMessageSchema, TradeSignalSchema, PositionSchema, BalanceSchema, } from "./types";
|
|
15
|
+
export type { TradeAction, WebhookPayload, TradeQueueMessage, TradeSignal, } from "./types";
|
|
10
16
|
export { KVKeys } from "./kvKeys";
|
|
11
17
|
export { toError, Errors, createJsonResponse, createSuccessResponse, createErrorResponse, } from "./errors";
|
|
12
|
-
export {
|
|
18
|
+
export { ExchangeRouter } from "./exchange-client";
|
|
13
19
|
export type { ExchangeName, ExchangeConfig, TradeParams, OrderResponse, Position, IExchangeProvider, } from "./exchange-client";
|
|
20
|
+
export { BaseExchangeClient } from "./exchanges";
|
|
21
|
+
export type { SupportedExchange } from "./exchanges";
|
|
14
22
|
export { logKvTimestamp, headersToObject } from "./kvUtils";
|
|
15
23
|
export type { EnvWithKV } from "./kvUtils";
|
|
16
24
|
export { trackAnalytics } from "./analytics";
|
|
17
25
|
export type { AnalyticsEnv } from "./analytics";
|
|
18
26
|
export { healthCheck } from "./health";
|
|
19
27
|
export type { HealthCheckOptions } from "./health";
|
|
28
|
+
export { createQueueHandler } from "./queue-handler";
|
|
29
|
+
export type { QueueHandlerOptions } from "./queue-handler";
|
|
30
|
+
export { createCronHandler } from "./cron-handler";
|
|
31
|
+
export type { CronHandlerOptions } from "./cron-handler";
|
|
20
32
|
export { D1Repository } from "./d1/index";
|
|
21
|
-
export { serviceFetch } from "./service-bindings";
|
|
33
|
+
export { serviceFetch, authenticatedServiceFetch, ServiceAuthError, InternalAuthKeyFields, D1_READ_AUTH_KEY_FIELDS, D1_WRITE_AUTH_KEY_FIELDS, TRADE_EXECUTE_AUTH_KEY_FIELDS, TRADE_READ_AUTH_KEY_FIELDS, TELEGRAM_ALERT_AUTH_KEY_FIELDS, WALLET_EXECUTE_AUTH_KEY_FIELDS, DASHBOARD_D1_READ_AUTH_KEY_FIELDS, DASHBOARD_TRADE_EXECUTE_AUTH_KEY_FIELDS, DASHBOARD_TELEGRAM_ALERT_AUTH_KEY_FIELDS, resolveInternalAuthKey, } from "./service-bindings";
|
|
34
|
+
export type { AuthenticatedServiceEnv } from "./service-bindings";
|
|
22
35
|
export type { TradeRecord, PositionRecord, BalanceRecord, SystemLogRecord, TradeSignalRecord, D1QueryResult, BatchStatement, } from "./d1/index";
|
|
23
|
-
export
|
|
24
|
-
export
|
|
36
|
+
export * from "./test-utils";
|
|
37
|
+
export { Colors, CoolBracketPalette, ConnectionStatusColor, WorkerStatusColor, LogLevelColor, AlertSeverityColor, } from "./colors";
|
|
38
|
+
export type { ColorKey, CoolBracketColor, ConnectionStatusKey, WorkerStatusKey, LogLevelColorKey, AlertSeverityColorKey, } from "./colors";
|
|
25
39
|
export { formatNumber, formatCurrency, formatCompactCurrency, formatDuration, formatDurationCompact, formatTimestamp, formatRelativeTime, formatPercent, formatUptime, formatLatency, formatRequests, formatMemory, formatCpu, } from "./formatters";
|
|
26
|
-
export { readConfigSync, readConfig, writeConfigSync, writeConfig, validateConfig, } from "./config";
|
|
27
|
-
export type { HooxConfig } from "./config";
|
|
40
|
+
export { readConfigSync, readConfig, writeConfigSync, writeConfig, validateConfig, ensureHooxDirSecure, writeSecureFileSync, isUnixModeGroupOrWorldAccessible, isConfigWorldOrGroupReadable, formatConfigPermissionWarning, HOOX_DIR_MODE, HOOX_CONFIG_FILE_MODE, } from "./config";
|
|
41
|
+
export type { HooxConfig, HooxConfigTransport } from "./config";
|
|
28
42
|
export { hooxFetch, WorkerAPIError } from "./api-client";
|
|
43
|
+
export type { HooxFetchOptions } from "./api-client";
|
|
29
44
|
export { subscribeSSE } from "./sse";
|
|
30
|
-
export type { SSECallback, SSEStatusCallback } from "./sse";
|
|
45
|
+
export type { SSECallback, SSEStatusCallback, SubscribeSSEOptions, } from "./sse";
|
|
46
|
+
export { resolveOperatorTransportProfile, buildOperatorAuthHeaders, hasOperatorClientCredentials, operatorUrl, } from "./operator-transport";
|
|
47
|
+
export type { OperatorTransport, OperatorTransportProfile, OperatorTransportEnv, ResolveOperatorTransportOptions, } from "./operator-transport";
|
|
31
48
|
export { restoreSession, saveSession } from "./session";
|
|
32
49
|
export type { SessionState } from "./session";
|
|
33
50
|
export { formatRelativeTime as formatRelativeTimeFromTime } from "./format-time";
|
|
34
|
-
export type { ViewId, ModalState, WorkerStatus, WorkerInfo, TradeSide, Trade, AlertSeverity, Alert, LogLevel, LogEntry, SystemMetrics, ConnectionStatus, LogFilter, NotificationPreferences, } from "./types";
|
|
51
|
+
export type { ViewId, ModalState, WorkerStatus, WorkerInfo, TradeSide, Trade, AlertSeverity, Alert, LogLevel, LogEntry, SystemMetrics, ConnectionStatus, LogFilter, NotificationPreferences, CliErrorType, CliErrorDetails, } from "./types";
|
|
52
|
+
export { getHooxHome, resolveHooxPath, isWithinHooxHome, getRelativeHooxPath, getHooxRepoPath, getHooxConfigDir, getHooxDataDir, getHooxWranglerPath, getHooxStatePath, isHooxSetupRoot, findHooxSetupRoot, resolveHooxRuntimeRoot, getTuiEntryCandidates, } from "./path-utils";
|
|
53
|
+
export type { HooxPath, RuntimeRootSource, RuntimeRootResult, } from "./path-utils";
|
|
35
54
|
export type { StepId, WorkerPresetName, WorkerPreset, WorkerConfig, WorkersJsonConfig, IntegratedService, ProvisioningPlan, ProvisionResult, WizardCloudflareConfig, WizardState, StepDefinition, } from "./wizard";
|
|
36
55
|
export type { Provisioner } from "./wizard";
|
|
37
56
|
export { WizardEngine, PRESETS, WORKER_DEPENDENCIES, INTEGRATIONS, resolveDependencies, serializeState, deserializeState, WIZARD_STATE_PATH, } from "./wizard";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAIjB,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,aAAa,EACb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