@coffre/db 0.11.0 → 0.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.
@@ -113,6 +113,13 @@
113
113
  "when": 1792803757926,
114
114
  "tag": "0015_workload_access",
115
115
  "breakpoints": true
116
+ },
117
+ {
118
+ "idx": 16,
119
+ "version": "6",
120
+ "when": 1792835446455,
121
+ "tag": "0016_capped_alerts",
122
+ "breakpoints": true
116
123
  }
117
124
  ]
118
125
  }
@@ -558,6 +558,16 @@ export const consumedTokens = sqliteTable(
558
558
  (table) => [check('consumed_tokens_hash_check', sql`octet_length(${table.hash}) = 32`)],
559
559
  );
560
560
 
561
+ export const cappedAlerts = sqliteTable(
562
+ 'capped_alerts',
563
+ {
564
+ service: text().notNull(),
565
+ kind: text().notNull(),
566
+ raisedAt: time('raised_at').notNull(),
567
+ },
568
+ (table) => [primaryKey({ name: 'capped_alerts_pkey', columns: [table.service, table.kind] })],
569
+ );
570
+
561
571
  /**
562
572
  * MCP clients that registered themselves (RFC 7591), the fallback to Client
563
573
  * ID Metadata Documents, which need no row. The ID is the client's
package/src/schema.ts CHANGED
@@ -613,6 +613,24 @@ export const consumedTokens = pgTable(
613
613
  (table) => [check('consumed_tokens_hash_check', sql`octet_length(${table.hash}) = 32`)],
614
614
  );
615
615
 
616
+ /**
617
+ * When a service's capped alert was last raised, by kind: the refusal of a
618
+ * token signed by a key its uploaded keys lack (`unknown_key`) alerts once
619
+ * an hour, however many isolates see it. One conditional write per refusal
620
+ * decides (`claimAlert`), so that the many it caps never reach the log's
621
+ * head. Only a request that a binding of the service on the token's issuer
622
+ * gets as far as its keys writes here: a row per service, at most, per kind.
623
+ */
624
+ export const cappedAlerts = pgTable(
625
+ 'capped_alerts',
626
+ {
627
+ service: text().notNull(),
628
+ kind: text().notNull(),
629
+ raisedAt: timestamp('raised_at', { withTimezone: true }).notNull(),
630
+ },
631
+ (table) => [primaryKey({ name: 'capped_alerts_pkey', columns: [table.service, table.kind] })],
632
+ );
633
+
616
634
  /**
617
635
  * MCP clients that registered themselves (RFC 7591), the fallback to Client
618
636
  * ID Metadata Documents, which need no row. The ID is the client's