@secondlayer/shared 11.16.1 → 11.18.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.
@@ -223,6 +223,10 @@ type RuneStreamsEvent = {
223
223
  event_type: RuneEventType
224
224
  rune_id: string
225
225
  payload: RuneEventPayload
226
+ /** The event's block time, ISO 8601. Absent when the indexer has no header
227
+ * time for that block yet (rows written before block times were recorded,
228
+ * until backfilled). */
229
+ ts?: string
226
230
  /** True when this event's block is past the finality boundary (immutable).
227
231
  * Optional for back-compat with the same reasoning as `StreamsEventBase`. */
228
232
  finalized?: boolean
@@ -0,0 +1,27 @@
1
+ import { type Kysely, sql } from "kysely";
2
+ import { onControlPlane } from "../src/db/migration-role.ts";
3
+
4
+ /**
5
+ * Which accounts Sentinel's service key may touch. A row exists only for an
6
+ * account Sentinel created (`via = 'created'`) or one whose owner opted in
7
+ * from Sentinel's UI (`via = 'consent'`). Every `/internal/sentinel/*` call
8
+ * (and Sentinel-key `/internal/meters` items) beyond resolve/link requires a
9
+ * row, so a leaked key can't spend from or credit an arbitrary account.
10
+ */
11
+ export async function up(db: Kysely<unknown>): Promise<void> {
12
+ await onControlPlane(async () => {
13
+ await sql`
14
+ CREATE TABLE sentinel_accounts (
15
+ account_id uuid PRIMARY KEY REFERENCES accounts(id) ON DELETE CASCADE,
16
+ linked_at timestamptz NOT NULL DEFAULT now(),
17
+ via text NOT NULL CHECK (via IN ('created', 'consent'))
18
+ )
19
+ `.execute(db);
20
+ });
21
+ }
22
+
23
+ export async function down(db: Kysely<unknown>): Promise<void> {
24
+ await onControlPlane(async () => {
25
+ await sql`DROP TABLE IF EXISTS sentinel_accounts`.execute(db);
26
+ });
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "11.16.1",
3
+ "version": "11.18.0",
4
4
  "description": "Internal building blocks shared across Secondlayer packages.",
5
5
  "license": "MIT",
6
6
  "repository": {