@secondlayer/shared 6.18.0 → 6.20.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/dist/src/db/index.d.ts +68 -1
- package/dist/src/db/index.js +282 -2
- package/dist/src/db/index.js.map +6 -5
- package/dist/src/db/queries/chain-reorgs.d.ts +15 -2
- package/dist/src/db/queries/chain-reorgs.js +286 -1
- package/dist/src/db/queries/chain-reorgs.js.map +7 -6
- package/dist/src/db/queries/subgraphs.js +278 -1
- package/dist/src/db/queries/subgraphs.js.map +6 -5
- package/dist/src/env.d.ts +7 -1
- package/dist/src/env.js +5 -1
- package/dist/src/env.js.map +3 -3
- package/dist/src/index-http.d.ts +21 -0
- package/dist/src/index-http.js +50 -10
- package/dist/src/index-http.js.map +3 -3
- package/dist/src/index.d.ts +78 -1
- package/dist/src/index.js +327 -1
- package/dist/src/index.js.map +7 -5
- package/dist/src/logger.js +4 -1
- package/dist/src/logger.js.map +3 -3
- package/dist/src/node/archive-client.js +4 -1
- package/dist/src/node/archive-client.js.map +3 -3
- package/dist/src/node/hiro-client.js +4 -1
- package/dist/src/node/hiro-client.js.map +3 -3
- package/dist/src/queue/listener.js +2 -2
- package/dist/src/queue/listener.js.map +3 -3
- package/package.json +1 -1
|
@@ -57,6 +57,9 @@ function getEnv() {
|
|
|
57
57
|
cachedEnv = { ...result.data, enabledNetworks };
|
|
58
58
|
return cachedEnv;
|
|
59
59
|
}
|
|
60
|
+
function isPox4DecoderEnabled() {
|
|
61
|
+
return process.env.POX4_DECODER_ENABLED !== "false";
|
|
62
|
+
}
|
|
60
63
|
// src/logger.ts
|
|
61
64
|
var LOG_LEVELS = {
|
|
62
65
|
debug: 0,
|
|
@@ -151,6 +154,232 @@ import { Kysely } from "kysely";
|
|
|
151
154
|
import { PostgresJSDialect } from "kysely-postgres-js";
|
|
152
155
|
import postgres from "postgres";
|
|
153
156
|
import { sql as sql2 } from "kysely";
|
|
157
|
+
|
|
158
|
+
// src/db/source-read-columns.ts
|
|
159
|
+
var SOURCE_READ_COLUMNS = {
|
|
160
|
+
blocks: [
|
|
161
|
+
"burn_block_hash",
|
|
162
|
+
"burn_block_height",
|
|
163
|
+
"canonical",
|
|
164
|
+
"hash",
|
|
165
|
+
"height",
|
|
166
|
+
"parent_hash",
|
|
167
|
+
"timestamp"
|
|
168
|
+
],
|
|
169
|
+
decoded_events: [
|
|
170
|
+
"amount",
|
|
171
|
+
"asset_identifier",
|
|
172
|
+
"block_height",
|
|
173
|
+
"canonical",
|
|
174
|
+
"contract_id",
|
|
175
|
+
"cursor",
|
|
176
|
+
"event_index",
|
|
177
|
+
"event_type",
|
|
178
|
+
"memo",
|
|
179
|
+
"payload",
|
|
180
|
+
"recipient",
|
|
181
|
+
"sender",
|
|
182
|
+
"tx_id",
|
|
183
|
+
"tx_index",
|
|
184
|
+
"value"
|
|
185
|
+
],
|
|
186
|
+
transactions: [
|
|
187
|
+
"block_height",
|
|
188
|
+
"contract_id",
|
|
189
|
+
"function_args",
|
|
190
|
+
"function_name",
|
|
191
|
+
"raw_result",
|
|
192
|
+
"raw_tx",
|
|
193
|
+
"sender",
|
|
194
|
+
"status",
|
|
195
|
+
"tx_id",
|
|
196
|
+
"tx_index",
|
|
197
|
+
"type"
|
|
198
|
+
],
|
|
199
|
+
mempool_transactions: [
|
|
200
|
+
"contract_id",
|
|
201
|
+
"function_args",
|
|
202
|
+
"function_name",
|
|
203
|
+
"raw_tx",
|
|
204
|
+
"received_at",
|
|
205
|
+
"sender",
|
|
206
|
+
"seq",
|
|
207
|
+
"tx_id",
|
|
208
|
+
"type"
|
|
209
|
+
],
|
|
210
|
+
pox4_calls: [
|
|
211
|
+
"aggregated_amount_ustx",
|
|
212
|
+
"aggregated_signer_index",
|
|
213
|
+
"amount_ustx",
|
|
214
|
+
"auth_allowed",
|
|
215
|
+
"auth_id",
|
|
216
|
+
"auth_period",
|
|
217
|
+
"auth_topic",
|
|
218
|
+
"block_height",
|
|
219
|
+
"block_time",
|
|
220
|
+
"burn_block_height",
|
|
221
|
+
"caller",
|
|
222
|
+
"canonical",
|
|
223
|
+
"cursor",
|
|
224
|
+
"delegate_to",
|
|
225
|
+
"end_cycle",
|
|
226
|
+
"function_name",
|
|
227
|
+
"lock_period",
|
|
228
|
+
"max_amount",
|
|
229
|
+
"pox_addr_btc",
|
|
230
|
+
"pox_addr_hashbytes",
|
|
231
|
+
"pox_addr_version",
|
|
232
|
+
"result_ok",
|
|
233
|
+
"reward_cycle",
|
|
234
|
+
"signer_key",
|
|
235
|
+
"signer_signature",
|
|
236
|
+
"source_cursor",
|
|
237
|
+
"stacker",
|
|
238
|
+
"start_cycle",
|
|
239
|
+
"tx_id",
|
|
240
|
+
"tx_index"
|
|
241
|
+
],
|
|
242
|
+
sbtc_events: [
|
|
243
|
+
"amount",
|
|
244
|
+
"bitcoin_txid",
|
|
245
|
+
"block_height",
|
|
246
|
+
"block_time",
|
|
247
|
+
"burn_hash",
|
|
248
|
+
"burn_height",
|
|
249
|
+
"canonical",
|
|
250
|
+
"cursor",
|
|
251
|
+
"event_index",
|
|
252
|
+
"fee",
|
|
253
|
+
"governance_contract_type",
|
|
254
|
+
"governance_new_contract",
|
|
255
|
+
"max_fee",
|
|
256
|
+
"output_index",
|
|
257
|
+
"recipient_btc_hashbytes",
|
|
258
|
+
"recipient_btc_version",
|
|
259
|
+
"request_id",
|
|
260
|
+
"sender",
|
|
261
|
+
"signer_address",
|
|
262
|
+
"signer_aggregate_pubkey",
|
|
263
|
+
"signer_bitmap",
|
|
264
|
+
"signer_keys_count",
|
|
265
|
+
"signer_threshold",
|
|
266
|
+
"sweep_txid",
|
|
267
|
+
"topic",
|
|
268
|
+
"tx_id",
|
|
269
|
+
"tx_index"
|
|
270
|
+
],
|
|
271
|
+
sbtc_token_events: [
|
|
272
|
+
"amount",
|
|
273
|
+
"block_height",
|
|
274
|
+
"block_time",
|
|
275
|
+
"canonical",
|
|
276
|
+
"cursor",
|
|
277
|
+
"event_index",
|
|
278
|
+
"event_type",
|
|
279
|
+
"memo",
|
|
280
|
+
"recipient",
|
|
281
|
+
"sender",
|
|
282
|
+
"tx_id",
|
|
283
|
+
"tx_index"
|
|
284
|
+
],
|
|
285
|
+
bns_name_events: [
|
|
286
|
+
"block_height",
|
|
287
|
+
"block_time",
|
|
288
|
+
"bns_id",
|
|
289
|
+
"canonical",
|
|
290
|
+
"cursor",
|
|
291
|
+
"event_index",
|
|
292
|
+
"fqn",
|
|
293
|
+
"hashed_salted_fqn_preorder",
|
|
294
|
+
"imported_at",
|
|
295
|
+
"name",
|
|
296
|
+
"namespace",
|
|
297
|
+
"owner",
|
|
298
|
+
"preordered_by",
|
|
299
|
+
"registered_at",
|
|
300
|
+
"renewal_height",
|
|
301
|
+
"stx_burn",
|
|
302
|
+
"topic",
|
|
303
|
+
"tx_id",
|
|
304
|
+
"tx_index"
|
|
305
|
+
],
|
|
306
|
+
bns_namespace_events: [
|
|
307
|
+
"block_height",
|
|
308
|
+
"block_time",
|
|
309
|
+
"canonical",
|
|
310
|
+
"cursor",
|
|
311
|
+
"event_index",
|
|
312
|
+
"launched_at",
|
|
313
|
+
"lifetime",
|
|
314
|
+
"manager",
|
|
315
|
+
"manager_frozen",
|
|
316
|
+
"manager_transfers_disabled",
|
|
317
|
+
"namespace",
|
|
318
|
+
"price_frozen",
|
|
319
|
+
"price_function",
|
|
320
|
+
"revealed_at",
|
|
321
|
+
"status",
|
|
322
|
+
"tx_id",
|
|
323
|
+
"tx_index"
|
|
324
|
+
],
|
|
325
|
+
bns_marketplace_events: [
|
|
326
|
+
"action",
|
|
327
|
+
"block_height",
|
|
328
|
+
"block_time",
|
|
329
|
+
"bns_id",
|
|
330
|
+
"canonical",
|
|
331
|
+
"commission",
|
|
332
|
+
"cursor",
|
|
333
|
+
"event_index",
|
|
334
|
+
"price_ustx",
|
|
335
|
+
"tx_id",
|
|
336
|
+
"tx_index"
|
|
337
|
+
],
|
|
338
|
+
bns_names: [
|
|
339
|
+
"bns_id",
|
|
340
|
+
"fqn",
|
|
341
|
+
"last_event_at",
|
|
342
|
+
"last_event_cursor",
|
|
343
|
+
"name",
|
|
344
|
+
"namespace",
|
|
345
|
+
"owner",
|
|
346
|
+
"registered_at",
|
|
347
|
+
"renewal_height"
|
|
348
|
+
],
|
|
349
|
+
bns_namespaces: [
|
|
350
|
+
"last_event_at",
|
|
351
|
+
"last_event_cursor",
|
|
352
|
+
"launched_at",
|
|
353
|
+
"lifetime",
|
|
354
|
+
"manager",
|
|
355
|
+
"manager_frozen",
|
|
356
|
+
"name_count",
|
|
357
|
+
"namespace",
|
|
358
|
+
"price_frozen"
|
|
359
|
+
],
|
|
360
|
+
burn_block_rewards: [
|
|
361
|
+
"amount_sats",
|
|
362
|
+
"burn_amount",
|
|
363
|
+
"burn_block_hash",
|
|
364
|
+
"burn_block_height",
|
|
365
|
+
"canonical",
|
|
366
|
+
"cursor",
|
|
367
|
+
"recipient_btc",
|
|
368
|
+
"reward_index"
|
|
369
|
+
],
|
|
370
|
+
burn_block_reward_slots: [
|
|
371
|
+
"burn_block_hash",
|
|
372
|
+
"burn_block_height",
|
|
373
|
+
"canonical",
|
|
374
|
+
"cursor",
|
|
375
|
+
"holder_btc",
|
|
376
|
+
"slot_index"
|
|
377
|
+
],
|
|
378
|
+
events: ["block_height", "data", "event_index", "tx_id", "type"],
|
|
379
|
+
chain_reorgs: ["detected_at"]
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// src/db/index.ts
|
|
154
383
|
var DEFAULT_URL = "postgres://postgres:postgres@localhost:5432/secondlayer_dev";
|
|
155
384
|
var pools = new Map;
|
|
156
385
|
var poolSeq = 0;
|
|
@@ -183,6 +412,54 @@ function resolveSourceUrl() {
|
|
|
183
412
|
function resolveTargetUrl() {
|
|
184
413
|
return process.env.TARGET_DATABASE_URL || process.env.DATABASE_URL || DEFAULT_URL;
|
|
185
414
|
}
|
|
415
|
+
function describeDbUrl(url) {
|
|
416
|
+
try {
|
|
417
|
+
const u = new URL(url);
|
|
418
|
+
return `${u.hostname}${u.port ? `:${u.port}` : ""}${u.pathname}`;
|
|
419
|
+
} catch {
|
|
420
|
+
return "invalid-url";
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function getDbSplitStatus() {
|
|
424
|
+
const source = resolveSourceUrl();
|
|
425
|
+
const target = resolveTargetUrl();
|
|
426
|
+
const active = source !== target;
|
|
427
|
+
return {
|
|
428
|
+
mode: active ? "split" : "single",
|
|
429
|
+
active,
|
|
430
|
+
sourceDb: describeDbUrl(source),
|
|
431
|
+
targetDb: describeDbUrl(target)
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function assertDbSplit() {
|
|
435
|
+
const isProd = false;
|
|
436
|
+
const wantsSplit = !!(process.env.SOURCE_DATABASE_URL || process.env.TARGET_DATABASE_URL);
|
|
437
|
+
const databaseUrlSet = !!process.env.DATABASE_URL;
|
|
438
|
+
const source = resolveSourceUrl();
|
|
439
|
+
const target = resolveTargetUrl();
|
|
440
|
+
if (wantsSplit && !databaseUrlSet && (source === DEFAULT_URL || target === DEFAULT_URL)) {
|
|
441
|
+
const which = source === DEFAULT_URL ? "SOURCE_DATABASE_URL" : "TARGET_DATABASE_URL";
|
|
442
|
+
const msg = `${which} unset and DATABASE_URL absent — resolving to built-in DEFAULT_URL; refusing to silently use the wrong database`;
|
|
443
|
+
if (isProd)
|
|
444
|
+
console.error(`❌ ${msg}`);
|
|
445
|
+
else
|
|
446
|
+
console.warn(`⚠️ ${msg}`);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (!wantsSplit) {
|
|
450
|
+
if (isProd) {
|
|
451
|
+
console.warn("⚠️ DB split dormant — all services share one Postgres failure domain (SOURCE_/TARGET_DATABASE_URL unset)");
|
|
452
|
+
}
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (source === target) {
|
|
456
|
+
const msg = "DB split requested but SOURCE_DATABASE_URL === TARGET_DATABASE_URL (check for a typo or a stray DATABASE_URL fallback)";
|
|
457
|
+
if (isProd)
|
|
458
|
+
console.error(`❌ ${msg}`);
|
|
459
|
+
else
|
|
460
|
+
console.warn(`⚠️ ${msg}`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
186
463
|
function getOrCreatePool(url) {
|
|
187
464
|
const existing = pools.get(url);
|
|
188
465
|
if (existing) {
|
|
@@ -324,6 +601,13 @@ async function readChainReorgsSince(params) {
|
|
|
324
601
|
`.execute(db);
|
|
325
602
|
return result.rows.map(normalizeRow);
|
|
326
603
|
}
|
|
604
|
+
async function readChainReorgsForHeightRange(params) {
|
|
605
|
+
return readChainReorgsForRange({
|
|
606
|
+
from: { block_height: params.fromHeight, event_index: 0 },
|
|
607
|
+
to: { block_height: params.toHeight, event_index: 2147483647 },
|
|
608
|
+
db: params.db
|
|
609
|
+
});
|
|
610
|
+
}
|
|
327
611
|
async function readChainReorgsForRange(params) {
|
|
328
612
|
const db = params.db ?? getSourceDb();
|
|
329
613
|
const { from, to } = params;
|
|
@@ -352,9 +636,10 @@ async function readChainReorgsForRange(params) {
|
|
|
352
636
|
export {
|
|
353
637
|
readChainReorgsSince,
|
|
354
638
|
readChainReorgsForRange,
|
|
639
|
+
readChainReorgsForHeightRange,
|
|
355
640
|
insertChainReorg,
|
|
356
641
|
encodeChainReorgCursor
|
|
357
642
|
};
|
|
358
643
|
|
|
359
|
-
//# debugId=
|
|
644
|
+
//# debugId=CC17506FFD38A9EE64756E2164756E21
|
|
360
645
|
//# sourceMappingURL=chain-reorgs.js.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/env.ts", "../src/logger.ts", "../src/db/jsonb.ts", "../src/db/index.ts", "../src/db/queries/chain-reorgs.ts"],
|
|
3
|
+
"sources": ["../src/env.ts", "../src/logger.ts", "../src/db/jsonb.ts", "../src/db/index.ts", "../src/db/source-read-columns.ts", "../src/db/queries/chain-reorgs.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod/v4\";\n\n// Parse comma-separated networks\nconst networksSchema = z.string().transform((val) => {\n\tconst networks = val\n\t\t.split(\",\")\n\t\t.map((n) => n.trim())\n\t\t.filter(Boolean);\n\tconst valid = [\"mainnet\", \"testnet\"];\n\tfor (const n of networks) {\n\t\tif (!valid.includes(n)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid network: ${n}. Must be one of: ${valid.join(\", \")}`,\n\t\t\t);\n\t\t}\n\t}\n\treturn networks as (\"mainnet\" | \"testnet\")[];\n});\n\ninterface EnvSchemaOutput {\n\tDATABASE_URL?: string;\n\t/**\n\t * Shared indexer DB (blocks/txs/events). Falls back to DATABASE_URL.\n\t * Set this alongside TARGET_DATABASE_URL to enable dual-DB mode.\n\t */\n\tSOURCE_DATABASE_URL?: string;\n\t/**\n\t * Tenant DB (subgraph schemas + subgraphs table). Falls back to DATABASE_URL.\n\t * Set this alongside SOURCE_DATABASE_URL to enable dual-DB mode.\n\t */\n\tTARGET_DATABASE_URL?: string;\n\tNETWORK?: \"mainnet\" | \"testnet\";\n\tNETWORKS?: (\"mainnet\" | \"testnet\")[];\n\tLOG_LEVEL: \"debug\" | \"info\" | \"warn\" | \"error\";\n\tNODE_ENV: \"development\" | \"production\" | \"test\";\n}\n\n// Cast needed: z.preprocess / z.default create different _input vs _output types\n// that z.ZodType<T> can't represent without explicit input type param\nconst envSchema: z.ZodType<EnvSchemaOutput> = z.object({\n\tDATABASE_URL: z.preprocess(\n\t\t(val) => (typeof val === \"string\" && val.length === 0 ? undefined : val),\n\t\tz.string().url().optional(),\n\t),\n\tSOURCE_DATABASE_URL: z.preprocess(\n\t\t(val) => (typeof val === \"string\" && val.length === 0 ? undefined : val),\n\t\tz.string().url().optional(),\n\t),\n\tTARGET_DATABASE_URL: z.preprocess(\n\t\t(val) => (typeof val === \"string\" && val.length === 0 ? undefined : val),\n\t\tz.string().url().optional(),\n\t),\n\tNETWORK: z.enum([\"mainnet\", \"testnet\"]).optional(),\n\tNETWORKS: networksSchema.optional(),\n\tLOG_LEVEL: z.enum([\"debug\", \"info\", \"warn\", \"error\"]).default(\"info\"),\n\tNODE_ENV: z\n\t\t.enum([\"development\", \"production\", \"test\"])\n\t\t.default(\"development\"),\n}) as unknown as z.ZodType<EnvSchemaOutput>;\n\nexport type Env = EnvSchemaOutput & {\n\tenabledNetworks: (\"mainnet\" | \"testnet\")[];\n};\n\nlet cachedEnv: Env | null = null;\n\nexport function getEnv(): Env {\n\tif (cachedEnv) {\n\t\treturn cachedEnv;\n\t}\n\n\tconst result = envSchema.safeParse(process.env);\n\n\tif (!result.success) {\n\t\tconsole.error(\"❌ Invalid environment configuration:\");\n\t\tconsole.error(z.treeifyError(result.error));\n\t\tthrow new Error(\"Invalid environment configuration\");\n\t}\n\n\t// Compute enabled networks from NETWORKS or NETWORK\n\tlet enabledNetworks: (\"mainnet\" | \"testnet\")[];\n\tif (result.data.NETWORKS && result.data.NETWORKS.length > 0) {\n\t\tenabledNetworks = result.data.NETWORKS;\n\t} else if (result.data.NETWORK) {\n\t\tenabledNetworks = [result.data.NETWORK];\n\t} else {\n\t\tenabledNetworks = [\"mainnet\"]; // Default\n\t}\n\n\tcachedEnv = { ...result.data, enabledNetworks };\n\treturn cachedEnv;\n}\n\n// Export for testing\nexport { envSchema };\n",
|
|
5
|
+
"import { z } from \"zod/v4\";\n\n// Parse comma-separated networks\nconst networksSchema = z.string().transform((val) => {\n\tconst networks = val\n\t\t.split(\",\")\n\t\t.map((n) => n.trim())\n\t\t.filter(Boolean);\n\tconst valid = [\"mainnet\", \"testnet\"];\n\tfor (const n of networks) {\n\t\tif (!valid.includes(n)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid network: ${n}. Must be one of: ${valid.join(\", \")}`,\n\t\t\t);\n\t\t}\n\t}\n\treturn networks as (\"mainnet\" | \"testnet\")[];\n});\n\ninterface EnvSchemaOutput {\n\tDATABASE_URL?: string;\n\t/**\n\t * Shared indexer DB (blocks/txs/events). Falls back to DATABASE_URL.\n\t * Set this alongside TARGET_DATABASE_URL to enable dual-DB mode.\n\t */\n\tSOURCE_DATABASE_URL?: string;\n\t/**\n\t * Tenant DB (subgraph schemas + subgraphs table). Falls back to DATABASE_URL.\n\t * Set this alongside SOURCE_DATABASE_URL to enable dual-DB mode.\n\t */\n\tTARGET_DATABASE_URL?: string;\n\tNETWORK?: \"mainnet\" | \"testnet\";\n\tNETWORKS?: (\"mainnet\" | \"testnet\")[];\n\tLOG_LEVEL: \"debug\" | \"info\" | \"warn\" | \"error\";\n\tNODE_ENV: \"development\" | \"production\" | \"test\";\n}\n\n// Cast needed: z.preprocess / z.default create different _input vs _output types\n// that z.ZodType<T> can't represent without explicit input type param\nconst envSchema: z.ZodType<EnvSchemaOutput> = z.object({\n\tDATABASE_URL: z.preprocess(\n\t\t(val) => (typeof val === \"string\" && val.length === 0 ? undefined : val),\n\t\tz.string().url().optional(),\n\t),\n\tSOURCE_DATABASE_URL: z.preprocess(\n\t\t(val) => (typeof val === \"string\" && val.length === 0 ? undefined : val),\n\t\tz.string().url().optional(),\n\t),\n\tTARGET_DATABASE_URL: z.preprocess(\n\t\t(val) => (typeof val === \"string\" && val.length === 0 ? undefined : val),\n\t\tz.string().url().optional(),\n\t),\n\tNETWORK: z.enum([\"mainnet\", \"testnet\"]).optional(),\n\tNETWORKS: networksSchema.optional(),\n\tLOG_LEVEL: z.enum([\"debug\", \"info\", \"warn\", \"error\"]).default(\"info\"),\n\tNODE_ENV: z\n\t\t.enum([\"development\", \"production\", \"test\"])\n\t\t.default(\"development\"),\n}) as unknown as z.ZodType<EnvSchemaOutput>;\n\nexport type Env = EnvSchemaOutput & {\n\tenabledNetworks: (\"mainnet\" | \"testnet\")[];\n};\n\nlet cachedEnv: Env | null = null;\n\nexport function getEnv(): Env {\n\tif (cachedEnv) {\n\t\treturn cachedEnv;\n\t}\n\n\tconst result = envSchema.safeParse(process.env);\n\n\tif (!result.success) {\n\t\tconsole.error(\"❌ Invalid environment configuration:\");\n\t\tconsole.error(z.treeifyError(result.error));\n\t\tthrow new Error(\"Invalid environment configuration\");\n\t}\n\n\t// Compute enabled networks from NETWORKS or NETWORK\n\tlet enabledNetworks: (\"mainnet\" | \"testnet\")[];\n\tif (result.data.NETWORKS && result.data.NETWORKS.length > 0) {\n\t\tenabledNetworks = result.data.NETWORKS;\n\t} else if (result.data.NETWORK) {\n\t\tenabledNetworks = [result.data.NETWORK];\n\t} else {\n\t\tenabledNetworks = [\"mainnet\"]; // Default\n\t}\n\n\tcachedEnv = { ...result.data, enabledNetworks };\n\treturn cachedEnv;\n}\n\n/**\n * PoX-4 stacking decoder is ON by default — `/v1/index/stacking` is part of the\n * public surface, so the decoder that fills `pox4_calls` runs unless explicitly\n * opted out with `POX4_DECODER_ENABLED=false` (mirrors the sBTC decoder policy).\n */\nexport function isPox4DecoderEnabled(): boolean {\n\treturn process.env.POX4_DECODER_ENABLED !== \"false\";\n}\n\n// Export for testing\nexport { envSchema };\n",
|
|
6
6
|
"import { getEnv } from \"./env.ts\";\n\ntype LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n\tdebug: 0,\n\tinfo: 1,\n\twarn: 2,\n\terror: 3,\n};\n\nclass Logger {\n\tprivate _level?: LogLevel;\n\tprivate _isProduction?: boolean;\n\tprivate _initialized = false;\n\n\tprivate init() {\n\t\tif (this._initialized) return;\n\t\tthis._initialized = true;\n\t\ttry {\n\t\t\tconst env = getEnv();\n\t\t\tthis._level = env.LOG_LEVEL;\n\t\t\tthis._isProduction = env.NODE_ENV === \"production\";\n\t\t} catch {\n\t\t\t// Fallback when env is unavailable (e.g. tests without DATABASE_URL)\n\t\t\tthis._level = \"info\";\n\t\t\tthis._isProduction = false;\n\t\t}\n\t}\n\n\tprivate get level(): LogLevel {\n\t\tthis.init();\n\t\t// biome-ignore lint/style/noNonNullAssertion: value is non-null after preceding check or by construction; TS narrowing limitation\n\t\treturn this._level!;\n\t}\n\n\tprivate get isProduction(): boolean {\n\t\tthis.init();\n\t\t// biome-ignore lint/style/noNonNullAssertion: value is non-null after preceding check or by construction; TS narrowing limitation\n\t\treturn this._isProduction!;\n\t}\n\n\tprivate shouldLog(level: LogLevel): boolean {\n\t\treturn LOG_LEVELS[level] >= LOG_LEVELS[this.level];\n\t}\n\n\tprivate formatMessage(\n\t\tlevel: LogLevel,\n\t\tmessage: string,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\tmeta?: Record<string, any>,\n\t) {\n\t\tconst timestamp = new Date().toISOString();\n\n\t\tif (this.isProduction) {\n\t\t\t// JSON output for production\n\t\t\treturn JSON.stringify({\n\t\t\t\ttimestamp,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\t...meta,\n\t\t\t});\n\t\t}\n\n\t\t// Human-readable output for development\n\t\tconst metaStr = meta ? ` ${JSON.stringify(meta)}` : \"\";\n\t\treturn `[${timestamp}] ${level.toUpperCase()}: ${message}${metaStr}`;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tdebug(message: string, meta?: Record<string, any>): void {\n\t\tif (this.shouldLog(\"debug\")) {\n\t\t\tconsole.debug(this.formatMessage(\"debug\", message, meta));\n\t\t}\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tinfo(message: string, meta?: Record<string, any>): void {\n\t\tif (this.shouldLog(\"info\")) {\n\t\t\tconsole.info(this.formatMessage(\"info\", message, meta));\n\t\t}\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\twarn(message: string, meta?: Record<string, any>): void {\n\t\tif (this.shouldLog(\"warn\")) {\n\t\t\tconsole.warn(this.formatMessage(\"warn\", message, meta));\n\t\t}\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\terror(message: string, meta?: Record<string, any>): void {\n\t\tif (this.shouldLog(\"error\")) {\n\t\t\tconsole.error(this.formatMessage(\"error\", message, meta));\n\t\t}\n\t}\n}\n\n// Export singleton instance\nexport const logger: Logger = new Logger();\n",
|
|
7
7
|
"import { type RawBuilder, sql } from \"kysely\";\n\n/**\n * Safely encode a JS value as a JSONB literal for Kysely inserts/updates.\n * Kysely + postgres.js double-encodes JSON when using parameterized queries\n * with ::jsonb casts. This uses sql.raw to inline a properly escaped literal.\n *\n * Generic parameter lets callers set the RawBuilder's output type so they\n * don't need to cast at the insert site. Default is `unknown` — widen at\n * the call site when the column type is narrower, e.g. `jsonb<MyShape>(...)`.\n */\nexport function jsonb<T = unknown>(value: T): RawBuilder<T> {\n\tconst escaped = JSON.stringify(value, (_k, v) =>\n\t\ttypeof v === \"bigint\" ? v.toString() : v,\n\t).replace(/'/g, \"''\");\n\treturn sql`${sql.raw(`'${escaped}'::jsonb`)}`;\n}\n\n/**\n * Safely parse a JSONB value from the database.\n * Handles double-encoded strings where postgres.js returns a JSON string\n * instead of a parsed object.\n */\nexport function parseJsonb<T = unknown>(value: unknown): T {\n\tif (typeof value === \"string\") {\n\t\ttry {\n\t\t\treturn JSON.parse(value) as T;\n\t\t} catch {\n\t\t\treturn value as T;\n\t\t}\n\t}\n\treturn (value ?? {}) as T;\n}\n",
|
|
8
|
-
"import { Kysely } from \"kysely\";\nimport { PostgresJSDialect } from \"kysely-postgres-js\";\nimport postgres from \"postgres\";\nimport { logger } from \"../logger.ts\";\nimport type { Database } from \"./types.ts\";\n\nexport type { Database } from \"./types.ts\";\n\nconst DEFAULT_URL =\n\t\"postgres://postgres:postgres@localhost:5432/secondlayer_dev\";\n\ninterface PoolEntry {\n\tdb: Kysely<Database>;\n\trawClient: ReturnType<typeof postgres>;\n\t/** Last access (ms) — drives LRU eviction of BYO pools. */\n\tlastUsed: number;\n\t/** Monotonic counter as a tiebreaker; Date.now() can repeat under load. */\n\tseq: number;\n}\n\n/**\n * Cache of Kysely + raw postgres.js pools keyed by resolved URL.\n * Two getters resolving to the same URL share one entry (single pool) —\n * this is the single-DB backward-compat contract: when only `DATABASE_URL`\n * is set, `getSourceDb() === getTargetDb()` (zero regression vs. pre-dual-DB).\n *\n * The BYO data plane adds one pool per user-owned DB. To stop N user DBs from\n * exhausting connections/FDs, the map is bounded (`DATABASE_MAX_POOLS`, default\n * 25) with LRU eviction — the hot source/target pools are never evicted.\n */\nconst pools = new Map<string, PoolEntry>();\nlet poolSeq = 0;\n\nfunction maxPools(): number {\n\treturn Number.parseInt(process.env.DATABASE_MAX_POOLS ?? \"25\", 10);\n}\n\n/** Close the least-recently-used non-(source/target) pool when over the cap. */\nfunction evictIfNeeded(): void {\n\tif (pools.size <= maxPools()) return;\n\tconst protectedUrls = new Set([resolveSourceUrl(), resolveTargetUrl()]);\n\tlet lruUrl: string | undefined;\n\tlet lruEntry: PoolEntry | undefined;\n\tfor (const [url, entry] of pools) {\n\t\tif (protectedUrls.has(url)) continue;\n\t\tif (\n\t\t\t!lruEntry ||\n\t\t\tentry.lastUsed < lruEntry.lastUsed ||\n\t\t\t(entry.lastUsed === lruEntry.lastUsed && entry.seq < lruEntry.seq)\n\t\t) {\n\t\t\tlruUrl = url;\n\t\t\tlruEntry = entry;\n\t\t}\n\t}\n\tif (!lruUrl || !lruEntry) return;\n\tpools.delete(lruUrl);\n\tconst evicted = lruEntry;\n\t// Close in the background — never block pool creation on teardown.\n\tvoid evicted.db\n\t\t.destroy()\n\t\t.catch(() => {})\n\t\t.then(() => evicted.rawClient.end({ timeout: 5 }))\n\t\t.catch(() => {});\n}\n\nfunction resolveSourceUrl(): string {\n\treturn (\n\t\tprocess.env.SOURCE_DATABASE_URL || process.env.DATABASE_URL || DEFAULT_URL\n\t);\n}\n\nfunction resolveTargetUrl(): string {\n\treturn (\n\t\tprocess.env.TARGET_DATABASE_URL || process.env.DATABASE_URL || DEFAULT_URL\n\t);\n}\n\nfunction getOrCreatePool(url: string): PoolEntry {\n\tconst existing = pools.get(url);\n\tif (existing) {\n\t\texisting.lastUsed = Date.now();\n\t\texisting.seq = poolSeq++;\n\t\treturn existing;\n\t}\n\n\t// \"Local\" = we skip TLS. Any Docker service alias (single-label hostname\n\t// with no dots) is on an internal network and won't serve TLS.\n\tconst host = (() => {\n\t\ttry {\n\t\t\treturn new URL(url).hostname;\n\t\t} catch {\n\t\t\treturn \"\";\n\t\t}\n\t})();\n\tconst isLocal =\n\t\thost === \"localhost\" || host === \"127.0.0.1\" || !host.includes(\".\");\n\tconst poolMax = Number.parseInt(process.env.DATABASE_POOL_MAX ?? \"20\", 10);\n\t// Close idle connections so a fleet of BYO pools doesn't pin connections it\n\t// no longer needs (0 = never; postgres.js default).\n\tconst idleTimeout = Number.parseInt(\n\t\tprocess.env.DATABASE_IDLE_TIMEOUT ?? \"300\",\n\t\t10,\n\t);\n\tconst rawClient = postgres(url, {\n\t\tmax: poolMax,\n\t\tidle_timeout: idleTimeout,\n\t\tssl: isLocal\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\trejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== \"0\",\n\t\t\t\t},\n\t});\n\tconst db = new Kysely<Database>({\n\t\tdialect: new PostgresJSDialect({ postgres: rawClient }),\n\t\t// Diagnostic hook: surface the failing SQL whenever postgres rejects\n\t\t// with code 42P10 (ON CONFLICT target doesn't match any unique\n\t\t// constraint). Temporary — remove once we've caught the culprit\n\t\t// query in prod logs and fixed the schema drift.\n\t\tlog: (event) => {\n\t\t\tif (event.level !== \"error\") return;\n\t\t\tconst err = event.error as {\n\t\t\t\tcode?: string;\n\t\t\t\tmessage?: string;\n\t\t\t} | null;\n\t\t\tif (err?.code !== \"42P10\") return;\n\t\t\tlogger.warn(\"db.on_conflict_constraint_missing\", {\n\t\t\t\tcode: err.code,\n\t\t\t\tmessage: err.message,\n\t\t\t\tsql: event.query.sql,\n\t\t\t\tparams: event.query.parameters,\n\t\t\t});\n\t\t},\n\t});\n\tconst entry: PoolEntry = {\n\t\tdb,\n\t\trawClient,\n\t\tlastUsed: Date.now(),\n\t\tseq: poolSeq++,\n\t};\n\tpools.set(url, entry);\n\tevictIfNeeded();\n\treturn entry;\n}\n\n/**\n * Kysely instance for the SOURCE DB (block/tx/event reads from the shared\n * indexer). Resolution: `SOURCE_DATABASE_URL || DATABASE_URL`.\n */\nexport function getSourceDb(): Kysely<Database> {\n\treturn getOrCreatePool(resolveSourceUrl()).db;\n}\n\n/**\n * Kysely instance for the TARGET DB (subgraph schemas, subgraphs table,\n * account-scoped data — tenant-side writes). Resolution:\n * `TARGET_DATABASE_URL || DATABASE_URL`.\n */\nexport function getTargetDb(): Kysely<Database> {\n\treturn getOrCreatePool(resolveTargetUrl()).db;\n}\n\n/**\n * Backward-compat alias for `getTargetDb()`. Accepts an optional\n * `connectionString` override used by seed/test helpers — when supplied,\n * bypasses env resolution and uses the provided URL directly (still cached).\n */\nexport function getDb(connectionString?: string): Kysely<Database> {\n\tif (connectionString) return getOrCreatePool(connectionString).db;\n\treturn getTargetDb();\n}\n\n/**\n * Raw postgres.js client for dynamic schema DDL (CREATE SCHEMA, DROP, etc.).\n * Defaults to the target role (tenant schemas live in the target DB).\n */\nexport function getRawClient(\n\trole: \"source\" | \"target\" = \"target\",\n): ReturnType<typeof postgres> {\n\tconst url = role === \"source\" ? resolveSourceUrl() : resolveTargetUrl();\n\treturn getOrCreatePool(url).rawClient;\n}\n\n/**\n * Raw postgres.js client for an arbitrary connection string (cached by URL).\n * Used by the BYO data plane to run DDL / serving queries against a\n * user-owned Postgres. Distinct from {@link getRawClient}, which only knows the\n * source/target roles resolved from env.\n */\nexport function getRawClientFor(url: string): ReturnType<typeof postgres> {\n\treturn getOrCreatePool(url).rawClient;\n}\n\n/** Close all DB connection pools. Call in CLI commands to allow process exit. */\nexport async function closeDb(): Promise<void> {\n\tfor (const entry of pools.values()) {\n\t\tawait entry.db.destroy();\n\t\tawait entry.rawClient.end();\n\t}\n\tpools.clear();\n}\n\nimport { sql } from \"kysely\";\nexport { sql };\nexport * from \"./types.ts\";\nexport { jsonb, parseJsonb } from \"./jsonb.ts\";\n",
|
|
9
|
-
"import {
|
|
8
|
+
"import { Kysely } from \"kysely\";\nimport { PostgresJSDialect } from \"kysely-postgres-js\";\nimport postgres from \"postgres\";\nimport { logger } from \"../logger.ts\";\nimport type { Database } from \"./types.ts\";\n\nexport type { Database } from \"./types.ts\";\n\nconst DEFAULT_URL =\n\t\"postgres://postgres:postgres@localhost:5432/secondlayer_dev\";\n\ninterface PoolEntry {\n\tdb: Kysely<Database>;\n\trawClient: ReturnType<typeof postgres>;\n\t/** Last access (ms) — drives LRU eviction of BYO pools. */\n\tlastUsed: number;\n\t/** Monotonic counter as a tiebreaker; Date.now() can repeat under load. */\n\tseq: number;\n}\n\n/**\n * Cache of Kysely + raw postgres.js pools keyed by resolved URL.\n * Two getters resolving to the same URL share one entry (single pool) —\n * this is the single-DB backward-compat contract: when only `DATABASE_URL`\n * is set, `getSourceDb() === getTargetDb()` (zero regression vs. pre-dual-DB).\n *\n * The BYO data plane adds one pool per user-owned DB. To stop N user DBs from\n * exhausting connections/FDs, the map is bounded (`DATABASE_MAX_POOLS`, default\n * 25) with LRU eviction — the hot source/target pools are never evicted.\n */\nconst pools = new Map<string, PoolEntry>();\nlet poolSeq = 0;\n\nfunction maxPools(): number {\n\treturn Number.parseInt(process.env.DATABASE_MAX_POOLS ?? \"25\", 10);\n}\n\n/** Close the least-recently-used non-(source/target) pool when over the cap. */\nfunction evictIfNeeded(): void {\n\tif (pools.size <= maxPools()) return;\n\tconst protectedUrls = new Set([resolveSourceUrl(), resolveTargetUrl()]);\n\tlet lruUrl: string | undefined;\n\tlet lruEntry: PoolEntry | undefined;\n\tfor (const [url, entry] of pools) {\n\t\tif (protectedUrls.has(url)) continue;\n\t\tif (\n\t\t\t!lruEntry ||\n\t\t\tentry.lastUsed < lruEntry.lastUsed ||\n\t\t\t(entry.lastUsed === lruEntry.lastUsed && entry.seq < lruEntry.seq)\n\t\t) {\n\t\t\tlruUrl = url;\n\t\t\tlruEntry = entry;\n\t\t}\n\t}\n\tif (!lruUrl || !lruEntry) return;\n\tpools.delete(lruUrl);\n\tconst evicted = lruEntry;\n\t// Close in the background — never block pool creation on teardown.\n\tvoid evicted.db\n\t\t.destroy()\n\t\t.catch(() => {})\n\t\t.then(() => evicted.rawClient.end({ timeout: 5 }))\n\t\t.catch(() => {});\n}\n\nfunction resolveSourceUrl(): string {\n\treturn (\n\t\tprocess.env.SOURCE_DATABASE_URL || process.env.DATABASE_URL || DEFAULT_URL\n\t);\n}\n\nfunction resolveTargetUrl(): string {\n\treturn (\n\t\tprocess.env.TARGET_DATABASE_URL || process.env.DATABASE_URL || DEFAULT_URL\n\t);\n}\n\n/** Host[:port]/dbname for a connection URL — credentials stripped. */\nfunction describeDbUrl(url: string): string {\n\ttry {\n\t\tconst u = new URL(url);\n\t\treturn `${u.hostname}${u.port ? `:${u.port}` : \"\"}${u.pathname}`;\n\t} catch {\n\t\treturn \"invalid-url\";\n\t}\n}\n\nexport interface DbSplitStatus {\n\t/** \"split\" when source/target resolve to different DBs, else \"single\". */\n\tmode: \"split\" | \"single\";\n\t/** True when the chain/control split is live (distinct DBs). */\n\tactive: boolean;\n\t/** SOURCE host[:port]/dbname (no credentials). */\n\tsourceDb: string;\n\t/** TARGET host[:port]/dbname (no credentials). */\n\ttargetDb: string;\n}\n\n/**\n * Resolved source/target DB identity for status/health surfaces. Lets operators\n * see whether the chain/control split is live or dormant (collapsed to one DB)\n * without shelling in. Credentials are never exposed — host/db only.\n *\n * `active` is a STRING-IDENTITY check on the two URLs: it can't catch two\n * distinct URLs that alias the same physical instance (e.g. `postgres` vs\n * `127.0.0.1`, or a swapped/wrong host). Treat `active: true` as \"configured\n * for split\", not a proof of physical isolation.\n */\nexport function getDbSplitStatus(): DbSplitStatus {\n\tconst source = resolveSourceUrl();\n\tconst target = resolveTargetUrl();\n\tconst active = source !== target;\n\treturn {\n\t\tmode: active ? \"split\" : \"single\",\n\t\tactive,\n\t\tsourceDb: describeDbUrl(source),\n\t\ttargetDb: describeDbUrl(target),\n\t};\n}\n\n/**\n * Boot guard for the chain/control DB split. Surfaces three misconfigurations\n * loudly (fail-soft — logs, never throws, so a misconfig can't brick startup):\n *\n * 1. Silent wrong-DB: a split is requested (one of SOURCE_/TARGET_ set) but\n * `DATABASE_URL` is absent (the split-prod default) and the OTHER var is\n * unset, so it falls through to the built-in dev `DEFAULT_URL` — about to\n * read/write a real-but-wrong database. This is the failure mode the\n * remove-DATABASE_URL decision creates; catch it.\n * 2. Collapsed split: both vars set but resolve to the same DB (typo, or a\n * stray `DATABASE_URL` masking the intent).\n * 3. Dormant split (prod only): neither var set, so all services share one\n * Postgres failure domain. Not an error, but no longer silent.\n */\nexport function assertDbSplit(): void {\n\tconst isProd = process.env.NODE_ENV === \"production\";\n\tconst wantsSplit = !!(\n\t\tprocess.env.SOURCE_DATABASE_URL || process.env.TARGET_DATABASE_URL\n\t);\n\tconst databaseUrlSet = !!process.env.DATABASE_URL;\n\tconst source = resolveSourceUrl();\n\tconst target = resolveTargetUrl();\n\n\tif (\n\t\twantsSplit &&\n\t\t!databaseUrlSet &&\n\t\t(source === DEFAULT_URL || target === DEFAULT_URL)\n\t) {\n\t\tconst which =\n\t\t\tsource === DEFAULT_URL ? \"SOURCE_DATABASE_URL\" : \"TARGET_DATABASE_URL\";\n\t\tconst msg = `${which} unset and DATABASE_URL absent — resolving to built-in DEFAULT_URL; refusing to silently use the wrong database`;\n\t\tif (isProd) console.error(`❌ ${msg}`);\n\t\telse console.warn(`⚠️ ${msg}`);\n\t\treturn;\n\t}\n\n\tif (!wantsSplit) {\n\t\tif (isProd) {\n\t\t\tconsole.warn(\n\t\t\t\t\"⚠️ DB split dormant — all services share one Postgres failure domain (SOURCE_/TARGET_DATABASE_URL unset)\",\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (source === target) {\n\t\tconst msg =\n\t\t\t\"DB split requested but SOURCE_DATABASE_URL === TARGET_DATABASE_URL (check for a typo or a stray DATABASE_URL fallback)\";\n\t\tif (isProd) console.error(`❌ ${msg}`);\n\t\telse console.warn(`⚠️ ${msg}`);\n\t}\n}\n\nfunction getOrCreatePool(url: string): PoolEntry {\n\tconst existing = pools.get(url);\n\tif (existing) {\n\t\texisting.lastUsed = Date.now();\n\t\texisting.seq = poolSeq++;\n\t\treturn existing;\n\t}\n\n\t// \"Local\" = we skip TLS. Any Docker service alias (single-label hostname\n\t// with no dots) is on an internal network and won't serve TLS.\n\tconst host = (() => {\n\t\ttry {\n\t\t\treturn new URL(url).hostname;\n\t\t} catch {\n\t\t\treturn \"\";\n\t\t}\n\t})();\n\tconst isLocal =\n\t\thost === \"localhost\" || host === \"127.0.0.1\" || !host.includes(\".\");\n\tconst poolMax = Number.parseInt(process.env.DATABASE_POOL_MAX ?? \"20\", 10);\n\t// Close idle connections so a fleet of BYO pools doesn't pin connections it\n\t// no longer needs (0 = never; postgres.js default).\n\tconst idleTimeout = Number.parseInt(\n\t\tprocess.env.DATABASE_IDLE_TIMEOUT ?? \"300\",\n\t\t10,\n\t);\n\tconst rawClient = postgres(url, {\n\t\tmax: poolMax,\n\t\tidle_timeout: idleTimeout,\n\t\tssl: isLocal\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\trejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== \"0\",\n\t\t\t\t},\n\t});\n\tconst db = new Kysely<Database>({\n\t\tdialect: new PostgresJSDialect({ postgres: rawClient }),\n\t\t// Diagnostic hook: surface the failing SQL whenever postgres rejects\n\t\t// with code 42P10 (ON CONFLICT target doesn't match any unique\n\t\t// constraint). Temporary — remove once we've caught the culprit\n\t\t// query in prod logs and fixed the schema drift.\n\t\tlog: (event) => {\n\t\t\tif (event.level !== \"error\") return;\n\t\t\tconst err = event.error as {\n\t\t\t\tcode?: string;\n\t\t\t\tmessage?: string;\n\t\t\t} | null;\n\t\t\tif (err?.code !== \"42P10\") return;\n\t\t\tlogger.warn(\"db.on_conflict_constraint_missing\", {\n\t\t\t\tcode: err.code,\n\t\t\t\tmessage: err.message,\n\t\t\t\tsql: event.query.sql,\n\t\t\t\tparams: event.query.parameters,\n\t\t\t});\n\t\t},\n\t});\n\tconst entry: PoolEntry = {\n\t\tdb,\n\t\trawClient,\n\t\tlastUsed: Date.now(),\n\t\tseq: poolSeq++,\n\t};\n\tpools.set(url, entry);\n\tevictIfNeeded();\n\treturn entry;\n}\n\n/**\n * Kysely instance for the SOURCE DB (block/tx/event reads from the shared\n * indexer). Resolution: `SOURCE_DATABASE_URL || DATABASE_URL`.\n */\nexport function getSourceDb(): Kysely<Database> {\n\treturn getOrCreatePool(resolveSourceUrl()).db;\n}\n\n/**\n * Kysely instance for the TARGET DB (subgraph schemas, subgraphs table,\n * account-scoped data — tenant-side writes). Resolution:\n * `TARGET_DATABASE_URL || DATABASE_URL`.\n */\nexport function getTargetDb(): Kysely<Database> {\n\treturn getOrCreatePool(resolveTargetUrl()).db;\n}\n\n/**\n * Backward-compat alias for `getTargetDb()`. Accepts an optional\n * `connectionString` override used by seed/test helpers — when supplied,\n * bypasses env resolution and uses the provided URL directly (still cached).\n */\nexport function getDb(connectionString?: string): Kysely<Database> {\n\tif (connectionString) return getOrCreatePool(connectionString).db;\n\treturn getTargetDb();\n}\n\n/**\n * Raw postgres.js client for dynamic schema DDL (CREATE SCHEMA, DROP, etc.).\n * Defaults to the target role (tenant schemas live in the target DB).\n */\nexport function getRawClient(\n\trole: \"source\" | \"target\" = \"target\",\n): ReturnType<typeof postgres> {\n\tconst url = role === \"source\" ? resolveSourceUrl() : resolveTargetUrl();\n\treturn getOrCreatePool(url).rawClient;\n}\n\n/**\n * Raw postgres.js client for an arbitrary connection string (cached by URL).\n * Used by the BYO data plane to run DDL / serving queries against a\n * user-owned Postgres. Distinct from {@link getRawClient}, which only knows the\n * source/target roles resolved from env.\n */\nexport function getRawClientFor(url: string): ReturnType<typeof postgres> {\n\treturn getOrCreatePool(url).rawClient;\n}\n\n/** Close all DB connection pools. Call in CLI commands to allow process exit. */\nexport async function closeDb(): Promise<void> {\n\tfor (const entry of pools.values()) {\n\t\tawait entry.db.destroy();\n\t\tawait entry.rawClient.end();\n\t}\n\tpools.clear();\n}\n\nimport { sql } from \"kysely\";\nexport { sql };\nexport * from \"./types.ts\";\nexport type { DbReadRow, NumericAsText } from \"./read-row.ts\";\nexport { SOURCE_READ_COLUMNS } from \"./source-read-columns.ts\";\nexport { jsonb, parseJsonb } from \"./jsonb.ts\";\n",
|
|
9
|
+
"import type { Database } from \"./types.ts\";\n\n// The physical source-table columns the public read API (packages/api) actually\n// reads via getSourceDb(). This is the read contract between the indexer (which\n// owns the write schema) and the API (which reads it raw). A column rename or\n// removal on the producer side that isn't reflected here is caught by the\n// snapshot drift test; the `satisfies` clause guarantees every entry is a real\n// table + column today.\n//\n// Computed/aliased read expressions are intentionally excluded — they are not\n// part of the producer contract: `cursor`/`block_time` where derived in SQL\n// rather than stored, window ranks (stream_event_index), and JSONB extractions\n// from `events.data`. Generated bookkeeping columns (created_at/updated_at) are\n// excluded unless a read path selects them.\nexport const SOURCE_READ_COLUMNS = {\n\tblocks: [\n\t\t\"burn_block_hash\",\n\t\t\"burn_block_height\",\n\t\t\"canonical\",\n\t\t\"hash\",\n\t\t\"height\",\n\t\t\"parent_hash\",\n\t\t\"timestamp\",\n\t],\n\tdecoded_events: [\n\t\t\"amount\",\n\t\t\"asset_identifier\",\n\t\t\"block_height\",\n\t\t\"canonical\",\n\t\t\"contract_id\",\n\t\t\"cursor\",\n\t\t\"event_index\",\n\t\t\"event_type\",\n\t\t\"memo\",\n\t\t\"payload\",\n\t\t\"recipient\",\n\t\t\"sender\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t\t\"value\",\n\t],\n\ttransactions: [\n\t\t\"block_height\",\n\t\t\"contract_id\",\n\t\t\"function_args\",\n\t\t\"function_name\",\n\t\t\"raw_result\",\n\t\t\"raw_tx\",\n\t\t\"sender\",\n\t\t\"status\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t\t\"type\",\n\t],\n\tmempool_transactions: [\n\t\t\"contract_id\",\n\t\t\"function_args\",\n\t\t\"function_name\",\n\t\t\"raw_tx\",\n\t\t\"received_at\",\n\t\t\"sender\",\n\t\t\"seq\",\n\t\t\"tx_id\",\n\t\t\"type\",\n\t],\n\tpox4_calls: [\n\t\t\"aggregated_amount_ustx\",\n\t\t\"aggregated_signer_index\",\n\t\t\"amount_ustx\",\n\t\t\"auth_allowed\",\n\t\t\"auth_id\",\n\t\t\"auth_period\",\n\t\t\"auth_topic\",\n\t\t\"block_height\",\n\t\t\"block_time\",\n\t\t\"burn_block_height\",\n\t\t\"caller\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"delegate_to\",\n\t\t\"end_cycle\",\n\t\t\"function_name\",\n\t\t\"lock_period\",\n\t\t\"max_amount\",\n\t\t\"pox_addr_btc\",\n\t\t\"pox_addr_hashbytes\",\n\t\t\"pox_addr_version\",\n\t\t\"result_ok\",\n\t\t\"reward_cycle\",\n\t\t\"signer_key\",\n\t\t\"signer_signature\",\n\t\t\"source_cursor\",\n\t\t\"stacker\",\n\t\t\"start_cycle\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t],\n\tsbtc_events: [\n\t\t\"amount\",\n\t\t\"bitcoin_txid\",\n\t\t\"block_height\",\n\t\t\"block_time\",\n\t\t\"burn_hash\",\n\t\t\"burn_height\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"event_index\",\n\t\t\"fee\",\n\t\t\"governance_contract_type\",\n\t\t\"governance_new_contract\",\n\t\t\"max_fee\",\n\t\t\"output_index\",\n\t\t\"recipient_btc_hashbytes\",\n\t\t\"recipient_btc_version\",\n\t\t\"request_id\",\n\t\t\"sender\",\n\t\t\"signer_address\",\n\t\t\"signer_aggregate_pubkey\",\n\t\t\"signer_bitmap\",\n\t\t\"signer_keys_count\",\n\t\t\"signer_threshold\",\n\t\t\"sweep_txid\",\n\t\t\"topic\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t],\n\tsbtc_token_events: [\n\t\t\"amount\",\n\t\t\"block_height\",\n\t\t\"block_time\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"event_index\",\n\t\t\"event_type\",\n\t\t\"memo\",\n\t\t\"recipient\",\n\t\t\"sender\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t],\n\tbns_name_events: [\n\t\t\"block_height\",\n\t\t\"block_time\",\n\t\t\"bns_id\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"event_index\",\n\t\t\"fqn\",\n\t\t\"hashed_salted_fqn_preorder\",\n\t\t\"imported_at\",\n\t\t\"name\",\n\t\t\"namespace\",\n\t\t\"owner\",\n\t\t\"preordered_by\",\n\t\t\"registered_at\",\n\t\t\"renewal_height\",\n\t\t\"stx_burn\",\n\t\t\"topic\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t],\n\tbns_namespace_events: [\n\t\t\"block_height\",\n\t\t\"block_time\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"event_index\",\n\t\t\"launched_at\",\n\t\t\"lifetime\",\n\t\t\"manager\",\n\t\t\"manager_frozen\",\n\t\t\"manager_transfers_disabled\",\n\t\t\"namespace\",\n\t\t\"price_frozen\",\n\t\t\"price_function\",\n\t\t\"revealed_at\",\n\t\t\"status\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t],\n\tbns_marketplace_events: [\n\t\t\"action\",\n\t\t\"block_height\",\n\t\t\"block_time\",\n\t\t\"bns_id\",\n\t\t\"canonical\",\n\t\t\"commission\",\n\t\t\"cursor\",\n\t\t\"event_index\",\n\t\t\"price_ustx\",\n\t\t\"tx_id\",\n\t\t\"tx_index\",\n\t],\n\tbns_names: [\n\t\t\"bns_id\",\n\t\t\"fqn\",\n\t\t\"last_event_at\",\n\t\t\"last_event_cursor\",\n\t\t\"name\",\n\t\t\"namespace\",\n\t\t\"owner\",\n\t\t\"registered_at\",\n\t\t\"renewal_height\",\n\t],\n\tbns_namespaces: [\n\t\t\"last_event_at\",\n\t\t\"last_event_cursor\",\n\t\t\"launched_at\",\n\t\t\"lifetime\",\n\t\t\"manager\",\n\t\t\"manager_frozen\",\n\t\t\"name_count\",\n\t\t\"namespace\",\n\t\t\"price_frozen\",\n\t],\n\tburn_block_rewards: [\n\t\t\"amount_sats\",\n\t\t\"burn_amount\",\n\t\t\"burn_block_hash\",\n\t\t\"burn_block_height\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"recipient_btc\",\n\t\t\"reward_index\",\n\t],\n\tburn_block_reward_slots: [\n\t\t\"burn_block_hash\",\n\t\t\"burn_block_height\",\n\t\t\"canonical\",\n\t\t\"cursor\",\n\t\t\"holder_btc\",\n\t\t\"slot_index\",\n\t],\n\tevents: [\"block_height\", \"data\", \"event_index\", \"tx_id\", \"type\"],\n\tchain_reorgs: [\"detected_at\"],\n} as const satisfies {\n\treadonly [T in keyof Database]?: readonly (keyof Database[T])[];\n};\n",
|
|
10
|
+
"import type { Kysely, Transaction } from \"kysely\";\nimport { getSourceDb, sql } from \"../index.ts\";\nimport type { Database } from \"../types.ts\";\n\nexport type ChainReorgCursor = {\n\tblock_height: number;\n\tevent_index: number;\n};\n\nexport type ChainReorgRecord = {\n\tid: string;\n\tdetected_at: string;\n\tfork_point_height: number;\n\told_index_block_hash: string | null;\n\tnew_index_block_hash: string | null;\n\torphaned_range: { from: string; to: string };\n\tnew_canonical_tip: string;\n};\n\nexport type InsertChainReorgParams = {\n\tforkPointHeight: number;\n\toldIndexBlockHash?: string | null;\n\tnewIndexBlockHash?: string | null;\n\torphanedFrom: ChainReorgCursor;\n\torphanedTo: ChainReorgCursor;\n\tnewCanonicalTip: ChainReorgCursor;\n\tdb?: Kysely<Database> | Transaction<Database>;\n};\n\nexport type ReadChainReorgsSinceParams = {\n\tsince: Date | ChainReorgCursor;\n\tlimit: number;\n\tdb?: Kysely<Database>;\n};\n\nexport type ReadChainReorgsForRangeParams = {\n\tfrom: ChainReorgCursor;\n\tto: ChainReorgCursor;\n\tdb?: Kysely<Database>;\n};\n\nexport type ReadChainReorgsForHeightRangeParams = {\n\tfromHeight: number;\n\ttoHeight: number;\n\tdb?: Kysely<Database>;\n};\n\ntype ChainReorgRow = {\n\tid: string;\n\tdetected_at: Date | string;\n\tfork_point_height: string | number;\n\told_index_block_hash: string | null;\n\tnew_index_block_hash: string | null;\n\torphaned_from_height: string | number;\n\torphaned_from_event_index: string | number;\n\torphaned_to_height: string | number;\n\torphaned_to_event_index: string | number;\n\tnew_canonical_height: string | number;\n\tnew_canonical_event_index: string | number;\n};\n\nexport function encodeChainReorgCursor(cursor: ChainReorgCursor): string {\n\treturn `${cursor.block_height}:${cursor.event_index}`;\n}\n\nfunction normalizeRow(row: ChainReorgRow): ChainReorgRecord {\n\tconst detectedAt =\n\t\trow.detected_at instanceof Date\n\t\t\t? row.detected_at.toISOString()\n\t\t\t: new Date(row.detected_at).toISOString();\n\n\treturn {\n\t\tid: row.id,\n\t\tdetected_at: detectedAt,\n\t\tfork_point_height: Number(row.fork_point_height),\n\t\told_index_block_hash: row.old_index_block_hash,\n\t\tnew_index_block_hash: row.new_index_block_hash,\n\t\torphaned_range: {\n\t\t\tfrom: encodeChainReorgCursor({\n\t\t\t\tblock_height: Number(row.orphaned_from_height),\n\t\t\t\tevent_index: Number(row.orphaned_from_event_index),\n\t\t\t}),\n\t\t\tto: encodeChainReorgCursor({\n\t\t\t\tblock_height: Number(row.orphaned_to_height),\n\t\t\t\tevent_index: Number(row.orphaned_to_event_index),\n\t\t\t}),\n\t\t},\n\t\tnew_canonical_tip: encodeChainReorgCursor({\n\t\t\tblock_height: Number(row.new_canonical_height),\n\t\t\tevent_index: Number(row.new_canonical_event_index),\n\t\t}),\n\t};\n}\n\nexport async function insertChainReorg(\n\tparams: InsertChainReorgParams,\n): Promise<ChainReorgRecord> {\n\tconst db = params.db ?? getSourceDb();\n\tconst row = await db\n\t\t.insertInto(\"chain_reorgs\")\n\t\t.values({\n\t\t\tfork_point_height: params.forkPointHeight,\n\t\t\told_index_block_hash: params.oldIndexBlockHash ?? null,\n\t\t\tnew_index_block_hash: params.newIndexBlockHash ?? null,\n\t\t\torphaned_from_height: params.orphanedFrom.block_height,\n\t\t\torphaned_from_event_index: params.orphanedFrom.event_index,\n\t\t\torphaned_to_height: params.orphanedTo.block_height,\n\t\t\torphaned_to_event_index: params.orphanedTo.event_index,\n\t\t\tnew_canonical_height: params.newCanonicalTip.block_height,\n\t\t\tnew_canonical_event_index: params.newCanonicalTip.event_index,\n\t\t})\n\t\t.returningAll()\n\t\t.executeTakeFirstOrThrow();\n\n\treturn normalizeRow(row);\n}\n\nexport async function readChainReorgsSince(\n\tparams: ReadChainReorgsSinceParams,\n): Promise<ChainReorgRecord[]> {\n\tconst db = params.db ?? getSourceDb();\n\tconst limit = Math.min(1000, Math.max(1, params.limit));\n\n\tconst result =\n\t\tparams.since instanceof Date\n\t\t\t? await sql<ChainReorgRow>`\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM chain_reorgs\n\t\t\t\t\tWHERE detected_at > ${params.since}\n\t\t\t\t\tORDER BY detected_at ASC, id ASC\n\t\t\t\t\tLIMIT ${limit}\n\t\t\t\t`.execute(db)\n\t\t\t: await sql<ChainReorgRow>`\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM chain_reorgs\n\t\t\t\t\tWHERE\n\t\t\t\t\t\torphaned_to_height > ${params.since.block_height}\n\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\torphaned_to_height = ${params.since.block_height}\n\t\t\t\t\t\t\tAND orphaned_to_event_index >= ${params.since.event_index}\n\t\t\t\t\t\t)\n\t\t\t\t\tORDER BY detected_at ASC, id ASC\n\t\t\t\t\tLIMIT ${limit}\n\t\t\t\t`.execute(db);\n\n\treturn result.rows.map(normalizeRow);\n}\n\n/**\n * Reorgs overlapping the block-height window [fromHeight, toHeight], ignoring\n * event_index. For cursor keyspaces that are NOT event-indexed (the\n * transactions / contract-calls endpoints key on block_height:tx_index): a\n * height-granular overlap. Over-inclusive — a partially-orphaned height in range\n * surfaces even if the page's specific rows survived — but never under-reports.\n */\nexport async function readChainReorgsForHeightRange(\n\tparams: ReadChainReorgsForHeightRangeParams,\n): Promise<ChainReorgRecord[]> {\n\treturn readChainReorgsForRange({\n\t\tfrom: { block_height: params.fromHeight, event_index: 0 },\n\t\t// int4 max — event_index is a Postgres `integer`, so a larger sentinel\n\t\t// (e.g. Number.MAX_SAFE_INTEGER) overflows when bound for comparison.\n\t\tto: { block_height: params.toHeight, event_index: 2_147_483_647 },\n\t\tdb: params.db,\n\t});\n}\n\nexport async function readChainReorgsForRange(\n\tparams: ReadChainReorgsForRangeParams,\n): Promise<ChainReorgRecord[]> {\n\tconst db = params.db ?? getSourceDb();\n\tconst { from, to } = params;\n\tconst { rows } = await sql<ChainReorgRow>`\n\t\tSELECT *\n\t\tFROM chain_reorgs\n\t\tWHERE\n\t\t\t(\n\t\t\t\torphaned_from_height < ${to.block_height}\n\t\t\t\tOR (\n\t\t\t\t\torphaned_from_height = ${to.block_height}\n\t\t\t\t\tAND orphaned_from_event_index <= ${to.event_index}\n\t\t\t\t)\n\t\t\t)\n\t\t\tAND (\n\t\t\t\torphaned_to_height > ${from.block_height}\n\t\t\t\tOR (\n\t\t\t\t\torphaned_to_height = ${from.block_height}\n\t\t\t\t\tAND orphaned_to_event_index >= ${from.event_index}\n\t\t\t\t)\n\t\t\t)\n\t\tORDER BY detected_at ASC, id ASC\n\t`.execute(db);\n\n\treturn rows.map(normalizeRow);\n}\n"
|
|
10
11
|
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAGA,IAAM,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC,QAAQ;AAAA,EACpD,MAAM,WAAW,IACf,MAAM,GAAG,EACT,IAAI,CAAC,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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,sBAAsB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,YAAY;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,aAAa;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,mBAAmB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,iBAAiB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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