@secondlayer/shared 6.6.0 → 6.8.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/README.md +9 -12
- package/dist/src/db/index.d.ts +3 -0
- package/dist/src/db/queries/chain-reorgs.d.ts +3 -0
- package/dist/src/db/queries/integrity.d.ts +3 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +3 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +3 -0
- package/dist/src/db/queries/subgraphs.d.ts +3 -0
- package/dist/src/db/queries/subscriptions.d.ts +3 -0
- package/dist/src/db/schema.d.ts +3 -0
- package/dist/src/index.d.ts +32 -42
- package/dist/src/index.js +94 -103
- package/dist/src/index.js.map +3 -4
- package/dist/src/node/local-client.d.ts +3 -0
- package/dist/src/schemas/index.d.ts +29 -42
- package/dist/src/schemas/index.js +94 -103
- package/dist/src/schemas/index.js.map +3 -4
- package/migrations/0079_decoded_events_payload.ts +12 -0
- package/package.json +1 -21
- package/dist/src/db/queries/account-spend-caps.d.ts +0 -729
- package/dist/src/db/queries/account-spend-caps.js +0 -59
- package/dist/src/db/queries/account-spend-caps.js.map +0 -10
- package/dist/src/db/queries/accounts.d.ts +0 -741
- package/dist/src/db/queries/accounts.js +0 -86
- package/dist/src/db/queries/accounts.js.map +0 -10
- package/dist/src/db/queries/projects.d.ts +0 -722
- package/dist/src/db/queries/projects.js +0 -47
- package/dist/src/db/queries/projects.js.map +0 -10
- package/dist/src/db/queries/usage.d.ts +0 -731
- package/dist/src/db/queries/usage.js +0 -109
- package/dist/src/db/queries/usage.js.map +0 -10
- package/dist/src/schemas/accounts.d.ts +0 -14
- package/dist/src/schemas/accounts.js +0 -29
- package/dist/src/schemas/accounts.js.map +0 -10
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/db/queries/usage.ts
|
|
18
|
-
import { sql } from "kysely";
|
|
19
|
-
async function incrementApiRequests(db, accountId) {
|
|
20
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
21
|
-
await sql`
|
|
22
|
-
INSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries)
|
|
23
|
-
VALUES (${accountId}, NULL, ${today}, 1, 0)
|
|
24
|
-
ON CONFLICT (account_id, date) WHERE tenant_id IS NULL
|
|
25
|
-
DO UPDATE SET api_requests = usage_daily.api_requests + 1
|
|
26
|
-
`.execute(db);
|
|
27
|
-
}
|
|
28
|
-
async function incrementAccountDailyCounter(db, accountId, column, quantity) {
|
|
29
|
-
if (quantity <= 0)
|
|
30
|
-
return;
|
|
31
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
32
|
-
await sql`
|
|
33
|
-
INSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries, ${sql.raw(column)})
|
|
34
|
-
VALUES (${accountId}, NULL, ${today}, 0, 0, ${quantity})
|
|
35
|
-
ON CONFLICT (account_id, date) WHERE tenant_id IS NULL
|
|
36
|
-
DO UPDATE SET ${sql.raw(column)} = usage_daily.${sql.raw(column)} + ${quantity}
|
|
37
|
-
`.execute(db);
|
|
38
|
-
}
|
|
39
|
-
async function incrementStreamsEventsReturned(db, accountId, quantity) {
|
|
40
|
-
await incrementAccountDailyCounter(db, accountId, "streams_events_returned", quantity);
|
|
41
|
-
}
|
|
42
|
-
async function incrementIndexDecodedEventsReturned(db, accountId, quantity) {
|
|
43
|
-
await incrementAccountDailyCounter(db, accountId, "index_decoded_events_returned", quantity);
|
|
44
|
-
}
|
|
45
|
-
async function getUsage(db, accountId) {
|
|
46
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
47
|
-
const monthStart = `${today.slice(0, 7)}-01`;
|
|
48
|
-
const dailyRow = await db.selectFrom("usage_daily").select("api_requests").where("account_id", "=", accountId).where("date", "=", today).executeTakeFirst();
|
|
49
|
-
const monthlyRow = await db.selectFrom("usage_daily").select(sql`COALESCE(SUM(deliveries), 0)`.as("total")).where("account_id", "=", accountId).where("date", ">=", monthStart).executeTakeFirst();
|
|
50
|
-
const storageRow = await db.selectFrom("usage_snapshots").select("storage_bytes").where("account_id", "=", accountId).orderBy("measured_at", "desc").limit(1).executeTakeFirst();
|
|
51
|
-
return {
|
|
52
|
-
apiRequestsToday: dailyRow?.api_requests ?? 0,
|
|
53
|
-
deliveriesThisMonth: Number(monthlyRow?.total ?? 0),
|
|
54
|
-
storageBytes: Number(storageRow?.storage_bytes ?? 0)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
async function getProductUsage(db, accountId) {
|
|
58
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
59
|
-
const monthStart = `${today.slice(0, 7)}-01`;
|
|
60
|
-
const dailyRow = await db.selectFrom("usage_daily").select(["streams_events_returned", "index_decoded_events_returned"]).where("account_id", "=", accountId).where("date", "=", today).executeTakeFirst();
|
|
61
|
-
const monthlyRow = await db.selectFrom("usage_daily").select([
|
|
62
|
-
sql`COALESCE(SUM(streams_events_returned), 0)`.as("streams_total"),
|
|
63
|
-
sql`COALESCE(SUM(index_decoded_events_returned), 0)`.as("index_total")
|
|
64
|
-
]).where("account_id", "=", accountId).where("date", ">=", monthStart).executeTakeFirst();
|
|
65
|
-
return {
|
|
66
|
-
streamsEventsToday: Number(dailyRow?.streams_events_returned ?? 0),
|
|
67
|
-
streamsEventsThisMonth: Number(monthlyRow?.streams_total ?? 0),
|
|
68
|
-
indexDecodedEventsToday: Number(dailyRow?.index_decoded_events_returned ?? 0),
|
|
69
|
-
indexDecodedEventsThisMonth: Number(monthlyRow?.index_total ?? 0)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
async function measureStorage(db) {
|
|
73
|
-
const accountSubgraphs = await db.selectFrom("subgraphs").select(["account_id", "schema_name"]).where("schema_name", "is not", null).execute();
|
|
74
|
-
const byAccount = new Map;
|
|
75
|
-
for (const row of accountSubgraphs) {
|
|
76
|
-
const schemas = byAccount.get(row.account_id) ?? [];
|
|
77
|
-
if (row.schema_name)
|
|
78
|
-
schemas.push(row.schema_name);
|
|
79
|
-
byAccount.set(row.account_id, schemas);
|
|
80
|
-
}
|
|
81
|
-
for (const [accountId, schemas] of byAccount) {
|
|
82
|
-
let totalBytes = 0;
|
|
83
|
-
for (const schema of schemas) {
|
|
84
|
-
try {
|
|
85
|
-
const result = await sql`
|
|
86
|
-
SELECT COALESCE(SUM(pg_total_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename))), 0)::text as size
|
|
87
|
-
FROM pg_tables WHERE schemaname = ${schema}
|
|
88
|
-
`.execute(db);
|
|
89
|
-
const row = result.rows[0];
|
|
90
|
-
totalBytes += Number(row?.size ?? 0);
|
|
91
|
-
} catch {}
|
|
92
|
-
}
|
|
93
|
-
await db.insertInto("usage_snapshots").values({
|
|
94
|
-
account_id: accountId,
|
|
95
|
-
storage_bytes: totalBytes
|
|
96
|
-
}).execute();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export {
|
|
100
|
-
measureStorage,
|
|
101
|
-
incrementStreamsEventsReturned,
|
|
102
|
-
incrementIndexDecodedEventsReturned,
|
|
103
|
-
incrementApiRequests,
|
|
104
|
-
getUsage,
|
|
105
|
-
getProductUsage
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
//# debugId=4876492CE8C84D6164756E2164756E21
|
|
109
|
-
//# sourceMappingURL=usage.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/db/queries/usage.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { type Kysely, sql } from \"kysely\";\nimport type { Database } from \"../types.ts\";\n\n/** Increment API request counter for today. Fire-and-forget safe. */\nexport async function incrementApiRequests(\n\tdb: Kysely<Database>,\n\taccountId: string,\n): Promise<void> {\n\tconst today = new Date().toISOString().slice(0, 10);\n\tawait sql`\n\t\tINSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries)\n\t\tVALUES (${accountId}, NULL, ${today}, 1, 0)\n\t\tON CONFLICT (account_id, date) WHERE tenant_id IS NULL\n\t\tDO UPDATE SET api_requests = usage_daily.api_requests + 1\n\t`.execute(db);\n}\n\nasync function incrementAccountDailyCounter(\n\tdb: Kysely<Database>,\n\taccountId: string,\n\tcolumn: \"streams_events_returned\" | \"index_decoded_events_returned\",\n\tquantity: number,\n): Promise<void> {\n\tif (quantity <= 0) return;\n\tconst today = new Date().toISOString().slice(0, 10);\n\tawait sql`\n\t\tINSERT INTO usage_daily (account_id, tenant_id, date, api_requests, deliveries, ${sql.raw(column)})\n\t\tVALUES (${accountId}, NULL, ${today}, 0, 0, ${quantity})\n\t\tON CONFLICT (account_id, date) WHERE tenant_id IS NULL\n\t\tDO UPDATE SET ${sql.raw(column)} = usage_daily.${sql.raw(column)} + ${quantity}\n\t`.execute(db);\n}\n\nexport async function incrementStreamsEventsReturned(\n\tdb: Kysely<Database>,\n\taccountId: string,\n\tquantity: number,\n): Promise<void> {\n\tawait incrementAccountDailyCounter(\n\t\tdb,\n\t\taccountId,\n\t\t\"streams_events_returned\",\n\t\tquantity,\n\t);\n}\n\nexport async function incrementIndexDecodedEventsReturned(\n\tdb: Kysely<Database>,\n\taccountId: string,\n\tquantity: number,\n): Promise<void> {\n\tawait incrementAccountDailyCounter(\n\t\tdb,\n\t\taccountId,\n\t\t\"index_decoded_events_returned\",\n\t\tquantity,\n\t);\n}\n\nexport interface UsageSummary {\n\tapiRequestsToday: number;\n\tdeliveriesThisMonth: number;\n\tstorageBytes: number;\n}\n\n/** Get current usage for an account. */\nexport async function getUsage(\n\tdb: Kysely<Database>,\n\taccountId: string,\n): Promise<UsageSummary> {\n\tconst today = new Date().toISOString().slice(0, 10);\n\tconst monthStart = `${today.slice(0, 7)}-01`; // YYYY-MM-01\n\n\t// Today's API requests\n\tconst dailyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select(\"api_requests\")\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \"=\", today)\n\t\t.executeTakeFirst();\n\n\t// This month's deliveries\n\tconst monthlyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select(sql<number>`COALESCE(SUM(deliveries), 0)`.as(\"total\"))\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \">=\", monthStart)\n\t\t.executeTakeFirst();\n\n\t// Latest storage snapshot\n\tconst storageRow = await db\n\t\t.selectFrom(\"usage_snapshots\")\n\t\t.select(\"storage_bytes\")\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.orderBy(\"measured_at\", \"desc\")\n\t\t.limit(1)\n\t\t.executeTakeFirst();\n\n\treturn {\n\t\tapiRequestsToday: dailyRow?.api_requests ?? 0,\n\t\tdeliveriesThisMonth: Number(monthlyRow?.total ?? 0),\n\t\tstorageBytes: Number(storageRow?.storage_bytes ?? 0),\n\t};\n}\n\nexport interface ProductUsageBreakdown {\n\tstreamsEventsToday: number;\n\tstreamsEventsThisMonth: number;\n\tindexDecodedEventsToday: number;\n\tindexDecodedEventsThisMonth: number;\n}\n\n/** Get per-product event counts (today + this month) for an account. */\nexport async function getProductUsage(\n\tdb: Kysely<Database>,\n\taccountId: string,\n): Promise<ProductUsageBreakdown> {\n\tconst today = new Date().toISOString().slice(0, 10);\n\tconst monthStart = `${today.slice(0, 7)}-01`;\n\n\tconst dailyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select([\"streams_events_returned\", \"index_decoded_events_returned\"])\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \"=\", today)\n\t\t.executeTakeFirst();\n\n\tconst monthlyRow = await db\n\t\t.selectFrom(\"usage_daily\")\n\t\t.select([\n\t\t\tsql<number>`COALESCE(SUM(streams_events_returned), 0)`.as(\n\t\t\t\t\"streams_total\",\n\t\t\t),\n\t\t\tsql<number>`COALESCE(SUM(index_decoded_events_returned), 0)`.as(\n\t\t\t\t\"index_total\",\n\t\t\t),\n\t\t])\n\t\t.where(\"account_id\", \"=\", accountId)\n\t\t.where(\"date\", \">=\", monthStart)\n\t\t.executeTakeFirst();\n\n\treturn {\n\t\tstreamsEventsToday: Number(dailyRow?.streams_events_returned ?? 0),\n\t\tstreamsEventsThisMonth: Number(monthlyRow?.streams_total ?? 0),\n\t\tindexDecodedEventsToday: Number(\n\t\t\tdailyRow?.index_decoded_events_returned ?? 0,\n\t\t),\n\t\tindexDecodedEventsThisMonth: Number(monthlyRow?.index_total ?? 0),\n\t};\n}\n\n/**\n * Measure storage for all accounts by querying pg_total_relation_size\n * for each tenant's subgraph schemas.\n */\nexport async function measureStorage(db: Kysely<Database>): Promise<void> {\n\t// Get all accounts with subgraphs\n\tconst accountSubgraphs = await db\n\t\t.selectFrom(\"subgraphs\")\n\t\t.select([\"account_id\", \"schema_name\"])\n\t\t.where(\"schema_name\", \"is not\", null)\n\t\t.execute();\n\n\t// Group schemas by account\n\tconst byAccount = new Map<string, string[]>();\n\tfor (const row of accountSubgraphs) {\n\t\tconst schemas = byAccount.get(row.account_id) ?? [];\n\t\tif (row.schema_name) schemas.push(row.schema_name);\n\t\tbyAccount.set(row.account_id, schemas);\n\t}\n\n\tfor (const [accountId, schemas] of byAccount) {\n\t\tlet totalBytes = 0;\n\t\tfor (const schema of schemas) {\n\t\t\ttry {\n\t\t\t\tconst result = await sql<{ size: string }>`\n SELECT COALESCE(SUM(pg_total_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename))), 0)::text as size\n FROM pg_tables WHERE schemaname = ${schema}\n `.execute(db);\n\t\t\t\tconst row = result.rows[0] as { size?: string } | undefined;\n\t\t\t\ttotalBytes += Number(row?.size ?? 0);\n\t\t\t} catch {\n\t\t\t\t// Schema may not exist\n\t\t\t}\n\t\t}\n\n\t\tawait db\n\t\t\t.insertInto(\"usage_snapshots\")\n\t\t\t.values({\n\t\t\t\taccount_id: accountId,\n\t\t\t\tstorage_bytes: totalBytes,\n\t\t\t})\n\t\t\t.execute();\n\t}\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "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",
|
|
8
|
-
"debugId": "4876492CE8C84D6164756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
/**
|
|
3
|
-
* Account profile shapes. Unrelated to marketplace — previously lived in
|
|
4
|
-
* schemas/marketplace.ts alongside public-directory types. Kept here now
|
|
5
|
-
* that marketplace is gone so the profile fields (display_name, bio, slug)
|
|
6
|
-
* have a stable home.
|
|
7
|
-
*/
|
|
8
|
-
interface UpdateProfileRequest {
|
|
9
|
-
display_name?: string;
|
|
10
|
-
bio?: string;
|
|
11
|
-
slug?: string;
|
|
12
|
-
}
|
|
13
|
-
declare const UpdateProfileRequestSchema: z.ZodType<UpdateProfileRequest>;
|
|
14
|
-
export { UpdateProfileRequestSchema, UpdateProfileRequest };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/schemas/accounts.ts
|
|
18
|
-
import { z } from "zod/v4";
|
|
19
|
-
var UpdateProfileRequestSchema = z.object({
|
|
20
|
-
display_name: z.string().max(50).optional(),
|
|
21
|
-
bio: z.string().max(300).optional(),
|
|
22
|
-
slug: z.string().regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").min(3).max(30).optional()
|
|
23
|
-
});
|
|
24
|
-
export {
|
|
25
|
-
UpdateProfileRequestSchema
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//# debugId=F54EDBF58C290BFF64756E2164756E21
|
|
29
|
-
//# sourceMappingURL=accounts.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/schemas/accounts.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { z } from \"zod/v4\";\n\n/**\n * Account profile shapes. Unrelated to marketplace — previously lived in\n * schemas/marketplace.ts alongside public-directory types. Kept here now\n * that marketplace is gone so the profile fields (display_name, bio, slug)\n * have a stable home.\n */\n\nexport interface UpdateProfileRequest {\n\tdisplay_name?: string;\n\tbio?: string;\n\tslug?: string;\n}\n\nexport const UpdateProfileRequestSchema: z.ZodType<UpdateProfileRequest> =\n\tz.object({\n\t\tdisplay_name: z.string().max(50).optional(),\n\t\tbio: z.string().max(300).optional(),\n\t\tslug: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.min(3)\n\t\t\t.max(30)\n\t\t\t.optional(),\n\t});\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAeO,IAAM,6BACZ,EAAE,OAAO;AAAA,EACR,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAC1C,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAClC,MAAM,EACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,CAAC,EACL,IAAI,EAAE,EACN,SAAS;AACZ,CAAC;",
|
|
8
|
-
"debugId": "F54EDBF58C290BFF64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|