@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 {
|
|
@@ -1106,6 +1213,8 @@ interface WebhookOutboxTable {
|
|
|
1106
1213
|
next_attempt_at: Generated<Date>;
|
|
1107
1214
|
status: ColumnType<OutboxStatus, OutboxStatus | undefined, OutboxStatus>;
|
|
1108
1215
|
is_replay: Generated<boolean>;
|
|
1216
|
+
/** The replay that created this row; null for live rows. */
|
|
1217
|
+
replay_id: string | null;
|
|
1109
1218
|
/** The chain block_time of the matched event/tx. Null for rows written
|
|
1110
1219
|
* before this column existed, and for the settlement scan path (not yet
|
|
1111
1220
|
* wired). Lets `delivered_at - block_time` measure end-to-end webhook
|
|
@@ -1121,6 +1230,22 @@ interface WebhookOutboxTable {
|
|
|
1121
1230
|
last_error: string | null;
|
|
1122
1231
|
created_at: Generated<Date>;
|
|
1123
1232
|
}
|
|
1233
|
+
type WebhookReplayStatus = "scanning" | "running" | "done" | "failed";
|
|
1234
|
+
interface WebhookReplaysTable {
|
|
1235
|
+
id: string;
|
|
1236
|
+
webhook_id: string;
|
|
1237
|
+
from_block: number | bigint;
|
|
1238
|
+
to_block: number | bigint;
|
|
1239
|
+
status: WebhookReplayStatus;
|
|
1240
|
+
scanned_count: Generated<number>;
|
|
1241
|
+
enqueued_count: Generated<number>;
|
|
1242
|
+
total: number | null;
|
|
1243
|
+
delivered: number | null;
|
|
1244
|
+
gave_up: number | null;
|
|
1245
|
+
error: string | null;
|
|
1246
|
+
started_at: Generated<Date>;
|
|
1247
|
+
finished_at: Date | null;
|
|
1248
|
+
}
|
|
1124
1249
|
interface WebhookDeliveriesTable {
|
|
1125
1250
|
id: Generated<string>;
|
|
1126
1251
|
/** Nullable after migration 0077 — outbox row may be cleaned up while
|
|
@@ -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 {
|
|
@@ -1106,6 +1213,8 @@ interface WebhookOutboxTable {
|
|
|
1106
1213
|
next_attempt_at: Generated<Date>;
|
|
1107
1214
|
status: ColumnType<OutboxStatus, OutboxStatus | undefined, OutboxStatus>;
|
|
1108
1215
|
is_replay: Generated<boolean>;
|
|
1216
|
+
/** The replay that created this row; null for live rows. */
|
|
1217
|
+
replay_id: string | null;
|
|
1109
1218
|
/** The chain block_time of the matched event/tx. Null for rows written
|
|
1110
1219
|
* before this column existed, and for the settlement scan path (not yet
|
|
1111
1220
|
* wired). Lets `delivered_at - block_time` measure end-to-end webhook
|
|
@@ -1121,6 +1230,22 @@ interface WebhookOutboxTable {
|
|
|
1121
1230
|
last_error: string | null;
|
|
1122
1231
|
created_at: Generated<Date>;
|
|
1123
1232
|
}
|
|
1233
|
+
type WebhookReplayStatus = "scanning" | "running" | "done" | "failed";
|
|
1234
|
+
interface WebhookReplaysTable {
|
|
1235
|
+
id: string;
|
|
1236
|
+
webhook_id: string;
|
|
1237
|
+
from_block: number | bigint;
|
|
1238
|
+
to_block: number | bigint;
|
|
1239
|
+
status: WebhookReplayStatus;
|
|
1240
|
+
scanned_count: Generated<number>;
|
|
1241
|
+
enqueued_count: Generated<number>;
|
|
1242
|
+
total: number | null;
|
|
1243
|
+
delivered: number | null;
|
|
1244
|
+
gave_up: number | null;
|
|
1245
|
+
error: string | null;
|
|
1246
|
+
started_at: Generated<Date>;
|
|
1247
|
+
finished_at: Date | null;
|
|
1248
|
+
}
|
|
1124
1249
|
interface WebhookDeliveriesTable {
|
|
1125
1250
|
id: Generated<string>;
|
|
1126
1251
|
/** Nullable after migration 0077 — outbox row may be cleaned up while
|
|
@@ -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
|