@secondlayer/shared 11.18.0 → 11.19.1

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.
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -477,7 +477,6 @@ interface SubgraphsTable {
477
477
  expires_at: Date | null;
478
478
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
479
479
  sparse_probe_targets: unknown | null;
480
- sandbox_workers: Generated<boolean>;
481
480
  created_at: Generated<Date>;
482
481
  updated_at: Generated<Date>;
483
482
  }
@@ -554,7 +553,9 @@ interface ApiKeysTable {
554
553
  rate_limit: Generated<number>;
555
554
  ip_address: string;
556
555
  account_id: string;
557
- product: Generated<"account" | "streams" | "index">;
556
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
557
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
558
+ areas: unknown | null;
558
559
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
559
560
  last_used_at: Date | null;
560
561
  revoked_at: Date | null;
@@ -161,7 +161,6 @@ interface SubgraphsTable {
161
161
  expires_at: Date | null;
162
162
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
163
163
  sparse_probe_targets: unknown | null;
164
- sandbox_workers: Generated<boolean>;
165
164
  created_at: Generated<Date>;
166
165
  updated_at: Generated<Date>;
167
166
  }
@@ -238,7 +237,9 @@ interface ApiKeysTable {
238
237
  rate_limit: Generated<number>;
239
238
  ip_address: string;
240
239
  account_id: string;
241
- product: Generated<"account" | "streams" | "index">;
240
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
241
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
242
+ areas: unknown | null;
242
243
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
243
244
  last_used_at: Date | null;
244
245
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -170,7 +170,6 @@ interface SubgraphsTable {
170
170
  expires_at: Date | null;
171
171
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
172
172
  sparse_probe_targets: unknown | null;
173
- sandbox_workers: Generated<boolean>;
174
173
  created_at: Generated<Date>;
175
174
  updated_at: Generated<Date>;
176
175
  }
@@ -247,7 +246,9 @@ interface ApiKeysTable {
247
246
  rate_limit: Generated<number>;
248
247
  ip_address: string;
249
248
  account_id: string;
250
- product: Generated<"account" | "streams" | "index">;
249
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
250
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
251
+ areas: unknown | null;
251
252
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
252
253
  last_used_at: Date | null;
253
254
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -159,7 +159,6 @@ interface SubgraphsTable {
159
159
  expires_at: Date | null;
160
160
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
161
161
  sparse_probe_targets: unknown | null;
162
- sandbox_workers: Generated<boolean>;
163
162
  created_at: Generated<Date>;
164
163
  updated_at: Generated<Date>;
165
164
  }
@@ -236,7 +235,9 @@ interface ApiKeysTable {
236
235
  rate_limit: Generated<number>;
237
236
  ip_address: string;
238
237
  account_id: string;
239
- product: Generated<"account" | "streams" | "index">;
238
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
239
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
240
+ areas: unknown | null;
240
241
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
241
242
  last_used_at: Date | null;
242
243
  revoked_at: Date | null;
@@ -159,7 +159,6 @@ interface SubgraphsTable {
159
159
  expires_at: Date | null;
160
160
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
161
161
  sparse_probe_targets: unknown | null;
162
- sandbox_workers: Generated<boolean>;
163
162
  created_at: Generated<Date>;
164
163
  updated_at: Generated<Date>;
165
164
  }
@@ -236,7 +235,9 @@ interface ApiKeysTable {
236
235
  rate_limit: Generated<number>;
237
236
  ip_address: string;
238
237
  account_id: string;
239
- product: Generated<"account" | "streams" | "index">;
238
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
239
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
240
+ areas: unknown | null;
240
241
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
241
242
  last_used_at: Date | null;
242
243
  revoked_at: Date | null;
@@ -160,7 +160,6 @@ interface SubgraphsTable {
160
160
  expires_at: Date | null;
161
161
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
162
162
  sparse_probe_targets: unknown | null;
163
- sandbox_workers: Generated<boolean>;
164
163
  created_at: Generated<Date>;
165
164
  updated_at: Generated<Date>;
166
165
  }
@@ -237,7 +236,9 @@ interface ApiKeysTable {
237
236
  rate_limit: Generated<number>;
238
237
  ip_address: string;
239
238
  account_id: string;
240
- product: Generated<"account" | "streams" | "index">;
239
+ product: Generated<"account" | "streams" | "index" | "sentinel">;
240
+ /** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
241
+ areas: unknown | null;
241
242
  tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
242
243
  last_used_at: Date | null;
243
244
  revoked_at: Date | null;
@@ -0,0 +1,42 @@
1
+ import { type Kysely, sql } from "kysely";
2
+ import { onControlPlane } from "../src/db/migration-role.ts";
3
+
4
+ /**
5
+ * Sentinel agent keys: `api_keys.product = 'sentinel'` plus nullable `areas`
6
+ * jsonb holding Sentinel's permission areas (`{plans, monitoring, alerts}`,
7
+ * each none|read|write). Only `/internal/sentinel/keys` mints them; they
8
+ * authenticate nothing on secondlayer itself (hosted /v1 and `requireAuth`
9
+ * accept `account` keys only), Sentinel resolves them server-to-server.
10
+ */
11
+ export async function up(db: Kysely<unknown>): Promise<void> {
12
+ await onControlPlane(async () => {
13
+ await sql`SET lock_timeout = '30s'`.execute(db);
14
+ await sql`ALTER TABLE api_keys ADD COLUMN IF NOT EXISTS areas jsonb`.execute(
15
+ db,
16
+ );
17
+ await sql`
18
+ ALTER TABLE api_keys DROP CONSTRAINT IF EXISTS api_keys_product_check
19
+ `.execute(db);
20
+ await sql`
21
+ ALTER TABLE api_keys
22
+ ADD CONSTRAINT api_keys_product_check
23
+ CHECK (product IN ('account', 'streams', 'index', 'sentinel'))
24
+ `.execute(db);
25
+ });
26
+ }
27
+
28
+ export async function down(db: Kysely<unknown>): Promise<void> {
29
+ await onControlPlane(async () => {
30
+ await sql`SET lock_timeout = '30s'`.execute(db);
31
+ await sql`DELETE FROM api_keys WHERE product = 'sentinel'`.execute(db);
32
+ await sql`
33
+ ALTER TABLE api_keys DROP CONSTRAINT IF EXISTS api_keys_product_check
34
+ `.execute(db);
35
+ await sql`
36
+ ALTER TABLE api_keys
37
+ ADD CONSTRAINT api_keys_product_check
38
+ CHECK (product IN ('account', 'streams', 'index'))
39
+ `.execute(db);
40
+ await sql`ALTER TABLE api_keys DROP COLUMN IF EXISTS areas`.execute(db);
41
+ });
42
+ }
@@ -0,0 +1,24 @@
1
+ import { type Kysely, sql } from "kysely";
2
+ import { onControlPlane } from "../src/db/migration-role.ts";
3
+
4
+ // The subprocess handler sandbox is gone (hosted stacks isolate handlers with
5
+ // gVisor), so its per-subgraph opt-in column has no reader. Control-plane
6
+ // (TARGET) — the subgraphs control-plane table.
7
+ export async function up(db: Kysely<unknown>): Promise<void> {
8
+ await sql`SET lock_timeout = '30s'`.execute(db);
9
+ await onControlPlane(async () => {
10
+ await sql`
11
+ ALTER TABLE subgraphs
12
+ DROP COLUMN IF EXISTS sandbox_workers
13
+ `.execute(db);
14
+ });
15
+ }
16
+
17
+ export async function down(db: Kysely<unknown>): Promise<void> {
18
+ await onControlPlane(async () => {
19
+ await sql`
20
+ ALTER TABLE subgraphs
21
+ ADD COLUMN IF NOT EXISTS sandbox_workers BOOLEAN NOT NULL DEFAULT FALSE
22
+ `.execute(db);
23
+ });
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "11.18.0",
3
+ "version": "11.19.1",
4
4
  "description": "Internal building blocks shared across Secondlayer packages.",
5
5
  "license": "MIT",
6
6
  "repository": {