@tradejs/infra 3.1.21-beta.237 → 3.1.22-beta.238
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/{chunk-OLB6NQRG.mjs → chunk-CH5L3BE4.mjs} +1 -1
- package/dist/{chunk-ZXU7OYFU.mjs → chunk-SSL36P7G.mjs} +14 -2
- package/dist/timescale/candles.js +15 -0
- package/dist/timescale/candles.mjs +2 -2
- package/dist/timescale/client.js +1 -1
- package/dist/timescale/client.mjs +2 -2
- package/dist/timescale/derivatives.js +1 -1
- package/dist/timescale/derivatives.mjs +1 -1
- package/dist/timescale/hyperliquidWhales.js +1 -1
- package/dist/timescale/hyperliquidWhales.mjs +1 -1
- package/dist/timescale/marketContext.js +2 -2
- package/dist/timescale/marketContext.mjs +1 -1
- package/dist/timescale/spread.js +3 -0
- package/dist/timescale/spread.mjs +1 -1
- package/package.json +2 -2
|
@@ -126,6 +126,18 @@ var ensureCandlesSchema = async () => {
|
|
|
126
126
|
CANDLES_SCHEMA_LOCK_KEY,
|
|
127
127
|
async () => {
|
|
128
128
|
const pool = getPool();
|
|
129
|
+
if (process.env.TRADEJS_TIMESCALE_READ_ONLY === "true") {
|
|
130
|
+
const result = await pool.query(
|
|
131
|
+
`SELECT to_regclass('public.candles') AS "tableName"`
|
|
132
|
+
);
|
|
133
|
+
if (!result.rows[0]?.tableName) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
"Timescale candles schema is not prepared for read-only replay"
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
candlesSchemaReady = true;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
129
141
|
await pool.query("CREATE EXTENSION IF NOT EXISTS timescaledb");
|
|
130
142
|
await pool.query(`
|
|
131
143
|
CREATE TABLE IF NOT EXISTS candles (
|
|
@@ -849,7 +861,7 @@ var ensureHyperliquidWhaleSchema = async () => {
|
|
|
849
861
|
};
|
|
850
862
|
|
|
851
863
|
// src/timescale/internal.ts
|
|
852
|
-
var marketContextSchemaMode = "ensure";
|
|
864
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
853
865
|
var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
|
|
854
866
|
var configureTimescaleMarketContextSchemaMode = (mode) => {
|
|
855
867
|
marketContextSchemaMode = mode;
|
|
@@ -913,7 +925,7 @@ var verifyMarketContextSchema = async (source) => {
|
|
|
913
925
|
var prepareMarketContextSchemaForRead = async (source) => marketContextSchemaMode === "verify" ? verifyMarketContextSchema(source) : ensureMarketContextSchema(source);
|
|
914
926
|
var ensureMarketContextSchemas = async (sources) => {
|
|
915
927
|
for (const source of new Set(sources)) {
|
|
916
|
-
await
|
|
928
|
+
await prepareMarketContextSchemaForRead(source);
|
|
917
929
|
}
|
|
918
930
|
};
|
|
919
931
|
|
|
@@ -82,6 +82,18 @@ var ensureCandlesSchema = async () => {
|
|
|
82
82
|
CANDLES_SCHEMA_LOCK_KEY,
|
|
83
83
|
async () => {
|
|
84
84
|
const pool = getPool();
|
|
85
|
+
if (process.env.TRADEJS_TIMESCALE_READ_ONLY === "true") {
|
|
86
|
+
const result = await pool.query(
|
|
87
|
+
`SELECT to_regclass('public.candles') AS "tableName"`
|
|
88
|
+
);
|
|
89
|
+
if (!result.rows[0]?.tableName) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
"Timescale candles schema is not prepared for read-only replay"
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
candlesSchemaReady = true;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
85
97
|
await pool.query("CREATE EXTENSION IF NOT EXISTS timescaledb");
|
|
86
98
|
await pool.query(`
|
|
87
99
|
CREATE TABLE IF NOT EXISTS candles (
|
|
@@ -129,6 +141,9 @@ var ensureCandlesSchema = async () => {
|
|
|
129
141
|
await candlesSchemaReadyPromise;
|
|
130
142
|
};
|
|
131
143
|
|
|
144
|
+
// src/timescale/internal.ts
|
|
145
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
146
|
+
|
|
132
147
|
// src/timescale/candles.ts
|
|
133
148
|
var toRows = (provider, symbol, interval, data) => {
|
|
134
149
|
const normalizedProvider = normalizeCandleProvider(provider);
|
package/dist/timescale/client.js
CHANGED
|
@@ -95,7 +95,7 @@ var resetHyperliquidWhalesSchemaState = () => {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
// src/timescale/internal.ts
|
|
98
|
-
var marketContextSchemaMode = "ensure";
|
|
98
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
99
99
|
var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
|
|
100
100
|
var configureTimescaleMarketContextSchemaMode = (mode) => {
|
|
101
101
|
marketContextSchemaMode = mode;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
waitForDbReady
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-CH5L3BE4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
closeTimescalePool,
|
|
6
6
|
configureTimescaleMarketContextSchemaMode
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-SSL36P7G.mjs";
|
|
8
8
|
export {
|
|
9
9
|
closeTimescalePool,
|
|
10
10
|
configureTimescaleMarketContextSchemaMode,
|
|
@@ -741,7 +741,7 @@ var ensureHyperliquidWhaleSchema = async () => {
|
|
|
741
741
|
};
|
|
742
742
|
|
|
743
743
|
// src/timescale/internal.ts
|
|
744
|
-
var marketContextSchemaMode = "ensure";
|
|
744
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
745
745
|
var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
|
|
746
746
|
var ensureCoinMarketCapContextSchema = async () => ensureBinanceMarketSchema();
|
|
747
747
|
var ensureMarketContextSchema = async (source) => {
|
|
@@ -747,7 +747,7 @@ var ensureHyperliquidWhaleSchema = async () => {
|
|
|
747
747
|
};
|
|
748
748
|
|
|
749
749
|
// src/timescale/internal.ts
|
|
750
|
-
var marketContextSchemaMode = "ensure";
|
|
750
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
751
751
|
var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
|
|
752
752
|
var ensureCoinMarketCapContextSchema = async () => ensureBinanceMarketSchema();
|
|
753
753
|
var ensureMarketContextSchema = async (source) => {
|
|
@@ -763,7 +763,7 @@ var ensureHyperliquidWhaleSchema = async () => {
|
|
|
763
763
|
};
|
|
764
764
|
|
|
765
765
|
// src/timescale/internal.ts
|
|
766
|
-
var marketContextSchemaMode = "ensure";
|
|
766
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
767
767
|
var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
|
|
768
768
|
var ensureCoinMarketCapContextSchema = async () => ensureBinanceMarketSchema();
|
|
769
769
|
var ensureMarketContextSchema = async (source) => {
|
|
@@ -814,7 +814,7 @@ var verifyMarketContextSchema = async (source) => {
|
|
|
814
814
|
var prepareMarketContextSchemaForRead = async (source) => marketContextSchemaMode === "verify" ? verifyMarketContextSchema(source) : ensureMarketContextSchema(source);
|
|
815
815
|
var ensureMarketContextSchemas = async (sources) => {
|
|
816
816
|
for (const source of new Set(sources)) {
|
|
817
|
-
await
|
|
817
|
+
await prepareMarketContextSchemaForRead(source);
|
|
818
818
|
}
|
|
819
819
|
};
|
|
820
820
|
|
package/dist/timescale/spread.js
CHANGED
|
@@ -108,6 +108,9 @@ var ensureSpreadSchema = async () => {
|
|
|
108
108
|
await spreadSchemaReadyPromise;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
// src/timescale/internal.ts
|
|
112
|
+
var marketContextSchemaMode = process.env.TRADEJS_TIMESCALE_READ_ONLY === "true" ? "verify" : "ensure";
|
|
113
|
+
|
|
111
114
|
// src/timescale/spread.ts
|
|
112
115
|
async function upsertSpreadRows(rows) {
|
|
113
116
|
if (!rows.length) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/infra",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.22-beta.238",
|
|
4
4
|
"description": "MIT-licensed server infrastructure adapters for TradeJS: Redis, Timescale, ML, logging, and IO.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"dependencies": {
|
|
131
131
|
"@grpc/grpc-js": "^1.14.4",
|
|
132
132
|
"@grpc/proto-loader": "^0.8.1",
|
|
133
|
-
"@tradejs/types": "^3.1.
|
|
133
|
+
"@tradejs/types": "^3.1.22-beta.238",
|
|
134
134
|
"chalk": "4.1.2",
|
|
135
135
|
"date-fns": "^3.6.0",
|
|
136
136
|
"ioredis": "5.11.1",
|