@secondlayer/shared 7.8.0 → 7.10.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/derived-stage-report.d.ts +99 -0
- package/dist/src/archive/derived-stage-report.js +64 -0
- package/dist/src/archive/derived-stage-report.js.map +10 -0
- package/dist/src/archive/disk-guard.d.ts +46 -0
- package/dist/src/archive/disk-guard.js +69 -0
- package/dist/src/archive/disk-guard.js.map +10 -0
- package/dist/src/archive/per-height-digest.d.ts +99 -0
- package/dist/src/archive/per-height-digest.js +194 -0
- package/dist/src/archive/per-height-digest.js.map +11 -0
- package/dist/src/archive/range-digest.d.ts +96 -0
- package/dist/src/archive/semantic-digest-builder.d.ts +1183 -0
- package/dist/src/archive/semantic-digest-builder.js +302 -0
- package/dist/src/archive/semantic-digest-builder.js.map +11 -0
- package/dist/src/archive/semantic-digest.d.ts +131 -0
- package/dist/src/archive/semantic-digest.js +143 -0
- package/dist/src/archive/semantic-digest.js.map +10 -0
- package/dist/src/coverage/index.d.ts +1670 -0
- package/dist/src/coverage/index.js +1483 -0
- package/dist/src/coverage/index.js.map +23 -0
- package/dist/src/db/index.d.ts +105 -1
- package/dist/src/db/index.js +31 -1
- package/dist/src/db/index.js.map +6 -5
- package/dist/src/db/queries/chain-reorgs.d.ts +96 -0
- package/dist/src/db/queries/chain-reorgs.js +30 -1
- package/dist/src/db/queries/chain-reorgs.js.map +6 -5
- package/dist/src/db/queries/contracts.d.ts +96 -0
- package/dist/src/db/queries/instance.d.ts +1127 -0
- package/dist/src/db/queries/instance.js +92 -0
- package/dist/src/db/queries/instance.js.map +10 -0
- package/dist/src/db/queries/integrity.d.ts +96 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +96 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +96 -0
- package/dist/src/db/queries/subgraphs.d.ts +99 -1
- package/dist/src/db/queries/subgraphs.js +52 -23
- package/dist/src/db/queries/subgraphs.js.map +7 -7
- package/dist/src/db/queries/subscriptions.d.ts +96 -0
- package/dist/src/db/queries/subscriptions.js +47 -31
- package/dist/src/db/queries/subscriptions.js.map +5 -5
- package/dist/src/db/schema.d.ts +97 -1
- package/dist/src/index.d.ts +109 -1
- package/dist/src/index.js +52 -1
- package/dist/src/index.js.map +7 -6
- package/dist/src/node/client.d.ts +11 -1
- package/dist/src/node/client.js +42 -4
- package/dist/src/node/client.js.map +3 -3
- package/dist/src/node/local-client.d.ts +96 -0
- package/dist/src/node/nakamoto.d.ts +22 -7
- package/dist/src/node/nakamoto.js +46 -5
- package/dist/src/node/nakamoto.js.map +3 -3
- package/migrations/0115_instances.ts +33 -0
- package/migrations/0116_coverage_schema.ts +163 -0
- package/package.json +29 -1
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { ColumnType, Generated } from "kysely";
|
|
2
|
+
/**
|
|
3
|
+
* Coverage-kernel constraints. SQL CHECKs in migration 0116 must stay
|
|
4
|
+
* identical — property tests treat this file as the spec.
|
|
5
|
+
*/
|
|
6
|
+
declare const STAGE_KINDS: readonly ["raw", "decode", "subgraph", "queue"];
|
|
7
|
+
type StageKind = (typeof STAGE_KINDS)[number];
|
|
8
|
+
declare const NATIVE_CLOCKS: readonly ["block", "cursor", "queue"];
|
|
9
|
+
type NativeClock = (typeof NATIVE_CLOCKS)[number];
|
|
10
|
+
declare const REPAIR_MODES: readonly ["range_safe", "full_reindex", "archive_replay", "none"];
|
|
11
|
+
type RepairMode = (typeof REPAIR_MODES)[number];
|
|
12
|
+
declare const RUN_STATUSES: readonly ["pending", "running", "complete", "syncing", "lagging", "gap", "stale", "failed", "unverified_import", "unanchored", "source_unavailable", "out_of_scope", "disabled", "halted"];
|
|
13
|
+
type RunStatus = (typeof RUN_STATUSES)[number];
|
|
14
|
+
declare const FAILURE_UNITS: readonly ["block", "range", "cursor", "queue"];
|
|
15
|
+
type FailureUnit = (typeof FAILURE_UNITS)[number];
|
|
16
|
+
declare const FAILURE_CLASSES: readonly ["omission", "version", "digest_mismatch", "crash", "reorg", "source_gap", "handler", "timeout", "unknown"];
|
|
17
|
+
type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
18
|
+
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
19
|
+
type RetryState = (typeof RETRY_STATES)[number];
|
|
2
20
|
interface BlocksTable {
|
|
3
21
|
height: number;
|
|
4
22
|
hash: string;
|
|
@@ -190,6 +208,12 @@ interface ApiKeysTable {
|
|
|
190
208
|
revoked_at: Date | null;
|
|
191
209
|
created_at: Generated<Date>;
|
|
192
210
|
}
|
|
211
|
+
/** Singleton self-host / publisher identity. Network is immutable. */
|
|
212
|
+
interface InstancesTable {
|
|
213
|
+
id: Generated<string>;
|
|
214
|
+
network: string;
|
|
215
|
+
created_at: Generated<Date>;
|
|
216
|
+
}
|
|
193
217
|
interface AccountsTable {
|
|
194
218
|
id: Generated<string>;
|
|
195
219
|
/** NULL for unclaimed ghost accounts (anonymous self-serve keys). */
|
|
@@ -720,6 +744,72 @@ interface ObserverJournalTable {
|
|
|
720
744
|
error: string | null;
|
|
721
745
|
processed_at: Date | null;
|
|
722
746
|
}
|
|
747
|
+
/** Declared coverage stage. Identity is the `id` string (`raw`, `decode:stx`, …). */
|
|
748
|
+
interface StageRegistryTable {
|
|
749
|
+
id: string;
|
|
750
|
+
kind: StageKind;
|
|
751
|
+
depends_on: string | null;
|
|
752
|
+
native_clock: NativeClock;
|
|
753
|
+
producer_version: string;
|
|
754
|
+
repair_mode: RepairMode;
|
|
755
|
+
enabled: Generated<boolean>;
|
|
756
|
+
created_at: Generated<Date>;
|
|
757
|
+
}
|
|
758
|
+
/** One versioned sweep of a stage. */
|
|
759
|
+
interface StageRunsTable {
|
|
760
|
+
id: Generated<string>;
|
|
761
|
+
stage_id: string;
|
|
762
|
+
code_hash: string;
|
|
763
|
+
config_hash: string;
|
|
764
|
+
handler_hash: string | null;
|
|
765
|
+
target_height: number | null;
|
|
766
|
+
target_cursor: string | null;
|
|
767
|
+
status: RunStatus;
|
|
768
|
+
complete_through: number | null;
|
|
769
|
+
started_at: Generated<Date>;
|
|
770
|
+
finished_at: Date | null;
|
|
771
|
+
}
|
|
772
|
+
/** Per-block acknowledgement. Unique on (stage, height, hash). */
|
|
773
|
+
interface StageBlockReceiptsTable {
|
|
774
|
+
id: Generated<string>;
|
|
775
|
+
stage_id: string;
|
|
776
|
+
run_id: string | null;
|
|
777
|
+
block_height: number;
|
|
778
|
+
block_hash: string;
|
|
779
|
+
input_count: number;
|
|
780
|
+
input_digest: string;
|
|
781
|
+
effect_digest: string;
|
|
782
|
+
finalized: Generated<boolean>;
|
|
783
|
+
compacted_at: Date | null;
|
|
784
|
+
created_at: Generated<Date>;
|
|
785
|
+
}
|
|
786
|
+
/** Compacted finalized range. Only sealed after receipts in the range finalize. */
|
|
787
|
+
interface CoverageSegmentsTable {
|
|
788
|
+
id: Generated<string>;
|
|
789
|
+
stage_id: string;
|
|
790
|
+
from_height: number;
|
|
791
|
+
to_height: number;
|
|
792
|
+
chain_digest: string;
|
|
793
|
+
input_digest: string;
|
|
794
|
+
output_digest: string;
|
|
795
|
+
sealed_at: Generated<Date>;
|
|
796
|
+
}
|
|
797
|
+
/** Exact unit or range that failed, plus retry/retention state. */
|
|
798
|
+
interface StageFailuresTable {
|
|
799
|
+
id: Generated<string>;
|
|
800
|
+
stage_id: string;
|
|
801
|
+
run_id: string | null;
|
|
802
|
+
unit_kind: FailureUnit;
|
|
803
|
+
from_height: number | null;
|
|
804
|
+
to_height: number | null;
|
|
805
|
+
class: FailureClass;
|
|
806
|
+
retry_state: RetryState;
|
|
807
|
+
retry_count: Generated<number>;
|
|
808
|
+
last_error: string | null;
|
|
809
|
+
created_at: Generated<Date>;
|
|
810
|
+
resolved_at: Date | null;
|
|
811
|
+
retain_until: Generated<Date>;
|
|
812
|
+
}
|
|
723
813
|
interface Database {
|
|
724
814
|
blocks: BlocksTable;
|
|
725
815
|
transactions: TransactionsTable;
|
|
@@ -732,6 +822,7 @@ interface Database {
|
|
|
732
822
|
contracts: ContractsTable;
|
|
733
823
|
subgraphs: SubgraphsTable;
|
|
734
824
|
api_keys: ApiKeysTable;
|
|
825
|
+
instances: InstancesTable;
|
|
735
826
|
accounts: AccountsTable;
|
|
736
827
|
sessions: SessionsTable;
|
|
737
828
|
magic_links: MagicLinksTable;
|
|
@@ -784,6 +875,11 @@ interface Database {
|
|
|
784
875
|
chain_read_cache: ChainReadCacheTable;
|
|
785
876
|
pending_fork_blocks: PendingForkBlocksTable;
|
|
786
877
|
observer_journal: ObserverJournalTable;
|
|
878
|
+
stage_registry: StageRegistryTable;
|
|
879
|
+
stage_runs: StageRunsTable;
|
|
880
|
+
stage_block_receipts: StageBlockReceiptsTable;
|
|
881
|
+
coverage_segments: CoverageSegmentsTable;
|
|
882
|
+
stage_failures: StageFailuresTable;
|
|
787
883
|
}
|
|
788
884
|
/** Prepaid x402 credit — one running USD-micros balance per payer principal. */
|
|
789
885
|
interface X402BalancesTable {
|