dexbot 1.6.17 → 1.7.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/CHANGELOG.md +58 -0
- package/README.md +24 -18
- package/analysis/README.md +105 -12
- package/analysis/ama_fitting/README.md +2 -2
- package/analysis/bot_fitting/README.md +3 -3
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/analyze_args.d.ts +2 -1
- package/dist/analysis/analyze_dynamic_weight.js +2 -1
- package/dist/analysis/analyze_kalman.js +3 -2
- package/dist/analysis/analyze_liquidity.d.ts +17 -0
- package/dist/analysis/analyze_liquidity.js +325 -0
- package/dist/analysis/analyze_regime.js +3 -2
- package/dist/analysis/analyze_regime_windows.js +3 -2
- package/dist/analysis/analyze_volatility.js +3 -2
- package/dist/analysis/fills_source.d.ts +1 -8
- package/dist/analysis/fills_source.js +1 -1
- package/dist/analysis/grid_correction_check.d.ts +9 -6
- package/dist/analysis/grid_correction_check.js +56 -64
- package/dist/analysis/liquidity/liquidity_chain.d.ts +66 -0
- package/dist/analysis/liquidity/liquidity_chain.js +178 -0
- package/dist/analysis/liquidity/liquidity_chart_generator.d.ts +19 -0
- package/dist/analysis/liquidity/liquidity_chart_generator.js +523 -0
- package/dist/analysis/liquidity/liquidity_depth_model.d.ts +141 -0
- package/dist/analysis/liquidity/liquidity_depth_model.js +230 -0
- package/dist/analysis/liquidity/liquidity_view.d.ts +38 -0
- package/dist/analysis/liquidity/liquidity_view.js +55 -0
- package/dist/analysis/math_utils.d.ts +1 -1
- package/dist/analysis/trade_profitability.d.ts +1 -1
- package/dist/analysis/trade_profitability.js +2 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +2 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +3 -3
- package/dist/analysis/trend_detection/huber_scale_variants.d.ts +4 -3
- package/dist/dexbot.js +74 -169
- package/dist/market_adapter/cli_args.d.ts +6 -1
- package/dist/market_adapter/cli_args.js +16 -2
- package/dist/market_adapter/core/kibana_candles.d.ts +5 -1
- package/dist/market_adapter/core/kibana_candles.js +3 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +7 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +3 -1
- package/dist/market_adapter/inputs/cex_candle_parsing.d.ts +7 -2
- package/dist/market_adapter/inputs/cex_candle_parsing.js +3 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts +7 -1
- package/dist/market_adapter/inputs/fetch_book_data.js +3 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -11
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +26 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +62 -52
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts +14 -2
- package/dist/market_adapter/inputs/kibana_feed_source.js +14 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +14 -3
- package/dist/market_adapter/inputs/window_cache.js +14 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +12 -9
- package/dist/market_adapter/lp_chart_runner.js +3 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +5 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +3 -1
- package/dist/market_adapter/market_adapter.d.ts +10 -2
- package/dist/market_adapter/market_adapter.js +10 -11
- package/dist/market_adapter/utils/chain.d.ts +2 -3
- package/dist/market_adapter/utils/file_json_cache.d.ts +5 -1
- package/dist/market_adapter/utils/file_json_cache.js +3 -1
- package/dist/market_adapter/utils/file_lock.js +1 -1
- package/dist/market_adapter/utils/native_history.d.ts +7 -3
- package/dist/market_adapter/utils/native_history.js +3 -1
- package/dist/market_adapter/utils/pair_orientation.d.ts +2 -2
- package/dist/modules/asset_lookup.d.ts +25 -0
- package/dist/modules/asset_lookup.js +75 -0
- package/dist/modules/bots_file_lock.d.ts +2 -2
- package/dist/modules/bots_file_lock.js +2 -2
- package/dist/modules/chain_scan.d.ts +64 -0
- package/dist/modules/chain_scan.js +80 -0
- package/dist/modules/cli_colors.d.ts +5 -0
- package/dist/modules/cli_colors.js +7 -0
- package/dist/modules/cli_progress.d.ts +51 -0
- package/dist/modules/cli_progress.js +113 -0
- package/dist/modules/constants.js +6 -3
- package/dist/modules/dexbot_class.d.ts +8 -0
- package/dist/modules/dexbot_class.js +10 -0
- package/dist/modules/dexbot_cow_runtime.d.ts +62 -1
- package/dist/modules/dexbot_cow_runtime.js +475 -47
- package/dist/modules/dexbot_credential_client.d.ts +5 -0
- package/dist/modules/dexbot_fill_runtime.js +20 -0
- package/dist/modules/dexbot_maintenance_runtime.js +71 -9
- package/dist/modules/dexbot_startup_runtime.js +7 -1
- package/dist/modules/graceful_shutdown.d.ts +2 -2
- package/dist/modules/graceful_shutdown.js +2 -2
- package/dist/modules/launcher/runtime_entry.d.ts +21 -1
- package/dist/modules/launcher/runtime_entry.js +36 -1
- package/dist/modules/launcher/runtime_mode.d.ts +4 -3
- package/dist/modules/liquidity_pool_ref.d.ts +32 -0
- package/dist/modules/liquidity_pool_ref.js +116 -0
- package/dist/modules/node_manager.d.ts +1 -1
- package/dist/modules/node_manager.js +1 -1
- package/dist/modules/order/accounting.js +2 -1
- package/dist/modules/order/export.d.ts +2 -2
- package/dist/modules/order/export.js +2 -2
- package/dist/modules/order/grid.d.ts +19 -14
- package/dist/modules/order/grid.js +269 -61
- package/dist/modules/order/grid_reconcile.js +27 -2
- package/dist/modules/order/grid_reconcile_internal.js +94 -15
- package/dist/modules/order/index.d.ts +24 -4
- package/dist/modules/order/manager.d.ts +12 -0
- package/dist/modules/order/manager.js +44 -11
- package/dist/modules/order/strategy.js +22 -2
- package/dist/modules/order/sync_engine.d.ts +32 -1
- package/dist/modules/order/sync_engine.js +209 -26
- package/dist/modules/order/utils/math.d.ts +26 -10
- package/dist/modules/order/utils/math.js +54 -14
- package/dist/modules/order/utils/order.d.ts +158 -11
- package/dist/modules/order/utils/order.js +434 -21
- package/dist/modules/order/utils/system.d.ts +136 -30
- package/dist/modules/order/utils/system.js +465 -63
- package/dist/modules/order/utils/validate.d.ts +1 -0
- package/dist/modules/order/utils/validate.js +37 -3
- package/dist/modules/storage/index.d.ts +3 -2
- package/dist/modules/storage/index.js +3 -2
- package/dist/modules/types.d.ts +14 -0
- package/dist/modules/utils/asset_symbols.d.ts +13 -2
- package/dist/modules/utils/asset_symbols.js +21 -2
- package/dist/scripts/analysis_runner.d.ts +10 -0
- package/dist/scripts/analysis_runner.js +33 -0
- package/dist/scripts/analyze-orders.js +2 -1
- package/dist/scripts/asset.d.ts +26 -0
- package/dist/scripts/asset.js +165 -0
- package/dist/scripts/bts_distribution.d.ts +1 -0
- package/dist/scripts/bts_distribution.js +194 -142
- package/dist/scripts/chart_command.d.ts +1 -1
- package/dist/scripts/chart_command.js +60 -86
- package/dist/scripts/chart_targets.d.ts +18 -0
- package/dist/scripts/chart_targets.js +52 -0
- package/dist/scripts/dw.js +1 -1
- package/dist/scripts/liquid.d.ts +24 -0
- package/dist/scripts/liquid.js +134 -0
- package/dist/scripts/rich_list.js +12 -16
- package/dist/scripts/token_distribution.d.ts +2 -0
- package/dist/scripts/token_distribution.js +132 -108
- package/dist/scripts/tv.js +1 -1
- package/dist/scripts/verify-browser-bundle.js +18 -0
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -1
- package/docs/COW_INVARIANTS.md +21 -11
- package/docs/DEXBOT_COMPARISON.md +6 -6
- package/docs/EVOLUTION.md +10 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +11 -11
- package/docs/GRID_PRICE_INVARIANT.md +28 -5
- package/docs/GRID_RECONCILE.md +25 -5
- package/docs/LIFECYCLE.md +11 -11
- package/docs/LOGGING.md +37 -2
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +124 -36
- package/docs/README.md +1 -1
- package/docs/WORKFLOW.md +3 -1
- package/docs/architecture.md +115 -13
- package/docs/developer_guide.md +12 -0
- package/market_adapter/README.md +9 -4
- package/modules/README.md +23 -15
- package/package.json +6 -3
- package/scripts/README.md +23 -7
|
@@ -41,6 +41,7 @@ import { shardStemFromName } from '../utils/month_shards.js';
|
|
|
41
41
|
import * as bitsharesClient from '../../modules/bitshares_client.js';
|
|
42
42
|
import { getErrorMessage, resolveSeamMs } from '../../modules/utils/errors.js';
|
|
43
43
|
import { isSameBotName } from '../../modules/utils/sanitize_key.js';
|
|
44
|
+
import { walkCliArgs } from '../cli_args.js';
|
|
44
45
|
import { pathToFileURL } from 'node:url';
|
|
45
46
|
const storage = getStorage();
|
|
46
47
|
const { readJSON } = storage;
|
|
@@ -56,8 +57,44 @@ const FETCH_MAX_ATTEMPTS = MARKET_ADAPTER.RUNTIME_DEFAULTS.sourceRetries;
|
|
|
56
57
|
const FETCH_RETRY_BACKOFF_BASE_MS = MARKET_ADAPTER.LP_FETCH_RETRY_BACKOFF_BASE_MS;
|
|
57
58
|
const BOTS_JSON = PATHS.PROFILES.BOTS_JSON;
|
|
58
59
|
// ─── CLI ──────────────────────────────────────────────────────────────────────
|
|
60
|
+
function printHelp() {
|
|
61
|
+
console.log(`Usage:
|
|
62
|
+
node dist/market_adapter/inputs/fetch_lp_data.js [options]
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
--bot <name> Read pool/assets/interval from profiles/bots.json
|
|
66
|
+
--pool <id> Liquidity pool id (1.19.N or N)
|
|
67
|
+
--interval <label> Candle interval (1m|5m|15m|30m|1h|2h|4h|6h|12h|1d|1w or seconds)
|
|
68
|
+
--lookback <hours> Trailing window in hours (accepts a trailing \`h\`)
|
|
69
|
+
--start <date> Absolute ISO start time (pairs with --end)
|
|
70
|
+
--end <date> Absolute ISO end time (pairs with --start)
|
|
71
|
+
--chunkMonths <n> Fetch window size in months (default ${DEFAULT_CONFIG.chunkMonths})
|
|
72
|
+
--precA <n> Override asset A precision
|
|
73
|
+
--precB <n> Override asset B precision
|
|
74
|
+
--apiKey <key> Kibana API key, when the endpoint requires auth
|
|
75
|
+
--out <file> Explicit output path
|
|
76
|
+
--help, -h Show this help
|
|
77
|
+
|
|
78
|
+
Flags accept \`--flag value\` or \`--flag=value\`; use the second form when the
|
|
79
|
+
value itself starts with \`--\`.
|
|
80
|
+
`);
|
|
81
|
+
}
|
|
82
|
+
/** Parse an integer option, rejecting non-numeric or out-of-range input. */
|
|
83
|
+
function parseIntOption(flag, raw, min) {
|
|
84
|
+
const value = raw.trim() === '' ? Number.NaN : Number(raw);
|
|
85
|
+
if (!Number.isInteger(value) || value < min) {
|
|
86
|
+
throw new Error(`${flag}: invalid value "${raw}" (expected an integer >= ${min})`);
|
|
87
|
+
}
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
/** Reject an empty string option (a blank path or API key is never intended). */
|
|
91
|
+
function requireNonEmpty(flag, raw) {
|
|
92
|
+
if (raw.trim() === '') {
|
|
93
|
+
throw new Error(`${flag}: expected a non-empty value`);
|
|
94
|
+
}
|
|
95
|
+
return raw;
|
|
96
|
+
}
|
|
59
97
|
function parseArgs() {
|
|
60
|
-
const args = process.argv.slice(2);
|
|
61
98
|
const config = { ...DEFAULT_CONFIG };
|
|
62
99
|
let poolId = null; // null = auto-discover from bots.json
|
|
63
100
|
let botName = null;
|
|
@@ -71,19 +108,15 @@ function parseArgs() {
|
|
|
71
108
|
'1h': 3600, '2h': 7200, '4h': 14400, '6h': 21600, '12h': 43200,
|
|
72
109
|
'1d': 86400, '1w': 604800, '7d': 604800,
|
|
73
110
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
poolId = val;
|
|
84
|
-
i++;
|
|
85
|
-
break;
|
|
86
|
-
case '--interval': {
|
|
111
|
+
walkCliArgs(process.argv.slice(2), {
|
|
112
|
+
onHelp: () => {
|
|
113
|
+
printHelp();
|
|
114
|
+
process.exit(0);
|
|
115
|
+
},
|
|
116
|
+
value: {
|
|
117
|
+
'--bot': (val) => { botName = val; },
|
|
118
|
+
'--pool': (val) => { poolId = val; },
|
|
119
|
+
'--interval': (val) => {
|
|
87
120
|
let seconds = intervalMap[val];
|
|
88
121
|
if (seconds == null)
|
|
89
122
|
seconds = parseInt(val, 10);
|
|
@@ -91,48 +124,23 @@ function parseArgs() {
|
|
|
91
124
|
throw new Error(`--interval: unsupported value "${val}" (use ${Object.keys(intervalMap).join(', ')} or seconds)`);
|
|
92
125
|
}
|
|
93
126
|
config.intervalSeconds = seconds;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
case '--lookback': {
|
|
127
|
+
},
|
|
128
|
+
'--lookback': (val) => {
|
|
98
129
|
const hours = parseInt(String(val).replace('h', ''), 10);
|
|
99
130
|
if (!Number.isFinite(hours) || hours <= 0) {
|
|
100
131
|
throw new Error(`--lookback: invalid value "${val}" (expected hours, e.g. 48 or 48h)`);
|
|
101
132
|
}
|
|
102
133
|
config.lookbackHours = hours;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
break;
|
|
114
|
-
case '--precB':
|
|
115
|
-
precB = parseInt(val, 10);
|
|
116
|
-
i++;
|
|
117
|
-
break;
|
|
118
|
-
case '--apiKey':
|
|
119
|
-
config.apiKey = val;
|
|
120
|
-
i++;
|
|
121
|
-
break;
|
|
122
|
-
case '--start':
|
|
123
|
-
config.timeRange = { ...(config.timeRange || {}), gte: val };
|
|
124
|
-
i++;
|
|
125
|
-
break;
|
|
126
|
-
case '--end':
|
|
127
|
-
config.timeRange = { ...(config.timeRange || {}), lte: val };
|
|
128
|
-
i++;
|
|
129
|
-
break;
|
|
130
|
-
case '--out':
|
|
131
|
-
config.outPath = val;
|
|
132
|
-
i++;
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
134
|
+
},
|
|
135
|
+
'--chunkMonths': (val) => { config.chunkMonths = parseIntOption('--chunkMonths', val, 1); },
|
|
136
|
+
'--precA': (val) => { precA = parseIntOption('--precA', val, 0); },
|
|
137
|
+
'--precB': (val) => { precB = parseIntOption('--precB', val, 0); },
|
|
138
|
+
'--apiKey': (val) => { config.apiKey = requireNonEmpty('--apiKey', val); },
|
|
139
|
+
'--start': (val) => { config.timeRange = { ...(config.timeRange || {}), gte: val }; },
|
|
140
|
+
'--end': (val) => { config.timeRange = { ...(config.timeRange || {}), lte: val }; },
|
|
141
|
+
'--out': (val) => { config.outPath = requireNonEmpty('--out', val); },
|
|
142
|
+
},
|
|
143
|
+
});
|
|
136
144
|
return { poolId, botName, precA, precB, config };
|
|
137
145
|
}
|
|
138
146
|
// ─── Output path ──────────────────────────────────────────────────────────────
|
|
@@ -642,5 +650,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
642
650
|
process.exit(1);
|
|
643
651
|
});
|
|
644
652
|
}
|
|
645
|
-
export {
|
|
653
|
+
export { fetchCandlesSequentially, outputPath };
|
|
654
|
+
/** Internal seams exercised directly by tests. */
|
|
655
|
+
export const __test = { applyPrecisionOverrides, parseBotsConfig, selectBot, loadCachedFetchContext, parseArgs };
|
|
646
656
|
//# sourceMappingURL=fetch_lp_data.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare const OP_TYPE_FEED = 19;
|
|
2
1
|
interface AssetRef {
|
|
3
2
|
id?: string;
|
|
4
3
|
precision?: number;
|
|
@@ -135,5 +134,18 @@ declare function fetchFeedCandlesSequentially(feedCtx: FeedContext, assetA: Asse
|
|
|
135
134
|
};
|
|
136
135
|
outPath?: string;
|
|
137
136
|
}): Promise<number[][]>;
|
|
138
|
-
export {
|
|
137
|
+
export { fetchFeedCandlesSequentially };
|
|
138
|
+
/** Internal seams exercised directly by tests. */
|
|
139
|
+
export declare const __test: {
|
|
140
|
+
OP_TYPE_FEED: number;
|
|
141
|
+
backingPerMpa: typeof backingPerMpa;
|
|
142
|
+
hitToFeedPrice: typeof hitToFeedPrice;
|
|
143
|
+
buildFeedDocumentQuery: typeof buildFeedDocumentQuery;
|
|
144
|
+
crossPointsToRatios: typeof crossPointsToRatios;
|
|
145
|
+
bucketPricesToCandles: typeof bucketPricesToCandles;
|
|
146
|
+
invertCandles: typeof invertCandles;
|
|
147
|
+
getFeedCandlesForMpa: typeof getFeedCandlesForMpa;
|
|
148
|
+
getFeedCandlesForPair: typeof getFeedCandlesForPair;
|
|
149
|
+
getFeedCandlesForMpaCross: typeof getFeedCandlesForMpaCross;
|
|
150
|
+
};
|
|
139
151
|
//# sourceMappingURL=kibana_feed_source.d.ts.map
|
|
@@ -584,5 +584,18 @@ async function fetchFeedCandlesSequentially(feedCtx, assetA, assetB, opts = {})
|
|
|
584
584
|
});
|
|
585
585
|
return flipped ? invertCandles(merged) : merged;
|
|
586
586
|
}
|
|
587
|
-
export {
|
|
587
|
+
export { fetchFeedCandlesSequentially };
|
|
588
|
+
/** Internal seams exercised directly by tests. */
|
|
589
|
+
export const __test = {
|
|
590
|
+
OP_TYPE_FEED,
|
|
591
|
+
backingPerMpa,
|
|
592
|
+
hitToFeedPrice,
|
|
593
|
+
buildFeedDocumentQuery,
|
|
594
|
+
crossPointsToRatios,
|
|
595
|
+
bucketPricesToCandles,
|
|
596
|
+
invertCandles,
|
|
597
|
+
getFeedCandlesForMpa,
|
|
598
|
+
getFeedCandlesForPair,
|
|
599
|
+
getFeedCandlesForMpaCross,
|
|
600
|
+
};
|
|
588
601
|
//# sourceMappingURL=kibana_feed_source.js.map
|
|
@@ -87,9 +87,7 @@ interface RunCachedWindowsOptions {
|
|
|
87
87
|
lte: string;
|
|
88
88
|
}) => void;
|
|
89
89
|
}
|
|
90
|
-
declare const TAIL_REFRESH_HOURS = 48;
|
|
91
90
|
declare const TAIL_SETTLE_LAG_MS: number;
|
|
92
|
-
declare const GAP_SETTLE_HORIZON_MS: number;
|
|
93
91
|
declare const MAX_COVERAGE_SPANS = 64;
|
|
94
92
|
declare function readCacheChunk(chunkFile: string, requestKey: unknown, isMatch: (meta: unknown, requestKey: unknown) => boolean): CacheChunk | null;
|
|
95
93
|
declare function loadBucketCache(outPath: string, requestKey: unknown, isMatch: (meta: unknown, requestKey: unknown) => boolean, range?: {
|
|
@@ -174,6 +172,19 @@ declare function formatWindowLine(unit: string, index: number, total: number, gt
|
|
|
174
172
|
* touch nothing on disk.
|
|
175
173
|
*/
|
|
176
174
|
declare function runCachedWindows(opts: RunCachedWindowsOptions): Promise<Candle[]>;
|
|
177
|
-
export {
|
|
175
|
+
export { TAIL_SETTLE_LAG_MS, MAX_COVERAGE_SPANS, shardKeyForTimestamp, shardBoundsForKey, shardKeysForRange, shardPathFor, unionQueriedRanges, compactCoverage, rangesCoveredBy, coverageSatisfied, verifiedAt, timestampMs, allQueriedRanges, buildFetchWindowsFromRange, formatWindowLine, runCachedWindows, };
|
|
176
|
+
/** Internal seams exercised directly by tests. */
|
|
177
|
+
export declare const __test: {
|
|
178
|
+
TAIL_REFRESH_HOURS: number;
|
|
179
|
+
GAP_SETTLE_HORIZON_MS: number;
|
|
180
|
+
readCacheChunk: typeof readCacheChunk;
|
|
181
|
+
loadBucketCache: typeof loadBucketCache;
|
|
182
|
+
settleCoverage: typeof settleCoverage;
|
|
183
|
+
findMissingBucketRanges: typeof findMissingBucketRanges;
|
|
184
|
+
mergeGapRanges: typeof mergeGapRanges;
|
|
185
|
+
pruneImmutableGaps: typeof pruneImmutableGaps;
|
|
186
|
+
persistCacheChunk: typeof persistCacheChunk;
|
|
187
|
+
planWindowReuse: typeof planWindowReuse;
|
|
188
|
+
};
|
|
178
189
|
export type { QueriedRange } from '../utils/month_shards.js';
|
|
179
190
|
//# sourceMappingURL=window_cache.d.ts.map
|
|
@@ -822,5 +822,18 @@ async function runCachedWindows(opts) {
|
|
|
822
822
|
}
|
|
823
823
|
return merged;
|
|
824
824
|
}
|
|
825
|
-
export {
|
|
825
|
+
export { TAIL_SETTLE_LAG_MS, MAX_COVERAGE_SPANS, shardKeyForTimestamp, shardBoundsForKey, shardKeysForRange, shardPathFor, unionQueriedRanges, compactCoverage, rangesCoveredBy, coverageSatisfied, verifiedAt, timestampMs, allQueriedRanges, buildFetchWindowsFromRange, formatWindowLine, runCachedWindows, };
|
|
826
|
+
/** Internal seams exercised directly by tests. */
|
|
827
|
+
export const __test = {
|
|
828
|
+
TAIL_REFRESH_HOURS,
|
|
829
|
+
GAP_SETTLE_HORIZON_MS,
|
|
830
|
+
readCacheChunk,
|
|
831
|
+
loadBucketCache,
|
|
832
|
+
settleCoverage,
|
|
833
|
+
findMissingBucketRanges,
|
|
834
|
+
mergeGapRanges,
|
|
835
|
+
pruneImmutableGaps,
|
|
836
|
+
persistCacheChunk,
|
|
837
|
+
planWindowReuse,
|
|
838
|
+
};
|
|
826
839
|
//# sourceMappingURL=window_cache.js.map
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { findLatestLpData } from './utils/data_discovery.js';
|
|
2
|
-
declare const DEFAULT_COMPARISON_STRATEGIES: {
|
|
3
|
-
name: string;
|
|
4
|
-
erPeriod: number;
|
|
5
|
-
fastPeriod: number;
|
|
6
|
-
slowPeriod: number;
|
|
7
|
-
color: string;
|
|
8
|
-
dash: string;
|
|
9
|
-
}[];
|
|
10
2
|
type NormalizedLpCandle = [number, number, number, number, number, number];
|
|
11
3
|
interface LpCandleObject {
|
|
12
4
|
timestamp: number;
|
|
@@ -117,5 +109,16 @@ declare function generateLpChartBundle(options?: BundleChartOptions): {
|
|
|
117
109
|
marketChart: ReturnType<typeof generateMarketLpChart>;
|
|
118
110
|
comparisonChart: ReturnType<typeof generateComparisonLpChart>;
|
|
119
111
|
};
|
|
120
|
-
export {
|
|
112
|
+
export { calculateMetrics, defaultMarketChartPath, findLatestLpData, generateComparisonLpChart, generateLpChartBundle, generateMarketLpChart, loadLpDataFile, parseLpChartCliArgs };
|
|
113
|
+
/** Internal seams exercised directly by tests. */
|
|
114
|
+
export declare const __test: {
|
|
115
|
+
DEFAULT_COMPARISON_STRATEGIES: {
|
|
116
|
+
name: string;
|
|
117
|
+
erPeriod: number;
|
|
118
|
+
fastPeriod: number;
|
|
119
|
+
slowPeriod: number;
|
|
120
|
+
color: string;
|
|
121
|
+
dash: string;
|
|
122
|
+
}[];
|
|
123
|
+
};
|
|
121
124
|
//# sourceMappingURL=lp_chart_runner.d.ts.map
|
|
@@ -323,5 +323,7 @@ function generateLpChartBundle(options = {}) {
|
|
|
323
323
|
comparisonChart,
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
export {
|
|
326
|
+
export { calculateMetrics, defaultMarketChartPath, findLatestLpData, generateComparisonLpChart, generateLpChartBundle, generateMarketLpChart, loadLpDataFile, parseLpChartCliArgs };
|
|
327
|
+
/** Internal seams exercised directly by tests. */
|
|
328
|
+
export const __test = { DEFAULT_COMPARISON_STRATEGIES };
|
|
327
329
|
//# sourceMappingURL=lp_chart_runner.js.map
|
|
@@ -40,5 +40,9 @@ declare function loadStrategiesForLpChart({ dataFile, meta, profilesFile, extraS
|
|
|
40
40
|
profilesFile?: string | null;
|
|
41
41
|
extraSearchDirs?: string[];
|
|
42
42
|
}): AmaStrategy[] | null;
|
|
43
|
-
export { loadStrategiesForLpChart
|
|
43
|
+
export { loadStrategiesForLpChart };
|
|
44
|
+
/** Internal seams exercised directly by tests. */
|
|
45
|
+
export declare const __test: {
|
|
46
|
+
loadStrategiesFromProfiles: typeof loadStrategiesFromProfiles;
|
|
47
|
+
};
|
|
44
48
|
//# sourceMappingURL=lp_chart_strategy_loader.d.ts.map
|
|
@@ -163,5 +163,7 @@ function loadStrategiesForLpChart({ dataFile, meta, profilesFile, extraSearchDir
|
|
|
163
163
|
}
|
|
164
164
|
return loadStrategiesFromProfiles(profilesFile, meta);
|
|
165
165
|
}
|
|
166
|
-
export { loadStrategiesForLpChart
|
|
166
|
+
export { loadStrategiesForLpChart };
|
|
167
|
+
/** Internal seams exercised directly by tests. */
|
|
168
|
+
export const __test = { loadStrategiesFromProfiles };
|
|
167
169
|
//# sourceMappingURL=lp_chart_strategy_loader.js.map
|
|
@@ -271,7 +271,7 @@ declare function buildAmaRecord(botAma: unknown, amaPrice: number): {
|
|
|
271
271
|
}[];
|
|
272
272
|
declare function fetchNativeMarketHistorySince(assetA: unknown, assetB: unknown, sinceMs: number, untilMs: number, intervalSeconds: number, options?: {
|
|
273
273
|
fillCandleGaps?: (...args: unknown[]) => unknown;
|
|
274
|
-
}): Promise<
|
|
274
|
+
}): Promise<[number, number, number, number, number, number][]>;
|
|
275
275
|
declare function writeGridResetTrigger(bot: Record<string, unknown>, payload: Record<string, unknown>): string;
|
|
276
276
|
/**
|
|
277
277
|
* Atomically write the dynamic grid snapshot for a bot to profiles/orders/<botKey>.dynamicgrid.json.
|
|
@@ -324,5 +324,13 @@ declare function runOnceForAma(overrides?: object): Promise<{
|
|
|
324
324
|
updatedAt: string;
|
|
325
325
|
}>;
|
|
326
326
|
declare function main(): Promise<0 | 1>;
|
|
327
|
-
export { main, runOnceForAma, DEFAULT_AMA, DEFAULTS, calculateBotThreshold, buildAmaRecord, computeCandleStaleness, normalizeMarketSource, sleepUntilAlignedBoundary, computeStartupDelayMs, evaluateStartupSleep, resolveAmaForBot,
|
|
327
|
+
export { main, runOnceForAma, DEFAULT_AMA, DEFAULTS, calculateBotThreshold, buildAmaRecord, computeCandleStaleness, normalizeMarketSource, sleepUntilAlignedBoundary, computeStartupDelayMs, evaluateStartupSleep, resolveAmaForBot, applyRuntimeDefaultsFromGeneralSettings, resolveBotCfg, usesAmaGridPrice, isBotWhitelisted, isBotDynamicWeightWhitelisted, isBotAsymmetricBoundsWhitelisted, writeCenterSnapshot, writeBotDynamicGrid, writeGridResetTrigger, normalizeNativeMarketHistoryCandles, fetchNativeMarketHistorySince, loadMarketAdapterSettings, findPairForBot };
|
|
328
|
+
/** Internal seams exercised directly by tests. */
|
|
329
|
+
export declare const __test: {
|
|
330
|
+
resolveDeltaThresholdPercentFromGeneralSettings: typeof resolveDeltaThresholdPercentFromGeneralSettings;
|
|
331
|
+
resolveAmaSlopeDeltaThresholdPercentFromGeneralSettings: typeof resolveAmaSlopeDeltaThresholdPercentFromGeneralSettings;
|
|
332
|
+
_resetCycleCache: typeof _resetCycleCache;
|
|
333
|
+
mergeGridResetMetadataFromDynamicGrid: typeof mergeGridResetMetadataFromDynamicGrid;
|
|
334
|
+
_setBitsharesClientForTests: typeof setBitsharesClientForTests;
|
|
335
|
+
};
|
|
328
336
|
//# sourceMappingURL=market_adapter.d.ts.map
|
|
@@ -1037,16 +1037,7 @@ async function fetchNativeMarketHistorySince(assetA, assetB, sinceMs, untilMs, i
|
|
|
1037
1037
|
}
|
|
1038
1038
|
const startDate = new Date(Number.isFinite(sinceMs) ? sinceMs : Date.now());
|
|
1039
1039
|
const stopDate = new Date(Number.isFinite(untilMs) ? untilMs : Date.now());
|
|
1040
|
-
|
|
1041
|
-
if (typeof BitShares.history?.getMarketHistory === 'function') {
|
|
1042
|
-
history = await BitShares.history.getMarketHistory(b.id, a.id, intervalSeconds, startDate.toISOString().slice(0, -5), stopDate.toISOString().slice(0, -5));
|
|
1043
|
-
}
|
|
1044
|
-
else if (typeof BitShares.tradeHistory === 'function') {
|
|
1045
|
-
history = await BitShares.tradeHistory(b.symbol || b.id, a.symbol || a.id, startDate, stopDate, intervalSeconds);
|
|
1046
|
-
}
|
|
1047
|
-
else {
|
|
1048
|
-
throw new Error('native market history source unavailable');
|
|
1049
|
-
}
|
|
1040
|
+
const history = await BitShares.history.getMarketHistory(b.id, a.id, intervalSeconds, startDate.toISOString().slice(0, -5), stopDate.toISOString().slice(0, -5));
|
|
1050
1041
|
let candles = normalizeNativeMarketHistoryCandles(history, a, b);
|
|
1051
1042
|
if (candles.length > 0 && typeof options.fillCandleGaps === 'function') {
|
|
1052
1043
|
candles = options.fillCandleGaps(candles, intervalSeconds);
|
|
@@ -1588,5 +1579,13 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
1588
1579
|
process.exit(1);
|
|
1589
1580
|
});
|
|
1590
1581
|
}
|
|
1591
|
-
export { main, runOnceForAma, DEFAULT_AMA, DEFAULTS, calculateBotThreshold, buildAmaRecord, computeCandleStaleness, normalizeMarketSource, sleepUntilAlignedBoundary, computeStartupDelayMs, evaluateStartupSleep, resolveAmaForBot,
|
|
1582
|
+
export { main, runOnceForAma, DEFAULT_AMA, DEFAULTS, calculateBotThreshold, buildAmaRecord, computeCandleStaleness, normalizeMarketSource, sleepUntilAlignedBoundary, computeStartupDelayMs, evaluateStartupSleep, resolveAmaForBot, applyRuntimeDefaultsFromGeneralSettings, resolveBotCfg, usesAmaGridPrice, isBotWhitelisted, isBotDynamicWeightWhitelisted, isBotAsymmetricBoundsWhitelisted, writeCenterSnapshot, writeBotDynamicGrid, writeGridResetTrigger, normalizeNativeMarketHistoryCandles, fetchNativeMarketHistorySince, loadMarketAdapterSettings, findPairForBot };
|
|
1583
|
+
/** Internal seams exercised directly by tests. */
|
|
1584
|
+
export const __test = {
|
|
1585
|
+
resolveDeltaThresholdPercentFromGeneralSettings,
|
|
1586
|
+
resolveAmaSlopeDeltaThresholdPercentFromGeneralSettings,
|
|
1587
|
+
_resetCycleCache,
|
|
1588
|
+
mergeGridResetMetadataFromDynamicGrid,
|
|
1589
|
+
_setBitsharesClientForTests: setBitsharesClientForTests,
|
|
1590
|
+
};
|
|
1592
1591
|
//# sourceMappingURL=market_adapter.js.map
|
|
@@ -9,7 +9,6 @@ interface RpcClient {
|
|
|
9
9
|
BitShares: {
|
|
10
10
|
db: RpcProxy;
|
|
11
11
|
history: RpcProxy;
|
|
12
|
-
tradeHistory?: (...args: unknown[]) => Promise<unknown>;
|
|
13
12
|
[method: string]: unknown;
|
|
14
13
|
};
|
|
15
14
|
}
|
|
@@ -20,7 +19,7 @@ interface BitsharesClient extends RpcClient {
|
|
|
20
19
|
[key: string]: unknown;
|
|
21
20
|
}
|
|
22
21
|
/** Resolved asset identity used by the pool/context helpers. */
|
|
23
|
-
|
|
22
|
+
interface ResolvedAsset {
|
|
24
23
|
id: string;
|
|
25
24
|
precision: number;
|
|
26
25
|
symbol: string;
|
|
@@ -44,7 +43,7 @@ declare function normalizeMarketSource(raw: unknown): 'pool' | 'book' | null;
|
|
|
44
43
|
declare function hasNumericStartPrice(raw: unknown): boolean;
|
|
45
44
|
declare function resolveMarketSourceForBot(bot: unknown): 'pool' | 'book' | null;
|
|
46
45
|
declare function normalizePoolId(id: unknown): string | null;
|
|
47
|
-
|
|
46
|
+
interface ResolvedBotContext {
|
|
48
47
|
assetA: ResolvedAsset;
|
|
49
48
|
assetB: ResolvedAsset;
|
|
50
49
|
poolId: string | null;
|
|
@@ -25,5 +25,9 @@ declare function readCachedJson<T>(filePath: string, loader: () => T): T;
|
|
|
25
25
|
declare function noteJsonWritten(filePath: string, value: unknown): void;
|
|
26
26
|
/** Drop every cached entry (config reload, tests, explicit cache busting). */
|
|
27
27
|
declare function clearJsonCache(): void;
|
|
28
|
-
export { readCachedJson, noteJsonWritten
|
|
28
|
+
export { readCachedJson, noteJsonWritten };
|
|
29
|
+
/** Internal seams exercised directly by tests. */
|
|
30
|
+
export declare const __test: {
|
|
31
|
+
clearJsonCache: typeof clearJsonCache;
|
|
32
|
+
};
|
|
29
33
|
//# sourceMappingURL=file_json_cache.d.ts.map
|
|
@@ -102,5 +102,7 @@ function noteJsonWritten(filePath, value) {
|
|
|
102
102
|
function clearJsonCache() {
|
|
103
103
|
_cache.clear();
|
|
104
104
|
}
|
|
105
|
-
export { readCachedJson, noteJsonWritten
|
|
105
|
+
export { readCachedJson, noteJsonWritten };
|
|
106
|
+
/** Internal seams exercised directly by tests. */
|
|
107
|
+
export const __test = { clearJsonCache };
|
|
106
108
|
//# sourceMappingURL=file_json_cache.js.map
|
|
@@ -84,7 +84,7 @@ function _resolveLockPayload(lockPath, opts, timeoutMs) {
|
|
|
84
84
|
const buildPayloadFn = opts.buildPayload;
|
|
85
85
|
const buildPayload = typeof buildPayloadFn === 'function'
|
|
86
86
|
? () => ({ ...buildPayloadFn(), ownerId })
|
|
87
|
-
: () => ({ pid:
|
|
87
|
+
: () => ({ pid: runtime.pid, at: Date.now(), ownerId });
|
|
88
88
|
const alreadyRunningMsg = opts.alreadyRunningMsg;
|
|
89
89
|
const resolveRunningMsg = typeof alreadyRunningMsg === 'function'
|
|
90
90
|
? alreadyRunningMsg
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** Asset identity/precision needed to convert chain amounts. */
|
|
2
|
-
|
|
2
|
+
interface NativeHistoryAssetMeta {
|
|
3
3
|
id?: unknown;
|
|
4
4
|
precision?: number;
|
|
5
5
|
}
|
|
6
6
|
/** Normalized OHLCV candle: [tsMs, open, high, low, close, volume]. */
|
|
7
|
-
|
|
7
|
+
type NativeHistoryCandle = [number, number, number, number, number, number];
|
|
8
8
|
/**
|
|
9
9
|
* Native BitShares market history parsing utilities.
|
|
10
10
|
*
|
|
@@ -14,5 +14,9 @@ export type NativeHistoryCandle = [number, number, number, number, number, numbe
|
|
|
14
14
|
*/
|
|
15
15
|
declare function parseNativeMarketHistoryTimestamp(entry: unknown): number | null;
|
|
16
16
|
declare function normalizeNativeMarketHistoryCandles(history: unknown, assetA: NativeHistoryAssetMeta, assetB: NativeHistoryAssetMeta): NativeHistoryCandle[];
|
|
17
|
-
export {
|
|
17
|
+
export { normalizeNativeMarketHistoryCandles };
|
|
18
|
+
/** Internal seams exercised directly by tests. */
|
|
19
|
+
export declare const __test: {
|
|
20
|
+
parseNativeMarketHistoryTimestamp: typeof parseNativeMarketHistoryTimestamp;
|
|
21
|
+
};
|
|
18
22
|
//# sourceMappingURL=native_history.d.ts.map
|
|
@@ -153,5 +153,7 @@ function normalizeNativeMarketHistoryCandles(history, assetA, assetB) {
|
|
|
153
153
|
}
|
|
154
154
|
return candles.sort((a, b) => a[0] - b[0]);
|
|
155
155
|
}
|
|
156
|
-
export {
|
|
156
|
+
export { normalizeNativeMarketHistoryCandles };
|
|
157
|
+
/** Internal seams exercised directly by tests. */
|
|
158
|
+
export const __test = { parseNativeMarketHistoryTimestamp };
|
|
157
159
|
//# sourceMappingURL=native_history.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
interface OrientableAsset {
|
|
2
2
|
id?: string | null;
|
|
3
3
|
precision?: unknown;
|
|
4
4
|
symbol?: string | null;
|
|
5
5
|
}
|
|
6
6
|
/** The asset legs stored on every shard meta and cache request key. */
|
|
7
|
-
|
|
7
|
+
interface AssetPairLike {
|
|
8
8
|
assetA?: {
|
|
9
9
|
id?: string | null;
|
|
10
10
|
precision?: unknown;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Ids/refs per `get_assets` call; get_assets has no page limit to respect. */
|
|
2
|
+
declare const LOOKUP_BATCH = 250;
|
|
3
|
+
type ChainRead = (method: string, args: unknown[]) => Promise<unknown>;
|
|
4
|
+
interface RawAssetObject {
|
|
5
|
+
id?: string;
|
|
6
|
+
symbol?: string;
|
|
7
|
+
precision?: number;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface AssetLookupResult {
|
|
11
|
+
/** The reference exactly as the caller passed it (for error messages). */
|
|
12
|
+
request: string;
|
|
13
|
+
/** The chain object, or null when the reference does not exist. */
|
|
14
|
+
asset: RawAssetObject | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve asset references (symbols in any case, or `1.3.x` ids), preserving
|
|
18
|
+
* the caller's order. Unresolvable references come back with `asset: null`.
|
|
19
|
+
*/
|
|
20
|
+
declare function lookupAssetRefs(read: ChainRead, refs: unknown[]): Promise<AssetLookupResult[]>;
|
|
21
|
+
/** Resolve one asset reference, or null when it does not exist on chain. */
|
|
22
|
+
declare function resolveAssetRef(read: ChainRead, ref: unknown): Promise<RawAssetObject | null>;
|
|
23
|
+
export { LOOKUP_BATCH, lookupAssetRefs, resolveAssetRef };
|
|
24
|
+
export type { ChainRead, RawAssetObject, AssetLookupResult };
|
|
25
|
+
//# sourceMappingURL=asset_lookup.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* CHAIN ASSET LOOKUP (case-insensitive, one implementation)
|
|
4
|
+
*
|
|
5
|
+
* Every CLI path that takes an asset from a human — `dexbot asset <symbol>`,
|
|
6
|
+
* `dexbot rich <asset...>`, `dexbot liq`/`tv`/`dw` pairs, the liquidity
|
|
7
|
+
* analyzer's `--base/--quote`, pool tokens — resolves it through here.
|
|
8
|
+
*
|
|
9
|
+
* BitShares stores symbols canonically UPPERCASE and `get_assets` /
|
|
10
|
+
* `lookup_asset_symbols` are case-sensitive, so `dexbot asset token.sym`
|
|
11
|
+
* found nothing while `TOKEN.SYM` worked. The reference is therefore
|
|
12
|
+
* normalized with `normalizeAssetSymbol` (modules/utils/asset_symbols.ts) and
|
|
13
|
+
* looked up in ONE batched `get_assets` call, which accepts symbols and
|
|
14
|
+
* `1.3.x` ids alike and returns the extended asset object.
|
|
15
|
+
*
|
|
16
|
+
* Only when the canonical spelling misses is the spelling as typed retried, so
|
|
17
|
+
* a node that really does hold a non-canonical symbol still resolves.
|
|
18
|
+
*
|
|
19
|
+
* The reader is injected, so the module stays browser-safe.
|
|
20
|
+
*/
|
|
21
|
+
import { assetSymbolCandidates } from './utils/asset_symbols.js';
|
|
22
|
+
/** Ids/refs per `get_assets` call; get_assets has no page limit to respect. */
|
|
23
|
+
const LOOKUP_BATCH = 250;
|
|
24
|
+
function chunk(items, size) {
|
|
25
|
+
const out = [];
|
|
26
|
+
for (let i = 0; i < items.length; i += size)
|
|
27
|
+
out.push(items.slice(i, i + size));
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
async function getAssets(read, refs) {
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const batch of chunk(refs, LOOKUP_BATCH)) {
|
|
33
|
+
const rows = await read('get_assets', [batch]);
|
|
34
|
+
for (let i = 0; i < batch.length; i++) {
|
|
35
|
+
const row = Array.isArray(rows) ? rows[i] : null;
|
|
36
|
+
out.push(row && typeof row.id === 'string' ? row : null);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve asset references (symbols in any case, or `1.3.x` ids), preserving
|
|
43
|
+
* the caller's order. Unresolvable references come back with `asset: null`.
|
|
44
|
+
*/
|
|
45
|
+
async function lookupAssetRefs(read, refs) {
|
|
46
|
+
const requested = refs.map((ref) => String(ref ?? '').trim());
|
|
47
|
+
// Canonical spelling first (ids pass through), spelling as typed as fallback.
|
|
48
|
+
const candidates = requested.map((ref) => assetSymbolCandidates(ref));
|
|
49
|
+
const primary = candidates.map((list) => list[1] ?? list[0] ?? '');
|
|
50
|
+
// Nothing to look up for empty refs; keep the slots so order is preserved.
|
|
51
|
+
const indexes = requested.map((_, index) => index).filter((index) => primary[index] !== '');
|
|
52
|
+
const resolved = new Map();
|
|
53
|
+
if (indexes.length > 0) {
|
|
54
|
+
const rows = await getAssets(read, indexes.map((index) => primary[index]));
|
|
55
|
+
indexes.forEach((index, offset) => resolved.set(index, rows[offset] ?? null));
|
|
56
|
+
// A node could hold a non-canonical (lowercase) symbol: retry just those
|
|
57
|
+
// refs with the spelling as typed, once, in a single batch.
|
|
58
|
+
const retry = indexes.filter((index) => !resolved.get(index) && (candidates[index][0] ?? '') !== primary[index]);
|
|
59
|
+
if (retry.length > 0) {
|
|
60
|
+
const retried = await getAssets(read, retry.map((index) => candidates[index][0]));
|
|
61
|
+
retry.forEach((index, offset) => {
|
|
62
|
+
if (retried[offset])
|
|
63
|
+
resolved.set(index, retried[offset]);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return requested.map((request, index) => ({ request, asset: resolved.get(index) ?? null }));
|
|
68
|
+
}
|
|
69
|
+
/** Resolve one asset reference, or null when it does not exist on chain. */
|
|
70
|
+
async function resolveAssetRef(read, ref) {
|
|
71
|
+
const [result] = await lookupAssetRefs(read, [ref]);
|
|
72
|
+
return result?.asset ?? null;
|
|
73
|
+
}
|
|
74
|
+
export { LOOKUP_BATCH, lookupAssetRefs, resolveAssetRef };
|
|
75
|
+
//# sourceMappingURL=asset_lookup.js.map
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
*
|
|
34
34
|
* ===============================================================================
|
|
35
35
|
*
|
|
36
|
-
* USAGE:
|
|
37
|
-
*
|
|
36
|
+
* USAGE (from the repo root):
|
|
37
|
+
* import { readBotsFileWithLock, writeBotsFileWithLock, readBotsFileSync } from './modules/bots_file_lock.js';
|
|
38
38
|
* const { config } = await readBotsFileWithLock('./profiles/bots.json', JSON.parse);
|
|
39
39
|
* await writeBotsFileWithLock('./profiles/bots.json', updatedConfig);
|
|
40
40
|
*
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
*
|
|
34
34
|
* ===============================================================================
|
|
35
35
|
*
|
|
36
|
-
* USAGE:
|
|
37
|
-
*
|
|
36
|
+
* USAGE (from the repo root):
|
|
37
|
+
* import { readBotsFileWithLock, writeBotsFileWithLock, readBotsFileSync } from './modules/bots_file_lock.js';
|
|
38
38
|
* const { config } = await readBotsFileWithLock('./profiles/bots.json', JSON.parse);
|
|
39
39
|
* await writeBotsFileWithLock('./profiles/bots.json', updatedConfig);
|
|
40
40
|
*
|