@secondlayer/shared 15.3.3 → 15.4.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/archive/range-digest.d.ts +7 -0
- package/dist/src/archive/semantic-digest-builder.d.ts +7 -0
- package/dist/src/classify/index.js +16 -2
- package/dist/src/classify/index.js.map +3 -3
- package/dist/src/coverage/index.d.ts +15 -1
- package/dist/src/coverage/index.js +57 -2
- package/dist/src/coverage/index.js.map +4 -4
- package/dist/src/crypto/secondlayer-webhook.js +16 -2
- package/dist/src/crypto/secondlayer-webhook.js.map +3 -3
- package/dist/src/crypto/secrets.d.ts +8 -2
- package/dist/src/crypto/secrets.js +21 -7
- package/dist/src/crypto/secrets.js.map +3 -3
- package/dist/src/db/index.d.ts +15 -1
- package/dist/src/db/index.js +29 -7
- package/dist/src/db/index.js.map +5 -5
- package/dist/src/db/queries/chain-reorgs.d.ts +7 -0
- package/dist/src/db/queries/chain-reorgs.js +27 -7
- package/dist/src/db/queries/chain-reorgs.js.map +5 -5
- package/dist/src/db/queries/contracts.d.ts +21 -1
- package/dist/src/db/queries/contracts.js +23 -1
- package/dist/src/db/queries/contracts.js.map +4 -4
- package/dist/src/db/queries/instance.d.ts +33 -5
- package/dist/src/db/queries/instance.js +224 -14
- package/dist/src/db/queries/instance.js.map +6 -5
- package/dist/src/db/queries/integrity.d.ts +84 -1
- package/dist/src/db/queries/integrity.js +430 -15
- package/dist/src/db/queries/integrity.js.map +8 -6
- package/dist/src/db/queries/subgraph-gaps.d.ts +18 -6
- package/dist/src/db/queries/subgraph-gaps.js +81 -14
- package/dist/src/db/queries/subgraph-gaps.js.map +3 -3
- package/dist/src/db/queries/subgraph-operations.d.ts +10 -1
- package/dist/src/db/queries/subgraph-operations.js +9 -5
- package/dist/src/db/queries/subgraph-operations.js.map +3 -3
- package/dist/src/db/queries/subgraphs.d.ts +11 -4
- package/dist/src/db/queries/subgraphs.js +13 -6
- package/dist/src/db/queries/subgraphs.js.map +4 -4
- package/dist/src/db/queries/sync-scope.d.ts +7 -0
- package/dist/src/db/queries/webhook-replays.d.ts +7 -0
- package/dist/src/db/queries/webhook-replays.js +20 -7
- package/dist/src/db/queries/webhook-replays.js.map +3 -3
- package/dist/src/db/queries/webhooks.d.ts +7 -0
- package/dist/src/db/queries/webhooks.js +20 -7
- package/dist/src/db/queries/webhooks.js.map +3 -3
- package/dist/src/db/schema.d.ts +7 -0
- package/dist/src/db/schema.js.map +2 -2
- package/dist/src/email/index.js +16 -2
- package/dist/src/email/index.js.map +3 -3
- package/dist/src/env.d.ts +8 -1
- package/dist/src/env.js +18 -3
- package/dist/src/env.js.map +3 -3
- package/dist/src/index.d.ts +59 -1
- package/dist/src/index.js +71 -8
- package/dist/src/index.js.map +8 -8
- package/dist/src/insights/index.d.ts +7 -0
- package/dist/src/insights/index.js +16 -2
- package/dist/src/insights/index.js.map +3 -3
- package/dist/src/leader.js +915 -27
- package/dist/src/leader.js.map +13 -6
- package/dist/src/logger.js +16 -2
- package/dist/src/logger.js.map +3 -3
- package/dist/src/node/local-client.d.ts +7 -0
- package/dist/src/node/tx-summary.js +16 -2
- package/dist/src/node/tx-summary.js.map +3 -3
- package/dist/src/queue/listener.js +27 -7
- package/dist/src/queue/listener.js.map +5 -5
- package/dist/src/schemas/index.js +2 -2
- package/dist/src/schemas/index.js.map +3 -3
- package/dist/src/schemas/subgraphs.js +2 -2
- package/dist/src/schemas/subgraphs.js.map +3 -3
- package/dist/src/types.d.ts +3 -0
- package/migrations/0197_subgraph_last_block_hash.ts +67 -0
- package/migrations/0198_blocks_event_count.ts +24 -0
- package/migrations/0199_transactions_height_tx_index_uniq.ts +77 -0
- package/migrations/0200_subgraphs_schema_name_unique.ts +39 -0
- package/migrations/0201_subgraph_gaps_range_check.ts +47 -0
- package/migrations/0202_instances_secrets_key_canary.ts +36 -0
- package/package.json +2 -2
|
@@ -59,6 +59,9 @@ interface BlocksTable {
|
|
|
59
59
|
/** Tx count `persistBlock` was handed for this height. Null on rows
|
|
60
60
|
* ingested before this column existed. */
|
|
61
61
|
tx_count: ColumnType<number | null, number | null | undefined, number | null>;
|
|
62
|
+
/** Event count `persistBlock` was handed for this height. Null on rows
|
|
63
|
+
* ingested before this column existed. */
|
|
64
|
+
event_count: ColumnType<number | null, number | null | undefined, number | null>;
|
|
62
65
|
created_at: Generated<Date>;
|
|
63
66
|
}
|
|
64
67
|
interface TransactionsTable {
|
|
@@ -192,6 +195,8 @@ interface SubgraphsTable {
|
|
|
192
195
|
schema_name: string | null;
|
|
193
196
|
start_block: Generated<number>;
|
|
194
197
|
last_processed_block: Generated<number>;
|
|
198
|
+
/** Hash of the block at `last_processed_block`; NULL = unknown (see 0197). */
|
|
199
|
+
last_processed_block_hash: Generated<string | null>;
|
|
195
200
|
reindex_from_block: number | null;
|
|
196
201
|
reindex_to_block: number | null;
|
|
197
202
|
last_error: string | null;
|
|
@@ -316,6 +321,8 @@ interface ApiKeysTable {
|
|
|
316
321
|
interface InstancesTable {
|
|
317
322
|
id: Generated<string>;
|
|
318
323
|
network: string;
|
|
324
|
+
/** `SECONDLAYER_SECRETS_KEY` sealed under itself; see `ensureSecretsKeyCanary`. */
|
|
325
|
+
secrets_key_canary: ColumnType<string | null, string | null | undefined, string | null>;
|
|
319
326
|
created_at: Generated<Date>;
|
|
320
327
|
}
|
|
321
328
|
interface AccountsTable {
|
|
@@ -59,6 +59,9 @@ interface BlocksTable {
|
|
|
59
59
|
/** Tx count `persistBlock` was handed for this height. Null on rows
|
|
60
60
|
* ingested before this column existed. */
|
|
61
61
|
tx_count: ColumnType<number | null, number | null | undefined, number | null>;
|
|
62
|
+
/** Event count `persistBlock` was handed for this height. Null on rows
|
|
63
|
+
* ingested before this column existed. */
|
|
64
|
+
event_count: ColumnType<number | null, number | null | undefined, number | null>;
|
|
62
65
|
created_at: Generated<Date>;
|
|
63
66
|
}
|
|
64
67
|
interface TransactionsTable {
|
|
@@ -192,6 +195,8 @@ interface SubgraphsTable {
|
|
|
192
195
|
schema_name: string | null;
|
|
193
196
|
start_block: Generated<number>;
|
|
194
197
|
last_processed_block: Generated<number>;
|
|
198
|
+
/** Hash of the block at `last_processed_block`; NULL = unknown (see 0197). */
|
|
199
|
+
last_processed_block_hash: Generated<string | null>;
|
|
195
200
|
reindex_from_block: number | null;
|
|
196
201
|
reindex_to_block: number | null;
|
|
197
202
|
last_error: string | null;
|
|
@@ -316,6 +321,8 @@ interface ApiKeysTable {
|
|
|
316
321
|
interface InstancesTable {
|
|
317
322
|
id: Generated<string>;
|
|
318
323
|
network: string;
|
|
324
|
+
/** `SECONDLAYER_SECRETS_KEY` sealed under itself; see `ensureSecretsKeyCanary`. */
|
|
325
|
+
secrets_key_canary: ColumnType<string | null, string | null | undefined, string | null>;
|
|
319
326
|
created_at: Generated<Date>;
|
|
320
327
|
}
|
|
321
328
|
interface AccountsTable {
|
|
@@ -36,11 +36,25 @@ function getEnv() {
|
|
|
36
36
|
} else if (result.data.NETWORK) {
|
|
37
37
|
enabledNetworks = [result.data.NETWORK];
|
|
38
38
|
} else {
|
|
39
|
-
|
|
39
|
+
const named = stacksNetwork();
|
|
40
|
+
enabledNetworks = named === "testnet" ? ["testnet"] : ["mainnet"];
|
|
40
41
|
}
|
|
41
42
|
cachedEnv = { ...result.data, enabledNetworks };
|
|
42
43
|
return cachedEnv;
|
|
43
44
|
}
|
|
45
|
+
var warnedNetworkFallback = false;
|
|
46
|
+
function stacksNetwork(env = process.env) {
|
|
47
|
+
if (env.STACKS_NETWORK)
|
|
48
|
+
return env.STACKS_NETWORK;
|
|
49
|
+
if (env.NETWORK) {
|
|
50
|
+
if (!warnedNetworkFallback) {
|
|
51
|
+
warnedNetworkFallback = true;
|
|
52
|
+
console.warn("NETWORK is deprecated: set STACKS_NETWORK instead");
|
|
53
|
+
}
|
|
54
|
+
return env.NETWORK;
|
|
55
|
+
}
|
|
56
|
+
return "mainnet";
|
|
57
|
+
}
|
|
44
58
|
function isProductionEnv() {
|
|
45
59
|
return process.env["NODE_ENV"] === "production";
|
|
46
60
|
}
|
|
@@ -460,5 +474,5 @@ export {
|
|
|
460
474
|
scoreConfidence
|
|
461
475
|
};
|
|
462
476
|
|
|
463
|
-
//# debugId=
|
|
477
|
+
//# debugId=4FDF802B29ABC5C464756E2164756E21
|
|
464
478
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/env.ts", "../src/logger.ts", "../src/classify/confidence.ts", "../src/classify/types.ts", "../src/classify/limits.ts", "../src/classify/system-one.ts", "../src/classify/providers.ts", "../src/classify/rules.ts", "../src/classify/classify.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod\";\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 = [\"
|
|
5
|
+
"import { z } from \"zod\";\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\tconst named = stacksNetwork();\n\t\tenabledNetworks = named === \"testnet\" ? [\"testnet\"] : [\"mainnet\"];\n\t}\n\n\tcachedEnv = { ...result.data, enabledNetworks };\n\treturn cachedEnv;\n}\n\nlet warnedNetworkFallback = false;\n\n/**\n * The Stacks network this process serves, and the only place that decides it:\n * `STACKS_NETWORK`, else the deprecated `NETWORK` (warned once so a deployment\n * that only sets it is not silently re-keyed), else mainnet. Not validated;\n * `instanceNetworkFromEnv` is the strict form.\n */\nexport function stacksNetwork(env: NodeJS.ProcessEnv = process.env): string {\n\tif (env.STACKS_NETWORK) return env.STACKS_NETWORK;\n\tif (env.NETWORK) {\n\t\tif (!warnedNetworkFallback) {\n\t\t\twarnedNetworkFallback = true;\n\t\t\tconsole.warn(\"NETWORK is deprecated: set STACKS_NETWORK instead\");\n\t\t}\n\t\treturn env.NETWORK;\n\t}\n\treturn \"mainnet\";\n}\n\n/**\n * True when `NODE_ENV=production`, read at RUNTIME — the single source of truth\n * for prod-vs-dev branching in this package.\n *\n * Why a helper instead of inlining `process.env.NODE_ENV === \"production\"`:\n * bunup/esbuild constant-folds the dot-access `process.env.NODE_ENV` to its\n * BUILD-time value. `@secondlayer/shared` is consumed by other services as its\n * built `dist`, so an inlined check freezes to a literal in the shipped bundle\n * (e.g. `const isProd = false`) and silently ignores the container's real\n * NODE_ENV. The bracket access below is NOT folded, so it stays a runtime read.\n * Route every prod check through here so the footgun lives in exactly one place.\n */\nexport function isProductionEnv(): boolean {\n\t// biome-ignore lint/complexity/useLiteralKeys: bracket access is deliberate — dot-access gets constant-folded by the bundler, freezing this to a build-time literal in the shipped dist.\n\treturn process.env[\"NODE_ENV\"] === \"production\";\n}\n\ntype EnvMap = NodeJS.ProcessEnv;\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(env: EnvMap = process.env): boolean {\n\treturn env.POX4_DECODER_ENABLED !== \"false\";\n}\n\n/**\n * PoX-5 print-event decoder is ON by default (mirrors pox-4/sBTC policy).\n * No activation gating needed: pox-5 events cannot exist before the Epoch 4.0\n * hard fork (Bitcoin block 960,230), so pre-activation the decoder idles at\n * tip. Opt out with `POX5_DECODER_ENABLED=false`.\n */\nexport function isPox5DecoderEnabled(env: EnvMap = process.env): boolean {\n\treturn env.POX5_DECODER_ENABLED !== \"false\";\n}\n\n/** Default ON. Opt out with `SBTC_DECODER_ENABLED=false`. */\nexport function isSbtcDecoderEnabled(env: EnvMap = process.env): boolean {\n\treturn env.SBTC_DECODER_ENABLED !== \"false\";\n}\n\n/** Default OFF. Opt in with `BNS_DECODER_ENABLED=true`. */\nexport function isBnsDecoderEnabled(env: EnvMap = process.env): boolean {\n\treturn env.BNS_DECODER_ENABLED === \"true\";\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 { Answer, Question } from \"./types.ts\";\n\nconst clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n\n/** (p_max - 1/K) / (1 - 1/K). One option gives 1. */\nexport function choiceConfidence(\n\tprobabilities: Record<string, number>,\n): number {\n\tconst ps = Object.values(probabilities);\n\tconst k = ps.length;\n\tif (k <= 1) return 1;\n\tconst pmax = Math.max(...ps);\n\treturn clamp01((pmax - 1 / k) / (1 - 1 / k));\n}\n\n/** max(0, 1 - E|level - mode| / D); D = mean distance of a uniform\n * distribution over the levels from the middle level. */\nexport function scoreConfidence(\n\tprobabilities: Record<string, number>,\n\tlevels: number,\n): number {\n\tif (levels <= 1) return 1;\n\tlet mode = 0;\n\tlet best = -1;\n\tfor (let i = 0; i < levels; i++) {\n\t\tconst p = probabilities[String(i)] ?? 0;\n\t\tif (p > best) {\n\t\t\tbest = p;\n\t\t\tmode = i;\n\t\t}\n\t}\n\tlet e = 0;\n\tlet d = 0;\n\tfor (let i = 0; i < levels; i++) {\n\t\te += (probabilities[String(i)] ?? 0) * Math.abs(i - mode);\n\t\td += Math.abs(i - (levels - 1) / 2);\n\t}\n\td /= levels;\n\treturn clamp01(1 - e / d);\n}\n\n/** Host-defined: |2p - 1|. Not comparable with choice/score confidence. */\nexport function booleanConfidence(p: number): number {\n\treturn Math.abs(2 * p - 1);\n}\n\n/** Shape of an `ai` DecisionAnswer, or the rules output, before normalizing. */\nexport type RawAnswer =\n\t| { type: \"choice\"; choice: string; probabilities?: Record<string, number> }\n\t| { type: \"score\"; score: number; probabilities?: Record<string, number> }\n\t| { type: \"boolean\"; probability: number }\n\t| { type: \"refusal\" };\n\nexport function normalizeAnswer(question: Question, raw: RawAnswer): Answer {\n\tif (raw.type === \"refusal\") return { type: \"refusal\" };\n\tif (raw.type === \"boolean\" && question.type === \"boolean\") {\n\t\treturn {\n\t\t\ttype: \"boolean\",\n\t\t\tprobability: raw.probability,\n\t\t\tconfidence: booleanConfidence(raw.probability),\n\t\t};\n\t}\n\tif (raw.type === \"choice\" && question.type === \"choice\") {\n\t\tconst probabilities = raw.probabilities ?? {};\n\t\t// Never fabricate a distribution: no probabilities means confidence 0.\n\t\treturn {\n\t\t\ttype: \"choice\",\n\t\t\tchoice: raw.choice,\n\t\t\tprobabilities,\n\t\t\tconfidence: raw.probabilities ? choiceConfidence(probabilities) : 0,\n\t\t};\n\t}\n\tif (raw.type === \"score\" && question.type === \"score\") {\n\t\tconst probabilities = raw.probabilities ?? {};\n\t\treturn {\n\t\t\ttype: \"score\",\n\t\t\tscore: raw.score,\n\t\t\tprobabilities,\n\t\t\tconfidence: raw.probabilities\n\t\t\t\t? scoreConfidence(probabilities, question.criteria.length)\n\t\t\t\t: 0,\n\t\t};\n\t}\n\treturn { type: \"refusal\" };\n}\n",
|
|
8
8
|
"export type ClassifierName = \"jev\" | \"kev\" | \"clef\" | \"rules\";\n\nexport type Question =\n\t| { type: \"choice\"; instructions: string; criteria: Record<string, string> }\n\t| { type: \"score\"; instructions: string; criteria: readonly string[] }\n\t| {\n\t\t\ttype: \"boolean\";\n\t\t\tinstructions: string;\n\t\t\tcriteria: { true: string; false: string };\n\t };\n\nexport type Answer =\n\t| {\n\t\t\ttype: \"choice\";\n\t\t\tchoice: string;\n\t\t\tprobabilities: Record<string, number>;\n\t\t\tconfidence: number;\n\t }\n\t| {\n\t\t\ttype: \"score\";\n\t\t\tscore: number;\n\t\t\tprobabilities: Record<string, number>;\n\t\t\tconfidence: number;\n\t }\n\t| { type: \"boolean\"; probability: number; confidence: number }\n\t| { type: \"refusal\" };\n\nexport type Answers<Q extends Record<string, Question>> = {\n\t[K in keyof Q]: Answer;\n};\n\nexport type ClassifyResult<Q extends Record<string, Question>> = {\n\tprovider: ClassifierName;\n\t/** response.modelId when the backend reports one. */\n\tmodelId: string;\n\tanswers: Answers<Q>;\n};\n\n/** Deterministic answers for the offline provider. Return a value per question\n * it can decide; omitted questions come back as `{ type: \"refusal\" }`. */\nexport type RuleValue =\n\t| string /* choice option */\n\t| number /* score level index */\n\t| boolean;\nexport type RulesFn<Q extends Record<string, Question>> = (\n\tstate: string | Record<string, unknown>,\n) => { [K in keyof Q]?: RuleValue } | null;\n\nexport class ClassifierInputError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"ClassifierInputError\";\n\t}\n}\n",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"import type { Answer, Answers, Question, RuleValue, RulesFn } from \"./types.ts\";\n\nfunction answerFor(question: Question, value: RuleValue | undefined): Answer {\n\tif (value === undefined) return { type: \"refusal\" };\n\tif (question.type === \"choice\") {\n\t\tif (typeof value !== \"string\" || !(value in question.criteria)) {\n\t\t\treturn { type: \"refusal\" };\n\t\t}\n\t\tconst probabilities = Object.fromEntries(\n\t\t\tObject.keys(question.criteria).map((k) => [k, k === value ? 1 : 0]),\n\t\t);\n\t\treturn { type: \"choice\", choice: value, probabilities, confidence: 1 };\n\t}\n\tif (question.type === \"score\") {\n\t\tconst n = question.criteria.length;\n\t\tif (typeof value !== \"number\" || !Number.isInteger(value)) {\n\t\t\treturn { type: \"refusal\" };\n\t\t}\n\t\tif (value < 0 || value >= n) return { type: \"refusal\" };\n\t\tconst probabilities = Object.fromEntries(\n\t\t\tArray.from({ length: n }, (_, i) => [String(i), i === value ? 1 : 0]),\n\t\t);\n\t\treturn { type: \"score\", score: value, probabilities, confidence: 1 };\n\t}\n\tif (typeof value !== \"boolean\") return { type: \"refusal\" };\n\treturn { type: \"boolean\", probability: value ? 1 : 0, confidence: 1 };\n}\n\n/** Offline provider: deterministic, never touches the network. */\nexport function runRules<Q extends Record<string, Question>>(\n\tquestions: Q,\n\tfn: RulesFn<Q>,\n\tstate: string | Record<string, unknown>,\n): Answers<Q> {\n\tconst values = fn(state) ?? {};\n\tconst out: Record<string, Answer> = {};\n\tfor (const id of Object.keys(questions)) {\n\t\tout[id] = answerFor(\n\t\t\tquestions[id] as Question,\n\t\t\t(values as Record<string, RuleValue | undefined>)[id],\n\t\t);\n\t}\n\treturn out as Answers<Q>;\n}\n",
|
|
13
13
|
"import { logger } from \"../logger.ts\";\nimport { type RawAnswer, normalizeAnswer } from \"./confidence.ts\";\nimport { MAX_STATE_CHARS, stateSize, validateQuestions } from \"./limits.ts\";\nimport {\n\tDEFAULT_MODEL,\n\tbuildModel,\n\tenvModel,\n\tresolveProvider,\n} from \"./providers.ts\";\nimport { runRules } from \"./rules.ts\";\nimport type {\n\tAnswers,\n\tClassifierName,\n\tClassifyResult,\n\tQuestion,\n\tRulesFn,\n} from \"./types.ts\";\n\n/**\n * One classifier call over jev, kev, clef or offline rules.\n * Returns null on any provider failure (fail-open: callers decide what null\n * means). Only ClassifierInputError, a bad question definition, escapes.\n * Never logs state or response bodies.\n */\nexport async function classify<\n\tconst Q extends Record<string, Question>,\n>(input: {\n\tstate: string | Record<string, unknown>;\n\tquestions: Q;\n\trules?: RulesFn<Q>;\n\t/** Overrides resolveProvider(); used by classifier-compare. */\n\tprovider?: ClassifierName;\n\t/** Overrides CLASSIFIER_MODEL / the provider default. */\n\tmodelId?: string;\n\t/** Default 5000. */\n\ttimeoutMs?: number;\n\tenv?: Record<string, string | undefined>;\n\t/** Tests only (kev/clef). */\n\tfetchImpl?: typeof fetch;\n}): Promise<ClassifyResult<Q> | null> {\n\tvalidateQuestions(input.questions);\n\tconst env = input.env ?? process.env;\n\tconst resolved = resolveProvider(env);\n\tconst name = input.provider ?? resolved.name;\n\tif (name === \"rules\") {\n\t\tif (!input.rules) return null;\n\t\treturn {\n\t\t\tprovider: \"rules\",\n\t\t\tmodelId: \"rules\",\n\t\t\tanswers: runRules(input.questions, input.rules, input.state),\n\t\t};\n\t}\n\t// An explicit provider override ignores CLASSIFIER_MODEL (it pins one backend).\n\tconst modelId =\n\t\tinput.modelId ??\n\t\t(input.provider ? undefined : envModel(env)) ??\n\t\tDEFAULT_MODEL[name];\n\n\tif (stateSize(input.state) > MAX_STATE_CHARS) {\n\t\tlogger.warn(`classifier: state over ${MAX_STATE_CHARS} chars; skipped`);\n\t\treturn null;\n\t}\n\ttry {\n\t\tconst { experimental_decide: decide } = await import(\"ai\");\n\t\tconst r = await decide({\n\t\t\tmodel: buildModel(name, modelId, env, input.fetchImpl),\n\t\t\tstate: input.state as string,\n\t\t\t// Our Question is a structural subset of the SDK's question type.\n\t\t\tquestions: input.questions as Parameters<typeof decide>[0][\"questions\"],\n\t\t\tmaxRetries: 1,\n\t\t\tabortSignal: AbortSignal.timeout(input.timeoutMs ?? 5000),\n\t\t});\n\t\tconst answers: Record<string, ReturnType<typeof normalizeAnswer>> = {};\n\t\tfor (const id of Object.keys(input.questions)) {\n\t\t\tanswers[id] = normalizeAnswer(\n\t\t\t\tinput.questions[id] as Question,\n\t\t\t\t(r.answers as Record<string, RawAnswer>)[id] ?? { type: \"refusal\" },\n\t\t\t);\n\t\t}\n\t\treturn {\n\t\t\tprovider: name,\n\t\t\tmodelId: r.response.modelId ?? modelId,\n\t\t\tanswers: answers as Answers<Q>,\n\t\t};\n\t} catch (err) {\n\t\tlogger.warn(\n\t\t\t`classifier: ${name} failed: ${err instanceof Error ? err.name : \"error\"}`,\n\t\t);\n\t\treturn null;\n\t}\n}\n"
|
|
14
14
|
],
|
|
15
|
-
"mappings": ";AAAA;AAGA,IAAM,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC,QAAQ;AAAA,EACpD,MAAM,WAAW,IACf,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO;AAAA,EAChB,MAAM,QAAQ,CAAC,WAAW,SAAS;AAAA,EACnC,WAAW,KAAK,UAAU;AAAA,IACzB,IAAI,CAAC,MAAM,SAAS,CAAC,GAAG;AAAA,MACvB,MAAM,IAAI,MACT,oBAAoB,sBAAsB,MAAM,KAAK,IAAI,GAC1D;AAAA,IACD;AAAA,EACD;AAAA,EACA,OAAO;AAAA,CACP;AAsBD,IAAM,YAAwC,EAAE,OAAO;AAAA,EACtD,cAAc,EAAE,WACf,CAAC,QAAS,OAAO,QAAQ,YAAY,IAAI,WAAW,IAAI,YAAY,KACpE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAC3B;AAAA,EACA,qBAAqB,EAAE,WACtB,CAAC,QAAS,OAAO,QAAQ,YAAY,IAAI,WAAW,IAAI,YAAY,KACpE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAC3B;AAAA,EACA,qBAAqB,EAAE,WACtB,CAAC,QAAS,OAAO,QAAQ,YAAY,IAAI,WAAW,IAAI,YAAY,KACpE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAC3B;AAAA,EACA,SAAS,EAAE,KAAK,CAAC,WAAW,SAAS,CAAC,EAAE,SAAS;AAAA,EACjD,UAAU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@ -376,6 +376,9 @@ interface BlocksTable {
|
|
|
376
376
|
/** Tx count `persistBlock` was handed for this height. Null on rows
|
|
377
377
|
* ingested before this column existed. */
|
|
378
378
|
tx_count: ColumnType<number | null, number | null | undefined, number | null>;
|
|
379
|
+
/** Event count `persistBlock` was handed for this height. Null on rows
|
|
380
|
+
* ingested before this column existed. */
|
|
381
|
+
event_count: ColumnType<number | null, number | null | undefined, number | null>;
|
|
379
382
|
created_at: Generated<Date>;
|
|
380
383
|
}
|
|
381
384
|
interface TransactionsTable {
|
|
@@ -509,6 +512,8 @@ interface SubgraphsTable {
|
|
|
509
512
|
schema_name: string | null;
|
|
510
513
|
start_block: Generated<number>;
|
|
511
514
|
last_processed_block: Generated<number>;
|
|
515
|
+
/** Hash of the block at `last_processed_block`; NULL = unknown (see 0197). */
|
|
516
|
+
last_processed_block_hash: Generated<string | null>;
|
|
512
517
|
reindex_from_block: number | null;
|
|
513
518
|
reindex_to_block: number | null;
|
|
514
519
|
last_error: string | null;
|
|
@@ -633,6 +638,8 @@ interface ApiKeysTable {
|
|
|
633
638
|
interface InstancesTable {
|
|
634
639
|
id: Generated<string>;
|
|
635
640
|
network: string;
|
|
641
|
+
/** `SECONDLAYER_SECRETS_KEY` sealed under itself; see `ensureSecretsKeyCanary`. */
|
|
642
|
+
secrets_key_canary: ColumnType<string | null, string | null | undefined, string | null>;
|
|
636
643
|
created_at: Generated<Date>;
|
|
637
644
|
}
|
|
638
645
|
interface AccountsTable {
|
|
@@ -1819,6 +1826,13 @@ type DecoderAdapterCommit = {
|
|
|
1819
1826
|
declare function runDecoderCommitSteps(steps: Record<DecoderCommitStep, () => Promise<void>>, crashAfter?: DecoderCommitStep): Promise<void>;
|
|
1820
1827
|
declare function applyDecoderReceipts(state: RunnerState, receipts: readonly DecoderAdapterReceipt[]): RunnerResult;
|
|
1821
1828
|
/**
|
|
1829
|
+
* Set a decoder's checkpoint to `cursor`, backward or forward. The one
|
|
1830
|
+
* unconditional checkpoint writer: reorg handlers rewind decoders to the fork
|
|
1831
|
+
* point through it, and reset tools reposition them. The commit path
|
|
1832
|
+
* (`writeCheckpoint`) only moves forward.
|
|
1833
|
+
*/
|
|
1834
|
+
declare function rewindDecoderCheckpoint(db: Kysely<Database>, decoderName: string, cursor: string | null): Promise<void>;
|
|
1835
|
+
/**
|
|
1822
1836
|
* Persist output + checkpoint + receipts + failure in one transaction.
|
|
1823
1837
|
* Runner validation is the caller's job (`applyDecoderReceipts`) so a
|
|
1824
1838
|
* rejected ack never opens a transaction.
|
|
@@ -2046,4 +2060,4 @@ declare function reportVerify(opts: {
|
|
|
2046
2060
|
diverged?: boolean
|
|
2047
2061
|
detail?: string
|
|
2048
2062
|
}): VerifyReport;
|
|
2049
|
-
export { BootstrapSource, COVERAGE_REPORT_SCHEMA_VERSION, COVERAGE_STATES, CanonicalBlock, CoverageRange, CoverageReport, CoverageState, DECODER_COMMIT_STEPS, DEFAULT_MAX_RETRIES, DecoderAdapterCommit, DecoderAdapterCrash, DecoderAdapterFailure, DecoderAdapterReceipt, DecoderClockEvent, DecoderClockInput, DecoderClockReceipt, DecoderClockResult, DecoderCommitStep, DeepVerifyResult, EffectMutation, EffectOp, EvaluatorInput, EvaluatorOptions, FAILURE_CLASSES, FAILURE_RETENTION_DAYS, FAILURE_UNITS, FailureClass, FailureRow, FailureUnit, NATIVE_CLOCKS, NativeClock, OpenFailure, QUEUE_STAGES, QueueApply, QueueCounters, QueueEvent, QueueStage, QueueState, REPAIR_MODES, RETRY_STATES, RUNNER_EVENT_TYPES, RUNNER_STATUSES, RUNNER_TRANSITION_TABLE, RUN_STATUSES, ReceiptRow, RepairDefect, RepairMode, RepairPlan, RetryState, RowSnapshot, RunStatus, RunnerEffect, RunnerEvent, RunnerEventType, RunnerFailure, RunnerResult, RunnerState, RunnerStatus, RunnerVersion, SAFE_REPAIR_MODES, STAGE_KINDS, SUBGRAPH_COMMIT_STEPS, SealResult, SealableReceipt, SealedSegment, SourceClock, StageCoverage, StageDeclaration, StageEvidence, StageKind, StageRunView, SubgraphAdapterCrash, SubgraphCommitInput, SubgraphCommitStep, SyncScope, TransitionRule, VERIFY_EXIT, VerifyExit, VerifyMode, VerifyReport, VerifyTarget, applyDecoderReceipts, applyMutations, applyQueueEvent, applyRunnerEvent, canonicalizeMutations, commitDecoderAdapter, commitDecoderAdapterBatch, commitSubgraphAdapter, contiguousThrough, createRunnerState, cursorHeight, cursorIsAfterBlock, cursorIsBeforeBlock, datasetMatchesTarget, deepVerify, defaultRetainUntil, emptyQueueState, evaluateCoverage, expectedAckHeight, failureRangeHolds, failureRetentionHolds, finalRowDigest, findRangeGaps, hashEffectManifest, inputDigest, isFailureClass, isFailureUnit, isNativeClock, isNonNegativeInt, isRepairMode, isRetryState, isRunStatus, isStageKind, lookupTransition, manifestsEqual, mergeRanges, parseVerifyTarget, planDecoderReceipts, planRepair, proofsAgree, queueCaughtUp, rangeDigestOf, rangeIsOrdered, receiptRetentionHolds, receiptsAfterReorg, reportVerify, runDecoderCommitSteps, runSubgraphCommitSteps, sealFinalizedRange, segmentsOverlap, segmentsSurviveReorg, sequentialDigests, sparseDigests, topoSort, versionsEqual };
|
|
2063
|
+
export { BootstrapSource, COVERAGE_REPORT_SCHEMA_VERSION, COVERAGE_STATES, CanonicalBlock, CoverageRange, CoverageReport, CoverageState, DECODER_COMMIT_STEPS, DEFAULT_MAX_RETRIES, DecoderAdapterCommit, DecoderAdapterCrash, DecoderAdapterFailure, DecoderAdapterReceipt, DecoderClockEvent, DecoderClockInput, DecoderClockReceipt, DecoderClockResult, DecoderCommitStep, DeepVerifyResult, EffectMutation, EffectOp, EvaluatorInput, EvaluatorOptions, FAILURE_CLASSES, FAILURE_RETENTION_DAYS, FAILURE_UNITS, FailureClass, FailureRow, FailureUnit, NATIVE_CLOCKS, NativeClock, OpenFailure, QUEUE_STAGES, QueueApply, QueueCounters, QueueEvent, QueueStage, QueueState, REPAIR_MODES, RETRY_STATES, RUNNER_EVENT_TYPES, RUNNER_STATUSES, RUNNER_TRANSITION_TABLE, RUN_STATUSES, ReceiptRow, RepairDefect, RepairMode, RepairPlan, RetryState, RowSnapshot, RunStatus, RunnerEffect, RunnerEvent, RunnerEventType, RunnerFailure, RunnerResult, RunnerState, RunnerStatus, RunnerVersion, SAFE_REPAIR_MODES, STAGE_KINDS, SUBGRAPH_COMMIT_STEPS, SealResult, SealableReceipt, SealedSegment, SourceClock, StageCoverage, StageDeclaration, StageEvidence, StageKind, StageRunView, SubgraphAdapterCrash, SubgraphCommitInput, SubgraphCommitStep, SyncScope, TransitionRule, VERIFY_EXIT, VerifyExit, VerifyMode, VerifyReport, VerifyTarget, applyDecoderReceipts, applyMutations, applyQueueEvent, applyRunnerEvent, canonicalizeMutations, commitDecoderAdapter, commitDecoderAdapterBatch, commitSubgraphAdapter, contiguousThrough, createRunnerState, cursorHeight, cursorIsAfterBlock, cursorIsBeforeBlock, datasetMatchesTarget, deepVerify, defaultRetainUntil, emptyQueueState, evaluateCoverage, expectedAckHeight, failureRangeHolds, failureRetentionHolds, finalRowDigest, findRangeGaps, hashEffectManifest, inputDigest, isFailureClass, isFailureUnit, isNativeClock, isNonNegativeInt, isRepairMode, isRetryState, isRunStatus, isStageKind, lookupTransition, manifestsEqual, mergeRanges, parseVerifyTarget, planDecoderReceipts, planRepair, proofsAgree, queueCaughtUp, rangeDigestOf, rangeIsOrdered, receiptRetentionHolds, receiptsAfterReorg, reportVerify, rewindDecoderCheckpoint, runDecoderCommitSteps, runSubgraphCommitSteps, sealFinalizedRange, segmentsOverlap, segmentsSurviveReorg, sequentialDigests, sparseDigests, topoSort, versionsEqual };
|
|
@@ -122,6 +122,40 @@ function decodeStreamsCursor(cursor) {
|
|
|
122
122
|
}
|
|
123
123
|
return decoded;
|
|
124
124
|
}
|
|
125
|
+
var FEED_TAGS = ["btc", "vm"];
|
|
126
|
+
|
|
127
|
+
class StreamsCursorFeedMismatchError extends Error {
|
|
128
|
+
expected;
|
|
129
|
+
actual;
|
|
130
|
+
constructor(expected, actual) {
|
|
131
|
+
super(`cursor belongs to the ${actual} feed; this request reads the ${expected} feed`);
|
|
132
|
+
this.expected = expected;
|
|
133
|
+
this.actual = actual;
|
|
134
|
+
this.name = "StreamsCursorFeedMismatchError";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function encodeFeedCursor(feed, cursor) {
|
|
138
|
+
const bare = encodeStreamsCursor(cursor);
|
|
139
|
+
return feed === "stacks" ? bare : `${feed}:${bare}`;
|
|
140
|
+
}
|
|
141
|
+
function decodeTaggedStreamsCursor(raw) {
|
|
142
|
+
for (const tag of FEED_TAGS) {
|
|
143
|
+
if (raw.startsWith(`${tag}:`)) {
|
|
144
|
+
return {
|
|
145
|
+
feed: tag,
|
|
146
|
+
cursor: decodeStreamsCursor(raw.slice(tag.length + 1))
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return { feed: null, cursor: decodeStreamsCursor(raw) };
|
|
151
|
+
}
|
|
152
|
+
function decodeFeedCursor(raw, feed) {
|
|
153
|
+
const decoded = decodeTaggedStreamsCursor(raw);
|
|
154
|
+
if (decoded.feed !== null && decoded.feed !== feed) {
|
|
155
|
+
throw new StreamsCursorFeedMismatchError(feed, decoded.feed);
|
|
156
|
+
}
|
|
157
|
+
return decoded.cursor;
|
|
158
|
+
}
|
|
125
159
|
function compareStreamsCursor(a, b) {
|
|
126
160
|
if (a.block_height !== b.block_height) {
|
|
127
161
|
return a.block_height < b.block_height ? -1 : 1;
|
|
@@ -953,16 +987,36 @@ async function upsertRegistry(tx, stageId) {
|
|
|
953
987
|
repair_mode: "full_reindex"
|
|
954
988
|
}).onConflict((oc) => oc.column("id").doNothing()).execute();
|
|
955
989
|
}
|
|
990
|
+
var CHECKPOINT_CURSOR = /^(\d+):(\d+)$/;
|
|
991
|
+
async function rewindDecoderCheckpoint(db, decoderName, cursor) {
|
|
992
|
+
await db.insertInto("decoder_checkpoints").values({ decoder_name: decoderName, last_cursor: cursor }).onConflict((oc) => oc.column("decoder_name").doUpdateSet({
|
|
993
|
+
last_cursor: cursor,
|
|
994
|
+
updated_at: new Date
|
|
995
|
+
})).execute();
|
|
996
|
+
}
|
|
956
997
|
async function writeCheckpoint(tx, decoderName, cursor) {
|
|
957
998
|
if (cursor === null)
|
|
958
999
|
return;
|
|
1000
|
+
const parsed = CHECKPOINT_CURSOR.exec(cursor);
|
|
1001
|
+
if (!parsed) {
|
|
1002
|
+
throw new Error(`decoder checkpoint cursor must be "<height>:<index>", got "${cursor}" (${decoderName})`);
|
|
1003
|
+
}
|
|
1004
|
+
const height = parsed[1];
|
|
1005
|
+
const index = parsed[2];
|
|
959
1006
|
const written = await tx.insertInto("decoder_checkpoints").values({
|
|
960
1007
|
decoder_name: decoderName,
|
|
961
1008
|
last_cursor: cursor
|
|
962
1009
|
}).onConflict((oc) => oc.column("decoder_name").doUpdateSet({
|
|
963
1010
|
last_cursor: cursor,
|
|
964
1011
|
updated_at: new Date
|
|
965
|
-
}).where(
|
|
1012
|
+
}).where(sql`(
|
|
1013
|
+
decoder_checkpoints.last_cursor IS NULL
|
|
1014
|
+
OR decoder_checkpoints.last_cursor !~ '^[0-9]+:[0-9]+$'
|
|
1015
|
+
OR (
|
|
1016
|
+
split_part(decoder_checkpoints.last_cursor, ':', 1)::bigint,
|
|
1017
|
+
split_part(decoder_checkpoints.last_cursor, ':', 2)::bigint
|
|
1018
|
+
) < (${height}::bigint, ${index}::bigint)
|
|
1019
|
+
)`)).returning("last_cursor").execute();
|
|
966
1020
|
if (written.length === 0)
|
|
967
1021
|
return;
|
|
968
1022
|
await sql`SELECT pg_notify('index:tip', ${decoderName})`.execute(tx);
|
|
@@ -1525,6 +1579,7 @@ export {
|
|
|
1525
1579
|
receiptRetentionHolds,
|
|
1526
1580
|
receiptsAfterReorg,
|
|
1527
1581
|
reportVerify,
|
|
1582
|
+
rewindDecoderCheckpoint,
|
|
1528
1583
|
runDecoderCommitSteps,
|
|
1529
1584
|
runSubgraphCommitSteps,
|
|
1530
1585
|
sealFinalizedRange,
|
|
@@ -1536,5 +1591,5 @@ export {
|
|
|
1536
1591
|
versionsEqual
|
|
1537
1592
|
};
|
|
1538
1593
|
|
|
1539
|
-
//# debugId=
|
|
1594
|
+
//# debugId=DE87B2B03C092AB764756E2164756E21
|
|
1540
1595
|
//# sourceMappingURL=index.js.map
|