@secondlayer/shared 13.11.0 → 13.13.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 +125 -0
- package/dist/src/archive/semantic-digest-builder.d.ts +125 -0
- package/dist/src/coverage/index.d.ts +125 -0
- package/dist/src/db/index.d.ts +146 -2
- package/dist/src/db/index.js +11 -1
- package/dist/src/db/index.js.map +3 -3
- package/dist/src/db/queries/chain-reorgs.d.ts +125 -0
- package/dist/src/db/queries/chain-reorgs.js +11 -1
- package/dist/src/db/queries/chain-reorgs.js.map +3 -3
- package/dist/src/db/queries/contracts.d.ts +125 -0
- package/dist/src/db/queries/instance.d.ts +125 -0
- package/dist/src/db/queries/integrity.d.ts +125 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +125 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +125 -0
- package/dist/src/db/queries/subgraphs.d.ts +125 -0
- package/dist/src/db/queries/sync-scope.d.ts +125 -0
- package/dist/src/db/queries/webhook-replays.d.ts +1431 -0
- package/dist/src/db/queries/webhook-replays.js +156 -0
- package/dist/src/db/queries/webhook-replays.js.map +10 -0
- package/dist/src/db/queries/webhooks.d.ts +125 -0
- package/dist/src/db/schema.d.ts +136 -2
- package/dist/src/index.d.ts +146 -2
- package/dist/src/index.js +15 -1
- package/dist/src/index.js.map +4 -4
- package/dist/src/insights/index.d.ts +142 -3
- package/dist/src/insights/index.js +40 -3
- package/dist/src/insights/index.js.map +3 -3
- package/dist/src/node/local-client.d.ts +125 -0
- package/dist/src/queue/listener.js +11 -1
- package/dist/src/queue/listener.js.map +3 -3
- package/dist/src/schemas/index.js +5 -1
- package/dist/src/schemas/index.js.map +3 -3
- package/dist/src/schemas/webhooks.d.ts +45 -1
- package/dist/src/schemas/webhooks.js +6 -1
- package/dist/src/schemas/webhooks.js.map +3 -3
- package/migrations/0177_oauth_mcp.ts +122 -0
- package/migrations/0178_insight_snooze.ts +22 -0
- package/migrations/0179_webhook_replays.ts +56 -0
- package/migrations/0180_push.ts +54 -0
- package/migrations/0181_push_sent.ts +30 -0
- package/package.json +5 -1
|
@@ -402,6 +402,7 @@ interface InsightsTable {
|
|
|
402
402
|
clear_streak: Generated<number>;
|
|
403
403
|
resolved_at: Date | null;
|
|
404
404
|
dismissed_at: Date | null;
|
|
405
|
+
snoozed_until: Date | null;
|
|
405
406
|
}
|
|
406
407
|
/** "Expected": mutes one rule for one resource until removed. */
|
|
407
408
|
interface InsightMutesTable {
|
|
@@ -895,6 +896,7 @@ interface Database {
|
|
|
895
896
|
webhooks: WebhooksTable;
|
|
896
897
|
webhook_outbox: WebhookOutboxTable;
|
|
897
898
|
webhook_deliveries: WebhookDeliveriesTable;
|
|
899
|
+
webhook_replays: WebhookReplaysTable;
|
|
898
900
|
trigger_evaluator_state: TriggerEvaluatorStateTable;
|
|
899
901
|
decoded_events: DecodedEventsTable;
|
|
900
902
|
decoder_checkpoints: DecoderCheckpointsTable;
|
|
@@ -928,6 +930,12 @@ interface Database {
|
|
|
928
930
|
account_balance_alerts: AccountBalanceAlertsTable;
|
|
929
931
|
webhook_incident_alerts: WebhookIncidentAlertsTable;
|
|
930
932
|
cli_device_logins: CliDeviceLoginsTable;
|
|
933
|
+
oauth_clients: OauthClientsTable;
|
|
934
|
+
oauth_requests: OauthRequestsTable;
|
|
935
|
+
oauth_codes: OauthCodesTable;
|
|
936
|
+
oauth_grants: OauthGrantsTable;
|
|
937
|
+
oauth_tokens: OauthTokensTable;
|
|
938
|
+
oauth_refresh_retired: OauthRefreshRetiredTable;
|
|
931
939
|
sentinel_accounts: SentinelAccountsTable;
|
|
932
940
|
waitlists: WaitlistsTable;
|
|
933
941
|
waitlist_signups: WaitlistSignupsTable;
|
|
@@ -937,6 +945,9 @@ interface Database {
|
|
|
937
945
|
insights: InsightsTable;
|
|
938
946
|
insight_mutes: InsightMutesTable;
|
|
939
947
|
feedback_tickets: FeedbackTicketsTable;
|
|
948
|
+
push_subscriptions: PushSubscriptionsTable;
|
|
949
|
+
push_prefs: PushPrefsTable;
|
|
950
|
+
push_sent: PushSentTable;
|
|
940
951
|
}
|
|
941
952
|
interface ServiceHeartbeatsTable {
|
|
942
953
|
name: string;
|
|
@@ -1029,6 +1040,36 @@ interface WebhookIncidentAlertsTable {
|
|
|
1029
1040
|
email_attempts: Generated<number>;
|
|
1030
1041
|
resolved_at: Date | null;
|
|
1031
1042
|
}
|
|
1043
|
+
/** One browser/device push subscription; the endpoint is unique. */
|
|
1044
|
+
interface PushSubscriptionsTable {
|
|
1045
|
+
id: Generated<string>;
|
|
1046
|
+
account_id: string;
|
|
1047
|
+
endpoint: string;
|
|
1048
|
+
p256dh: string;
|
|
1049
|
+
auth: string;
|
|
1050
|
+
user_agent: string | null;
|
|
1051
|
+
created_at: Generated<Date>;
|
|
1052
|
+
last_success_at: Date | null;
|
|
1053
|
+
failed_count: Generated<number>;
|
|
1054
|
+
}
|
|
1055
|
+
/** Per-account push toggles. A missing row means the column defaults. */
|
|
1056
|
+
interface PushPrefsTable {
|
|
1057
|
+
account_id: string;
|
|
1058
|
+
webhook_failing: Generated<boolean>;
|
|
1059
|
+
subgraph_stopped: Generated<boolean>;
|
|
1060
|
+
subgraph_not_serving: Generated<boolean>;
|
|
1061
|
+
replay_done: Generated<boolean>;
|
|
1062
|
+
spend_cap: Generated<boolean>;
|
|
1063
|
+
key_repeat: Generated<boolean>;
|
|
1064
|
+
updated_at: Generated<Date>;
|
|
1065
|
+
}
|
|
1066
|
+
/** A push already sent, keyed by what it was about; debounces repeat signals. */
|
|
1067
|
+
interface PushSentTable {
|
|
1068
|
+
account_id: string;
|
|
1069
|
+
key: string;
|
|
1070
|
+
kind: string;
|
|
1071
|
+
sent_at: Generated<Date>;
|
|
1072
|
+
}
|
|
1032
1073
|
type CliDeviceLoginStatus = "pending" | "approved" | "denied" | "consumed";
|
|
1033
1074
|
/** The product that started a CLI sign-in; null is `sl login`. */
|
|
1034
1075
|
type CliDeviceProduct = "sentinel";
|
|
@@ -1049,6 +1090,72 @@ interface CliDeviceLoginsTable {
|
|
|
1049
1090
|
approved_at: Date | null;
|
|
1050
1091
|
consumed_at: Date | null;
|
|
1051
1092
|
}
|
|
1093
|
+
/** An app that registered itself (RFC 7591). Public clients only: no secret. */
|
|
1094
|
+
interface OauthClientsTable {
|
|
1095
|
+
id: string;
|
|
1096
|
+
/** The app's own claim, validated at registration; shown quoted. */
|
|
1097
|
+
name: string;
|
|
1098
|
+
redirect_uris: string[];
|
|
1099
|
+
created_ip: string | null;
|
|
1100
|
+
created_at: Generated<Date>;
|
|
1101
|
+
/** Set when it first gets tokens; never-used clients are purged. */
|
|
1102
|
+
last_used_at: Date | null;
|
|
1103
|
+
}
|
|
1104
|
+
type OauthRequestStatus = "pending" | "approved" | "denied";
|
|
1105
|
+
/** One authorize request waiting for (or answered on) the consent page. */
|
|
1106
|
+
interface OauthRequestsTable {
|
|
1107
|
+
id: string;
|
|
1108
|
+
client_id: string;
|
|
1109
|
+
redirect_uri: string;
|
|
1110
|
+
state: string | null;
|
|
1111
|
+
code_challenge: string;
|
|
1112
|
+
resource: string;
|
|
1113
|
+
status: Generated<OauthRequestStatus>;
|
|
1114
|
+
account_id: string | null;
|
|
1115
|
+
created_at: Generated<Date>;
|
|
1116
|
+
expires_at: Date;
|
|
1117
|
+
answered_at: Date | null;
|
|
1118
|
+
}
|
|
1119
|
+
/** A one-time authorization code, bound to its client, redirect, PKCE
|
|
1120
|
+
* challenge, resource and account. */
|
|
1121
|
+
interface OauthCodesTable {
|
|
1122
|
+
code_hash: string;
|
|
1123
|
+
client_id: string;
|
|
1124
|
+
account_id: string;
|
|
1125
|
+
redirect_uri: string;
|
|
1126
|
+
code_challenge: string;
|
|
1127
|
+
resource: string;
|
|
1128
|
+
/** The grant its one use made, so a replay can revoke it. */
|
|
1129
|
+
grant_id: string | null;
|
|
1130
|
+
created_at: Generated<Date>;
|
|
1131
|
+
expires_at: Date;
|
|
1132
|
+
used_at: Date | null;
|
|
1133
|
+
}
|
|
1134
|
+
/** What a person allowed one app to do: use the hosted MCP as them. */
|
|
1135
|
+
interface OauthGrantsTable {
|
|
1136
|
+
id: Generated<string>;
|
|
1137
|
+
account_id: string;
|
|
1138
|
+
client_id: string;
|
|
1139
|
+
scope: Generated<string>;
|
|
1140
|
+
resource: string;
|
|
1141
|
+
created_at: Generated<Date>;
|
|
1142
|
+
last_used_at: Date | null;
|
|
1143
|
+
revoked_at: Date | null;
|
|
1144
|
+
}
|
|
1145
|
+
type OauthTokenKind = "access" | "refresh";
|
|
1146
|
+
interface OauthTokensTable {
|
|
1147
|
+
token_hash: string;
|
|
1148
|
+
grant_id: string;
|
|
1149
|
+
kind: OauthTokenKind;
|
|
1150
|
+
created_at: Generated<Date>;
|
|
1151
|
+
expires_at: Date;
|
|
1152
|
+
}
|
|
1153
|
+
/** A refresh token a rotation replaced: presented again, it revokes the grant. */
|
|
1154
|
+
interface OauthRefreshRetiredTable {
|
|
1155
|
+
token_hash: string;
|
|
1156
|
+
grant_id: string;
|
|
1157
|
+
retired_at: Generated<Date>;
|
|
1158
|
+
}
|
|
1052
1159
|
/** Accounts Sentinel's service key may touch: created by Sentinel, or the
|
|
1053
1160
|
* owner opted in. */
|
|
1054
1161
|
interface SentinelAccountsTable {
|
|
@@ -1107,6 +1214,8 @@ interface WebhookOutboxTable {
|
|
|
1107
1214
|
next_attempt_at: Generated<Date>;
|
|
1108
1215
|
status: ColumnType<OutboxStatus, OutboxStatus | undefined, OutboxStatus>;
|
|
1109
1216
|
is_replay: Generated<boolean>;
|
|
1217
|
+
/** The replay that created this row; null for live rows. */
|
|
1218
|
+
replay_id: string | null;
|
|
1110
1219
|
/** The chain block_time of the matched event/tx. Null for rows written
|
|
1111
1220
|
* before this column existed, and for the settlement scan path (not yet
|
|
1112
1221
|
* wired). Lets `delivered_at - block_time` measure end-to-end webhook
|
|
@@ -1122,6 +1231,22 @@ interface WebhookOutboxTable {
|
|
|
1122
1231
|
last_error: string | null;
|
|
1123
1232
|
created_at: Generated<Date>;
|
|
1124
1233
|
}
|
|
1234
|
+
type WebhookReplayStatus = "scanning" | "running" | "done" | "failed";
|
|
1235
|
+
interface WebhookReplaysTable {
|
|
1236
|
+
id: string;
|
|
1237
|
+
webhook_id: string;
|
|
1238
|
+
from_block: number | bigint;
|
|
1239
|
+
to_block: number | bigint;
|
|
1240
|
+
status: WebhookReplayStatus;
|
|
1241
|
+
scanned_count: Generated<number>;
|
|
1242
|
+
enqueued_count: Generated<number>;
|
|
1243
|
+
total: number | null;
|
|
1244
|
+
delivered: number | null;
|
|
1245
|
+
gave_up: number | null;
|
|
1246
|
+
error: string | null;
|
|
1247
|
+
started_at: Generated<Date>;
|
|
1248
|
+
finished_at: Date | null;
|
|
1249
|
+
}
|
|
1125
1250
|
interface WebhookDeliveriesTable {
|
|
1126
1251
|
id: Generated<string>;
|
|
1127
1252
|
/** Nullable after migration 0077 — outbox row may be cleaned up while
|
|
@@ -412,6 +412,7 @@ interface InsightsTable {
|
|
|
412
412
|
clear_streak: Generated<number>;
|
|
413
413
|
resolved_at: Date | null;
|
|
414
414
|
dismissed_at: Date | null;
|
|
415
|
+
snoozed_until: Date | null;
|
|
415
416
|
}
|
|
416
417
|
/** "Expected": mutes one rule for one resource until removed. */
|
|
417
418
|
interface InsightMutesTable {
|
|
@@ -905,6 +906,7 @@ interface Database {
|
|
|
905
906
|
webhooks: WebhooksTable;
|
|
906
907
|
webhook_outbox: WebhookOutboxTable;
|
|
907
908
|
webhook_deliveries: WebhookDeliveriesTable;
|
|
909
|
+
webhook_replays: WebhookReplaysTable;
|
|
908
910
|
trigger_evaluator_state: TriggerEvaluatorStateTable;
|
|
909
911
|
decoded_events: DecodedEventsTable;
|
|
910
912
|
decoder_checkpoints: DecoderCheckpointsTable;
|
|
@@ -938,6 +940,12 @@ interface Database {
|
|
|
938
940
|
account_balance_alerts: AccountBalanceAlertsTable;
|
|
939
941
|
webhook_incident_alerts: WebhookIncidentAlertsTable;
|
|
940
942
|
cli_device_logins: CliDeviceLoginsTable;
|
|
943
|
+
oauth_clients: OauthClientsTable;
|
|
944
|
+
oauth_requests: OauthRequestsTable;
|
|
945
|
+
oauth_codes: OauthCodesTable;
|
|
946
|
+
oauth_grants: OauthGrantsTable;
|
|
947
|
+
oauth_tokens: OauthTokensTable;
|
|
948
|
+
oauth_refresh_retired: OauthRefreshRetiredTable;
|
|
941
949
|
sentinel_accounts: SentinelAccountsTable;
|
|
942
950
|
waitlists: WaitlistsTable;
|
|
943
951
|
waitlist_signups: WaitlistSignupsTable;
|
|
@@ -947,6 +955,9 @@ interface Database {
|
|
|
947
955
|
insights: InsightsTable;
|
|
948
956
|
insight_mutes: InsightMutesTable;
|
|
949
957
|
feedback_tickets: FeedbackTicketsTable;
|
|
958
|
+
push_subscriptions: PushSubscriptionsTable;
|
|
959
|
+
push_prefs: PushPrefsTable;
|
|
960
|
+
push_sent: PushSentTable;
|
|
950
961
|
}
|
|
951
962
|
interface ServiceHeartbeatsTable {
|
|
952
963
|
name: string;
|
|
@@ -1039,6 +1050,36 @@ interface WebhookIncidentAlertsTable {
|
|
|
1039
1050
|
email_attempts: Generated<number>;
|
|
1040
1051
|
resolved_at: Date | null;
|
|
1041
1052
|
}
|
|
1053
|
+
/** One browser/device push subscription; the endpoint is unique. */
|
|
1054
|
+
interface PushSubscriptionsTable {
|
|
1055
|
+
id: Generated<string>;
|
|
1056
|
+
account_id: string;
|
|
1057
|
+
endpoint: string;
|
|
1058
|
+
p256dh: string;
|
|
1059
|
+
auth: string;
|
|
1060
|
+
user_agent: string | null;
|
|
1061
|
+
created_at: Generated<Date>;
|
|
1062
|
+
last_success_at: Date | null;
|
|
1063
|
+
failed_count: Generated<number>;
|
|
1064
|
+
}
|
|
1065
|
+
/** Per-account push toggles. A missing row means the column defaults. */
|
|
1066
|
+
interface PushPrefsTable {
|
|
1067
|
+
account_id: string;
|
|
1068
|
+
webhook_failing: Generated<boolean>;
|
|
1069
|
+
subgraph_stopped: Generated<boolean>;
|
|
1070
|
+
subgraph_not_serving: Generated<boolean>;
|
|
1071
|
+
replay_done: Generated<boolean>;
|
|
1072
|
+
spend_cap: Generated<boolean>;
|
|
1073
|
+
key_repeat: Generated<boolean>;
|
|
1074
|
+
updated_at: Generated<Date>;
|
|
1075
|
+
}
|
|
1076
|
+
/** A push already sent, keyed by what it was about; debounces repeat signals. */
|
|
1077
|
+
interface PushSentTable {
|
|
1078
|
+
account_id: string;
|
|
1079
|
+
key: string;
|
|
1080
|
+
kind: string;
|
|
1081
|
+
sent_at: Generated<Date>;
|
|
1082
|
+
}
|
|
1042
1083
|
type CliDeviceLoginStatus = "pending" | "approved" | "denied" | "consumed";
|
|
1043
1084
|
/** The product that started a CLI sign-in; null is `sl login`. */
|
|
1044
1085
|
type CliDeviceProduct = "sentinel";
|
|
@@ -1059,6 +1100,72 @@ interface CliDeviceLoginsTable {
|
|
|
1059
1100
|
approved_at: Date | null;
|
|
1060
1101
|
consumed_at: Date | null;
|
|
1061
1102
|
}
|
|
1103
|
+
/** An app that registered itself (RFC 7591). Public clients only: no secret. */
|
|
1104
|
+
interface OauthClientsTable {
|
|
1105
|
+
id: string;
|
|
1106
|
+
/** The app's own claim, validated at registration; shown quoted. */
|
|
1107
|
+
name: string;
|
|
1108
|
+
redirect_uris: string[];
|
|
1109
|
+
created_ip: string | null;
|
|
1110
|
+
created_at: Generated<Date>;
|
|
1111
|
+
/** Set when it first gets tokens; never-used clients are purged. */
|
|
1112
|
+
last_used_at: Date | null;
|
|
1113
|
+
}
|
|
1114
|
+
type OauthRequestStatus = "pending" | "approved" | "denied";
|
|
1115
|
+
/** One authorize request waiting for (or answered on) the consent page. */
|
|
1116
|
+
interface OauthRequestsTable {
|
|
1117
|
+
id: string;
|
|
1118
|
+
client_id: string;
|
|
1119
|
+
redirect_uri: string;
|
|
1120
|
+
state: string | null;
|
|
1121
|
+
code_challenge: string;
|
|
1122
|
+
resource: string;
|
|
1123
|
+
status: Generated<OauthRequestStatus>;
|
|
1124
|
+
account_id: string | null;
|
|
1125
|
+
created_at: Generated<Date>;
|
|
1126
|
+
expires_at: Date;
|
|
1127
|
+
answered_at: Date | null;
|
|
1128
|
+
}
|
|
1129
|
+
/** A one-time authorization code, bound to its client, redirect, PKCE
|
|
1130
|
+
* challenge, resource and account. */
|
|
1131
|
+
interface OauthCodesTable {
|
|
1132
|
+
code_hash: string;
|
|
1133
|
+
client_id: string;
|
|
1134
|
+
account_id: string;
|
|
1135
|
+
redirect_uri: string;
|
|
1136
|
+
code_challenge: string;
|
|
1137
|
+
resource: string;
|
|
1138
|
+
/** The grant its one use made, so a replay can revoke it. */
|
|
1139
|
+
grant_id: string | null;
|
|
1140
|
+
created_at: Generated<Date>;
|
|
1141
|
+
expires_at: Date;
|
|
1142
|
+
used_at: Date | null;
|
|
1143
|
+
}
|
|
1144
|
+
/** What a person allowed one app to do: use the hosted MCP as them. */
|
|
1145
|
+
interface OauthGrantsTable {
|
|
1146
|
+
id: Generated<string>;
|
|
1147
|
+
account_id: string;
|
|
1148
|
+
client_id: string;
|
|
1149
|
+
scope: Generated<string>;
|
|
1150
|
+
resource: string;
|
|
1151
|
+
created_at: Generated<Date>;
|
|
1152
|
+
last_used_at: Date | null;
|
|
1153
|
+
revoked_at: Date | null;
|
|
1154
|
+
}
|
|
1155
|
+
type OauthTokenKind = "access" | "refresh";
|
|
1156
|
+
interface OauthTokensTable {
|
|
1157
|
+
token_hash: string;
|
|
1158
|
+
grant_id: string;
|
|
1159
|
+
kind: OauthTokenKind;
|
|
1160
|
+
created_at: Generated<Date>;
|
|
1161
|
+
expires_at: Date;
|
|
1162
|
+
}
|
|
1163
|
+
/** A refresh token a rotation replaced: presented again, it revokes the grant. */
|
|
1164
|
+
interface OauthRefreshRetiredTable {
|
|
1165
|
+
token_hash: string;
|
|
1166
|
+
grant_id: string;
|
|
1167
|
+
retired_at: Generated<Date>;
|
|
1168
|
+
}
|
|
1062
1169
|
/** Accounts Sentinel's service key may touch: created by Sentinel, or the
|
|
1063
1170
|
* owner opted in. */
|
|
1064
1171
|
interface SentinelAccountsTable {
|
|
@@ -1116,6 +1223,8 @@ interface WebhookOutboxTable {
|
|
|
1116
1223
|
next_attempt_at: Generated<Date>;
|
|
1117
1224
|
status: ColumnType<OutboxStatus, OutboxStatus | undefined, OutboxStatus>;
|
|
1118
1225
|
is_replay: Generated<boolean>;
|
|
1226
|
+
/** The replay that created this row; null for live rows. */
|
|
1227
|
+
replay_id: string | null;
|
|
1119
1228
|
/** The chain block_time of the matched event/tx. Null for rows written
|
|
1120
1229
|
* before this column existed, and for the settlement scan path (not yet
|
|
1121
1230
|
* wired). Lets `delivered_at - block_time` measure end-to-end webhook
|
|
@@ -1131,6 +1240,22 @@ interface WebhookOutboxTable {
|
|
|
1131
1240
|
last_error: string | null;
|
|
1132
1241
|
created_at: Generated<Date>;
|
|
1133
1242
|
}
|
|
1243
|
+
type WebhookReplayStatus = "scanning" | "running" | "done" | "failed";
|
|
1244
|
+
interface WebhookReplaysTable {
|
|
1245
|
+
id: string;
|
|
1246
|
+
webhook_id: string;
|
|
1247
|
+
from_block: number | bigint;
|
|
1248
|
+
to_block: number | bigint;
|
|
1249
|
+
status: WebhookReplayStatus;
|
|
1250
|
+
scanned_count: Generated<number>;
|
|
1251
|
+
enqueued_count: Generated<number>;
|
|
1252
|
+
total: number | null;
|
|
1253
|
+
delivered: number | null;
|
|
1254
|
+
gave_up: number | null;
|
|
1255
|
+
error: string | null;
|
|
1256
|
+
started_at: Generated<Date>;
|
|
1257
|
+
finished_at: Date | null;
|
|
1258
|
+
}
|
|
1134
1259
|
interface WebhookDeliveriesTable {
|
|
1135
1260
|
id: Generated<string>;
|
|
1136
1261
|
/** Nullable after migration 0077 — outbox row may be cleaned up while
|