@secondlayer/shared 13.4.0 → 13.5.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 +31 -0
- package/dist/src/archive/semantic-digest-builder.d.ts +31 -0
- package/dist/src/coverage/index.d.ts +31 -0
- package/dist/src/db/index.d.ts +34 -1
- package/dist/src/db/index.js +3 -1
- package/dist/src/db/index.js.map +3 -3
- package/dist/src/db/queries/chain-reorgs.d.ts +31 -0
- package/dist/src/db/queries/chain-reorgs.js +3 -1
- package/dist/src/db/queries/chain-reorgs.js.map +3 -3
- package/dist/src/db/queries/contracts.d.ts +31 -0
- package/dist/src/db/queries/instance.d.ts +31 -0
- package/dist/src/db/queries/integrity.d.ts +31 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +31 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +31 -0
- package/dist/src/db/queries/subgraphs.d.ts +31 -0
- package/dist/src/db/queries/sync-scope.d.ts +31 -0
- package/dist/src/db/queries/webhooks.d.ts +31 -0
- package/dist/src/db/schema.d.ts +32 -1
- package/dist/src/index.d.ts +128 -7
- package/dist/src/index.js +182 -87
- package/dist/src/index.js.map +5 -4
- package/dist/src/insights/index.d.ts +1540 -0
- package/dist/src/insights/index.js +2284 -0
- package/dist/src/insights/index.js.map +29 -0
- package/dist/src/insights/thresholds.d.ts +56 -0
- package/dist/src/insights/thresholds.js +86 -0
- package/dist/src/insights/thresholds.js.map +10 -0
- package/dist/src/leader.d.ts +3 -1
- package/dist/src/leader.js +3 -1
- package/dist/src/leader.js.map +3 -3
- package/dist/src/node/local-client.d.ts +31 -0
- package/dist/src/queue/listener.js +3 -1
- package/dist/src/queue/listener.js.map +3 -3
- package/dist/src/schemas/index.d.ts +95 -7
- package/dist/src/schemas/index.js +180 -87
- package/dist/src/schemas/index.js.map +4 -3
- package/dist/src/schemas/insights.d.ts +89 -0
- package/dist/src/schemas/insights.js +98 -0
- package/dist/src/schemas/insights.js.map +10 -0
- package/migrations/0170_insights.ts +63 -0
- package/package.json +13 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -597,6 +597,35 @@ interface SubgraphErrorGroupsTable {
|
|
|
597
597
|
first_seen: Generated<Date>;
|
|
598
598
|
last_seen: Generated<Date>;
|
|
599
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* One ranked dashboard insight. `account_id` is NULL on tenant and self-host
|
|
602
|
+
* databases. `severity` is never "recovered": that is derived on read from
|
|
603
|
+
* `resolved_at`.
|
|
604
|
+
*/
|
|
605
|
+
interface InsightsTable {
|
|
606
|
+
id: Generated<string>;
|
|
607
|
+
account_id: string | null;
|
|
608
|
+
resource_kind: string;
|
|
609
|
+
resource_id: string;
|
|
610
|
+
rule: string;
|
|
611
|
+
severity: string;
|
|
612
|
+
impact: Generated<number>;
|
|
613
|
+
/** resource, line, meta, lead, body, evidence, handoff, how. */
|
|
614
|
+
payload: unknown;
|
|
615
|
+
first_seen_at: Generated<Date>;
|
|
616
|
+
last_seen_at: Generated<Date>;
|
|
617
|
+
clear_streak: Generated<number>;
|
|
618
|
+
resolved_at: Date | null;
|
|
619
|
+
dismissed_at: Date | null;
|
|
620
|
+
}
|
|
621
|
+
/** "Expected": mutes one rule for one resource until removed. */
|
|
622
|
+
interface InsightMutesTable {
|
|
623
|
+
account_id: string | null;
|
|
624
|
+
resource_kind: string;
|
|
625
|
+
resource_id: string;
|
|
626
|
+
rule: string;
|
|
627
|
+
created_at: Generated<Date>;
|
|
628
|
+
}
|
|
600
629
|
interface ProcessedStripeEventsTable {
|
|
601
630
|
event_id: string;
|
|
602
631
|
event_type: string;
|
|
@@ -1118,6 +1147,8 @@ interface Database {
|
|
|
1118
1147
|
contact_requests: ContactRequestsTable;
|
|
1119
1148
|
api_failed_requests: ApiFailedRequestsTable;
|
|
1120
1149
|
api_request_log: ApiRequestLogTable;
|
|
1150
|
+
insights: InsightsTable;
|
|
1151
|
+
insight_mutes: InsightMutesTable;
|
|
1121
1152
|
feedback_tickets: FeedbackTicketsTable;
|
|
1122
1153
|
}
|
|
1123
1154
|
interface ServiceHeartbeatsTable {
|
|
@@ -2506,6 +2537,8 @@ declare const TABLE_TO_DB: {
|
|
|
2506
2537
|
contact_requests: string
|
|
2507
2538
|
api_failed_requests: string
|
|
2508
2539
|
api_request_log: string
|
|
2540
|
+
insights: string
|
|
2541
|
+
insight_mutes: string
|
|
2509
2542
|
feedback_tickets: string
|
|
2510
2543
|
service_heartbeats: string
|
|
2511
2544
|
};
|
|
@@ -2753,10 +2786,98 @@ declare class Logger {
|
|
|
2753
2786
|
}
|
|
2754
2787
|
declare const logger: Logger;
|
|
2755
2788
|
import { z as z3 } from "zod";
|
|
2789
|
+
/**
|
|
2790
|
+
* The insight contract. The tenant (`/api/insights`) and platform
|
|
2791
|
+
* (`/api/accounts/insights`) routes serve `Insight` verbatim. The web app keeps
|
|
2792
|
+
* a field-for-field copy in `apps/web/src/lib/insights.ts`; change both
|
|
2793
|
+
* together.
|
|
2794
|
+
*
|
|
2795
|
+
* The types are written out and the schemas annotated with them, rather than
|
|
2796
|
+
* inferred: the bundled `.d.ts` loses inferred zod types (they come out as
|
|
2797
|
+
* `unknown`), the same reason `schemas/webhooks.ts` annotates its schemas.
|
|
2798
|
+
*/
|
|
2799
|
+
declare const INSIGHT_SEVERITIES: readonly ["losing", "will_fail", "costs", "recovered"];
|
|
2800
|
+
type InsightSeverity = (typeof INSIGHT_SEVERITIES)[number];
|
|
2801
|
+
type InsightResourceKind = "webhook" | "subgraph" | "account";
|
|
2802
|
+
type InsightEvidence = {
|
|
2803
|
+
kind: "series"
|
|
2804
|
+
title: string
|
|
2805
|
+
series: {
|
|
2806
|
+
name: string
|
|
2807
|
+
role: "a" | "context" | "mark"
|
|
2808
|
+
points: number[]
|
|
2809
|
+
}[]
|
|
2810
|
+
labels: [number, string][]
|
|
2811
|
+
unit?: string
|
|
2812
|
+
} | {
|
|
2813
|
+
kind: "table"
|
|
2814
|
+
title: string
|
|
2815
|
+
columns: string[]
|
|
2816
|
+
rows: (string | number)[][]
|
|
2817
|
+
markRow?: number
|
|
2818
|
+
} | {
|
|
2819
|
+
kind: "shapes"
|
|
2820
|
+
title: string
|
|
2821
|
+
shapes: {
|
|
2822
|
+
code: string
|
|
2823
|
+
body: string
|
|
2824
|
+
count: number
|
|
2825
|
+
isNew: boolean
|
|
2826
|
+
}[]
|
|
2827
|
+
} | {
|
|
2828
|
+
kind: "timeline"
|
|
2829
|
+
title: string
|
|
2830
|
+
steps: {
|
|
2831
|
+
what: string
|
|
2832
|
+
at: string
|
|
2833
|
+
note?: string
|
|
2834
|
+
failed: boolean
|
|
2835
|
+
}[]
|
|
2836
|
+
};
|
|
2837
|
+
interface Insight {
|
|
2838
|
+
id: string;
|
|
2839
|
+
rule: string;
|
|
2840
|
+
severity: InsightSeverity;
|
|
2841
|
+
impact: number;
|
|
2842
|
+
resource: {
|
|
2843
|
+
kind: InsightResourceKind
|
|
2844
|
+
id: string
|
|
2845
|
+
name: string
|
|
2846
|
+
};
|
|
2847
|
+
line: string;
|
|
2848
|
+
meta?: string;
|
|
2849
|
+
lead: string;
|
|
2850
|
+
body: string;
|
|
2851
|
+
evidence: InsightEvidence[];
|
|
2852
|
+
handoff: {
|
|
2853
|
+
prompt: string
|
|
2854
|
+
commands: string[]
|
|
2855
|
+
};
|
|
2856
|
+
how: {
|
|
2857
|
+
detector: string
|
|
2858
|
+
facts: [string, string][]
|
|
2859
|
+
label?: {
|
|
2860
|
+
cause: string
|
|
2861
|
+
confidence: number
|
|
2862
|
+
}
|
|
2863
|
+
};
|
|
2864
|
+
createdAt: string;
|
|
2865
|
+
resolvedAt?: string | null;
|
|
2866
|
+
}
|
|
2867
|
+
interface InsightListResponse {
|
|
2868
|
+
data: Insight[];
|
|
2869
|
+
}
|
|
2870
|
+
declare const InsightSeveritySchema: z3.ZodType<InsightSeverity>;
|
|
2871
|
+
declare const InsightResourceKindSchema: z3.ZodType<InsightResourceKind>;
|
|
2872
|
+
declare const InsightEvidenceSchema: z3.ZodType<InsightEvidence>;
|
|
2873
|
+
declare const InsightSchema: z3.ZodType<Insight>;
|
|
2874
|
+
declare const InsightListResponseSchema: z3.ZodType<InsightListResponse>;
|
|
2875
|
+
declare const SEVERITY_ORDER: Record<InsightSeverity, number>;
|
|
2876
|
+
import { z as z4 } from "zod";
|
|
2756
2877
|
declare const WEBHOOK_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
|
|
2757
2878
|
declare const WEBHOOK_STATUSES: readonly ["active", "paused", "error"];
|
|
2758
|
-
declare const WebhookStatusSchema:
|
|
2759
|
-
declare const WebhookFormatSchema:
|
|
2879
|
+
declare const WebhookStatusSchema: z4.ZodType<WebhookStatus2>;
|
|
2880
|
+
declare const WebhookFormatSchema: z4.ZodType<WebhookFormat2>;
|
|
2760
2881
|
declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_burn", "stx_lock", "ft_transfer", "ft_mint", "ft_burn", "nft_transfer", "nft_mint", "nft_burn", "contract_call", "contract_deploy", "print_event", "nested_contract_call", "var_set", "map_set", "map_insert", "map_delete", "sbtc_deposit", "sbtc_withdrawal_create", "sbtc_withdrawal_accept", "sbtc_withdrawal_reject", "sbtc_withdrawal_swept_confirmed", "rune_etch", "rune_mint", "rune_transfer", "rune_burn"];
|
|
2761
2882
|
/**
|
|
2762
2883
|
* Per-type accepted filter fields for chain triggers, DERIVED from
|
|
@@ -2764,9 +2885,9 @@ declare const CHAIN_TRIGGER_TYPES: readonly ["stx_transfer", "stx_mint", "stx_bu
|
|
|
2764
2885
|
* the validator. `{ stx_transfer: ["sender","recipient","minAmount","maxAmount"], ... }`.
|
|
2765
2886
|
*/
|
|
2766
2887
|
declare const CHAIN_TRIGGER_FIELDS: Record<string, string[]>;
|
|
2767
|
-
declare const CreateWebhookRequestSchema:
|
|
2768
|
-
declare const UpdateWebhookRequestSchema:
|
|
2769
|
-
declare const ReplayWebhookRequestSchema:
|
|
2888
|
+
declare const CreateWebhookRequestSchema: z4.ZodType<ParsedCreateWebhookRequest>;
|
|
2889
|
+
declare const UpdateWebhookRequestSchema: z4.ZodType<UpdateWebhookRequest>;
|
|
2890
|
+
declare const ReplayWebhookRequestSchema: z4.ZodType<ReplayWebhookRequest>;
|
|
2770
2891
|
type WebhookStatus2 = (typeof WEBHOOK_STATUSES)[number];
|
|
2771
2892
|
/** Webhook kind (mirrors db/types `WebhookKind`). Chain events only. */
|
|
2772
2893
|
type WebhookKind2 = "chain";
|
|
@@ -3040,7 +3161,7 @@ interface DeadRow {
|
|
|
3040
3161
|
failedAt: string | null;
|
|
3041
3162
|
createdAt: string;
|
|
3042
3163
|
}
|
|
3043
|
-
declare function formatWebhookSchemaErrors(error:
|
|
3164
|
+
declare function formatWebhookSchemaErrors(error: z4.ZodError): string[];
|
|
3044
3165
|
type SubgraphSpecFormat = "openapi" | "agent" | "markdown";
|
|
3045
3166
|
/** Options for generating a subgraph's agent schema. */
|
|
3046
3167
|
interface SubgraphSpecOptions {
|
|
@@ -3497,4 +3618,4 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
|
|
|
3497
3618
|
declare function ed25519KeyId(publicKeyPem: string): string;
|
|
3498
3619
|
declare function signEd25519(payload: string, privateKey: KeyObject): string;
|
|
3499
3620
|
declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
|
|
3500
|
-
export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, AuthenticationError, AuthorizationError, BILLING_PAUSED_PREFIX, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, CHAIN_TRIGGER_FIELDS, CHAIN_TRIGGER_TYPES, CODE_TO_STATUS, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReadCacheTable, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainReorgsTable, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTxLevelEvent, ChainWebhookDelivery, ChainWebhookEnvelope, ContactRequest, ContactRequestsTable, Contract, ContractsTable, CoverageSegmentsTable, CreateWebhookRequest, CreateWebhookRequestSchema, CreateWebhookResponse, DB_TO_STREAMS_EVENT_TYPE, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DEFAULT_BTC_CONFIRMATIONS, Database, DatabaseError, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadRow, DecodedEventType2 as DecodedEventType, DecodedEventsTable, DecoderCheckpointsTable, DeliveryRow, DeploySubgraphRequest, DeploySubgraphRequestSchema, DeploySubgraphResponse, EMPTY_RANGE_EVENT_INDEX_SENTINEL, Env, ErrorCode, ErrorCodes, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, ForbiddenError, HealthHour, HealthSnapshotPoint, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertApiRequestLogRow, InsertArchiveFetch, InsertBlock, InsertContactRequest, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InstancesTable, KeyRotatedError, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NotFoundError, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, ParsedCreateWebhookRequest, ParsedReplayWebhookRequest, ParsedUpdateWebhookRequest, PaymentRequiredError, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RUNE_EVENT_TYPES, RateLimitError, ReindexResponse, RepairMode, ReplayResult, ReplayWebhookRequest, ReplayWebhookRequestSchema, RetryState, RotateSecretResponse, RunStatus, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneEventType, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, STREAMS_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_TO_DB_EVENT_TYPES, SbtcDepositEvent, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SbtcWithdrawalEvent, SbtcWithdrawalSweptConfirmedEvent, SecondLayerError, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, StreamsCursor, StreamsDbEventType, StreamsEventType, Subgraph, SubgraphAgentSchema, SubgraphAggregateParams, SubgraphAggregateResponse, SubgraphDetail, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapEntry, SubgraphGapRange, SubgraphGapsResponse, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphQueryParams, SubgraphSpecFormat, SubgraphSpecOptions, SubgraphSummary, SubgraphSyncInfo, SubgraphVerification, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, TenantSuspendedError, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UpdateWebhookRequest, UpdateWebhookRequestSchema, UsageLedgerRow, UsageLedgerTable, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_STORED_TO_NODE_TYPE, ValidationError, VersionConflictError, VmEvent, VmEventType, VmEventsArchiveTable, VmEventsTable, VmNodeEventType, WEBHOOK_FORMATS, WEBHOOK_STATUSES, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDetail, WebhookFormat, WebhookFormatSchema, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhookStatusSchema, WebhookSummary, WebhooksTable, applicationDatabaseUrl, assertDbSplit, billingPausedCode, blockEndCursor, bucketHourly, closeDb, closeDbOrTimeout, committedHeight, compareStreamsCursor, exports_hmac as crypto, decodeStreamsCursor, describeDbUrl, exports_ed25519 as ed25519, encodeStreamsCursor, finalizedBurnHeight, formatWebhookSchemaErrors, generateSubgraphAgentSchema, generateSubgraphMarkdown, generateSubgraphOpenApi, generateSubgraphSpec, getDb, getDbSplitStatus, getEnv, getErrorMessage, getMigrationRole, getRawClient, getSourceDb, getTargetDb, isBnsDecoderEnabled, isEmptyRangeCursor, isPox4DecoderEnabled, isPox5DecoderEnabled, isSbtcDecoderEnabled, jsonb, logger, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
|
|
3621
|
+
export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, AuthenticationError, AuthorizationError, BILLING_PAUSED_PREFIX, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, CHAIN_TRIGGER_FIELDS, CHAIN_TRIGGER_TYPES, CODE_TO_STATUS, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReadCacheTable, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainReorgsTable, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTxLevelEvent, ChainWebhookDelivery, ChainWebhookEnvelope, ContactRequest, ContactRequestsTable, Contract, ContractsTable, CoverageSegmentsTable, CreateWebhookRequest, CreateWebhookRequestSchema, CreateWebhookResponse, DB_TO_STREAMS_EVENT_TYPE, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DEFAULT_BTC_CONFIRMATIONS, Database, DatabaseError, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadRow, DecodedEventType2 as DecodedEventType, DecodedEventsTable, DecoderCheckpointsTable, DeliveryRow, DeploySubgraphRequest, DeploySubgraphRequestSchema, DeploySubgraphResponse, EMPTY_RANGE_EVENT_INDEX_SENTINEL, Env, ErrorCode, ErrorCodes, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, ForbiddenError, HealthHour, HealthSnapshotPoint, INSIGHT_SEVERITIES, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertApiRequestLogRow, InsertArchiveFetch, InsertBlock, InsertContactRequest, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, Insight, InsightEvidence, InsightEvidenceSchema, InsightListResponse, InsightListResponseSchema, InsightMutesTable, InsightResourceKind, InsightResourceKindSchema, InsightSchema, InsightSeverity, InsightSeveritySchema, InsightsTable, InstancesTable, KeyRotatedError, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NotFoundError, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, ParsedCreateWebhookRequest, ParsedReplayWebhookRequest, ParsedUpdateWebhookRequest, PaymentRequiredError, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RUNE_EVENT_TYPES, RateLimitError, ReindexResponse, RepairMode, ReplayResult, ReplayWebhookRequest, ReplayWebhookRequestSchema, RetryState, RotateSecretResponse, RunStatus, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneEventType, SEVERITY_ORDER, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, STREAMS_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_TO_DB_EVENT_TYPES, SbtcDepositEvent, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SbtcWithdrawalEvent, SbtcWithdrawalSweptConfirmedEvent, SecondLayerError, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, StreamsCursor, StreamsDbEventType, StreamsEventType, Subgraph, SubgraphAgentSchema, SubgraphAggregateParams, SubgraphAggregateResponse, SubgraphDetail, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapEntry, SubgraphGapRange, SubgraphGapsResponse, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphQueryParams, SubgraphSpecFormat, SubgraphSpecOptions, SubgraphSummary, SubgraphSyncInfo, SubgraphVerification, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, TenantSuspendedError, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UpdateWebhookRequest, UpdateWebhookRequestSchema, UsageLedgerRow, UsageLedgerTable, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_STORED_TO_NODE_TYPE, ValidationError, VersionConflictError, VmEvent, VmEventType, VmEventsArchiveTable, VmEventsTable, VmNodeEventType, WEBHOOK_FORMATS, WEBHOOK_STATUSES, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDetail, WebhookFormat, WebhookFormatSchema, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhookStatusSchema, WebhookSummary, WebhooksTable, applicationDatabaseUrl, assertDbSplit, billingPausedCode, blockEndCursor, bucketHourly, closeDb, closeDbOrTimeout, committedHeight, compareStreamsCursor, exports_hmac as crypto, decodeStreamsCursor, describeDbUrl, exports_ed25519 as ed25519, encodeStreamsCursor, finalizedBurnHeight, formatWebhookSchemaErrors, generateSubgraphAgentSchema, generateSubgraphMarkdown, generateSubgraphOpenApi, generateSubgraphSpec, getDb, getDbSplitStatus, getEnv, getErrorMessage, getMigrationRole, getRawClient, getSourceDb, getTargetDb, isBnsDecoderEnabled, isEmptyRangeCursor, isPox4DecoderEnabled, isPox5DecoderEnabled, isSbtcDecoderEnabled, jsonb, logger, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
|
package/dist/src/index.js
CHANGED
|
@@ -866,6 +866,8 @@ var TABLE_TO_DB = {
|
|
|
866
866
|
contact_requests: "target",
|
|
867
867
|
api_failed_requests: "target",
|
|
868
868
|
api_request_log: "target",
|
|
869
|
+
insights: "target",
|
|
870
|
+
insight_mutes: "target",
|
|
869
871
|
feedback_tickets: "target",
|
|
870
872
|
service_heartbeats: "both"
|
|
871
873
|
};
|
|
@@ -1256,8 +1258,94 @@ var BILLING_PAUSED_PREFIX = "billing_paused: ";
|
|
|
1256
1258
|
function billingPausedCode(lastError) {
|
|
1257
1259
|
return lastError?.startsWith(BILLING_PAUSED_PREFIX) ? lastError.slice(BILLING_PAUSED_PREFIX.length) : null;
|
|
1258
1260
|
}
|
|
1259
|
-
// src/schemas/
|
|
1261
|
+
// src/schemas/insights.ts
|
|
1260
1262
|
import { z as z3 } from "zod";
|
|
1263
|
+
var INSIGHT_SEVERITIES = [
|
|
1264
|
+
"losing",
|
|
1265
|
+
"will_fail",
|
|
1266
|
+
"costs",
|
|
1267
|
+
"recovered"
|
|
1268
|
+
];
|
|
1269
|
+
var InsightSeveritySchema = z3.enum(INSIGHT_SEVERITIES);
|
|
1270
|
+
var InsightResourceKindSchema = z3.enum(["webhook", "subgraph", "account"]);
|
|
1271
|
+
var InsightEvidenceSchema = z3.discriminatedUnion("kind", [
|
|
1272
|
+
z3.object({
|
|
1273
|
+
kind: z3.literal("series"),
|
|
1274
|
+
title: z3.string(),
|
|
1275
|
+
series: z3.array(z3.object({
|
|
1276
|
+
name: z3.string(),
|
|
1277
|
+
role: z3.enum(["a", "context", "mark"]),
|
|
1278
|
+
points: z3.array(z3.number())
|
|
1279
|
+
})),
|
|
1280
|
+
labels: z3.array(z3.tuple([z3.number(), z3.string()])),
|
|
1281
|
+
unit: z3.string().optional()
|
|
1282
|
+
}),
|
|
1283
|
+
z3.object({
|
|
1284
|
+
kind: z3.literal("table"),
|
|
1285
|
+
title: z3.string(),
|
|
1286
|
+
columns: z3.array(z3.string()),
|
|
1287
|
+
rows: z3.array(z3.array(z3.union([z3.string(), z3.number()]))),
|
|
1288
|
+
markRow: z3.number().optional()
|
|
1289
|
+
}),
|
|
1290
|
+
z3.object({
|
|
1291
|
+
kind: z3.literal("shapes"),
|
|
1292
|
+
title: z3.string(),
|
|
1293
|
+
shapes: z3.array(z3.object({
|
|
1294
|
+
code: z3.string(),
|
|
1295
|
+
body: z3.string(),
|
|
1296
|
+
count: z3.number(),
|
|
1297
|
+
isNew: z3.boolean()
|
|
1298
|
+
}))
|
|
1299
|
+
}),
|
|
1300
|
+
z3.object({
|
|
1301
|
+
kind: z3.literal("timeline"),
|
|
1302
|
+
title: z3.string(),
|
|
1303
|
+
steps: z3.array(z3.object({
|
|
1304
|
+
what: z3.string(),
|
|
1305
|
+
at: z3.string(),
|
|
1306
|
+
note: z3.string().optional(),
|
|
1307
|
+
failed: z3.boolean()
|
|
1308
|
+
}))
|
|
1309
|
+
})
|
|
1310
|
+
]);
|
|
1311
|
+
var InsightSchema = z3.object({
|
|
1312
|
+
id: z3.string(),
|
|
1313
|
+
rule: z3.string(),
|
|
1314
|
+
severity: InsightSeveritySchema,
|
|
1315
|
+
impact: z3.number(),
|
|
1316
|
+
resource: z3.object({
|
|
1317
|
+
kind: InsightResourceKindSchema,
|
|
1318
|
+
id: z3.string(),
|
|
1319
|
+
name: z3.string()
|
|
1320
|
+
}),
|
|
1321
|
+
line: z3.string(),
|
|
1322
|
+
meta: z3.string().optional(),
|
|
1323
|
+
lead: z3.string(),
|
|
1324
|
+
body: z3.string(),
|
|
1325
|
+
evidence: z3.array(InsightEvidenceSchema),
|
|
1326
|
+
handoff: z3.object({
|
|
1327
|
+
prompt: z3.string(),
|
|
1328
|
+
commands: z3.array(z3.string())
|
|
1329
|
+
}),
|
|
1330
|
+
how: z3.object({
|
|
1331
|
+
detector: z3.string(),
|
|
1332
|
+
facts: z3.array(z3.tuple([z3.string(), z3.string()])),
|
|
1333
|
+
label: z3.object({ cause: z3.string(), confidence: z3.number() }).optional()
|
|
1334
|
+
}),
|
|
1335
|
+
createdAt: z3.string(),
|
|
1336
|
+
resolvedAt: z3.string().nullable().optional()
|
|
1337
|
+
});
|
|
1338
|
+
var InsightListResponseSchema = z3.object({
|
|
1339
|
+
data: z3.array(InsightSchema)
|
|
1340
|
+
});
|
|
1341
|
+
var SEVERITY_ORDER = {
|
|
1342
|
+
losing: 0,
|
|
1343
|
+
will_fail: 1,
|
|
1344
|
+
costs: 2,
|
|
1345
|
+
recovered: 3
|
|
1346
|
+
};
|
|
1347
|
+
// src/schemas/webhooks.ts
|
|
1348
|
+
import { z as z4 } from "zod";
|
|
1261
1349
|
var WEBHOOK_FORMATS = [
|
|
1262
1350
|
"standard-webhooks",
|
|
1263
1351
|
"inngest",
|
|
@@ -1283,7 +1371,7 @@ function webhookTimeoutMsCeiling() {
|
|
|
1283
1371
|
return ceilingFromEnv("WEBHOOK_TIMEOUT_MS_CEILING", WEBHOOK_TIMEOUT_MS_CEILING_DEFAULT);
|
|
1284
1372
|
}
|
|
1285
1373
|
function maxRetriesField() {
|
|
1286
|
-
return
|
|
1374
|
+
return z4.number().int().min(0).optional().superRefine((v, ctx) => {
|
|
1287
1375
|
if (v === undefined)
|
|
1288
1376
|
return;
|
|
1289
1377
|
const ceiling = webhookMaxRetriesCeiling();
|
|
@@ -1296,7 +1384,7 @@ function maxRetriesField() {
|
|
|
1296
1384
|
});
|
|
1297
1385
|
}
|
|
1298
1386
|
function timeoutMsField() {
|
|
1299
|
-
return
|
|
1387
|
+
return z4.number().int().min(100).optional().superRefine((v, ctx) => {
|
|
1300
1388
|
if (v === undefined)
|
|
1301
1389
|
return;
|
|
1302
1390
|
const ceiling = webhookTimeoutMsCeiling();
|
|
@@ -1308,8 +1396,8 @@ function timeoutMsField() {
|
|
|
1308
1396
|
}
|
|
1309
1397
|
});
|
|
1310
1398
|
}
|
|
1311
|
-
var webhookUrl =
|
|
1312
|
-
var name =
|
|
1399
|
+
var webhookUrl = z4.string().trim().min(1).refine((value) => value.startsWith("http://") || value.startsWith("https://"), "must be an http(s) URL");
|
|
1400
|
+
var name = z4.string().trim().min(1).max(128);
|
|
1313
1401
|
var MANAGED_NAME_PREFIXES = {
|
|
1314
1402
|
"sentinel:": "Sentinel"
|
|
1315
1403
|
};
|
|
@@ -1320,8 +1408,8 @@ function managedByForName(name) {
|
|
|
1320
1408
|
}
|
|
1321
1409
|
return null;
|
|
1322
1410
|
}
|
|
1323
|
-
var WebhookStatusSchema =
|
|
1324
|
-
var WebhookFormatSchema =
|
|
1411
|
+
var WebhookStatusSchema = z4.enum(WEBHOOK_STATUSES);
|
|
1412
|
+
var WebhookFormatSchema = z4.enum(WEBHOOK_FORMATS);
|
|
1325
1413
|
var CHAIN_TRIGGER_TYPES = [
|
|
1326
1414
|
"stx_transfer",
|
|
1327
1415
|
"stx_mint",
|
|
@@ -1351,212 +1439,212 @@ var CHAIN_TRIGGER_TYPES = [
|
|
|
1351
1439
|
"rune_transfer",
|
|
1352
1440
|
"rune_burn"
|
|
1353
1441
|
];
|
|
1354
|
-
var runeRef =
|
|
1355
|
-
var triggerAmount =
|
|
1356
|
-
|
|
1357
|
-
|
|
1442
|
+
var runeRef = z4.string().trim().min(1);
|
|
1443
|
+
var triggerAmount = z4.union([
|
|
1444
|
+
z4.string().trim().regex(/^\d+$/, "must be a non-negative integer string"),
|
|
1445
|
+
z4.number().int().nonnegative()
|
|
1358
1446
|
]);
|
|
1359
|
-
var triggerPattern =
|
|
1360
|
-
var trait =
|
|
1361
|
-
var printWhereValue =
|
|
1362
|
-
var PrintWhereSchema =
|
|
1447
|
+
var triggerPattern = z4.string().trim().min(1);
|
|
1448
|
+
var trait = z4.string().trim().min(1);
|
|
1449
|
+
var printWhereValue = z4.string().min(1).max(256);
|
|
1450
|
+
var PrintWhereSchema = z4.record(z4.string().trim().min(1).max(64), z4.union([printWhereValue, z4.array(printWhereValue).min(1).max(20)])).refine((o) => {
|
|
1363
1451
|
const n = Object.keys(o).length;
|
|
1364
1452
|
return n >= 1 && n <= 10;
|
|
1365
1453
|
}, "where takes 1 to 10 keys");
|
|
1366
|
-
var ChainTriggerSchema =
|
|
1367
|
-
|
|
1368
|
-
type:
|
|
1454
|
+
var ChainTriggerSchema = z4.discriminatedUnion("type", [
|
|
1455
|
+
z4.object({
|
|
1456
|
+
type: z4.literal("stx_transfer"),
|
|
1369
1457
|
sender: triggerPattern.optional(),
|
|
1370
1458
|
recipient: triggerPattern.optional(),
|
|
1371
1459
|
minAmount: triggerAmount.optional(),
|
|
1372
1460
|
maxAmount: triggerAmount.optional()
|
|
1373
1461
|
}).strict(),
|
|
1374
|
-
|
|
1375
|
-
type:
|
|
1462
|
+
z4.object({
|
|
1463
|
+
type: z4.literal("stx_mint"),
|
|
1376
1464
|
recipient: triggerPattern.optional(),
|
|
1377
1465
|
minAmount: triggerAmount.optional()
|
|
1378
1466
|
}).strict(),
|
|
1379
|
-
|
|
1380
|
-
type:
|
|
1467
|
+
z4.object({
|
|
1468
|
+
type: z4.literal("stx_burn"),
|
|
1381
1469
|
sender: triggerPattern.optional(),
|
|
1382
1470
|
minAmount: triggerAmount.optional()
|
|
1383
1471
|
}).strict(),
|
|
1384
|
-
|
|
1385
|
-
type:
|
|
1472
|
+
z4.object({
|
|
1473
|
+
type: z4.literal("stx_lock"),
|
|
1386
1474
|
lockedAddress: triggerPattern.optional(),
|
|
1387
1475
|
minAmount: triggerAmount.optional()
|
|
1388
1476
|
}).strict(),
|
|
1389
|
-
|
|
1390
|
-
type:
|
|
1477
|
+
z4.object({
|
|
1478
|
+
type: z4.literal("ft_transfer"),
|
|
1391
1479
|
assetIdentifier: triggerPattern.optional(),
|
|
1392
1480
|
sender: triggerPattern.optional(),
|
|
1393
1481
|
recipient: triggerPattern.optional(),
|
|
1394
1482
|
minAmount: triggerAmount.optional(),
|
|
1395
1483
|
trait: trait.optional()
|
|
1396
1484
|
}).strict(),
|
|
1397
|
-
|
|
1398
|
-
type:
|
|
1485
|
+
z4.object({
|
|
1486
|
+
type: z4.literal("ft_mint"),
|
|
1399
1487
|
assetIdentifier: triggerPattern.optional(),
|
|
1400
1488
|
recipient: triggerPattern.optional(),
|
|
1401
1489
|
minAmount: triggerAmount.optional(),
|
|
1402
1490
|
trait: trait.optional()
|
|
1403
1491
|
}).strict(),
|
|
1404
|
-
|
|
1405
|
-
type:
|
|
1492
|
+
z4.object({
|
|
1493
|
+
type: z4.literal("ft_burn"),
|
|
1406
1494
|
assetIdentifier: triggerPattern.optional(),
|
|
1407
1495
|
sender: triggerPattern.optional(),
|
|
1408
1496
|
minAmount: triggerAmount.optional(),
|
|
1409
1497
|
trait: trait.optional()
|
|
1410
1498
|
}).strict(),
|
|
1411
|
-
|
|
1412
|
-
type:
|
|
1499
|
+
z4.object({
|
|
1500
|
+
type: z4.literal("nft_transfer"),
|
|
1413
1501
|
assetIdentifier: triggerPattern.optional(),
|
|
1414
1502
|
sender: triggerPattern.optional(),
|
|
1415
1503
|
recipient: triggerPattern.optional(),
|
|
1416
1504
|
trait: trait.optional()
|
|
1417
1505
|
}).strict(),
|
|
1418
|
-
|
|
1419
|
-
type:
|
|
1506
|
+
z4.object({
|
|
1507
|
+
type: z4.literal("nft_mint"),
|
|
1420
1508
|
assetIdentifier: triggerPattern.optional(),
|
|
1421
1509
|
recipient: triggerPattern.optional(),
|
|
1422
1510
|
trait: trait.optional()
|
|
1423
1511
|
}).strict(),
|
|
1424
|
-
|
|
1425
|
-
type:
|
|
1512
|
+
z4.object({
|
|
1513
|
+
type: z4.literal("nft_burn"),
|
|
1426
1514
|
assetIdentifier: triggerPattern.optional(),
|
|
1427
1515
|
sender: triggerPattern.optional(),
|
|
1428
1516
|
trait: trait.optional()
|
|
1429
1517
|
}).strict(),
|
|
1430
|
-
|
|
1431
|
-
type:
|
|
1518
|
+
z4.object({
|
|
1519
|
+
type: z4.literal("contract_call"),
|
|
1432
1520
|
contractId: triggerPattern.optional(),
|
|
1433
1521
|
functionName: triggerPattern.optional(),
|
|
1434
1522
|
caller: triggerPattern.optional(),
|
|
1435
1523
|
trait: trait.optional()
|
|
1436
1524
|
}).strict(),
|
|
1437
|
-
|
|
1438
|
-
type:
|
|
1525
|
+
z4.object({
|
|
1526
|
+
type: z4.literal("contract_deploy"),
|
|
1439
1527
|
deployer: triggerPattern.optional(),
|
|
1440
1528
|
contractName: triggerPattern.optional()
|
|
1441
1529
|
}).strict(),
|
|
1442
|
-
|
|
1443
|
-
type:
|
|
1530
|
+
z4.object({
|
|
1531
|
+
type: z4.literal("print_event"),
|
|
1444
1532
|
contractId: triggerPattern.optional(),
|
|
1445
1533
|
topic: triggerPattern.optional(),
|
|
1446
1534
|
trait: trait.optional(),
|
|
1447
1535
|
where: PrintWhereSchema.optional()
|
|
1448
1536
|
}).strict(),
|
|
1449
|
-
|
|
1450
|
-
type:
|
|
1537
|
+
z4.object({
|
|
1538
|
+
type: z4.literal("nested_contract_call"),
|
|
1451
1539
|
contractId: triggerPattern.optional(),
|
|
1452
1540
|
functionName: triggerPattern.optional(),
|
|
1453
1541
|
caller: triggerPattern.optional(),
|
|
1454
1542
|
sender: triggerPattern.optional(),
|
|
1455
1543
|
trait: trait.optional()
|
|
1456
1544
|
}).strict(),
|
|
1457
|
-
|
|
1458
|
-
type:
|
|
1545
|
+
z4.object({
|
|
1546
|
+
type: z4.literal("var_set"),
|
|
1459
1547
|
contractId: triggerPattern.optional(),
|
|
1460
1548
|
varName: triggerPattern.optional(),
|
|
1461
1549
|
trait: trait.optional()
|
|
1462
1550
|
}).strict(),
|
|
1463
|
-
|
|
1464
|
-
type:
|
|
1551
|
+
z4.object({
|
|
1552
|
+
type: z4.literal("map_set"),
|
|
1465
1553
|
contractId: triggerPattern.optional(),
|
|
1466
1554
|
map: triggerPattern.optional(),
|
|
1467
1555
|
trait: trait.optional()
|
|
1468
1556
|
}).strict(),
|
|
1469
|
-
|
|
1470
|
-
type:
|
|
1557
|
+
z4.object({
|
|
1558
|
+
type: z4.literal("map_insert"),
|
|
1471
1559
|
contractId: triggerPattern.optional(),
|
|
1472
1560
|
map: triggerPattern.optional(),
|
|
1473
1561
|
trait: trait.optional()
|
|
1474
1562
|
}).strict(),
|
|
1475
|
-
|
|
1476
|
-
type:
|
|
1563
|
+
z4.object({
|
|
1564
|
+
type: z4.literal("map_delete"),
|
|
1477
1565
|
contractId: triggerPattern.optional(),
|
|
1478
1566
|
map: triggerPattern.optional(),
|
|
1479
1567
|
trait: trait.optional()
|
|
1480
1568
|
}).strict(),
|
|
1481
|
-
|
|
1482
|
-
type:
|
|
1569
|
+
z4.object({
|
|
1570
|
+
type: z4.literal("sbtc_deposit"),
|
|
1483
1571
|
sender: triggerPattern.optional(),
|
|
1484
1572
|
minAmount: triggerAmount.optional(),
|
|
1485
1573
|
maxAmount: triggerAmount.optional(),
|
|
1486
1574
|
bitcoinTxid: triggerPattern.optional(),
|
|
1487
|
-
requestId:
|
|
1575
|
+
requestId: z4.number().int().nonnegative().optional()
|
|
1488
1576
|
}).strict(),
|
|
1489
|
-
|
|
1490
|
-
type:
|
|
1577
|
+
z4.object({
|
|
1578
|
+
type: z4.literal("sbtc_withdrawal_create"),
|
|
1491
1579
|
sender: triggerPattern.optional(),
|
|
1492
1580
|
minAmount: triggerAmount.optional(),
|
|
1493
1581
|
maxAmount: triggerAmount.optional(),
|
|
1494
|
-
requestId:
|
|
1582
|
+
requestId: z4.number().int().nonnegative().optional()
|
|
1495
1583
|
}).strict(),
|
|
1496
|
-
|
|
1497
|
-
type:
|
|
1498
|
-
requestId:
|
|
1584
|
+
z4.object({
|
|
1585
|
+
type: z4.literal("sbtc_withdrawal_accept"),
|
|
1586
|
+
requestId: z4.number().int().nonnegative().optional(),
|
|
1499
1587
|
sweepTxid: triggerPattern.optional()
|
|
1500
1588
|
}).strict(),
|
|
1501
|
-
|
|
1502
|
-
type:
|
|
1503
|
-
requestId:
|
|
1589
|
+
z4.object({
|
|
1590
|
+
type: z4.literal("sbtc_withdrawal_reject"),
|
|
1591
|
+
requestId: z4.number().int().nonnegative().optional()
|
|
1504
1592
|
}).strict(),
|
|
1505
|
-
|
|
1506
|
-
type:
|
|
1507
|
-
requestId:
|
|
1593
|
+
z4.object({
|
|
1594
|
+
type: z4.literal("sbtc_withdrawal_swept_confirmed"),
|
|
1595
|
+
requestId: z4.number().int().nonnegative().optional(),
|
|
1508
1596
|
sweepTxid: triggerPattern.optional()
|
|
1509
1597
|
}).strict(),
|
|
1510
|
-
|
|
1511
|
-
type:
|
|
1598
|
+
z4.object({
|
|
1599
|
+
type: z4.literal("rune_etch"),
|
|
1512
1600
|
rune: runeRef.optional()
|
|
1513
1601
|
}).strict(),
|
|
1514
|
-
|
|
1515
|
-
type:
|
|
1602
|
+
z4.object({
|
|
1603
|
+
type: z4.literal("rune_mint"),
|
|
1516
1604
|
rune: runeRef.optional()
|
|
1517
1605
|
}).strict(),
|
|
1518
|
-
|
|
1519
|
-
type:
|
|
1606
|
+
z4.object({
|
|
1607
|
+
type: z4.literal("rune_transfer"),
|
|
1520
1608
|
rune: runeRef.optional(),
|
|
1521
1609
|
address: triggerPattern.optional(),
|
|
1522
1610
|
minAmount: triggerAmount.optional()
|
|
1523
1611
|
}).strict(),
|
|
1524
|
-
|
|
1525
|
-
type:
|
|
1612
|
+
z4.object({
|
|
1613
|
+
type: z4.literal("rune_burn"),
|
|
1526
1614
|
rune: runeRef.optional()
|
|
1527
1615
|
}).strict()
|
|
1528
1616
|
]);
|
|
1529
|
-
var ChainTriggersSchema =
|
|
1617
|
+
var ChainTriggersSchema = z4.array(ChainTriggerSchema).min(1).max(50);
|
|
1530
1618
|
var CHAIN_TRIGGER_FIELDS = Object.fromEntries(ChainTriggerSchema._zod.def.options.map((opt) => {
|
|
1531
1619
|
const shape = opt._zod.def.shape;
|
|
1532
1620
|
const type = shape.type._zod.def.values[0];
|
|
1533
1621
|
return [type, Object.keys(shape).filter((k) => k !== "type")];
|
|
1534
1622
|
}));
|
|
1535
|
-
var CreateWebhookRequestSchema =
|
|
1623
|
+
var CreateWebhookRequestSchema = z4.object({
|
|
1536
1624
|
name,
|
|
1537
1625
|
triggers: ChainTriggersSchema,
|
|
1538
1626
|
url: webhookUrl,
|
|
1539
1627
|
format: WebhookFormatSchema.default("standard-webhooks"),
|
|
1540
|
-
authConfig:
|
|
1628
|
+
authConfig: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1541
1629
|
maxRetries: maxRetriesField(),
|
|
1542
1630
|
timeoutMs: timeoutMsField(),
|
|
1543
|
-
concurrency:
|
|
1631
|
+
concurrency: z4.number().int().min(1).max(100).optional()
|
|
1544
1632
|
});
|
|
1545
|
-
var UpdateWebhookRequestSchema =
|
|
1633
|
+
var UpdateWebhookRequestSchema = z4.object({
|
|
1546
1634
|
name: name.optional(),
|
|
1547
1635
|
url: webhookUrl.optional(),
|
|
1548
1636
|
format: WebhookFormatSchema.optional(),
|
|
1549
|
-
authConfig:
|
|
1637
|
+
authConfig: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1550
1638
|
maxRetries: maxRetriesField(),
|
|
1551
1639
|
timeoutMs: timeoutMsField(),
|
|
1552
|
-
concurrency:
|
|
1640
|
+
concurrency: z4.number().int().min(1).max(100).optional()
|
|
1553
1641
|
}).refine((value) => Object.keys(value).length > 0, {
|
|
1554
1642
|
message: "At least one field must be provided"
|
|
1555
1643
|
});
|
|
1556
|
-
var ReplayWebhookRequestSchema =
|
|
1557
|
-
fromBlock:
|
|
1558
|
-
toBlock:
|
|
1559
|
-
force:
|
|
1644
|
+
var ReplayWebhookRequestSchema = z4.object({
|
|
1645
|
+
fromBlock: z4.number().int().nonnegative(),
|
|
1646
|
+
toBlock: z4.number().int().nonnegative(),
|
|
1647
|
+
force: z4.string().trim().min(1).max(64).optional()
|
|
1560
1648
|
}).refine((value) => value.fromBlock <= value.toBlock, {
|
|
1561
1649
|
message: "fromBlock must be less than or equal to toBlock",
|
|
1562
1650
|
path: ["toBlock"]
|
|
@@ -2174,12 +2262,19 @@ export {
|
|
|
2174
2262
|
EMPTY_RANGE_EVENT_INDEX_SENTINEL,
|
|
2175
2263
|
ErrorCodes,
|
|
2176
2264
|
ForbiddenError,
|
|
2265
|
+
INSIGHT_SEVERITIES,
|
|
2266
|
+
InsightEvidenceSchema,
|
|
2267
|
+
InsightListResponseSchema,
|
|
2268
|
+
InsightResourceKindSchema,
|
|
2269
|
+
InsightSchema,
|
|
2270
|
+
InsightSeveritySchema,
|
|
2177
2271
|
KeyRotatedError,
|
|
2178
2272
|
NotFoundError,
|
|
2179
2273
|
PaymentRequiredError,
|
|
2180
2274
|
RUNE_EVENT_TYPES,
|
|
2181
2275
|
RateLimitError,
|
|
2182
2276
|
ReplayWebhookRequestSchema,
|
|
2277
|
+
SEVERITY_ORDER,
|
|
2183
2278
|
SOURCE_READ_COLUMNS,
|
|
2184
2279
|
SOURCE_READ_PKS,
|
|
2185
2280
|
SOURCE_READ_TYPES,
|
|
@@ -2243,5 +2338,5 @@ export {
|
|
|
2243
2338
|
sql2 as sql
|
|
2244
2339
|
};
|
|
2245
2340
|
|
|
2246
|
-
//# debugId=
|
|
2341
|
+
//# debugId=D95357BE1793CC7464756E2164756E21
|
|
2247
2342
|
//# sourceMappingURL=index.js.map
|