@secondlayer/shared 13.10.0 → 13.12.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.
@@ -938,6 +938,12 @@ interface Database {
938
938
  account_balance_alerts: AccountBalanceAlertsTable;
939
939
  webhook_incident_alerts: WebhookIncidentAlertsTable;
940
940
  cli_device_logins: CliDeviceLoginsTable;
941
+ oauth_clients: OauthClientsTable;
942
+ oauth_requests: OauthRequestsTable;
943
+ oauth_codes: OauthCodesTable;
944
+ oauth_grants: OauthGrantsTable;
945
+ oauth_tokens: OauthTokensTable;
946
+ oauth_refresh_retired: OauthRefreshRetiredTable;
941
947
  sentinel_accounts: SentinelAccountsTable;
942
948
  waitlists: WaitlistsTable;
943
949
  waitlist_signups: WaitlistSignupsTable;
@@ -1040,13 +1046,17 @@ interface WebhookIncidentAlertsTable {
1040
1046
  resolved_at: Date | null;
1041
1047
  }
1042
1048
  type CliDeviceLoginStatus = "pending" | "approved" | "denied" | "consumed";
1043
- /** One browser sign-in attempt from `sl login`. Only the hash of the CLI's
1044
- * device code is stored; the key is minted when the CLI polls after approval. */
1049
+ /** The product that started a CLI sign-in; null is `sl login`. */
1050
+ type CliDeviceProduct = "sentinel";
1051
+ /** One browser sign-in attempt from `sl login` (or `sentinel login`). Only the
1052
+ * hash of the CLI's device code is stored; the session is opened when the CLI
1053
+ * polls after approval. */
1045
1054
  interface CliDeviceLoginsTable {
1046
1055
  id: Generated<string>;
1047
1056
  device_code_hash: string;
1048
1057
  user_code: string;
1049
1058
  client_name: string;
1059
+ product: CliDeviceProduct | null;
1050
1060
  status: Generated<CliDeviceLoginStatus>;
1051
1061
  account_id: string | null;
1052
1062
  key_name: string | null;
@@ -1055,6 +1065,72 @@ interface CliDeviceLoginsTable {
1055
1065
  approved_at: Date | null;
1056
1066
  consumed_at: Date | null;
1057
1067
  }
1068
+ /** An app that registered itself (RFC 7591). Public clients only: no secret. */
1069
+ interface OauthClientsTable {
1070
+ id: string;
1071
+ /** The app's own claim, validated at registration; shown quoted. */
1072
+ name: string;
1073
+ redirect_uris: string[];
1074
+ created_ip: string | null;
1075
+ created_at: Generated<Date>;
1076
+ /** Set when it first gets tokens; never-used clients are purged. */
1077
+ last_used_at: Date | null;
1078
+ }
1079
+ type OauthRequestStatus = "pending" | "approved" | "denied";
1080
+ /** One authorize request waiting for (or answered on) the consent page. */
1081
+ interface OauthRequestsTable {
1082
+ id: string;
1083
+ client_id: string;
1084
+ redirect_uri: string;
1085
+ state: string | null;
1086
+ code_challenge: string;
1087
+ resource: string;
1088
+ status: Generated<OauthRequestStatus>;
1089
+ account_id: string | null;
1090
+ created_at: Generated<Date>;
1091
+ expires_at: Date;
1092
+ answered_at: Date | null;
1093
+ }
1094
+ /** A one-time authorization code, bound to its client, redirect, PKCE
1095
+ * challenge, resource and account. */
1096
+ interface OauthCodesTable {
1097
+ code_hash: string;
1098
+ client_id: string;
1099
+ account_id: string;
1100
+ redirect_uri: string;
1101
+ code_challenge: string;
1102
+ resource: string;
1103
+ /** The grant its one use made, so a replay can revoke it. */
1104
+ grant_id: string | null;
1105
+ created_at: Generated<Date>;
1106
+ expires_at: Date;
1107
+ used_at: Date | null;
1108
+ }
1109
+ /** What a person allowed one app to do: use the hosted MCP as them. */
1110
+ interface OauthGrantsTable {
1111
+ id: Generated<string>;
1112
+ account_id: string;
1113
+ client_id: string;
1114
+ scope: Generated<string>;
1115
+ resource: string;
1116
+ created_at: Generated<Date>;
1117
+ last_used_at: Date | null;
1118
+ revoked_at: Date | null;
1119
+ }
1120
+ type OauthTokenKind = "access" | "refresh";
1121
+ interface OauthTokensTable {
1122
+ token_hash: string;
1123
+ grant_id: string;
1124
+ kind: OauthTokenKind;
1125
+ created_at: Generated<Date>;
1126
+ expires_at: Date;
1127
+ }
1128
+ /** A refresh token a rotation replaced: presented again, it revokes the grant. */
1129
+ interface OauthRefreshRetiredTable {
1130
+ token_hash: string;
1131
+ grant_id: string;
1132
+ retired_at: Generated<Date>;
1133
+ }
1058
1134
  /** Accounts Sentinel's service key may touch: created by Sentinel, or the
1059
1135
  * owner opted in. */
1060
1136
  interface SentinelAccountsTable {
@@ -928,6 +928,12 @@ interface Database {
928
928
  account_balance_alerts: AccountBalanceAlertsTable;
929
929
  webhook_incident_alerts: WebhookIncidentAlertsTable;
930
930
  cli_device_logins: CliDeviceLoginsTable;
931
+ oauth_clients: OauthClientsTable;
932
+ oauth_requests: OauthRequestsTable;
933
+ oauth_codes: OauthCodesTable;
934
+ oauth_grants: OauthGrantsTable;
935
+ oauth_tokens: OauthTokensTable;
936
+ oauth_refresh_retired: OauthRefreshRetiredTable;
931
937
  sentinel_accounts: SentinelAccountsTable;
932
938
  waitlists: WaitlistsTable;
933
939
  waitlist_signups: WaitlistSignupsTable;
@@ -1030,13 +1036,17 @@ interface WebhookIncidentAlertsTable {
1030
1036
  resolved_at: Date | null;
1031
1037
  }
1032
1038
  type CliDeviceLoginStatus = "pending" | "approved" | "denied" | "consumed";
1033
- /** One browser sign-in attempt from `sl login`. Only the hash of the CLI's
1034
- * device code is stored; the key is minted when the CLI polls after approval. */
1039
+ /** The product that started a CLI sign-in; null is `sl login`. */
1040
+ type CliDeviceProduct = "sentinel";
1041
+ /** One browser sign-in attempt from `sl login` (or `sentinel login`). Only the
1042
+ * hash of the CLI's device code is stored; the session is opened when the CLI
1043
+ * polls after approval. */
1035
1044
  interface CliDeviceLoginsTable {
1036
1045
  id: Generated<string>;
1037
1046
  device_code_hash: string;
1038
1047
  user_code: string;
1039
1048
  client_name: string;
1049
+ product: CliDeviceProduct | null;
1040
1050
  status: Generated<CliDeviceLoginStatus>;
1041
1051
  account_id: string | null;
1042
1052
  key_name: string | null;
@@ -1045,6 +1055,72 @@ interface CliDeviceLoginsTable {
1045
1055
  approved_at: Date | null;
1046
1056
  consumed_at: Date | null;
1047
1057
  }
1058
+ /** An app that registered itself (RFC 7591). Public clients only: no secret. */
1059
+ interface OauthClientsTable {
1060
+ id: string;
1061
+ /** The app's own claim, validated at registration; shown quoted. */
1062
+ name: string;
1063
+ redirect_uris: string[];
1064
+ created_ip: string | null;
1065
+ created_at: Generated<Date>;
1066
+ /** Set when it first gets tokens; never-used clients are purged. */
1067
+ last_used_at: Date | null;
1068
+ }
1069
+ type OauthRequestStatus = "pending" | "approved" | "denied";
1070
+ /** One authorize request waiting for (or answered on) the consent page. */
1071
+ interface OauthRequestsTable {
1072
+ id: string;
1073
+ client_id: string;
1074
+ redirect_uri: string;
1075
+ state: string | null;
1076
+ code_challenge: string;
1077
+ resource: string;
1078
+ status: Generated<OauthRequestStatus>;
1079
+ account_id: string | null;
1080
+ created_at: Generated<Date>;
1081
+ expires_at: Date;
1082
+ answered_at: Date | null;
1083
+ }
1084
+ /** A one-time authorization code, bound to its client, redirect, PKCE
1085
+ * challenge, resource and account. */
1086
+ interface OauthCodesTable {
1087
+ code_hash: string;
1088
+ client_id: string;
1089
+ account_id: string;
1090
+ redirect_uri: string;
1091
+ code_challenge: string;
1092
+ resource: string;
1093
+ /** The grant its one use made, so a replay can revoke it. */
1094
+ grant_id: string | null;
1095
+ created_at: Generated<Date>;
1096
+ expires_at: Date;
1097
+ used_at: Date | null;
1098
+ }
1099
+ /** What a person allowed one app to do: use the hosted MCP as them. */
1100
+ interface OauthGrantsTable {
1101
+ id: Generated<string>;
1102
+ account_id: string;
1103
+ client_id: string;
1104
+ scope: Generated<string>;
1105
+ resource: string;
1106
+ created_at: Generated<Date>;
1107
+ last_used_at: Date | null;
1108
+ revoked_at: Date | null;
1109
+ }
1110
+ type OauthTokenKind = "access" | "refresh";
1111
+ interface OauthTokensTable {
1112
+ token_hash: string;
1113
+ grant_id: string;
1114
+ kind: OauthTokenKind;
1115
+ created_at: Generated<Date>;
1116
+ expires_at: Date;
1117
+ }
1118
+ /** A refresh token a rotation replaced: presented again, it revokes the grant. */
1119
+ interface OauthRefreshRetiredTable {
1120
+ token_hash: string;
1121
+ grant_id: string;
1122
+ retired_at: Generated<Date>;
1123
+ }
1048
1124
  /** Accounts Sentinel's service key may touch: created by Sentinel, or the
1049
1125
  * owner opted in. */
1050
1126
  interface SentinelAccountsTable {
@@ -927,6 +927,12 @@ interface Database {
927
927
  account_balance_alerts: AccountBalanceAlertsTable;
928
928
  webhook_incident_alerts: WebhookIncidentAlertsTable;
929
929
  cli_device_logins: CliDeviceLoginsTable;
930
+ oauth_clients: OauthClientsTable;
931
+ oauth_requests: OauthRequestsTable;
932
+ oauth_codes: OauthCodesTable;
933
+ oauth_grants: OauthGrantsTable;
934
+ oauth_tokens: OauthTokensTable;
935
+ oauth_refresh_retired: OauthRefreshRetiredTable;
930
936
  sentinel_accounts: SentinelAccountsTable;
931
937
  waitlists: WaitlistsTable;
932
938
  waitlist_signups: WaitlistSignupsTable;
@@ -1042,13 +1048,17 @@ interface WebhookIncidentAlertsTable {
1042
1048
  }
1043
1049
  type WebhookIncidentAlert = Selectable<WebhookIncidentAlertsTable>;
1044
1050
  type CliDeviceLoginStatus = "pending" | "approved" | "denied" | "consumed";
1045
- /** One browser sign-in attempt from `sl login`. Only the hash of the CLI's
1046
- * device code is stored; the key is minted when the CLI polls after approval. */
1051
+ /** The product that started a CLI sign-in; null is `sl login`. */
1052
+ type CliDeviceProduct = "sentinel";
1053
+ /** One browser sign-in attempt from `sl login` (or `sentinel login`). Only the
1054
+ * hash of the CLI's device code is stored; the session is opened when the CLI
1055
+ * polls after approval. */
1047
1056
  interface CliDeviceLoginsTable {
1048
1057
  id: Generated<string>;
1049
1058
  device_code_hash: string;
1050
1059
  user_code: string;
1051
1060
  client_name: string;
1061
+ product: CliDeviceProduct | null;
1052
1062
  status: Generated<CliDeviceLoginStatus>;
1053
1063
  account_id: string | null;
1054
1064
  key_name: string | null;
@@ -1058,6 +1068,74 @@ interface CliDeviceLoginsTable {
1058
1068
  consumed_at: Date | null;
1059
1069
  }
1060
1070
  type CliDeviceLogin = Selectable<CliDeviceLoginsTable>;
1071
+ /** An app that registered itself (RFC 7591). Public clients only: no secret. */
1072
+ interface OauthClientsTable {
1073
+ id: string;
1074
+ /** The app's own claim, validated at registration; shown quoted. */
1075
+ name: string;
1076
+ redirect_uris: string[];
1077
+ created_ip: string | null;
1078
+ created_at: Generated<Date>;
1079
+ /** Set when it first gets tokens; never-used clients are purged. */
1080
+ last_used_at: Date | null;
1081
+ }
1082
+ type OauthRequestStatus = "pending" | "approved" | "denied";
1083
+ /** One authorize request waiting for (or answered on) the consent page. */
1084
+ interface OauthRequestsTable {
1085
+ id: string;
1086
+ client_id: string;
1087
+ redirect_uri: string;
1088
+ state: string | null;
1089
+ code_challenge: string;
1090
+ resource: string;
1091
+ status: Generated<OauthRequestStatus>;
1092
+ account_id: string | null;
1093
+ created_at: Generated<Date>;
1094
+ expires_at: Date;
1095
+ answered_at: Date | null;
1096
+ }
1097
+ /** A one-time authorization code, bound to its client, redirect, PKCE
1098
+ * challenge, resource and account. */
1099
+ interface OauthCodesTable {
1100
+ code_hash: string;
1101
+ client_id: string;
1102
+ account_id: string;
1103
+ redirect_uri: string;
1104
+ code_challenge: string;
1105
+ resource: string;
1106
+ /** The grant its one use made, so a replay can revoke it. */
1107
+ grant_id: string | null;
1108
+ created_at: Generated<Date>;
1109
+ expires_at: Date;
1110
+ used_at: Date | null;
1111
+ }
1112
+ /** What a person allowed one app to do: use the hosted MCP as them. */
1113
+ interface OauthGrantsTable {
1114
+ id: Generated<string>;
1115
+ account_id: string;
1116
+ client_id: string;
1117
+ scope: Generated<string>;
1118
+ resource: string;
1119
+ created_at: Generated<Date>;
1120
+ last_used_at: Date | null;
1121
+ revoked_at: Date | null;
1122
+ }
1123
+ type OauthTokenKind = "access" | "refresh";
1124
+ interface OauthTokensTable {
1125
+ token_hash: string;
1126
+ grant_id: string;
1127
+ kind: OauthTokenKind;
1128
+ created_at: Generated<Date>;
1129
+ expires_at: Date;
1130
+ }
1131
+ /** A refresh token a rotation replaced: presented again, it revokes the grant. */
1132
+ interface OauthRefreshRetiredTable {
1133
+ token_hash: string;
1134
+ grant_id: string;
1135
+ retired_at: Generated<Date>;
1136
+ }
1137
+ type OauthClient = Selectable<OauthClientsTable>;
1138
+ type OauthGrant = Selectable<OauthGrantsTable>;
1061
1139
  /** Accounts Sentinel's service key may touch: created by Sentinel, or the
1062
1140
  * owner opted in. */
1063
1141
  interface SentinelAccountsTable {
@@ -1322,4 +1400,4 @@ type WaitlistSignup = Selectable<WaitlistSignupsTable>;
1322
1400
  type InsertWaitlistSignup = Insertable<WaitlistSignupsTable>;
1323
1401
  type ContactRequest = Selectable<ContactRequestsTable>;
1324
1402
  type InsertContactRequest = Insertable<ContactRequestsTable>;
1325
- export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, ChainReadCacheTable, ChainReorgsTable, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, ContactRequest, ContactRequestsTable, Contract, ContractsTable, CoverageSegmentsTable, Database, DeadLetterEventsTable, DecodedEventsTable, DecoderCheckpointsTable, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, 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, InsightMutesTable, InsightsTable, InstancesTable, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, NativeClock, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RepairMode, RetryState, RunStatus, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, Subgraph, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UsageLedgerRow, UsageLedgerTable, VmEvent, VmEventsArchiveTable, VmEventsTable, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookFormat, WebhookIncidentAlert, WebhookIncidentAlertsTable, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhooksTable };
1403
+ export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, ChainReadCacheTable, ChainReorgsTable, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, CliDeviceProduct, ContactRequest, ContactRequestsTable, Contract, ContractsTable, CoverageSegmentsTable, Database, DeadLetterEventsTable, DecodedEventsTable, DecoderCheckpointsTable, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, 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, InsightMutesTable, InsightsTable, InstancesTable, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, NativeClock, OauthClient, OauthClientsTable, OauthCodesTable, OauthGrant, OauthGrantsTable, OauthRefreshRetiredTable, OauthRequestStatus, OauthRequestsTable, OauthTokenKind, OauthTokensTable, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RepairMode, RetryState, RunStatus, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, Subgraph, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UsageLedgerRow, UsageLedgerTable, VmEvent, VmEventsArchiveTable, VmEventsTable, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookFormat, WebhookIncidentAlert, WebhookIncidentAlertsTable, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookStatus, WebhooksTable };
@@ -1146,6 +1146,12 @@ interface Database {
1146
1146
  account_balance_alerts: AccountBalanceAlertsTable;
1147
1147
  webhook_incident_alerts: WebhookIncidentAlertsTable;
1148
1148
  cli_device_logins: CliDeviceLoginsTable;
1149
+ oauth_clients: OauthClientsTable;
1150
+ oauth_requests: OauthRequestsTable;
1151
+ oauth_codes: OauthCodesTable;
1152
+ oauth_grants: OauthGrantsTable;
1153
+ oauth_tokens: OauthTokensTable;
1154
+ oauth_refresh_retired: OauthRefreshRetiredTable;
1149
1155
  sentinel_accounts: SentinelAccountsTable;
1150
1156
  waitlists: WaitlistsTable;
1151
1157
  waitlist_signups: WaitlistSignupsTable;
@@ -1261,13 +1267,17 @@ interface WebhookIncidentAlertsTable {
1261
1267
  }
1262
1268
  type WebhookIncidentAlert = Selectable<WebhookIncidentAlertsTable>;
1263
1269
  type CliDeviceLoginStatus = "pending" | "approved" | "denied" | "consumed";
1264
- /** One browser sign-in attempt from `sl login`. Only the hash of the CLI's
1265
- * device code is stored; the key is minted when the CLI polls after approval. */
1270
+ /** The product that started a CLI sign-in; null is `sl login`. */
1271
+ type CliDeviceProduct = "sentinel";
1272
+ /** One browser sign-in attempt from `sl login` (or `sentinel login`). Only the
1273
+ * hash of the CLI's device code is stored; the session is opened when the CLI
1274
+ * polls after approval. */
1266
1275
  interface CliDeviceLoginsTable {
1267
1276
  id: Generated<string>;
1268
1277
  device_code_hash: string;
1269
1278
  user_code: string;
1270
1279
  client_name: string;
1280
+ product: CliDeviceProduct | null;
1271
1281
  status: Generated<CliDeviceLoginStatus>;
1272
1282
  account_id: string | null;
1273
1283
  key_name: string | null;
@@ -1277,6 +1287,74 @@ interface CliDeviceLoginsTable {
1277
1287
  consumed_at: Date | null;
1278
1288
  }
1279
1289
  type CliDeviceLogin = Selectable<CliDeviceLoginsTable>;
1290
+ /** An app that registered itself (RFC 7591). Public clients only: no secret. */
1291
+ interface OauthClientsTable {
1292
+ id: string;
1293
+ /** The app's own claim, validated at registration; shown quoted. */
1294
+ name: string;
1295
+ redirect_uris: string[];
1296
+ created_ip: string | null;
1297
+ created_at: Generated<Date>;
1298
+ /** Set when it first gets tokens; never-used clients are purged. */
1299
+ last_used_at: Date | null;
1300
+ }
1301
+ type OauthRequestStatus = "pending" | "approved" | "denied";
1302
+ /** One authorize request waiting for (or answered on) the consent page. */
1303
+ interface OauthRequestsTable {
1304
+ id: string;
1305
+ client_id: string;
1306
+ redirect_uri: string;
1307
+ state: string | null;
1308
+ code_challenge: string;
1309
+ resource: string;
1310
+ status: Generated<OauthRequestStatus>;
1311
+ account_id: string | null;
1312
+ created_at: Generated<Date>;
1313
+ expires_at: Date;
1314
+ answered_at: Date | null;
1315
+ }
1316
+ /** A one-time authorization code, bound to its client, redirect, PKCE
1317
+ * challenge, resource and account. */
1318
+ interface OauthCodesTable {
1319
+ code_hash: string;
1320
+ client_id: string;
1321
+ account_id: string;
1322
+ redirect_uri: string;
1323
+ code_challenge: string;
1324
+ resource: string;
1325
+ /** The grant its one use made, so a replay can revoke it. */
1326
+ grant_id: string | null;
1327
+ created_at: Generated<Date>;
1328
+ expires_at: Date;
1329
+ used_at: Date | null;
1330
+ }
1331
+ /** What a person allowed one app to do: use the hosted MCP as them. */
1332
+ interface OauthGrantsTable {
1333
+ id: Generated<string>;
1334
+ account_id: string;
1335
+ client_id: string;
1336
+ scope: Generated<string>;
1337
+ resource: string;
1338
+ created_at: Generated<Date>;
1339
+ last_used_at: Date | null;
1340
+ revoked_at: Date | null;
1341
+ }
1342
+ type OauthTokenKind = "access" | "refresh";
1343
+ interface OauthTokensTable {
1344
+ token_hash: string;
1345
+ grant_id: string;
1346
+ kind: OauthTokenKind;
1347
+ created_at: Generated<Date>;
1348
+ expires_at: Date;
1349
+ }
1350
+ /** A refresh token a rotation replaced: presented again, it revokes the grant. */
1351
+ interface OauthRefreshRetiredTable {
1352
+ token_hash: string;
1353
+ grant_id: string;
1354
+ retired_at: Generated<Date>;
1355
+ }
1356
+ type OauthClient = Selectable<OauthClientsTable>;
1357
+ type OauthGrant = Selectable<OauthGrantsTable>;
1280
1358
  /** Accounts Sentinel's service key may touch: created by Sentinel, or the
1281
1359
  * owner opted in. */
1282
1360
  interface SentinelAccountsTable {
@@ -2553,6 +2631,12 @@ declare const TABLE_TO_DB: {
2553
2631
  sessions: string
2554
2632
  magic_links: string
2555
2633
  cli_device_logins: string
2634
+ oauth_clients: string
2635
+ oauth_requests: string
2636
+ oauth_codes: string
2637
+ oauth_grants: string
2638
+ oauth_tokens: string
2639
+ oauth_refresh_retired: string
2556
2640
  account_spend_caps: string
2557
2641
  processed_stripe_events: string
2558
2642
  webhooks: string
@@ -3678,4 +3762,4 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
3678
3762
  declare function ed25519KeyId(publicKeyPem: string): string;
3679
3763
  declare function signEd25519(payload: string, privateKey: KeyObject): string;
3680
3764
  declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
3681
- export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeyRevokedError, 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, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, 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, WebhookIncidentAlert, WebhookIncidentAlertsTable, 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 };
3765
+ export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeyRevokedError, 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, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, CliDeviceProduct, 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, OauthClient, OauthClientsTable, OauthCodesTable, OauthGrant, OauthGrantsTable, OauthRefreshRetiredTable, OauthRequestStatus, OauthRequestsTable, OauthTokenKind, OauthTokensTable, 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, WebhookIncidentAlert, WebhookIncidentAlertsTable, 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
@@ -844,6 +844,12 @@ var TABLE_TO_DB = {
844
844
  sessions: "target",
845
845
  magic_links: "target",
846
846
  cli_device_logins: "target",
847
+ oauth_clients: "target",
848
+ oauth_requests: "target",
849
+ oauth_codes: "target",
850
+ oauth_grants: "target",
851
+ oauth_tokens: "target",
852
+ oauth_refresh_retired: "target",
847
853
  account_spend_caps: "target",
848
854
  processed_stripe_events: "target",
849
855
  webhooks: "target",
@@ -2402,5 +2408,5 @@ export {
2402
2408
  sql2 as sql
2403
2409
  };
2404
2410
 
2405
- //# debugId=8DA4E9043B36B14364756E2164756E21
2411
+ //# debugId=D706D905F1A1003364756E2164756E21
2406
2412
  //# sourceMappingURL=index.js.map