@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.
- package/dist/connect.d.ts +1 -1
- package/dist/{database-Dh4W2pAj.d.ts → database-Ds1Y79h6.d.ts} +1 -1
- package/dist/dialect.d.ts +1 -1
- package/dist/grants.d.ts +1 -1
- package/dist/hyperdrive.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/log.d.ts +1 -1
- package/dist/migrations/postgres/0017_capped_alerts.sql +10 -0
- package/dist/migrations/postgres/meta/0017_snapshot.json +3295 -0
- package/dist/migrations/postgres/meta/_journal.json +7 -0
- package/dist/migrations/sqlite/0016_capped_alerts.sql +7 -0
- package/dist/migrations/sqlite/meta/0016_snapshot.json +2998 -0
- package/dist/migrations/sqlite/meta/_journal.json +7 -0
- package/dist/portable.d.ts +2 -2
- package/dist/{schema-DG2t57Kf.d.ts → schema-DcVkJhCf.d.ts} +68 -2
- package/dist/schema-sqlite.d.ts +63 -1
- package/dist/schema-sqlite.js +9 -1
- package/dist/schema-version.d.ts +1 -1
- package/dist/schema-version.js +14 -0
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +18 -1
- package/package.json +2 -2
- package/src/migrations/postgres/0017_capped_alerts.sql +10 -0
- package/src/migrations/postgres/meta/0017_snapshot.json +3295 -0
- package/src/migrations/postgres/meta/_journal.json +7 -0
- package/src/migrations/sqlite/0016_capped_alerts.sql +7 -0
- package/src/migrations/sqlite/meta/0016_snapshot.json +2998 -0
- package/src/migrations/sqlite/meta/_journal.json +7 -0
- package/src/schema.sqlite.ts +10 -0
- package/src/schema.ts +18 -0
package/src/schema.sqlite.ts
CHANGED
|
@@ -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
|