@secondlayer/shared 11.18.0 → 11.19.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/src/archive/range-digest.d.ts +3 -1
- package/dist/src/archive/semantic-digest-builder.d.ts +3 -1
- package/dist/src/coverage/index.d.ts +3 -1
- package/dist/src/db/index.d.ts +3 -1
- package/dist/src/db/queries/chain-reorgs.d.ts +3 -1
- package/dist/src/db/queries/contracts.d.ts +3 -1
- package/dist/src/db/queries/instance.d.ts +3 -1
- package/dist/src/db/queries/integrity.d.ts +3 -1
- package/dist/src/db/queries/subgraph-gaps.d.ts +3 -1
- package/dist/src/db/queries/subgraph-operations.d.ts +3 -1
- package/dist/src/db/queries/subgraphs.d.ts +3 -1
- package/dist/src/db/queries/sync-scope.d.ts +3 -1
- package/dist/src/db/queries/webhooks.d.ts +3 -1
- package/dist/src/db/schema.d.ts +3 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/node/local-client.d.ts +3 -1
- package/migrations/0151_api_keys_sentinel_product.ts +42 -0
- package/package.json +1 -1
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -554,7 +554,9 @@ interface ApiKeysTable {
|
|
|
554
554
|
rate_limit: Generated<number>;
|
|
555
555
|
ip_address: string;
|
|
556
556
|
account_id: string;
|
|
557
|
-
product: Generated<"account" | "streams" | "index">;
|
|
557
|
+
product: Generated<"account" | "streams" | "index" | "sentinel">;
|
|
558
|
+
/** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
|
|
559
|
+
areas: unknown | null;
|
|
558
560
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
559
561
|
last_used_at: Date | null;
|
|
560
562
|
revoked_at: Date | null;
|
package/dist/src/db/index.d.ts
CHANGED
|
@@ -238,7 +238,9 @@ interface ApiKeysTable {
|
|
|
238
238
|
rate_limit: Generated<number>;
|
|
239
239
|
ip_address: string;
|
|
240
240
|
account_id: string;
|
|
241
|
-
product: Generated<"account" | "streams" | "index">;
|
|
241
|
+
product: Generated<"account" | "streams" | "index" | "sentinel">;
|
|
242
|
+
/** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
|
|
243
|
+
areas: unknown | null;
|
|
242
244
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
243
245
|
last_used_at: Date | null;
|
|
244
246
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
|
@@ -247,7 +247,9 @@ interface ApiKeysTable {
|
|
|
247
247
|
rate_limit: Generated<number>;
|
|
248
248
|
ip_address: string;
|
|
249
249
|
account_id: string;
|
|
250
|
-
product: Generated<"account" | "streams" | "index">;
|
|
250
|
+
product: Generated<"account" | "streams" | "index" | "sentinel">;
|
|
251
|
+
/** Sentinel permission areas; set only on `product = 'sentinel'` keys. */
|
|
252
|
+
areas: unknown | null;
|
|
251
253
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
252
254
|
last_used_at: Date | null;
|
|
253
255
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
revoked_at: Date | null;
|
package/dist/src/db/schema.d.ts
CHANGED
|
@@ -236,7 +236,9 @@ interface ApiKeysTable {
|
|
|
236
236
|
rate_limit: Generated<number>;
|
|
237
237
|
ip_address: string;
|
|
238
238
|
account_id: string;
|
|
239
|
-
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;
|
|
240
242
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
241
243
|
last_used_at: Date | null;
|
|
242
244
|
revoked_at: Date | null;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -236,7 +236,9 @@ interface ApiKeysTable {
|
|
|
236
236
|
rate_limit: Generated<number>;
|
|
237
237
|
ip_address: string;
|
|
238
238
|
account_id: string;
|
|
239
|
-
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;
|
|
240
242
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
241
243
|
last_used_at: Date | null;
|
|
242
244
|
revoked_at: Date | null;
|
|
@@ -237,7 +237,9 @@ interface ApiKeysTable {
|
|
|
237
237
|
rate_limit: Generated<number>;
|
|
238
238
|
ip_address: string;
|
|
239
239
|
account_id: string;
|
|
240
|
-
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;
|
|
241
243
|
tier: "free" | "build" | "scale" | "enterprise" | "internal" | null;
|
|
242
244
|
last_used_at: Date | null;
|
|
243
245
|
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
|
+
}
|